diff options
-rw-r--r-- | GNUmakefile | 41 | ||||
-rw-r--r-- | VC2008/CryptoPP.cbp | 384 | ||||
-rw-r--r-- | VC2008/CryptoPP.vcproj | 384 | ||||
-rw-r--r-- | VC2008/GenerateBindings.cmd | 2 | ||||
-rw-r--r-- | VC2008/JsonCpp.cbp | 26 | ||||
-rw-r--r-- | VC2008/JsonCpp.vcproj | 14 | ||||
-rw-r--r-- | VC2008/Lua.cbp | 110 | ||||
-rw-r--r-- | VC2008/Lua.vcproj | 110 | ||||
-rw-r--r-- | VC2008/MCServer.cbp | 851 | ||||
-rw-r--r-- | VC2008/MCServer.vcproj | 958 | ||||
-rw-r--r-- | VC2008/ToLua.cbp | 38 | ||||
-rw-r--r-- | VC2008/ToLua.vcproj | 22 | ||||
-rw-r--r-- | VC2008/expat.cbp | 36 | ||||
-rw-r--r-- | VC2008/expat.vcproj | 36 | ||||
-rw-r--r-- | VC2008/zlib.cbp | 52 | ||||
-rw-r--r-- | VC2008/zlib.vcproj | 52 | ||||
-rw-r--r-- | VC2013/.gitignore | 1 | ||||
-rw-r--r-- | VC2013/CryptoPP.vcxproj | 384 | ||||
-rw-r--r-- | VC2013/CryptoPP.vcxproj.filters | 390 | ||||
-rw-r--r-- | VC2013/GenerateBindings.cmd | 3 | ||||
-rw-r--r-- | VC2013/JsonCpp.vcxproj | 14 | ||||
-rw-r--r-- | VC2013/JsonCpp.vcxproj.filters | 14 | ||||
-rw-r--r-- | VC2013/Lua.vcxproj | 110 | ||||
-rw-r--r-- | VC2013/Lua.vcxproj.filters | 110 | ||||
-rw-r--r-- | VC2013/MCServer.ipgset | 317 | ||||
-rw-r--r-- | VC2013/MCServer.sln | 10 | ||||
-rw-r--r-- | VC2013/MCServer.vcxproj | 958 | ||||
-rw-r--r-- | VC2013/MCServer.vcxproj.filters | 981 | ||||
-rw-r--r-- | VC2013/ToLua.vcxproj | 22 | ||||
-rw-r--r-- | VC2013/ToLua.vcxproj.filters | 14 | ||||
-rw-r--r-- | VC2013/expat.vcxproj | 36 | ||||
-rw-r--r-- | VC2013/expat.vcxproj.filters | 36 | ||||
-rw-r--r-- | VC2013/zlib.vcxproj | 52 | ||||
-rw-r--r-- | VC2013/zlib.vcxproj.filters | 52 | ||||
-rw-r--r-- | jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp | 885 | ||||
-rw-r--r-- | jsoncpp-src-0.5.0/src/lib_json/json_value.cpp | 1727 | ||||
-rw-r--r-- | jsoncpp-src-0.5.0/src/lib_json/json_writer.cpp | 829 | ||||
-rw-r--r-- | lib/cryptopp/Doxyfile (renamed from CryptoPP/Doxyfile) | 0 | ||||
-rw-r--r-- | lib/cryptopp/License.txt (renamed from CryptoPP/License.txt) | 0 | ||||
-rw-r--r-- | lib/cryptopp/Readme.txt (renamed from CryptoPP/Readme.txt) | 0 | ||||
-rw-r--r-- | lib/cryptopp/adler32.cpp (renamed from CryptoPP/adler32.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/adler32.h (renamed from CryptoPP/adler32.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/aes.h (renamed from CryptoPP/aes.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/algebra.cpp (renamed from CryptoPP/algebra.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/algebra.h (renamed from CryptoPP/algebra.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/algparam.cpp (renamed from CryptoPP/algparam.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/algparam.h (renamed from CryptoPP/algparam.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/argnames.h (renamed from CryptoPP/argnames.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/asn.cpp (renamed from CryptoPP/asn.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/asn.h (renamed from CryptoPP/asn.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/authenc.cpp (renamed from CryptoPP/authenc.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/authenc.h (renamed from CryptoPP/authenc.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/base32.cpp (renamed from CryptoPP/base32.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/base32.h (renamed from CryptoPP/base32.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/base64.cpp (renamed from CryptoPP/base64.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/base64.h (renamed from CryptoPP/base64.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/basecode.cpp (renamed from CryptoPP/basecode.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/basecode.h (renamed from CryptoPP/basecode.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/cbcmac.cpp (renamed from CryptoPP/cbcmac.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/cbcmac.h (renamed from CryptoPP/cbcmac.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/ccm.cpp (renamed from CryptoPP/ccm.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/ccm.h (renamed from CryptoPP/ccm.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/channels.cpp (renamed from CryptoPP/channels.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/channels.h (renamed from CryptoPP/channels.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/cmac.cpp (renamed from CryptoPP/cmac.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/cmac.h (renamed from CryptoPP/cmac.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/config.h (renamed from CryptoPP/config.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/cpu.cpp (renamed from CryptoPP/cpu.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/cpu.h (renamed from CryptoPP/cpu.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/crc.cpp (renamed from CryptoPP/crc.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/crc.h (renamed from CryptoPP/crc.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/cryptlib.cpp (renamed from CryptoPP/cryptlib.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/cryptlib.h (renamed from CryptoPP/cryptlib.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/default.cpp (renamed from CryptoPP/default.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/default.h (renamed from CryptoPP/default.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/des.cpp (renamed from CryptoPP/des.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/des.h (renamed from CryptoPP/des.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/dessp.cpp (renamed from CryptoPP/dessp.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/dh.cpp (renamed from CryptoPP/dh.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/dh.h (renamed from CryptoPP/dh.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/dh2.cpp (renamed from CryptoPP/dh2.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/dh2.h (renamed from CryptoPP/dh2.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/dll.cpp (renamed from CryptoPP/dll.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/dll.h (renamed from CryptoPP/dll.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/dmac.h (renamed from CryptoPP/dmac.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/dsa.cpp (renamed from CryptoPP/dsa.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/dsa.h (renamed from CryptoPP/dsa.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/eax.cpp (renamed from CryptoPP/eax.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/eax.h (renamed from CryptoPP/eax.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/ec2n.cpp (renamed from CryptoPP/ec2n.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/ec2n.h (renamed from CryptoPP/ec2n.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/eccrypto.cpp (renamed from CryptoPP/eccrypto.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/eccrypto.h (renamed from CryptoPP/eccrypto.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/ecp.cpp (renamed from CryptoPP/ecp.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/ecp.h (renamed from CryptoPP/ecp.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/elgamal.cpp (renamed from CryptoPP/elgamal.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/elgamal.h (renamed from CryptoPP/elgamal.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/emsa2.cpp (renamed from CryptoPP/emsa2.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/emsa2.h (renamed from CryptoPP/emsa2.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/eprecomp.cpp (renamed from CryptoPP/eprecomp.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/eprecomp.h (renamed from CryptoPP/eprecomp.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/esign.cpp (renamed from CryptoPP/esign.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/esign.h (renamed from CryptoPP/esign.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/factory.h (renamed from CryptoPP/factory.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/files.cpp (renamed from CryptoPP/files.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/files.h (renamed from CryptoPP/files.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/filters.cpp (renamed from CryptoPP/filters.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/filters.h (renamed from CryptoPP/filters.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/fips140.cpp (renamed from CryptoPP/fips140.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/fips140.h (renamed from CryptoPP/fips140.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/fltrimpl.h (renamed from CryptoPP/fltrimpl.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/gcm.cpp (renamed from CryptoPP/gcm.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/gcm.h (renamed from CryptoPP/gcm.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/gf256.cpp (renamed from CryptoPP/gf256.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/gf256.h (renamed from CryptoPP/gf256.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/gf2_32.cpp (renamed from CryptoPP/gf2_32.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/gf2_32.h (renamed from CryptoPP/gf2_32.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/gf2n.cpp (renamed from CryptoPP/gf2n.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/gf2n.h (renamed from CryptoPP/gf2n.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/gfpcrypt.cpp (renamed from CryptoPP/gfpcrypt.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/gfpcrypt.h (renamed from CryptoPP/gfpcrypt.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/gzip.h (renamed from CryptoPP/gzip.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/hex.cpp (renamed from CryptoPP/hex.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/hex.h (renamed from CryptoPP/hex.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/hmac.cpp (renamed from CryptoPP/hmac.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/hmac.h (renamed from CryptoPP/hmac.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/hrtimer.cpp (renamed from CryptoPP/hrtimer.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/hrtimer.h (renamed from CryptoPP/hrtimer.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/integer.cpp (renamed from CryptoPP/integer.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/integer.h (renamed from CryptoPP/integer.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/iterhash.cpp (renamed from CryptoPP/iterhash.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/iterhash.h (renamed from CryptoPP/iterhash.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/lubyrack.h (renamed from CryptoPP/lubyrack.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/luc.cpp (renamed from CryptoPP/luc.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/luc.h (renamed from CryptoPP/luc.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/md2.cpp (renamed from CryptoPP/md2.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/md2.h (renamed from CryptoPP/md2.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/md4.cpp (renamed from CryptoPP/md4.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/md4.h (renamed from CryptoPP/md4.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/md5.cpp (renamed from CryptoPP/md5.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/md5.h (renamed from CryptoPP/md5.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/mdc.h (renamed from CryptoPP/mdc.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/misc.cpp (renamed from CryptoPP/misc.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/misc.h (renamed from CryptoPP/misc.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/modarith.h (renamed from CryptoPP/modarith.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/modes.cpp (renamed from CryptoPP/modes.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/modes.h (renamed from CryptoPP/modes.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/modexppc.h (renamed from CryptoPP/modexppc.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/mqueue.cpp (renamed from CryptoPP/mqueue.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/mqueue.h (renamed from CryptoPP/mqueue.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/mqv.cpp (renamed from CryptoPP/mqv.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/mqv.h (renamed from CryptoPP/mqv.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/nbtheory.cpp (renamed from CryptoPP/nbtheory.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/nbtheory.h (renamed from CryptoPP/nbtheory.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/network.cpp (renamed from CryptoPP/network.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/network.h (renamed from CryptoPP/network.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/nr.h (renamed from CryptoPP/nr.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/oaep.cpp (renamed from CryptoPP/oaep.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/oaep.h (renamed from CryptoPP/oaep.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/oids.h (renamed from CryptoPP/oids.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/osrng.cpp (renamed from CryptoPP/osrng.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/osrng.h (renamed from CryptoPP/osrng.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/pch.cpp (renamed from CryptoPP/pch.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/pch.h (renamed from CryptoPP/pch.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/pkcspad.cpp (renamed from CryptoPP/pkcspad.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/pkcspad.h (renamed from CryptoPP/pkcspad.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/polynomi.cpp (renamed from CryptoPP/polynomi.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/polynomi.h (renamed from CryptoPP/polynomi.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/pssr.cpp (renamed from CryptoPP/pssr.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/pssr.h (renamed from CryptoPP/pssr.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/pubkey.cpp (renamed from CryptoPP/pubkey.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/pubkey.h (renamed from CryptoPP/pubkey.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/pwdbased.h (renamed from CryptoPP/pwdbased.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/queue.cpp (renamed from CryptoPP/queue.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/queue.h (renamed from CryptoPP/queue.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/rabin.cpp (renamed from CryptoPP/rabin.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/rabin.h (renamed from CryptoPP/rabin.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/randpool.cpp (renamed from CryptoPP/randpool.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/randpool.h (renamed from CryptoPP/randpool.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/rdtables.cpp (renamed from CryptoPP/rdtables.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/resource.h (renamed from CryptoPP/resource.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/rijndael.cpp (renamed from CryptoPP/rijndael.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/rijndael.h (renamed from CryptoPP/rijndael.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/rng.cpp (renamed from CryptoPP/rng.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/rng.h (renamed from CryptoPP/rng.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/rsa.cpp (renamed from CryptoPP/rsa.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/rsa.h (renamed from CryptoPP/rsa.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/rw.cpp (renamed from CryptoPP/rw.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/rw.h (renamed from CryptoPP/rw.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/safer.cpp (renamed from CryptoPP/safer.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/safer.h (renamed from CryptoPP/safer.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/seal.cpp (renamed from CryptoPP/seal.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/seal.h (renamed from CryptoPP/seal.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/secblock.h (renamed from CryptoPP/secblock.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/seckey.h (renamed from CryptoPP/seckey.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/seed.cpp (renamed from CryptoPP/seed.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/seed.h (renamed from CryptoPP/seed.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/sha.cpp (renamed from CryptoPP/sha.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/sha.h (renamed from CryptoPP/sha.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/shacal2.cpp (renamed from CryptoPP/shacal2.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/shacal2.h (renamed from CryptoPP/shacal2.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/simple.cpp (renamed from CryptoPP/simple.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/simple.h (renamed from CryptoPP/simple.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/smartptr.h (renamed from CryptoPP/smartptr.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/socketft.cpp (renamed from CryptoPP/socketft.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/socketft.h (renamed from CryptoPP/socketft.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/square.cpp (renamed from CryptoPP/square.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/square.h (renamed from CryptoPP/square.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/squaretb.cpp (renamed from CryptoPP/squaretb.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/stdcpp.h (renamed from CryptoPP/stdcpp.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/strciphr.cpp (renamed from CryptoPP/strciphr.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/strciphr.h (renamed from CryptoPP/strciphr.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/tea.cpp (renamed from CryptoPP/tea.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/tea.h (renamed from CryptoPP/tea.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/tiger.cpp (renamed from CryptoPP/tiger.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/tiger.h (renamed from CryptoPP/tiger.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/tigertab.cpp (renamed from CryptoPP/tigertab.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/trdlocal.cpp (renamed from CryptoPP/trdlocal.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/trdlocal.h (renamed from CryptoPP/trdlocal.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/trunhash.h (renamed from CryptoPP/trunhash.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/ttmac.cpp (renamed from CryptoPP/ttmac.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/ttmac.h (renamed from CryptoPP/ttmac.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/validate.h (renamed from CryptoPP/validate.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/vmac.cpp (renamed from CryptoPP/vmac.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/vmac.h (renamed from CryptoPP/vmac.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/wait.cpp (renamed from CryptoPP/wait.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/wait.h (renamed from CryptoPP/wait.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/winpipes.cpp (renamed from CryptoPP/winpipes.cpp) | 0 | ||||
-rw-r--r-- | lib/cryptopp/winpipes.h (renamed from CryptoPP/winpipes.h) | 0 | ||||
-rw-r--r-- | lib/cryptopp/words.h (renamed from CryptoPP/words.h) | 0 | ||||
-rw-r--r-- | lib/expat/ascii.h (renamed from expat/ascii.h) | 0 | ||||
-rw-r--r-- | lib/expat/asciitab.h (renamed from expat/asciitab.h) | 0 | ||||
-rw-r--r-- | lib/expat/expat.h (renamed from expat/expat.h) | 0 | ||||
-rw-r--r-- | lib/expat/expat_external.h (renamed from expat/expat_external.h) | 0 | ||||
-rw-r--r-- | lib/expat/iasciitab.h (renamed from expat/iasciitab.h) | 0 | ||||
-rw-r--r-- | lib/expat/internal.h (renamed from expat/internal.h) | 0 | ||||
-rw-r--r-- | lib/expat/latin1tab.h (renamed from expat/latin1tab.h) | 0 | ||||
-rw-r--r-- | lib/expat/nametab.h (renamed from expat/nametab.h) | 0 | ||||
-rw-r--r-- | lib/expat/utf8tab.h (renamed from expat/utf8tab.h) | 0 | ||||
-rw-r--r-- | lib/expat/winconfig.h (renamed from expat/winconfig.h) | 0 | ||||
-rw-r--r-- | lib/expat/xmlparse.c (renamed from expat/xmlparse.c) | 0 | ||||
-rw-r--r-- | lib/expat/xmlrole.c (renamed from expat/xmlrole.c) | 0 | ||||
-rw-r--r-- | lib/expat/xmlrole.h (renamed from expat/xmlrole.h) | 0 | ||||
-rw-r--r-- | lib/expat/xmltok.c (renamed from expat/xmltok.c) | 0 | ||||
-rw-r--r-- | lib/expat/xmltok.h (renamed from expat/xmltok.h) | 0 | ||||
-rw-r--r-- | lib/expat/xmltok_impl.c (renamed from expat/xmltok_impl.c) | 0 | ||||
-rw-r--r-- | lib/expat/xmltok_impl.h (renamed from expat/xmltok_impl.h) | 0 | ||||
-rw-r--r-- | lib/expat/xmltok_ns.c (renamed from expat/xmltok_ns.c) | 0 | ||||
-rw-r--r-- | lib/inifile/iniFile.cpp (renamed from iniFile/iniFile.cpp) | 0 | ||||
-rw-r--r-- | lib/inifile/iniFile.h (renamed from iniFile/iniFile.h) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/autolink.h (renamed from jsoncpp-src-0.5.0/include/json/autolink.h) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/config.h (renamed from jsoncpp-src-0.5.0/include/json/config.h) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/features.h (renamed from jsoncpp-src-0.5.0/include/json/features.h) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/forwards.h (renamed from jsoncpp-src-0.5.0/include/json/forwards.h) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/json.h (renamed from jsoncpp-src-0.5.0/include/json/json.h) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/reader.h (renamed from jsoncpp-src-0.5.0/include/json/reader.h) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/value.h (renamed from jsoncpp-src-0.5.0/include/json/value.h) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/include/json/writer.h (renamed from jsoncpp-src-0.5.0/include/json/writer.h) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/src/lib_json/json_batchallocator.h (renamed from jsoncpp-src-0.5.0/src/lib_json/json_batchallocator.h) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/src/lib_json/json_internalarray.inl (renamed from jsoncpp-src-0.5.0/src/lib_json/json_internalarray.inl) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/src/lib_json/json_internalmap.inl (renamed from jsoncpp-src-0.5.0/src/lib_json/json_internalmap.inl) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/src/lib_json/json_reader.cpp | 885 | ||||
-rw-r--r-- | lib/jsoncpp/src/lib_json/json_value.cpp | 1727 | ||||
-rw-r--r-- | lib/jsoncpp/src/lib_json/json_valueiterator.inl (renamed from jsoncpp-src-0.5.0/src/lib_json/json_valueiterator.inl) | 0 | ||||
-rw-r--r-- | lib/jsoncpp/src/lib_json/json_writer.cpp | 829 | ||||
-rw-r--r-- | lib/jsoncpp/src/lib_json/sconscript (renamed from jsoncpp-src-0.5.0/src/lib_json/sconscript) | 0 | ||||
-rw-r--r-- | lib/lua/COPYRIGHT (renamed from lua-5.1.4/COPYRIGHT) | 0 | ||||
-rw-r--r-- | lib/lua/HISTORY (renamed from lua-5.1.4/HISTORY) | 0 | ||||
-rw-r--r-- | lib/lua/INSTALL (renamed from lua-5.1.4/INSTALL) | 0 | ||||
-rw-r--r-- | lib/lua/Makefile (renamed from lua-5.1.4/Makefile) | 0 | ||||
-rw-r--r-- | lib/lua/README (renamed from lua-5.1.4/README) | 0 | ||||
-rw-r--r-- | lib/lua/src/Makefile (renamed from lua-5.1.4/src/Makefile) | 0 | ||||
-rw-r--r-- | lib/lua/src/lapi.c (renamed from lua-5.1.4/src/lapi.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lapi.h (renamed from lua-5.1.4/src/lapi.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lauxlib.c (renamed from lua-5.1.4/src/lauxlib.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lauxlib.h (renamed from lua-5.1.4/src/lauxlib.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lbaselib.c (renamed from lua-5.1.4/src/lbaselib.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lcode.c (renamed from lua-5.1.4/src/lcode.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lcode.h (renamed from lua-5.1.4/src/lcode.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/ldblib.c (renamed from lua-5.1.4/src/ldblib.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/ldebug.c (renamed from lua-5.1.4/src/ldebug.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/ldebug.h (renamed from lua-5.1.4/src/ldebug.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/ldo.c (renamed from lua-5.1.4/src/ldo.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/ldo.h (renamed from lua-5.1.4/src/ldo.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/ldump.c (renamed from lua-5.1.4/src/ldump.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lfunc.c (renamed from lua-5.1.4/src/lfunc.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lfunc.h (renamed from lua-5.1.4/src/lfunc.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lgc.c (renamed from lua-5.1.4/src/lgc.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lgc.h (renamed from lua-5.1.4/src/lgc.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/linit.c (renamed from lua-5.1.4/src/linit.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/liolib.c (renamed from lua-5.1.4/src/liolib.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/llex.c (renamed from lua-5.1.4/src/llex.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/llex.h (renamed from lua-5.1.4/src/llex.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/llimits.h (renamed from lua-5.1.4/src/llimits.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lmathlib.c (renamed from lua-5.1.4/src/lmathlib.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lmem.c (renamed from lua-5.1.4/src/lmem.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lmem.h (renamed from lua-5.1.4/src/lmem.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/loadlib.c (renamed from lua-5.1.4/src/loadlib.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lobject.c (renamed from lua-5.1.4/src/lobject.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lobject.h (renamed from lua-5.1.4/src/lobject.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lopcodes.c (renamed from lua-5.1.4/src/lopcodes.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lopcodes.h (renamed from lua-5.1.4/src/lopcodes.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/loslib.c (renamed from lua-5.1.4/src/loslib.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lparser.c (renamed from lua-5.1.4/src/lparser.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lparser.h (renamed from lua-5.1.4/src/lparser.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lstate.c (renamed from lua-5.1.4/src/lstate.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lstate.h (renamed from lua-5.1.4/src/lstate.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lstring.c (renamed from lua-5.1.4/src/lstring.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lstring.h (renamed from lua-5.1.4/src/lstring.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lstrlib.c (renamed from lua-5.1.4/src/lstrlib.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/ltable.c (renamed from lua-5.1.4/src/ltable.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/ltable.h (renamed from lua-5.1.4/src/ltable.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/ltablib.c (renamed from lua-5.1.4/src/ltablib.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/ltm.c (renamed from lua-5.1.4/src/ltm.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/ltm.h (renamed from lua-5.1.4/src/ltm.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lua.c (renamed from lua-5.1.4/src/lua.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lua.h (renamed from lua-5.1.4/src/lua.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/luac.c (renamed from lua-5.1.4/src/luac.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/luaconf.h (renamed from lua-5.1.4/src/luaconf.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lualib.h (renamed from lua-5.1.4/src/lualib.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lundump.c (renamed from lua-5.1.4/src/lundump.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lundump.h (renamed from lua-5.1.4/src/lundump.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lvm.c (renamed from lua-5.1.4/src/lvm.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lvm.h (renamed from lua-5.1.4/src/lvm.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/lzio.c (renamed from lua-5.1.4/src/lzio.c) | 0 | ||||
-rw-r--r-- | lib/lua/src/lzio.h (renamed from lua-5.1.4/src/lzio.h) | 0 | ||||
-rw-r--r-- | lib/lua/src/print.c (renamed from lua-5.1.4/src/print.c) | 0 | ||||
-rw-r--r-- | lib/luaexpat/lxplib.c | 599 | ||||
-rw-r--r-- | lib/luaexpat/lxplib.h (renamed from source/LuaExpat/lxplib.h) | 0 | ||||
-rw-r--r-- | lib/md5/md5.cpp (renamed from source/md5/md5.cpp) | 0 | ||||
-rw-r--r-- | lib/md5/md5.h (renamed from source/md5/md5.h) | 0 | ||||
-rw-r--r-- | lib/sqlite/lsqlite3.c | 2175 | ||||
-rw-r--r-- | lib/sqlite/sqlite3.c (renamed from source/SQLite/sqlite3.c) | 0 | ||||
-rw-r--r-- | lib/sqlite/sqlite3.h (renamed from source/SQLite/sqlite3.h) | 0 | ||||
-rw-r--r-- | lib/sqlite/urls.txt (renamed from source/SQLite/urls.txt) | 0 | ||||
-rw-r--r-- | lib/tolua++/COPYRIGHT (renamed from tolua++-1.0.93/COPYRIGHT) | 0 | ||||
-rw-r--r-- | lib/tolua++/INSTALL (renamed from tolua++-1.0.93/INSTALL) | 0 | ||||
-rw-r--r-- | lib/tolua++/Makefile (renamed from tolua++-1.0.93/Makefile) | 0 | ||||
-rw-r--r-- | lib/tolua++/README (renamed from tolua++-1.0.93/README) | 0 | ||||
-rw-r--r-- | lib/tolua++/README-5.1 (renamed from tolua++-1.0.93/README-5.1) | 0 | ||||
-rw-r--r-- | lib/tolua++/SConstruct (renamed from tolua++-1.0.93/SConstruct) | 0 | ||||
-rw-r--r-- | lib/tolua++/include/tolua++.h | 186 | ||||
-rw-r--r-- | lib/tolua++/src/bin/SCsub (renamed from tolua++-1.0.93/src/bin/SCsub) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/all.lua (renamed from tolua++-1.0.93/src/bin/lua/all.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/array.lua (renamed from tolua++-1.0.93/src/bin/lua/array.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/basic.lua (renamed from tolua++-1.0.93/src/bin/lua/basic.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/class.lua (renamed from tolua++-1.0.93/src/bin/lua/class.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/clean.lua (renamed from tolua++-1.0.93/src/bin/lua/clean.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/code.lua (renamed from tolua++-1.0.93/src/bin/lua/code.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/compat-5.1.lua (renamed from tolua++-1.0.93/src/bin/lua/compat-5.1.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/compat.lua (renamed from tolua++-1.0.93/src/bin/lua/compat.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/container.lua (renamed from tolua++-1.0.93/src/bin/lua/container.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/custom.lua (renamed from tolua++-1.0.93/src/bin/lua/custom.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/declaration.lua (renamed from tolua++-1.0.93/src/bin/lua/declaration.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/define.lua (renamed from tolua++-1.0.93/src/bin/lua/define.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/doit.lua (renamed from tolua++-1.0.93/src/bin/lua/doit.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/enumerate.lua (renamed from tolua++-1.0.93/src/bin/lua/enumerate.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/feature.lua (renamed from tolua++-1.0.93/src/bin/lua/feature.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/function.lua (renamed from tolua++-1.0.93/src/bin/lua/function.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/module.lua (renamed from tolua++-1.0.93/src/bin/lua/module.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/namespace.lua (renamed from tolua++-1.0.93/src/bin/lua/namespace.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/operator.lua (renamed from tolua++-1.0.93/src/bin/lua/operator.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/package.lua (renamed from tolua++-1.0.93/src/bin/lua/package.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/template_class.lua (renamed from tolua++-1.0.93/src/bin/lua/template_class.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/typedef.lua (renamed from tolua++-1.0.93/src/bin/lua/typedef.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/variable.lua (renamed from tolua++-1.0.93/src/bin/lua/variable.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/lua/verbatim.lua (renamed from tolua++-1.0.93/src/bin/lua/verbatim.lua) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/tolua.c | 169 | ||||
-rw-r--r-- | lib/tolua++/src/bin/tolua_scons.pkg (renamed from tolua++-1.0.93/src/bin/tolua_scons.pkg) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/toluabind.c (renamed from tolua++-1.0.93/src/bin/toluabind.c) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/toluabind.h (renamed from tolua++-1.0.93/src/bin/toluabind.h) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/toluabind_default.c (renamed from tolua++-1.0.93/src/bin/toluabind_default.c) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/bin/toluabind_default.h (renamed from tolua++-1.0.93/src/bin/toluabind_default.h) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/lib/SCsub (renamed from tolua++-1.0.93/src/lib/SCsub) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/lib/tolua_event.c | 536 | ||||
-rw-r--r-- | lib/tolua++/src/lib/tolua_event.h (renamed from tolua++-1.0.93/src/lib/tolua_event.h) | 0 | ||||
-rw-r--r-- | lib/tolua++/src/lib/tolua_is.c | 621 | ||||
-rw-r--r-- | lib/tolua++/src/lib/tolua_map.c | 704 | ||||
-rw-r--r-- | lib/tolua++/src/lib/tolua_push.c | 171 | ||||
-rw-r--r-- | lib/tolua++/src/lib/tolua_to.c | 133 | ||||
-rw-r--r-- | lib/tolua++/win32/tolualib/tolualib.vcproj (renamed from tolua++-1.0.93/win32/tolualib/tolualib.vcproj) | 0 | ||||
-rw-r--r-- | lib/tolua++/win32/tolualib/tolualib.vcproj.LAPTOPF.Kevin.user (renamed from tolua++-1.0.93/win32/tolualib/tolualib.vcproj.LAPTOPF.Kevin.user) | 0 | ||||
-rw-r--r-- | lib/tolua++/win32/tolualib/tolualib.vcxproj (renamed from tolua++-1.0.93/win32/tolualib/tolualib.vcxproj) | 0 | ||||
-rw-r--r-- | lib/tolua++/win32/tolualib/tolualib.vcxproj.filters (renamed from tolua++-1.0.93/win32/tolualib/tolualib.vcxproj.filters) | 0 | ||||
-rw-r--r-- | lib/tolua++/win32/tolualib/tolualib.vcxproj.user (renamed from tolua++-1.0.93/win32/tolualib/tolualib.vcxproj.user) | 0 | ||||
-rw-r--r-- | lib/tolua++/win32/vc7/clean.bat (renamed from tolua++-1.0.93/win32/vc7/clean.bat) | 0 | ||||
-rw-r--r-- | lib/tolua++/win32/vc7/toluapp.sln (renamed from tolua++-1.0.93/win32/vc7/toluapp.sln) | 0 | ||||
-rw-r--r-- | lib/tolua++/win32/vc7/toluapp.vcproj (renamed from tolua++-1.0.93/win32/vc7/toluapp.vcproj) | 0 | ||||
-rw-r--r-- | lib/tolua++/win32/vc7/toluapp.vcproj.LAPTOPF.Kevin.user (renamed from tolua++-1.0.93/win32/vc7/toluapp.vcproj.LAPTOPF.Kevin.user) | 0 | ||||
-rw-r--r-- | lib/tolua++/win32/vc7/toluapp.vcxproj (renamed from tolua++-1.0.93/win32/vc7/toluapp.vcxproj) | 0 | ||||
-rw-r--r-- | lib/tolua++/win32/vc7/toluapp.vcxproj.filters (renamed from tolua++-1.0.93/win32/vc7/toluapp.vcxproj.filters) | 0 | ||||
-rw-r--r-- | lib/tolua++/win32/vc7/toluapp.vcxproj.user (renamed from tolua++-1.0.93/win32/vc7/toluapp.vcxproj.user) | 0 | ||||
-rw-r--r-- | lib/zlib/adler32.c (renamed from zlib-1.2.7/adler32.c) | 0 | ||||
-rw-r--r-- | lib/zlib/compress.c (renamed from zlib-1.2.7/compress.c) | 0 | ||||
-rw-r--r-- | lib/zlib/crc32.c (renamed from zlib-1.2.7/crc32.c) | 0 | ||||
-rw-r--r-- | lib/zlib/crc32.h (renamed from zlib-1.2.7/crc32.h) | 0 | ||||
-rw-r--r-- | lib/zlib/deflate.c (renamed from zlib-1.2.7/deflate.c) | 0 | ||||
-rw-r--r-- | lib/zlib/deflate.h (renamed from zlib-1.2.7/deflate.h) | 0 | ||||
-rw-r--r-- | lib/zlib/example.c (renamed from zlib-1.2.7/example.c) | 0 | ||||
-rw-r--r-- | lib/zlib/gzclose.c (renamed from zlib-1.2.7/gzclose.c) | 0 | ||||
-rw-r--r-- | lib/zlib/gzguts.h (renamed from zlib-1.2.7/gzguts.h) | 0 | ||||
-rw-r--r-- | lib/zlib/gzlib.c (renamed from zlib-1.2.7/gzlib.c) | 0 | ||||
-rw-r--r-- | lib/zlib/gzread.c (renamed from zlib-1.2.7/gzread.c) | 0 | ||||
-rw-r--r-- | lib/zlib/gzwrite.c (renamed from zlib-1.2.7/gzwrite.c) | 0 | ||||
-rw-r--r-- | lib/zlib/infback.c (renamed from zlib-1.2.7/infback.c) | 0 | ||||
-rw-r--r-- | lib/zlib/inffast.c (renamed from zlib-1.2.7/inffast.c) | 0 | ||||
-rw-r--r-- | lib/zlib/inffast.h (renamed from zlib-1.2.7/inffast.h) | 0 | ||||
-rw-r--r-- | lib/zlib/inffixed.h (renamed from zlib-1.2.7/inffixed.h) | 0 | ||||
-rw-r--r-- | lib/zlib/inflate.c (renamed from zlib-1.2.7/inflate.c) | 0 | ||||
-rw-r--r-- | lib/zlib/inflate.h (renamed from zlib-1.2.7/inflate.h) | 0 | ||||
-rw-r--r-- | lib/zlib/inftrees.c (renamed from zlib-1.2.7/inftrees.c) | 0 | ||||
-rw-r--r-- | lib/zlib/inftrees.h (renamed from zlib-1.2.7/inftrees.h) | 0 | ||||
-rw-r--r-- | lib/zlib/minigzip.c (renamed from zlib-1.2.7/minigzip.c) | 0 | ||||
-rw-r--r-- | lib/zlib/trees.c (renamed from zlib-1.2.7/trees.c) | 0 | ||||
-rw-r--r-- | lib/zlib/trees.h (renamed from zlib-1.2.7/trees.h) | 0 | ||||
-rw-r--r-- | lib/zlib/uncompr.c (renamed from zlib-1.2.7/uncompr.c) | 0 | ||||
-rw-r--r-- | lib/zlib/zconf.h (renamed from zlib-1.2.7/zconf.h) | 0 | ||||
-rw-r--r-- | lib/zlib/zlib.h (renamed from zlib-1.2.7/zlib.h) | 0 | ||||
-rw-r--r-- | lib/zlib/zutil.c (renamed from zlib-1.2.7/zutil.c) | 0 | ||||
-rw-r--r-- | lib/zlib/zutil.h (renamed from zlib-1.2.7/zutil.h) | 0 | ||||
-rw-r--r-- | source/AllToLua.pkg | 81 | ||||
-rw-r--r-- | source/Authenticator.cpp | 267 | ||||
-rw-r--r-- | source/Bindings.cpp | 31660 | ||||
-rw-r--r-- | source/Bindings.h | 8 | ||||
-rw-r--r-- | source/BlockEntities/ChestEntity.cpp | 172 | ||||
-rw-r--r-- | source/BlockEntities/FurnaceEntity.cpp | 479 | ||||
-rw-r--r-- | source/BlockEntities/JukeboxEntity.cpp | 125 | ||||
-rw-r--r-- | source/BlockEntities/NoteEntity.cpp | 154 | ||||
-rw-r--r-- | source/BlockEntities/SignEntity.cpp | 115 | ||||
-rw-r--r-- | source/BlockID.cpp | 958 | ||||
-rw-r--r-- | source/Chunk.cpp | 2776 | ||||
-rw-r--r-- | source/ChunkMap.cpp | 2701 | ||||
-rw-r--r-- | source/Entities/Player.cpp | 1765 | ||||
-rw-r--r-- | source/Generating/BioGen.cpp | 707 | ||||
-rw-r--r-- | source/Generating/ChunkGenerator.cpp | 329 | ||||
-rw-r--r-- | source/Generating/CompoGen.cpp | 634 | ||||
-rw-r--r-- | source/Generating/ComposableGenerator.cpp | 501 | ||||
-rw-r--r-- | source/Generating/DistortedHeightmap.cpp | 444 | ||||
-rw-r--r-- | source/Generating/EndGen.cpp | 217 | ||||
-rw-r--r-- | source/Generating/HeiGen.cpp | 390 | ||||
-rw-r--r-- | source/Generating/Noise3DGenerator.cpp | 576 | ||||
-rw-r--r-- | source/GroupManager.cpp | 122 | ||||
-rw-r--r-- | source/HTTPServer/HTTPServer.h | 101 | ||||
-rw-r--r-- | source/Inventory.cpp | 682 | ||||
-rw-r--r-- | source/Item.cpp | 261 | ||||
-rw-r--r-- | source/LuaExpat/lxplib.c | 599 | ||||
-rw-r--r-- | source/LuaState.cpp | 1024 | ||||
-rw-r--r-- | source/LuaState.h | 817 | ||||
-rw-r--r-- | source/LuaWindow.cpp | 185 | ||||
-rw-r--r-- | source/MonsterConfig.cpp | 104 | ||||
-rw-r--r-- | source/OSSupport/GZipFile.h | 52 | ||||
-rw-r--r-- | source/PluginLua.cpp | 1471 | ||||
-rw-r--r-- | source/PluginManager.cpp | 1668 | ||||
-rw-r--r-- | source/Protocol/ChunkDataSerializer.cpp | 176 | ||||
-rw-r--r-- | source/Protocol/Protocol132.cpp | 950 | ||||
-rw-r--r-- | source/Protocol/Protocol132.h | 102 | ||||
-rw-r--r-- | source/Protocol/Protocol14x.cpp | 256 | ||||
-rw-r--r-- | source/Protocol/Protocol17x.h | 260 | ||||
-rw-r--r-- | source/RCONServer.cpp | 333 | ||||
-rw-r--r-- | source/Root.cpp | 754 | ||||
-rw-r--r-- | source/SQLite/lsqlite3.c | 2175 | ||||
-rw-r--r-- | source/Server.cpp | 707 | ||||
-rw-r--r-- | source/Server.h | 195 | ||||
-rw-r--r-- | source/Simulator/Simulator.h | 46 | ||||
-rw-r--r-- | source/StringCompression.h | 25 | ||||
-rw-r--r-- | source/WebAdmin.h | 215 | ||||
-rw-r--r-- | source/World.cpp | 2745 | ||||
-rw-r--r-- | source/WorldStorage/WSSAnvil.cpp | 1555 | ||||
-rw-r--r-- | source/WorldStorage/WSSCompact.cpp | 1009 | ||||
-rw-r--r-- | source/WorldStorage/WorldStorage.h | 135 | ||||
-rw-r--r-- | source/tolua++.h | 186 | ||||
-rw-r--r-- | src/AllToLua.bat (renamed from source/AllToLua.bat) | 0 | ||||
-rw-r--r-- | src/AllToLua.pkg | 81 | ||||
-rwxr-xr-x | src/AllToLua.sh (renamed from source/AllToLua.sh) | 0 | ||||
-rw-r--r-- | src/Authenticator.cpp | 267 | ||||
-rw-r--r-- | src/Authenticator.h (renamed from source/Authenticator.h) | 0 | ||||
-rw-r--r-- | src/Bindings.cpp | 31660 | ||||
-rw-r--r-- | src/Bindings.h | 8 | ||||
-rw-r--r-- | src/BlockArea.cpp (renamed from source/BlockArea.cpp) | 0 | ||||
-rw-r--r-- | src/BlockArea.h (renamed from source/BlockArea.h) | 0 | ||||
-rw-r--r-- | src/BlockEntities/BlockEntity.cpp (renamed from source/BlockEntities/BlockEntity.cpp) | 0 | ||||
-rw-r--r-- | src/BlockEntities/BlockEntity.h (renamed from source/BlockEntities/BlockEntity.h) | 0 | ||||
-rw-r--r-- | src/BlockEntities/BlockEntityWithItems.h (renamed from source/BlockEntities/BlockEntityWithItems.h) | 0 | ||||
-rw-r--r-- | src/BlockEntities/ChestEntity.cpp | 172 | ||||
-rw-r--r-- | src/BlockEntities/ChestEntity.h (renamed from source/BlockEntities/ChestEntity.h) | 0 | ||||
-rw-r--r-- | src/BlockEntities/DispenserEntity.cpp (renamed from source/BlockEntities/DispenserEntity.cpp) | 0 | ||||
-rw-r--r-- | src/BlockEntities/DispenserEntity.h (renamed from source/BlockEntities/DispenserEntity.h) | 0 | ||||
-rw-r--r-- | src/BlockEntities/DropSpenserEntity.cpp (renamed from source/BlockEntities/DropSpenserEntity.cpp) | 0 | ||||
-rw-r--r-- | src/BlockEntities/DropSpenserEntity.h (renamed from source/BlockEntities/DropSpenserEntity.h) | 0 | ||||
-rw-r--r-- | src/BlockEntities/DropperEntity.cpp (renamed from source/BlockEntities/DropperEntity.cpp) | 0 | ||||
-rw-r--r-- | src/BlockEntities/DropperEntity.h (renamed from source/BlockEntities/DropperEntity.h) | 0 | ||||
-rw-r--r-- | src/BlockEntities/FurnaceEntity.cpp | 479 | ||||
-rw-r--r-- | src/BlockEntities/FurnaceEntity.h (renamed from source/BlockEntities/FurnaceEntity.h) | 0 | ||||
-rw-r--r-- | src/BlockEntities/HopperEntity.cpp (renamed from source/BlockEntities/HopperEntity.cpp) | 0 | ||||
-rw-r--r-- | src/BlockEntities/HopperEntity.h (renamed from source/BlockEntities/HopperEntity.h) | 0 | ||||
-rw-r--r-- | src/BlockEntities/JukeboxEntity.cpp | 125 | ||||
-rw-r--r-- | src/BlockEntities/JukeboxEntity.h (renamed from source/BlockEntities/JukeboxEntity.h) | 0 | ||||
-rw-r--r-- | src/BlockEntities/NoteEntity.cpp | 154 | ||||
-rw-r--r-- | src/BlockEntities/NoteEntity.h (renamed from source/BlockEntities/NoteEntity.h) | 0 | ||||
-rw-r--r-- | src/BlockEntities/SignEntity.cpp | 115 | ||||
-rw-r--r-- | src/BlockEntities/SignEntity.h (renamed from source/BlockEntities/SignEntity.h) | 0 | ||||
-rw-r--r-- | src/BlockID.cpp | 958 | ||||
-rw-r--r-- | src/BlockID.h (renamed from source/BlockID.h) | 0 | ||||
-rw-r--r-- | src/BlockTracer.h (renamed from source/BlockTracer.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockBed.cpp (renamed from source/Blocks/BlockBed.cpp) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockBed.h (renamed from source/Blocks/BlockBed.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockBrewingStand.h (renamed from source/Blocks/BlockBrewingStand.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockButton.cpp (renamed from source/Blocks/BlockButton.cpp) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockButton.h (renamed from source/Blocks/BlockButton.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockCactus.h (renamed from source/Blocks/BlockCactus.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockCarpet.h (renamed from source/Blocks/BlockCarpet.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockCauldron.h (renamed from source/Blocks/BlockCauldron.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockChest.h (renamed from source/Blocks/BlockChest.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockCloth.h (renamed from source/Blocks/BlockCloth.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockCobWeb.h (renamed from source/Blocks/BlockCobWeb.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockComparator.cpp (renamed from source/Blocks/BlockComparator.cpp) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockComparator.h (renamed from source/Blocks/BlockComparator.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockCrops.h (renamed from source/Blocks/BlockCrops.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockDeadBush.h (renamed from source/Blocks/BlockDeadBush.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockDirt.h (renamed from source/Blocks/BlockDirt.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockDoor.cpp (renamed from source/Blocks/BlockDoor.cpp) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockDoor.h (renamed from source/Blocks/BlockDoor.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockDropSpenser.h (renamed from source/Blocks/BlockDropSpenser.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockEnderchest.h (renamed from source/Blocks/BlockEnderchest.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockEntity.h (renamed from source/Blocks/BlockEntity.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockFarmland.h (renamed from source/Blocks/BlockFarmland.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockFenceGate.h (renamed from source/Blocks/BlockFenceGate.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockFire.h (renamed from source/Blocks/BlockFire.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockFlower.h (renamed from source/Blocks/BlockFlower.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockFlowerPot.h (renamed from source/Blocks/BlockFlowerPot.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockFluid.h (renamed from source/Blocks/BlockFluid.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockFurnace.h (renamed from source/Blocks/BlockFurnace.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockGlass.h (renamed from source/Blocks/BlockGlass.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockGlowstone.h (renamed from source/Blocks/BlockGlowstone.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockGravel.h (renamed from source/Blocks/BlockGravel.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockHandler.cpp (renamed from source/Blocks/BlockHandler.cpp) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockHandler.h (renamed from source/Blocks/BlockHandler.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockHopper.h (renamed from source/Blocks/BlockHopper.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockIce.h (renamed from source/Blocks/BlockIce.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockLadder.h (renamed from source/Blocks/BlockLadder.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockLeaves.h (renamed from source/Blocks/BlockLeaves.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockLever.cpp (renamed from source/Blocks/BlockLever.cpp) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockLever.h (renamed from source/Blocks/BlockLever.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockMelon.h (renamed from source/Blocks/BlockMelon.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockMushroom.h (renamed from source/Blocks/BlockMushroom.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockMycelium.h (renamed from source/Blocks/BlockMycelium.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockNote.h (renamed from source/Blocks/BlockNote.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockOre.h (renamed from source/Blocks/BlockOre.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockPiston.cpp (renamed from source/Blocks/BlockPiston.cpp) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockPiston.h (renamed from source/Blocks/BlockPiston.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockPlanks.h (renamed from source/Blocks/BlockPlanks.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockPortal.h (renamed from source/Blocks/BlockPortal.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockPumpkin.h (renamed from source/Blocks/BlockPumpkin.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockRail.h (renamed from source/Blocks/BlockRail.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockRedstone.cpp (renamed from source/Blocks/BlockRedstone.cpp) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockRedstone.h (renamed from source/Blocks/BlockRedstone.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockRedstoneRepeater.cpp (renamed from source/Blocks/BlockRedstoneRepeater.cpp) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockRedstoneRepeater.h (renamed from source/Blocks/BlockRedstoneRepeater.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockRedstoneTorch.h (renamed from source/Blocks/BlockRedstoneTorch.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockSand.h (renamed from source/Blocks/BlockSand.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockSapling.h (renamed from source/Blocks/BlockSapling.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockSign.h (renamed from source/Blocks/BlockSign.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockSlab.h (renamed from source/Blocks/BlockSlab.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockSnow.h (renamed from source/Blocks/BlockSnow.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockStairs.h (renamed from source/Blocks/BlockStairs.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockStems.h (renamed from source/Blocks/BlockStems.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockStone.h (renamed from source/Blocks/BlockStone.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockSugarcane.h (renamed from source/Blocks/BlockSugarcane.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockTallGrass.h (renamed from source/Blocks/BlockTallGrass.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockTorch.h (renamed from source/Blocks/BlockTorch.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockVine.h (renamed from source/Blocks/BlockVine.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockWood.h (renamed from source/Blocks/BlockWood.h) | 0 | ||||
-rw-r--r-- | src/Blocks/BlockWorkbench.h (renamed from source/Blocks/BlockWorkbench.h) | 0 | ||||
-rw-r--r-- | src/BoundingBox.cpp (renamed from source/BoundingBox.cpp) | 0 | ||||
-rw-r--r-- | src/BoundingBox.h (renamed from source/BoundingBox.h) | 0 | ||||
-rw-r--r-- | src/ByteBuffer.cpp (renamed from source/ByteBuffer.cpp) | 0 | ||||
-rw-r--r-- | src/ByteBuffer.h (renamed from source/ByteBuffer.h) | 0 | ||||
-rw-r--r-- | src/ChatColor.cpp (renamed from source/ChatColor.cpp) | 0 | ||||
-rw-r--r-- | src/ChatColor.h (renamed from source/ChatColor.h) | 0 | ||||
-rw-r--r-- | src/Chunk.cpp | 2776 | ||||
-rw-r--r-- | src/Chunk.h (renamed from source/Chunk.h) | 0 | ||||
-rw-r--r-- | src/Chunk.inl.h (renamed from source/Chunk.inl.h) | 0 | ||||
-rw-r--r-- | src/ChunkDef.h (renamed from source/ChunkDef.h) | 0 | ||||
-rw-r--r-- | src/ChunkMap.cpp | 2701 | ||||
-rw-r--r-- | src/ChunkMap.h (renamed from source/ChunkMap.h) | 0 | ||||
-rw-r--r-- | src/ChunkSender.cpp (renamed from source/ChunkSender.cpp) | 0 | ||||
-rw-r--r-- | src/ChunkSender.h (renamed from source/ChunkSender.h) | 0 | ||||
-rw-r--r-- | src/ClientHandle.cpp (renamed from source/ClientHandle.cpp) | 0 | ||||
-rw-r--r-- | src/ClientHandle.h (renamed from source/ClientHandle.h) | 0 | ||||
-rw-r--r-- | src/CommandOutput.cpp (renamed from source/CommandOutput.cpp) | 0 | ||||
-rw-r--r-- | src/CommandOutput.h (renamed from source/CommandOutput.h) | 0 | ||||
-rw-r--r-- | src/CraftingRecipes.cpp (renamed from source/CraftingRecipes.cpp) | 0 | ||||
-rw-r--r-- | src/CraftingRecipes.h (renamed from source/CraftingRecipes.h) | 0 | ||||
-rw-r--r-- | src/Cuboid.cpp (renamed from source/Cuboid.cpp) | 0 | ||||
-rw-r--r-- | src/Cuboid.h (renamed from source/Cuboid.h) | 0 | ||||
-rw-r--r-- | src/DeadlockDetect.cpp (renamed from source/DeadlockDetect.cpp) | 0 | ||||
-rw-r--r-- | src/DeadlockDetect.h (renamed from source/DeadlockDetect.h) | 0 | ||||
-rw-r--r-- | src/Defines.h (renamed from source/Defines.h) | 0 | ||||
-rw-r--r-- | src/Enchantments.cpp (renamed from source/Enchantments.cpp) | 0 | ||||
-rw-r--r-- | src/Enchantments.h (renamed from source/Enchantments.h) | 0 | ||||
-rw-r--r-- | src/Endianness.h (renamed from source/Endianness.h) | 0 | ||||
-rw-r--r-- | src/Entities/Boat.cpp (renamed from source/Entities/Boat.cpp) | 0 | ||||
-rw-r--r-- | src/Entities/Boat.h (renamed from source/Entities/Boat.h) | 0 | ||||
-rw-r--r-- | src/Entities/Entity.cpp (renamed from source/Entities/Entity.cpp) | 0 | ||||
-rw-r--r-- | src/Entities/Entity.h (renamed from source/Entities/Entity.h) | 0 | ||||
-rw-r--r-- | src/Entities/ExpOrb.cpp (renamed from source/Entities/ExpOrb.cpp) | 0 | ||||
-rw-r--r-- | src/Entities/ExpOrb.h (renamed from source/Entities/ExpOrb.h) | 0 | ||||
-rw-r--r-- | src/Entities/FallingBlock.cpp (renamed from source/Entities/FallingBlock.cpp) | 0 | ||||
-rw-r--r-- | src/Entities/FallingBlock.h (renamed from source/Entities/FallingBlock.h) | 0 | ||||
-rw-r--r-- | src/Entities/Minecart.cpp (renamed from source/Entities/Minecart.cpp) | 0 | ||||
-rw-r--r-- | src/Entities/Minecart.h (renamed from source/Entities/Minecart.h) | 0 | ||||
-rw-r--r-- | src/Entities/Pawn.cpp (renamed from source/Entities/Pawn.cpp) | 0 | ||||
-rw-r--r-- | src/Entities/Pawn.h (renamed from source/Entities/Pawn.h) | 0 | ||||
-rw-r--r-- | src/Entities/Pickup.cpp (renamed from source/Entities/Pickup.cpp) | 0 | ||||
-rw-r--r-- | src/Entities/Pickup.h (renamed from source/Entities/Pickup.h) | 0 | ||||
-rw-r--r-- | src/Entities/Player.cpp | 1765 | ||||
-rw-r--r-- | src/Entities/Player.h (renamed from source/Entities/Player.h) | 0 | ||||
-rw-r--r-- | src/Entities/ProjectileEntity.cpp (renamed from source/Entities/ProjectileEntity.cpp) | 0 | ||||
-rw-r--r-- | src/Entities/ProjectileEntity.h (renamed from source/Entities/ProjectileEntity.h) | 0 | ||||
-rw-r--r-- | src/Entities/TNTEntity.cpp (renamed from source/Entities/TNTEntity.cpp) | 0 | ||||
-rw-r--r-- | src/Entities/TNTEntity.h (renamed from source/Entities/TNTEntity.h) | 0 | ||||
-rw-r--r-- | src/FastRandom.cpp (renamed from source/FastRandom.cpp) | 0 | ||||
-rw-r--r-- | src/FastRandom.h (renamed from source/FastRandom.h) | 0 | ||||
-rw-r--r-- | src/FurnaceRecipe.cpp (renamed from source/FurnaceRecipe.cpp) | 0 | ||||
-rw-r--r-- | src/FurnaceRecipe.h (renamed from source/FurnaceRecipe.h) | 0 | ||||
-rw-r--r-- | src/Generating/BioGen.cpp | 707 | ||||
-rw-r--r-- | src/Generating/BioGen.h (renamed from source/Generating/BioGen.h) | 0 | ||||
-rw-r--r-- | src/Generating/Caves.cpp (renamed from source/Generating/Caves.cpp) | 0 | ||||
-rw-r--r-- | src/Generating/Caves.h (renamed from source/Generating/Caves.h) | 0 | ||||
-rw-r--r-- | src/Generating/ChunkDesc.cpp (renamed from source/Generating/ChunkDesc.cpp) | 0 | ||||
-rw-r--r-- | src/Generating/ChunkDesc.h (renamed from source/Generating/ChunkDesc.h) | 0 | ||||
-rw-r--r-- | src/Generating/ChunkGenerator.cpp | 329 | ||||
-rw-r--r-- | src/Generating/ChunkGenerator.h (renamed from source/Generating/ChunkGenerator.h) | 0 | ||||
-rw-r--r-- | src/Generating/CompoGen.cpp | 634 | ||||
-rw-r--r-- | src/Generating/CompoGen.h (renamed from source/Generating/CompoGen.h) | 0 | ||||
-rw-r--r-- | src/Generating/ComposableGenerator.cpp | 501 | ||||
-rw-r--r-- | src/Generating/ComposableGenerator.h (renamed from source/Generating/ComposableGenerator.h) | 0 | ||||
-rw-r--r-- | src/Generating/DistortedHeightmap.cpp | 444 | ||||
-rw-r--r-- | src/Generating/DistortedHeightmap.h (renamed from source/Generating/DistortedHeightmap.h) | 0 | ||||
-rw-r--r-- | src/Generating/EndGen.cpp | 217 | ||||
-rw-r--r-- | src/Generating/EndGen.h (renamed from source/Generating/EndGen.h) | 0 | ||||
-rw-r--r-- | src/Generating/FinishGen.cpp (renamed from source/Generating/FinishGen.cpp) | 0 | ||||
-rw-r--r-- | src/Generating/FinishGen.h (renamed from source/Generating/FinishGen.h) | 0 | ||||
-rw-r--r-- | src/Generating/HeiGen.cpp | 390 | ||||
-rw-r--r-- | src/Generating/HeiGen.h (renamed from source/Generating/HeiGen.h) | 0 | ||||
-rw-r--r-- | src/Generating/MineShafts.cpp (renamed from source/Generating/MineShafts.cpp) | 0 | ||||
-rw-r--r-- | src/Generating/MineShafts.h (renamed from source/Generating/MineShafts.h) | 0 | ||||
-rw-r--r-- | src/Generating/Noise3DGenerator.cpp | 576 | ||||
-rw-r--r-- | src/Generating/Noise3DGenerator.h (renamed from source/Generating/Noise3DGenerator.h) | 0 | ||||
-rw-r--r-- | src/Generating/Ravines.cpp (renamed from source/Generating/Ravines.cpp) | 0 | ||||
-rw-r--r-- | src/Generating/Ravines.h (renamed from source/Generating/Ravines.h) | 0 | ||||
-rw-r--r-- | src/Generating/StructGen.cpp (renamed from source/Generating/StructGen.cpp) | 0 | ||||
-rw-r--r-- | src/Generating/StructGen.h (renamed from source/Generating/StructGen.h) | 0 | ||||
-rw-r--r-- | src/Generating/Trees.cpp (renamed from source/Generating/Trees.cpp) | 0 | ||||
-rw-r--r-- | src/Generating/Trees.h (renamed from source/Generating/Trees.h) | 0 | ||||
-rw-r--r-- | src/Globals.cpp (renamed from source/Globals.cpp) | 0 | ||||
-rw-r--r-- | src/Globals.h (renamed from source/Globals.h) | 0 | ||||
-rw-r--r-- | src/Group.cpp (renamed from source/Group.cpp) | 0 | ||||
-rw-r--r-- | src/Group.h (renamed from source/Group.h) | 0 | ||||
-rw-r--r-- | src/GroupManager.cpp | 122 | ||||
-rw-r--r-- | src/GroupManager.h (renamed from source/GroupManager.h) | 0 | ||||
-rw-r--r-- | src/HTTPServer/EnvelopeParser.cpp (renamed from source/HTTPServer/EnvelopeParser.cpp) | 0 | ||||
-rw-r--r-- | src/HTTPServer/EnvelopeParser.h (renamed from source/HTTPServer/EnvelopeParser.h) | 0 | ||||
-rw-r--r-- | src/HTTPServer/HTTPConnection.cpp (renamed from source/HTTPServer/HTTPConnection.cpp) | 0 | ||||
-rw-r--r-- | src/HTTPServer/HTTPConnection.h (renamed from source/HTTPServer/HTTPConnection.h) | 0 | ||||
-rw-r--r-- | src/HTTPServer/HTTPFormParser.cpp (renamed from source/HTTPServer/HTTPFormParser.cpp) | 0 | ||||
-rw-r--r-- | src/HTTPServer/HTTPFormParser.h (renamed from source/HTTPServer/HTTPFormParser.h) | 0 | ||||
-rw-r--r-- | src/HTTPServer/HTTPMessage.cpp (renamed from source/HTTPServer/HTTPMessage.cpp) | 0 | ||||
-rw-r--r-- | src/HTTPServer/HTTPMessage.h (renamed from source/HTTPServer/HTTPMessage.h) | 0 | ||||
-rw-r--r-- | src/HTTPServer/HTTPServer.cpp (renamed from source/HTTPServer/HTTPServer.cpp) | 0 | ||||
-rw-r--r-- | src/HTTPServer/HTTPServer.h | 101 | ||||
-rw-r--r-- | src/HTTPServer/MultipartParser.cpp (renamed from source/HTTPServer/MultipartParser.cpp) | 0 | ||||
-rw-r--r-- | src/HTTPServer/MultipartParser.h (renamed from source/HTTPServer/MultipartParser.h) | 0 | ||||
-rw-r--r-- | src/HTTPServer/NameValueParser.cpp (renamed from source/HTTPServer/NameValueParser.cpp) | 0 | ||||
-rw-r--r-- | src/HTTPServer/NameValueParser.h (renamed from source/HTTPServer/NameValueParser.h) | 0 | ||||
-rw-r--r-- | src/Inventory.cpp | 682 | ||||
-rw-r--r-- | src/Inventory.h (renamed from source/Inventory.h) | 0 | ||||
-rw-r--r-- | src/Item.cpp | 261 | ||||
-rw-r--r-- | src/Item.h (renamed from source/Item.h) | 0 | ||||
-rw-r--r-- | src/ItemGrid.cpp (renamed from source/ItemGrid.cpp) | 0 | ||||
-rw-r--r-- | src/ItemGrid.h (renamed from source/ItemGrid.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemBed.h (renamed from source/Items/ItemBed.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemBoat.h (renamed from source/Items/ItemBoat.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemBow.h (renamed from source/Items/ItemBow.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemBrewingStand.h (renamed from source/Items/ItemBrewingStand.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemBucket.h (renamed from source/Items/ItemBucket.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemCauldron.h (renamed from source/Items/ItemCauldron.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemCloth.h (renamed from source/Items/ItemCloth.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemComparator.h (renamed from source/Items/ItemComparator.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemDoor.h (renamed from source/Items/ItemDoor.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemDye.h (renamed from source/Items/ItemDye.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemFlowerPot.h (renamed from source/Items/ItemFlowerPot.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemFood.h (renamed from source/Items/ItemFood.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemHandler.cpp (renamed from source/Items/ItemHandler.cpp) | 0 | ||||
-rw-r--r-- | src/Items/ItemHandler.h (renamed from source/Items/ItemHandler.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemHoe.h (renamed from source/Items/ItemHoe.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemLeaves.h (renamed from source/Items/ItemLeaves.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemLighter.h (renamed from source/Items/ItemLighter.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemMinecart.h (renamed from source/Items/ItemMinecart.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemPickaxe.h (renamed from source/Items/ItemPickaxe.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemRedstoneDust.h (renamed from source/Items/ItemRedstoneDust.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemRedstoneRepeater.h (renamed from source/Items/ItemRedstoneRepeater.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemSapling.h (renamed from source/Items/ItemSapling.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemSeeds.h (renamed from source/Items/ItemSeeds.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemShears.h (renamed from source/Items/ItemShears.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemShovel.h (renamed from source/Items/ItemShovel.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemSign.h (renamed from source/Items/ItemSign.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemSpawnEgg.h (renamed from source/Items/ItemSpawnEgg.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemSugarcane.h (renamed from source/Items/ItemSugarcane.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemSword.h (renamed from source/Items/ItemSword.h) | 0 | ||||
-rw-r--r-- | src/Items/ItemThrowable.h (renamed from source/Items/ItemThrowable.h) | 0 | ||||
-rw-r--r-- | src/LeakFinder.cpp (renamed from source/LeakFinder.cpp) | 0 | ||||
-rw-r--r-- | src/LeakFinder.h (renamed from source/LeakFinder.h) | 0 | ||||
-rw-r--r-- | src/LightingThread.cpp (renamed from source/LightingThread.cpp) | 0 | ||||
-rw-r--r-- | src/LightingThread.h (renamed from source/LightingThread.h) | 0 | ||||
-rw-r--r-- | src/LineBlockTracer.cpp (renamed from source/LineBlockTracer.cpp) | 0 | ||||
-rw-r--r-- | src/LineBlockTracer.h (renamed from source/LineBlockTracer.h) | 0 | ||||
-rw-r--r-- | src/LinearInterpolation.cpp (renamed from source/LinearInterpolation.cpp) | 0 | ||||
-rw-r--r-- | src/LinearInterpolation.h (renamed from source/LinearInterpolation.h) | 0 | ||||
-rw-r--r-- | src/LinearUpscale.h (renamed from source/LinearUpscale.h) | 0 | ||||
-rw-r--r-- | src/Log.cpp (renamed from source/Log.cpp) | 0 | ||||
-rw-r--r-- | src/Log.h (renamed from source/Log.h) | 0 | ||||
-rw-r--r-- | src/LuaFunctions.h (renamed from source/LuaFunctions.h) | 0 | ||||
-rw-r--r-- | src/LuaState.cpp | 1024 | ||||
-rw-r--r-- | src/LuaState.h | 817 | ||||
-rw-r--r-- | src/LuaWindow.cpp | 185 | ||||
-rw-r--r-- | src/LuaWindow.h (renamed from source/LuaWindow.h) | 0 | ||||
-rw-r--r-- | src/MCLogger.cpp (renamed from source/MCLogger.cpp) | 0 | ||||
-rw-r--r-- | src/MCLogger.h (renamed from source/MCLogger.h) | 0 | ||||
-rw-r--r-- | src/ManualBindings.cpp (renamed from source/ManualBindings.cpp) | 0 | ||||
-rw-r--r-- | src/ManualBindings.h (renamed from source/ManualBindings.h) | 0 | ||||
-rw-r--r-- | src/Matrix4f.cpp (renamed from source/Matrix4f.cpp) | 0 | ||||
-rw-r--r-- | src/Matrix4f.h (renamed from source/Matrix4f.h) | 0 | ||||
-rw-r--r-- | src/MemoryLeak.h (renamed from source/MemoryLeak.h) | 0 | ||||
-rw-r--r-- | src/MersenneTwister.h (renamed from source/MersenneTwister.h) | 0 | ||||
-rw-r--r-- | src/MobCensus.cpp (renamed from source/MobCensus.cpp) | 0 | ||||
-rw-r--r-- | src/MobCensus.h (renamed from source/MobCensus.h) | 0 | ||||
-rw-r--r-- | src/MobFamilyCollecter.cpp (renamed from source/MobFamilyCollecter.cpp) | 0 | ||||
-rw-r--r-- | src/MobFamilyCollecter.h (renamed from source/MobFamilyCollecter.h) | 0 | ||||
-rw-r--r-- | src/MobProximityCounter.cpp (renamed from source/MobProximityCounter.cpp) | 0 | ||||
-rw-r--r-- | src/MobProximityCounter.h (renamed from source/MobProximityCounter.h) | 0 | ||||
-rw-r--r-- | src/MobSpawner.cpp (renamed from source/MobSpawner.cpp) | 0 | ||||
-rw-r--r-- | src/MobSpawner.h (renamed from source/MobSpawner.h) | 0 | ||||
-rw-r--r-- | src/Mobs/AggressiveMonster.cpp (renamed from source/Mobs/AggressiveMonster.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/AggressiveMonster.h (renamed from source/Mobs/AggressiveMonster.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Bat.cpp (renamed from source/Mobs/Bat.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Bat.h (renamed from source/Mobs/Bat.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Blaze.cpp (renamed from source/Mobs/Blaze.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Blaze.h (renamed from source/Mobs/Blaze.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Cavespider.cpp (renamed from source/Mobs/Cavespider.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Cavespider.h (renamed from source/Mobs/Cavespider.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Chicken.cpp (renamed from source/Mobs/Chicken.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Chicken.h (renamed from source/Mobs/Chicken.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Cow.cpp (renamed from source/Mobs/Cow.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Cow.h (renamed from source/Mobs/Cow.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Creeper.cpp (renamed from source/Mobs/Creeper.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Creeper.h (renamed from source/Mobs/Creeper.h) | 0 | ||||
-rw-r--r-- | src/Mobs/EnderDragon.cpp (renamed from source/Mobs/EnderDragon.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/EnderDragon.h (renamed from source/Mobs/EnderDragon.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Enderman.cpp (renamed from source/Mobs/Enderman.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Enderman.h (renamed from source/Mobs/Enderman.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Ghast.cpp (renamed from source/Mobs/Ghast.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Ghast.h (renamed from source/Mobs/Ghast.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Giant.cpp (renamed from source/Mobs/Giant.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Giant.h (renamed from source/Mobs/Giant.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Horse.cpp (renamed from source/Mobs/Horse.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Horse.h (renamed from source/Mobs/Horse.h) | 0 | ||||
-rw-r--r-- | src/Mobs/IncludeAllMonsters.h (renamed from source/Mobs/IncludeAllMonsters.h) | 0 | ||||
-rw-r--r-- | src/Mobs/IronGolem.cpp (renamed from source/Mobs/IronGolem.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/IronGolem.h (renamed from source/Mobs/IronGolem.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Magmacube.cpp (renamed from source/Mobs/Magmacube.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Magmacube.h (renamed from source/Mobs/Magmacube.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Monster.cpp (renamed from source/Mobs/Monster.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Monster.h (renamed from source/Mobs/Monster.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Mooshroom.cpp (renamed from source/Mobs/Mooshroom.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Mooshroom.h (renamed from source/Mobs/Mooshroom.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Ocelot.h (renamed from source/Mobs/Ocelot.h) | 0 | ||||
-rw-r--r-- | src/Mobs/PassiveAggressiveMonster.cpp (renamed from source/Mobs/PassiveAggressiveMonster.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/PassiveAggressiveMonster.h (renamed from source/Mobs/PassiveAggressiveMonster.h) | 0 | ||||
-rw-r--r-- | src/Mobs/PassiveMonster.cpp (renamed from source/Mobs/PassiveMonster.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/PassiveMonster.h (renamed from source/Mobs/PassiveMonster.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Pig.cpp (renamed from source/Mobs/Pig.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Pig.h (renamed from source/Mobs/Pig.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Sheep.cpp (renamed from source/Mobs/Sheep.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Sheep.h (renamed from source/Mobs/Sheep.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Silverfish.h (renamed from source/Mobs/Silverfish.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Skeleton.cpp (renamed from source/Mobs/Skeleton.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Skeleton.h (renamed from source/Mobs/Skeleton.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Slime.cpp (renamed from source/Mobs/Slime.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Slime.h (renamed from source/Mobs/Slime.h) | 0 | ||||
-rw-r--r-- | src/Mobs/SnowGolem.cpp (renamed from source/Mobs/SnowGolem.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/SnowGolem.h (renamed from source/Mobs/SnowGolem.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Spider.cpp (renamed from source/Mobs/Spider.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Spider.h (renamed from source/Mobs/Spider.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Squid.cpp (renamed from source/Mobs/Squid.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Squid.h (renamed from source/Mobs/Squid.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Villager.cpp (renamed from source/Mobs/Villager.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Villager.h (renamed from source/Mobs/Villager.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Witch.cpp (renamed from source/Mobs/Witch.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Witch.h (renamed from source/Mobs/Witch.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Wither.cpp (renamed from source/Mobs/Wither.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Wither.h (renamed from source/Mobs/Wither.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Wolf.cpp (renamed from source/Mobs/Wolf.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Wolf.h (renamed from source/Mobs/Wolf.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Zombie.cpp (renamed from source/Mobs/Zombie.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Zombie.h (renamed from source/Mobs/Zombie.h) | 0 | ||||
-rw-r--r-- | src/Mobs/Zombiepigman.cpp (renamed from source/Mobs/Zombiepigman.cpp) | 0 | ||||
-rw-r--r-- | src/Mobs/Zombiepigman.h (renamed from source/Mobs/Zombiepigman.h) | 0 | ||||
-rw-r--r-- | src/MonsterConfig.cpp | 103 | ||||
-rw-r--r-- | src/MonsterConfig.h (renamed from source/MonsterConfig.h) | 0 | ||||
-rw-r--r-- | src/Noise.cpp (renamed from source/Noise.cpp) | 0 | ||||
-rw-r--r-- | src/Noise.h (renamed from source/Noise.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/BlockingTCPLink.cpp (renamed from source/OSSupport/BlockingTCPLink.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/BlockingTCPLink.h (renamed from source/OSSupport/BlockingTCPLink.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/CriticalSection.cpp (renamed from source/OSSupport/CriticalSection.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/CriticalSection.h (renamed from source/OSSupport/CriticalSection.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/Event.cpp (renamed from source/OSSupport/Event.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/Event.h (renamed from source/OSSupport/Event.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/File.cpp (renamed from source/OSSupport/File.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/File.h (renamed from source/OSSupport/File.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/GZipFile.cpp (renamed from source/OSSupport/GZipFile.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/GZipFile.h | 52 | ||||
-rw-r--r-- | src/OSSupport/IsThread.cpp (renamed from source/OSSupport/IsThread.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/IsThread.h (renamed from source/OSSupport/IsThread.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/ListenThread.cpp (renamed from source/OSSupport/ListenThread.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/ListenThread.h (renamed from source/OSSupport/ListenThread.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/Semaphore.cpp (renamed from source/OSSupport/Semaphore.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/Semaphore.h (renamed from source/OSSupport/Semaphore.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/Sleep.cpp (renamed from source/OSSupport/Sleep.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/Sleep.h (renamed from source/OSSupport/Sleep.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/Socket.cpp (renamed from source/OSSupport/Socket.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/Socket.h (renamed from source/OSSupport/Socket.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/SocketThreads.cpp (renamed from source/OSSupport/SocketThreads.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/SocketThreads.h (renamed from source/OSSupport/SocketThreads.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/Thread.cpp (renamed from source/OSSupport/Thread.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/Thread.h (renamed from source/OSSupport/Thread.h) | 0 | ||||
-rw-r--r-- | src/OSSupport/Timer.cpp (renamed from source/OSSupport/Timer.cpp) | 0 | ||||
-rw-r--r-- | src/OSSupport/Timer.h (renamed from source/OSSupport/Timer.h) | 0 | ||||
-rw-r--r-- | src/Piston.cpp (renamed from source/Piston.cpp) | 0 | ||||
-rw-r--r-- | src/Piston.h (renamed from source/Piston.h) | 0 | ||||
-rw-r--r-- | src/Plugin.cpp (renamed from source/Plugin.cpp) | 0 | ||||
-rw-r--r-- | src/Plugin.h (renamed from source/Plugin.h) | 0 | ||||
-rw-r--r-- | src/PluginLua.cpp | 1471 | ||||
-rw-r--r-- | src/PluginLua.h (renamed from source/PluginLua.h) | 0 | ||||
-rw-r--r-- | src/PluginManager.cpp | 1668 | ||||
-rw-r--r-- | src/PluginManager.h (renamed from source/PluginManager.h) | 0 | ||||
-rw-r--r-- | src/ProbabDistrib.cpp (renamed from source/ProbabDistrib.cpp) | 0 | ||||
-rw-r--r-- | src/ProbabDistrib.h (renamed from source/ProbabDistrib.h) | 0 | ||||
-rw-r--r-- | src/Protocol/ChunkDataSerializer.cpp | 176 | ||||
-rw-r--r-- | src/Protocol/ChunkDataSerializer.h (renamed from source/Protocol/ChunkDataSerializer.h) | 0 | ||||
-rw-r--r-- | src/Protocol/Protocol.h (renamed from source/Protocol/Protocol.h) | 0 | ||||
-rw-r--r-- | src/Protocol/Protocol125.cpp (renamed from source/Protocol/Protocol125.cpp) | 0 | ||||
-rw-r--r-- | src/Protocol/Protocol125.h (renamed from source/Protocol/Protocol125.h) | 0 | ||||
-rw-r--r-- | src/Protocol/Protocol132.cpp | 950 | ||||
-rw-r--r-- | src/Protocol/Protocol132.h | 102 | ||||
-rw-r--r-- | src/Protocol/Protocol14x.cpp | 256 | ||||
-rw-r--r-- | src/Protocol/Protocol14x.h (renamed from source/Protocol/Protocol14x.h) | 0 | ||||
-rw-r--r-- | src/Protocol/Protocol15x.cpp (renamed from source/Protocol/Protocol15x.cpp) | 0 | ||||
-rw-r--r-- | src/Protocol/Protocol15x.h (renamed from source/Protocol/Protocol15x.h) | 0 | ||||
-rw-r--r-- | src/Protocol/Protocol16x.cpp (renamed from source/Protocol/Protocol16x.cpp) | 0 | ||||
-rw-r--r-- | src/Protocol/Protocol16x.h (renamed from source/Protocol/Protocol16x.h) | 0 | ||||
-rw-r--r-- | src/Protocol/Protocol17x.cpp (renamed from source/Protocol/Protocol17x.cpp) | 0 | ||||
-rw-r--r-- | src/Protocol/Protocol17x.h | 260 | ||||
-rw-r--r-- | src/Protocol/ProtocolRecognizer.cpp (renamed from source/Protocol/ProtocolRecognizer.cpp) | 0 | ||||
-rw-r--r-- | src/Protocol/ProtocolRecognizer.h (renamed from source/Protocol/ProtocolRecognizer.h) | 0 | ||||
-rw-r--r-- | src/RCONServer.cpp | 333 | ||||
-rw-r--r-- | src/RCONServer.h (renamed from source/RCONServer.h) | 0 | ||||
-rw-r--r-- | src/ReferenceManager.cpp (renamed from source/ReferenceManager.cpp) | 0 | ||||
-rw-r--r-- | src/ReferenceManager.h (renamed from source/ReferenceManager.h) | 0 | ||||
-rw-r--r-- | src/Root.cpp | 754 | ||||
-rw-r--r-- | src/Root.h (renamed from source/Root.h) | 0 | ||||
-rw-r--r-- | src/Server.cpp | 707 | ||||
-rw-r--r-- | src/Server.h | 195 | ||||
-rw-r--r-- | src/Simulator/DelayedFluidSimulator.cpp (renamed from source/Simulator/DelayedFluidSimulator.cpp) | 0 | ||||
-rw-r--r-- | src/Simulator/DelayedFluidSimulator.h (renamed from source/Simulator/DelayedFluidSimulator.h) | 0 | ||||
-rw-r--r-- | src/Simulator/FireSimulator.cpp (renamed from source/Simulator/FireSimulator.cpp) | 0 | ||||
-rw-r--r-- | src/Simulator/FireSimulator.h (renamed from source/Simulator/FireSimulator.h) | 0 | ||||
-rw-r--r-- | src/Simulator/FloodyFluidSimulator.cpp (renamed from source/Simulator/FloodyFluidSimulator.cpp) | 0 | ||||
-rw-r--r-- | src/Simulator/FloodyFluidSimulator.h (renamed from source/Simulator/FloodyFluidSimulator.h) | 0 | ||||
-rw-r--r-- | src/Simulator/FluidSimulator.cpp (renamed from source/Simulator/FluidSimulator.cpp) | 0 | ||||
-rw-r--r-- | src/Simulator/FluidSimulator.h (renamed from source/Simulator/FluidSimulator.h) | 0 | ||||
-rw-r--r-- | src/Simulator/NoopFluidSimulator.h (renamed from source/Simulator/NoopFluidSimulator.h) | 0 | ||||
-rw-r--r-- | src/Simulator/RedstoneSimulator.cpp (renamed from source/Simulator/RedstoneSimulator.cpp) | 0 | ||||
-rw-r--r-- | src/Simulator/RedstoneSimulator.h (renamed from source/Simulator/RedstoneSimulator.h) | 0 | ||||
-rw-r--r-- | src/Simulator/SandSimulator.cpp (renamed from source/Simulator/SandSimulator.cpp) | 0 | ||||
-rw-r--r-- | src/Simulator/SandSimulator.h (renamed from source/Simulator/SandSimulator.h) | 0 | ||||
-rw-r--r-- | src/Simulator/Simulator.cpp (renamed from source/Simulator/Simulator.cpp) | 0 | ||||
-rw-r--r-- | src/Simulator/Simulator.h | 46 | ||||
-rw-r--r-- | src/Simulator/SimulatorManager.cpp (renamed from source/Simulator/SimulatorManager.cpp) | 0 | ||||
-rw-r--r-- | src/Simulator/SimulatorManager.h (renamed from source/Simulator/SimulatorManager.h) | 0 | ||||
-rw-r--r-- | src/Simulator/VaporizeFluidSimulator.cpp (renamed from source/Simulator/VaporizeFluidSimulator.cpp) | 0 | ||||
-rw-r--r-- | src/Simulator/VaporizeFluidSimulator.h (renamed from source/Simulator/VaporizeFluidSimulator.h) | 0 | ||||
-rw-r--r-- | src/StackWalker.cpp (renamed from source/StackWalker.cpp) | 0 | ||||
-rw-r--r-- | src/StackWalker.h (renamed from source/StackWalker.h) | 0 | ||||
-rw-r--r-- | src/StringCompression.cpp (renamed from source/StringCompression.cpp) | 0 | ||||
-rw-r--r-- | src/StringCompression.h | 25 | ||||
-rw-r--r-- | src/StringUtils.cpp (renamed from source/StringUtils.cpp) | 0 | ||||
-rw-r--r-- | src/StringUtils.h (renamed from source/StringUtils.h) | 0 | ||||
-rw-r--r-- | src/Tracer.cpp (renamed from source/Tracer.cpp) | 0 | ||||
-rw-r--r-- | src/Tracer.h (renamed from source/Tracer.h) | 0 | ||||
-rw-r--r-- | src/UI/SlotArea.cpp (renamed from source/UI/SlotArea.cpp) | 0 | ||||
-rw-r--r-- | src/UI/SlotArea.h (renamed from source/UI/SlotArea.h) | 0 | ||||
-rw-r--r-- | src/UI/Window.cpp (renamed from source/UI/Window.cpp) | 0 | ||||
-rw-r--r-- | src/UI/Window.h (renamed from source/UI/Window.h) | 0 | ||||
-rw-r--r-- | src/UI/WindowOwner.h (renamed from source/UI/WindowOwner.h) | 0 | ||||
-rw-r--r-- | src/Vector3d.cpp (renamed from source/Vector3d.cpp) | 0 | ||||
-rw-r--r-- | src/Vector3d.h (renamed from source/Vector3d.h) | 0 | ||||
-rw-r--r-- | src/Vector3f.cpp (renamed from source/Vector3f.cpp) | 0 | ||||
-rw-r--r-- | src/Vector3f.h (renamed from source/Vector3f.h) | 0 | ||||
-rw-r--r-- | src/Vector3i.cpp (renamed from source/Vector3i.cpp) | 0 | ||||
-rw-r--r-- | src/Vector3i.h (renamed from source/Vector3i.h) | 0 | ||||
-rw-r--r-- | src/WebAdmin.cpp (renamed from source/WebAdmin.cpp) | 0 | ||||
-rw-r--r-- | src/WebAdmin.h | 215 | ||||
-rw-r--r-- | src/WebPlugin.cpp (renamed from source/WebPlugin.cpp) | 0 | ||||
-rw-r--r-- | src/WebPlugin.h (renamed from source/WebPlugin.h) | 0 | ||||
-rw-r--r-- | src/World.cpp | 2745 | ||||
-rw-r--r-- | src/World.h (renamed from source/World.h) | 0 | ||||
-rw-r--r-- | src/WorldStorage/FastNBT.cpp (renamed from source/WorldStorage/FastNBT.cpp) | 0 | ||||
-rw-r--r-- | src/WorldStorage/FastNBT.h (renamed from source/WorldStorage/FastNBT.h) | 0 | ||||
-rw-r--r-- | src/WorldStorage/NBTChunkSerializer.cpp (renamed from source/WorldStorage/NBTChunkSerializer.cpp) | 0 | ||||
-rw-r--r-- | src/WorldStorage/NBTChunkSerializer.h (renamed from source/WorldStorage/NBTChunkSerializer.h) | 0 | ||||
-rw-r--r-- | src/WorldStorage/WSSAnvil.cpp | 1555 | ||||
-rw-r--r-- | src/WorldStorage/WSSAnvil.h (renamed from source/WorldStorage/WSSAnvil.h) | 0 | ||||
-rw-r--r-- | src/WorldStorage/WSSCompact.cpp | 1009 | ||||
-rw-r--r-- | src/WorldStorage/WSSCompact.h (renamed from source/WorldStorage/WSSCompact.h) | 0 | ||||
-rw-r--r-- | src/WorldStorage/WorldStorage.cpp (renamed from source/WorldStorage/WorldStorage.cpp) | 0 | ||||
-rw-r--r-- | src/WorldStorage/WorldStorage.h | 135 | ||||
-rw-r--r-- | src/XMLParser.h (renamed from source/XMLParser.h) | 0 | ||||
-rw-r--r-- | src/lua5.1.dll (renamed from source/lua5.1.dll) | bin | 167424 -> 167424 bytes | |||
-rw-r--r-- | src/main.cpp (renamed from source/main.cpp) | 0 | ||||
-rw-r--r-- | src/tolua++.exe (renamed from source/tolua++.exe) | bin | 484864 -> 484864 bytes | |||
-rw-r--r-- | src/tolua++.h | 186 | ||||
-rw-r--r-- | src/tolua_base.h (renamed from source/tolua_base.h) | 0 | ||||
-rw-r--r-- | src/virtual_method_hooks.lua (renamed from source/virtual_method_hooks.lua) | 0 | ||||
-rw-r--r-- | tolua++-1.0.93/include/tolua++.h | 186 | ||||
-rw-r--r-- | tolua++-1.0.93/src/bin/tolua.c | 169 | ||||
-rw-r--r-- | tolua++-1.0.93/src/lib/tolua_event.c | 536 | ||||
-rw-r--r-- | tolua++-1.0.93/src/lib/tolua_is.c | 621 | ||||
-rw-r--r-- | tolua++-1.0.93/src/lib/tolua_map.c | 704 | ||||
-rw-r--r-- | tolua++-1.0.93/src/lib/tolua_push.c | 171 | ||||
-rw-r--r-- | tolua++-1.0.93/src/lib/tolua_to.c | 133 |
941 files changed, 73057 insertions, 73422 deletions
diff --git a/GNUmakefile b/GNUmakefile index d8afc0525..8c452c1cc 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -50,6 +50,7 @@ ifeq ($(release),1) CC_OPTIONS = -g -O3 -DNDEBUG CXX_OPTIONS = -g -O3 -DNDEBUG LNK_OPTIONS = -pthread -O3 + BUILDDIR = build/release/ else @@ -61,32 +62,22 @@ ifeq ($(profile),1) CC_OPTIONS = -s -g -ggdb -O3 -pg -DNDEBUG CXX_OPTIONS = -s -g -ggdb -O3 -pg -DNDEBUG LNK_OPTIONS = -pthread -ggdb -O3 -pg -BUILDDIR = build/profile/ -else -ifeq ($(pedantic),1) -################ -# pedantic build - basically a debug build with lots of warnings -################ - -CC_OPTIONS = -s -g -ggdb -D_DEBUG -Wall -Wextra -pedantic -ansi -Wno-long-long -CXX_OPTIONS = -s -g -ggdb -D_DEBUG -Wall -Wextra -pedantic -ansi -Wno-long-long -LNK_OPTIONS = -pthread -ggdb -BUILDDIR = build/pedantic/ +BUILDDIR = build/profile/ else ################ # debug build - fully traceable by gdb in C++ code, slowest -# Since C code is used only for supporting libraries (zlib, lua), it is still O3-optimized +# Since C code is used only for supporting libraries (zlib, lua), it is still Ofast-optimized ################ -CC_OPTIONS = -s -ggdb -g -D_DEBUG -O3 -CXX_OPTIONS = -s -ggdb -g -D_DEBUG -LNK_OPTIONS = -pthread -g -ggdb + CC_OPTIONS = -s -ggdb -g -D_DEBUG -O3 + +CXX_OPTIONS = -s -ggdb -g -D_DEBUG -Og +LNK_OPTIONS = -pthread -g -ggdb -Og BUILDDIR = build/debug/ endif endif -endif ################################################## # Always be warning. @@ -100,6 +91,7 @@ ifeq ($(shell $(CXX) --version 2>&1 | grep -i -c "clang version"),0) CC_OPTIONS += -Wno-tautological-compare CXX_OPTIONS += -Wno-tautological-compare disableasm = 1 +disableofast = 1 endif @@ -150,18 +142,9 @@ endif # INCLUDE directories for MCServer INCLUDE = -I.\ - -Isource\ - -Isource/md5\ - -Isource/items\ - -Isource/blocks\ - -Itolua++-1.0.93/src/lib\ - -Ilua-5.1.4/src\ - -Izlib-1.2.7\ - -IiniFile\ - -Itolua++-1.0.93/include\ - -Ijsoncpp-src-0.5.0/include\ - -Ijsoncpp-src-0.5.0/src/lib_json\ - -Iexpat + -Isrc\ + -Ilib\ + -Ilib/jsoncpp/include @@ -170,7 +153,7 @@ INCLUDE = -I.\ ################################################### # Build MCServer -SOURCES := $(shell find CryptoPP lua-5.1.4 jsoncpp-src-0.5.0 zlib-1.2.7 source tolua++-1.0.93 iniFile expat '(' -name '*.cpp' -o -name '*.c' ')') +SOURCES := $(shell find src lib '(' -name '*.cpp' -o -name '*.c' ')') SOURCES := $(filter-out %minigzip.c %lua.c %tolua.c %toluabind.c %LeakFinder.cpp %StackWalker.cpp %example.c,$(SOURCES)) OBJECTS := $(patsubst %.c,$(BUILDDIR)%.o,$(SOURCES)) OBJECTS := $(patsubst %.cpp,$(BUILDDIR)%.o,$(OBJECTS)) diff --git a/VC2008/CryptoPP.cbp b/VC2008/CryptoPP.cbp index f9f10e7a7..55b322b92 100644 --- a/VC2008/CryptoPP.cbp +++ b/VC2008/CryptoPP.cbp @@ -106,202 +106,202 @@ </Compiler> </Target> </Build> - <Unit filename="../CryptoPP/Doxyfile" /> - <Unit filename="../CryptoPP/GNUmakefile" /> - <Unit filename="../CryptoPP/License.txt" /> - <Unit filename="../CryptoPP/Readme.txt" /> - <Unit filename="../CryptoPP/adler32.cpp" /> - <Unit filename="../CryptoPP/adler32.h" /> - <Unit filename="../CryptoPP/aes.h" /> - <Unit filename="../CryptoPP/algebra.cpp" /> - <Unit filename="../CryptoPP/algebra.h" /> - <Unit filename="../CryptoPP/algparam.cpp" /> - <Unit filename="../CryptoPP/algparam.h" /> - <Unit filename="../CryptoPP/arc4.h" /> - <Unit filename="../CryptoPP/argnames.h" /> - <Unit filename="../CryptoPP/asn.cpp" /> - <Unit filename="../CryptoPP/asn.h" /> - <Unit filename="../CryptoPP/authenc.cpp" /> - <Unit filename="../CryptoPP/authenc.h" /> - <Unit filename="../CryptoPP/base32.cpp" /> - <Unit filename="../CryptoPP/base32.h" /> - <Unit filename="../CryptoPP/base64.cpp" /> - <Unit filename="../CryptoPP/base64.h" /> - <Unit filename="../CryptoPP/basecode.cpp" /> - <Unit filename="../CryptoPP/basecode.h" /> - <Unit filename="../CryptoPP/cbcmac.cpp" /> - <Unit filename="../CryptoPP/cbcmac.h" /> - <Unit filename="../CryptoPP/ccm.cpp" /> - <Unit filename="../CryptoPP/ccm.h" /> - <Unit filename="../CryptoPP/channels.cpp" /> - <Unit filename="../CryptoPP/channels.h" /> - <Unit filename="../CryptoPP/cmac.cpp" /> - <Unit filename="../CryptoPP/cmac.h" /> - <Unit filename="../CryptoPP/config.h" /> - <Unit filename="../CryptoPP/cpu.cpp" /> - <Unit filename="../CryptoPP/cpu.h" /> - <Unit filename="../CryptoPP/crc.cpp" /> - <Unit filename="../CryptoPP/crc.h" /> - <Unit filename="../CryptoPP/cryptlib.cpp" /> - <Unit filename="../CryptoPP/cryptlib.h" /> - <Unit filename="../CryptoPP/default.cpp" /> - <Unit filename="../CryptoPP/default.h" /> - <Unit filename="../CryptoPP/des.cpp" /> - <Unit filename="../CryptoPP/des.h" /> - <Unit filename="../CryptoPP/dessp.cpp" /> - <Unit filename="../CryptoPP/dh.cpp" /> - <Unit filename="../CryptoPP/dh.h" /> - <Unit filename="../CryptoPP/dh2.cpp" /> - <Unit filename="../CryptoPP/dh2.h" /> - <Unit filename="../CryptoPP/dll.cpp" /> - <Unit filename="../CryptoPP/dmac.h" /> - <Unit filename="../CryptoPP/dsa.cpp" /> - <Unit filename="../CryptoPP/dsa.h" /> - <Unit filename="../CryptoPP/eax.cpp" /> - <Unit filename="../CryptoPP/eax.h" /> - <Unit filename="../CryptoPP/ec2n.cpp" /> - <Unit filename="../CryptoPP/ec2n.h" /> - <Unit filename="../CryptoPP/eccrypto.cpp"> + <Unit filename="../lib/cryptopp/Doxyfile" /> + <Unit filename="../lib/cryptopp/GNUmakefile" /> + <Unit filename="../lib/cryptopp/License.txt" /> + <Unit filename="../lib/cryptopp/Readme.txt" /> + <Unit filename="../lib/cryptopp/adler32.cpp" /> + <Unit filename="../lib/cryptopp/adler32.h" /> + <Unit filename="../lib/cryptopp/aes.h" /> + <Unit filename="../lib/cryptopp/algebra.cpp" /> + <Unit filename="../lib/cryptopp/algebra.h" /> + <Unit filename="../lib/cryptopp/algparam.cpp" /> + <Unit filename="../lib/cryptopp/algparam.h" /> + <Unit filename="../lib/cryptopp/arc4.h" /> + <Unit filename="../lib/cryptopp/argnames.h" /> + <Unit filename="../lib/cryptopp/asn.cpp" /> + <Unit filename="../lib/cryptopp/asn.h" /> + <Unit filename="../lib/cryptopp/authenc.cpp" /> + <Unit filename="../lib/cryptopp/authenc.h" /> + <Unit filename="../lib/cryptopp/base32.cpp" /> + <Unit filename="../lib/cryptopp/base32.h" /> + <Unit filename="../lib/cryptopp/base64.cpp" /> + <Unit filename="../lib/cryptopp/base64.h" /> + <Unit filename="../lib/cryptopp/basecode.cpp" /> + <Unit filename="../lib/cryptopp/basecode.h" /> + <Unit filename="../lib/cryptopp/cbcmac.cpp" /> + <Unit filename="../lib/cryptopp/cbcmac.h" /> + <Unit filename="../lib/cryptopp/ccm.cpp" /> + <Unit filename="../lib/cryptopp/ccm.h" /> + <Unit filename="../lib/cryptopp/channels.cpp" /> + <Unit filename="../lib/cryptopp/channels.h" /> + <Unit filename="../lib/cryptopp/cmac.cpp" /> + <Unit filename="../lib/cryptopp/cmac.h" /> + <Unit filename="../lib/cryptopp/config.h" /> + <Unit filename="../lib/cryptopp/cpu.cpp" /> + <Unit filename="../lib/cryptopp/cpu.h" /> + <Unit filename="../lib/cryptopp/crc.cpp" /> + <Unit filename="../lib/cryptopp/crc.h" /> + <Unit filename="../lib/cryptopp/cryptlib.cpp" /> + <Unit filename="../lib/cryptopp/cryptlib.h" /> + <Unit filename="../lib/cryptopp/default.cpp" /> + <Unit filename="../lib/cryptopp/default.h" /> + <Unit filename="../lib/cryptopp/des.cpp" /> + <Unit filename="../lib/cryptopp/des.h" /> + <Unit filename="../lib/cryptopp/dessp.cpp" /> + <Unit filename="../lib/cryptopp/dh.cpp" /> + <Unit filename="../lib/cryptopp/dh.h" /> + <Unit filename="../lib/cryptopp/dh2.cpp" /> + <Unit filename="../lib/cryptopp/dh2.h" /> + <Unit filename="../lib/cryptopp/dll.cpp" /> + <Unit filename="../lib/cryptopp/dmac.h" /> + <Unit filename="../lib/cryptopp/dsa.cpp" /> + <Unit filename="../lib/cryptopp/dsa.h" /> + <Unit filename="../lib/cryptopp/eax.cpp" /> + <Unit filename="../lib/cryptopp/eax.h" /> + <Unit filename="../lib/cryptopp/ec2n.cpp" /> + <Unit filename="../lib/cryptopp/ec2n.h" /> + <Unit filename="../lib/cryptopp/eccrypto.cpp"> <Option target="<{~None~}>" /> </Unit> - <Unit filename="../CryptoPP/eccrypto.h" /> - <Unit filename="../CryptoPP/ecp.cpp" /> - <Unit filename="../CryptoPP/ecp.h" /> - <Unit filename="../CryptoPP/elgamal.cpp" /> - <Unit filename="../CryptoPP/elgamal.h" /> - <Unit filename="../CryptoPP/emsa2.cpp" /> - <Unit filename="../CryptoPP/emsa2.h" /> - <Unit filename="../CryptoPP/eprecomp.cpp"> + <Unit filename="../lib/cryptopp/eccrypto.h" /> + <Unit filename="../lib/cryptopp/ecp.cpp" /> + <Unit filename="../lib/cryptopp/ecp.h" /> + <Unit filename="../lib/cryptopp/elgamal.cpp" /> + <Unit filename="../lib/cryptopp/elgamal.h" /> + <Unit filename="../lib/cryptopp/emsa2.cpp" /> + <Unit filename="../lib/cryptopp/emsa2.h" /> + <Unit filename="../lib/cryptopp/eprecomp.cpp"> <Option target="<{~None~}>" /> </Unit> - <Unit filename="../CryptoPP/eprecomp.h" /> - <Unit filename="../CryptoPP/esign.cpp" /> - <Unit filename="../CryptoPP/esign.h" /> - <Unit filename="../CryptoPP/files.cpp" /> - <Unit filename="../CryptoPP/files.h" /> - <Unit filename="../CryptoPP/filters.cpp" /> - <Unit filename="../CryptoPP/filters.h" /> - <Unit filename="../CryptoPP/fips140.cpp" /> - <Unit filename="../CryptoPP/fips140.h" /> - <Unit filename="../CryptoPP/fltrimpl.h" /> - <Unit filename="../CryptoPP/gcm.cpp" /> - <Unit filename="../CryptoPP/gcm.h" /> - <Unit filename="../CryptoPP/gf256.cpp" /> - <Unit filename="../CryptoPP/gf256.h" /> - <Unit filename="../CryptoPP/gf2_32.cpp" /> - <Unit filename="../CryptoPP/gf2_32.h" /> - <Unit filename="../CryptoPP/gf2n.cpp" /> - <Unit filename="../CryptoPP/gf2n.h" /> - <Unit filename="../CryptoPP/gfpcrypt.cpp" /> - <Unit filename="../CryptoPP/gfpcrypt.h" /> - <Unit filename="../CryptoPP/gzip.h" /> - <Unit filename="../CryptoPP/hex.cpp" /> - <Unit filename="../CryptoPP/hex.h" /> - <Unit filename="../CryptoPP/hmac.cpp" /> - <Unit filename="../CryptoPP/hmac.h" /> - <Unit filename="../CryptoPP/hrtimer.cpp" /> - <Unit filename="../CryptoPP/hrtimer.h" /> - <Unit filename="../CryptoPP/integer.cpp" /> - <Unit filename="../CryptoPP/integer.h" /> - <Unit filename="../CryptoPP/iterhash.cpp" /> - <Unit filename="../CryptoPP/iterhash.h" /> - <Unit filename="../CryptoPP/lubyrack.h" /> - <Unit filename="../CryptoPP/luc.cpp" /> - <Unit filename="../CryptoPP/luc.h" /> - <Unit filename="../CryptoPP/md2.cpp" /> - <Unit filename="../CryptoPP/md2.h" /> - <Unit filename="../CryptoPP/md4.cpp" /> - <Unit filename="../CryptoPP/md4.h" /> - <Unit filename="../CryptoPP/md5.cpp" /> - <Unit filename="../CryptoPP/md5.h" /> - <Unit filename="../CryptoPP/mdc.h" /> - <Unit filename="../CryptoPP/misc.cpp" /> - <Unit filename="../CryptoPP/misc.h" /> - <Unit filename="../CryptoPP/modarith.h" /> - <Unit filename="../CryptoPP/modes.cpp" /> - <Unit filename="../CryptoPP/modes.h" /> - <Unit filename="../CryptoPP/modexppc.h" /> - <Unit filename="../CryptoPP/mqueue.cpp" /> - <Unit filename="../CryptoPP/mqueue.h" /> - <Unit filename="../CryptoPP/mqv.cpp" /> - <Unit filename="../CryptoPP/mqv.h" /> - <Unit filename="../CryptoPP/nbtheory.cpp" /> - <Unit filename="../CryptoPP/nbtheory.h" /> - <Unit filename="../CryptoPP/network.cpp" /> - <Unit filename="../CryptoPP/network.h" /> - <Unit filename="../CryptoPP/nr.h" /> - <Unit filename="../CryptoPP/oaep.cpp" /> - <Unit filename="../CryptoPP/oaep.h" /> - <Unit filename="../CryptoPP/oids.h" /> - <Unit filename="../CryptoPP/osrng.cpp" /> - <Unit filename="../CryptoPP/osrng.h" /> - <Unit filename="../CryptoPP/pch.cpp" /> - <Unit filename="../CryptoPP/pch.h" /> - <Unit filename="../CryptoPP/pkcspad.cpp" /> - <Unit filename="../CryptoPP/pkcspad.h" /> - <Unit filename="../CryptoPP/polynomi.cpp" /> - <Unit filename="../CryptoPP/polynomi.h" /> - <Unit filename="../CryptoPP/pssr.cpp" /> - <Unit filename="../CryptoPP/pssr.h" /> - <Unit filename="../CryptoPP/pubkey.cpp" /> - <Unit filename="../CryptoPP/pubkey.h" /> - <Unit filename="../CryptoPP/pwdbased.h" /> - <Unit filename="../CryptoPP/queue.cpp" /> - <Unit filename="../CryptoPP/queue.h" /> - <Unit filename="../CryptoPP/rabin.cpp" /> - <Unit filename="../CryptoPP/rabin.h" /> - <Unit filename="../CryptoPP/randpool.cpp" /> - <Unit filename="../CryptoPP/randpool.h" /> - <Unit filename="../CryptoPP/rdtables.cpp" /> - <Unit filename="../CryptoPP/rijndael.cpp" /> - <Unit filename="../CryptoPP/rijndael.h" /> - <Unit filename="../CryptoPP/rng.cpp" /> - <Unit filename="../CryptoPP/rng.h" /> - <Unit filename="../CryptoPP/rsa.cpp" /> - <Unit filename="../CryptoPP/rsa.h" /> - <Unit filename="../CryptoPP/rw.cpp" /> - <Unit filename="../CryptoPP/rw.h" /> - <Unit filename="../CryptoPP/safer.cpp" /> - <Unit filename="../CryptoPP/safer.h" /> - <Unit filename="../CryptoPP/seal.cpp" /> - <Unit filename="../CryptoPP/seal.h" /> - <Unit filename="../CryptoPP/secblock.h" /> - <Unit filename="../CryptoPP/seckey.h" /> - <Unit filename="../CryptoPP/seed.cpp" /> - <Unit filename="../CryptoPP/seed.h" /> - <Unit filename="../CryptoPP/sha.cpp" /> - <Unit filename="../CryptoPP/sha.h" /> - <Unit filename="../CryptoPP/shacal2.cpp" /> - <Unit filename="../CryptoPP/shacal2.h" /> - <Unit filename="../CryptoPP/simple.cpp" /> - <Unit filename="../CryptoPP/simple.h" /> - <Unit filename="../CryptoPP/smartptr.h" /> - <Unit filename="../CryptoPP/socketft.cpp" /> - <Unit filename="../CryptoPP/socketft.h" /> - <Unit filename="../CryptoPP/square.cpp" /> - <Unit filename="../CryptoPP/square.h" /> - <Unit filename="../CryptoPP/squaretb.cpp" /> - <Unit filename="../CryptoPP/stdcpp.h" /> - <Unit filename="../CryptoPP/strciphr.cpp" /> - <Unit filename="../CryptoPP/strciphr.h" /> - <Unit filename="../CryptoPP/tea.cpp" /> - <Unit filename="../CryptoPP/tea.h" /> - <Unit filename="../CryptoPP/tiger.cpp" /> - <Unit filename="../CryptoPP/tiger.h" /> - <Unit filename="../CryptoPP/tigertab.cpp" /> - <Unit filename="../CryptoPP/trdlocal.cpp" /> - <Unit filename="../CryptoPP/trdlocal.h" /> - <Unit filename="../CryptoPP/trunhash.h" /> - <Unit filename="../CryptoPP/ttmac.cpp" /> - <Unit filename="../CryptoPP/ttmac.h" /> - <Unit filename="../CryptoPP/vmac.cpp" /> - <Unit filename="../CryptoPP/vmac.h" /> - <Unit filename="../CryptoPP/wait.cpp" /> - <Unit filename="../CryptoPP/wait.h" /> - <Unit filename="../CryptoPP/wake.h" /> - <Unit filename="../CryptoPP/winpipes.cpp" /> - <Unit filename="../CryptoPP/winpipes.h" /> - <Unit filename="../CryptoPP/words.h" /> + <Unit filename="../lib/cryptopp/eprecomp.h" /> + <Unit filename="../lib/cryptopp/esign.cpp" /> + <Unit filename="../lib/cryptopp/esign.h" /> + <Unit filename="../lib/cryptopp/files.cpp" /> + <Unit filename="../lib/cryptopp/files.h" /> + <Unit filename="../lib/cryptopp/filters.cpp" /> + <Unit filename="../lib/cryptopp/filters.h" /> + <Unit filename="../lib/cryptopp/fips140.cpp" /> + <Unit filename="../lib/cryptopp/fips140.h" /> + <Unit filename="../lib/cryptopp/fltrimpl.h" /> + <Unit filename="../lib/cryptopp/gcm.cpp" /> + <Unit filename="../lib/cryptopp/gcm.h" /> + <Unit filename="../lib/cryptopp/gf256.cpp" /> + <Unit filename="../lib/cryptopp/gf256.h" /> + <Unit filename="../lib/cryptopp/gf2_32.cpp" /> + <Unit filename="../lib/cryptopp/gf2_32.h" /> + <Unit filename="../lib/cryptopp/gf2n.cpp" /> + <Unit filename="../lib/cryptopp/gf2n.h" /> + <Unit filename="../lib/cryptopp/gfpcrypt.cpp" /> + <Unit filename="../lib/cryptopp/gfpcrypt.h" /> + <Unit filename="../lib/cryptopp/gzip.h" /> + <Unit filename="../lib/cryptopp/hex.cpp" /> + <Unit filename="../lib/cryptopp/hex.h" /> + <Unit filename="../lib/cryptopp/hmac.cpp" /> + <Unit filename="../lib/cryptopp/hmac.h" /> + <Unit filename="../lib/cryptopp/hrtimer.cpp" /> + <Unit filename="../lib/cryptopp/hrtimer.h" /> + <Unit filename="../lib/cryptopp/integer.cpp" /> + <Unit filename="../lib/cryptopp/integer.h" /> + <Unit filename="../lib/cryptopp/iterhash.cpp" /> + <Unit filename="../lib/cryptopp/iterhash.h" /> + <Unit filename="../lib/cryptopp/lubyrack.h" /> + <Unit filename="../lib/cryptopp/luc.cpp" /> + <Unit filename="../lib/cryptopp/luc.h" /> + <Unit filename="../lib/cryptopp/md2.cpp" /> + <Unit filename="../lib/cryptopp/md2.h" /> + <Unit filename="../lib/cryptopp/md4.cpp" /> + <Unit filename="../lib/cryptopp/md4.h" /> + <Unit filename="../lib/cryptopp/md5.cpp" /> + <Unit filename="../lib/cryptopp/md5.h" /> + <Unit filename="../lib/cryptopp/mdc.h" /> + <Unit filename="../lib/cryptopp/misc.cpp" /> + <Unit filename="../lib/cryptopp/misc.h" /> + <Unit filename="../lib/cryptopp/modarith.h" /> + <Unit filename="../lib/cryptopp/modes.cpp" /> + <Unit filename="../lib/cryptopp/modes.h" /> + <Unit filename="../lib/cryptopp/modexppc.h" /> + <Unit filename="../lib/cryptopp/mqueue.cpp" /> + <Unit filename="../lib/cryptopp/mqueue.h" /> + <Unit filename="../lib/cryptopp/mqv.cpp" /> + <Unit filename="../lib/cryptopp/mqv.h" /> + <Unit filename="../lib/cryptopp/nbtheory.cpp" /> + <Unit filename="../lib/cryptopp/nbtheory.h" /> + <Unit filename="../lib/cryptopp/network.cpp" /> + <Unit filename="../lib/cryptopp/network.h" /> + <Unit filename="../lib/cryptopp/nr.h" /> + <Unit filename="../lib/cryptopp/oaep.cpp" /> + <Unit filename="../lib/cryptopp/oaep.h" /> + <Unit filename="../lib/cryptopp/oids.h" /> + <Unit filename="../lib/cryptopp/osrng.cpp" /> + <Unit filename="../lib/cryptopp/osrng.h" /> + <Unit filename="../lib/cryptopp/pch.cpp" /> + <Unit filename="../lib/cryptopp/pch.h" /> + <Unit filename="../lib/cryptopp/pkcspad.cpp" /> + <Unit filename="../lib/cryptopp/pkcspad.h" /> + <Unit filename="../lib/cryptopp/polynomi.cpp" /> + <Unit filename="../lib/cryptopp/polynomi.h" /> + <Unit filename="../lib/cryptopp/pssr.cpp" /> + <Unit filename="../lib/cryptopp/pssr.h" /> + <Unit filename="../lib/cryptopp/pubkey.cpp" /> + <Unit filename="../lib/cryptopp/pubkey.h" /> + <Unit filename="../lib/cryptopp/pwdbased.h" /> + <Unit filename="../lib/cryptopp/queue.cpp" /> + <Unit filename="../lib/cryptopp/queue.h" /> + <Unit filename="../lib/cryptopp/rabin.cpp" /> + <Unit filename="../lib/cryptopp/rabin.h" /> + <Unit filename="../lib/cryptopp/randpool.cpp" /> + <Unit filename="../lib/cryptopp/randpool.h" /> + <Unit filename="../lib/cryptopp/rdtables.cpp" /> + <Unit filename="../lib/cryptopp/rijndael.cpp" /> + <Unit filename="../lib/cryptopp/rijndael.h" /> + <Unit filename="../lib/cryptopp/rng.cpp" /> + <Unit filename="../lib/cryptopp/rng.h" /> + <Unit filename="../lib/cryptopp/rsa.cpp" /> + <Unit filename="../lib/cryptopp/rsa.h" /> + <Unit filename="../lib/cryptopp/rw.cpp" /> + <Unit filename="../lib/cryptopp/rw.h" /> + <Unit filename="../lib/cryptopp/safer.cpp" /> + <Unit filename="../lib/cryptopp/safer.h" /> + <Unit filename="../lib/cryptopp/seal.cpp" /> + <Unit filename="../lib/cryptopp/seal.h" /> + <Unit filename="../lib/cryptopp/secblock.h" /> + <Unit filename="../lib/cryptopp/seckey.h" /> + <Unit filename="../lib/cryptopp/seed.cpp" /> + <Unit filename="../lib/cryptopp/seed.h" /> + <Unit filename="../lib/cryptopp/sha.cpp" /> + <Unit filename="../lib/cryptopp/sha.h" /> + <Unit filename="../lib/cryptopp/shacal2.cpp" /> + <Unit filename="../lib/cryptopp/shacal2.h" /> + <Unit filename="../lib/cryptopp/simple.cpp" /> + <Unit filename="../lib/cryptopp/simple.h" /> + <Unit filename="../lib/cryptopp/smartptr.h" /> + <Unit filename="../lib/cryptopp/socketft.cpp" /> + <Unit filename="../lib/cryptopp/socketft.h" /> + <Unit filename="../lib/cryptopp/square.cpp" /> + <Unit filename="../lib/cryptopp/square.h" /> + <Unit filename="../lib/cryptopp/squaretb.cpp" /> + <Unit filename="../lib/cryptopp/stdcpp.h" /> + <Unit filename="../lib/cryptopp/strciphr.cpp" /> + <Unit filename="../lib/cryptopp/strciphr.h" /> + <Unit filename="../lib/cryptopp/tea.cpp" /> + <Unit filename="../lib/cryptopp/tea.h" /> + <Unit filename="../lib/cryptopp/tiger.cpp" /> + <Unit filename="../lib/cryptopp/tiger.h" /> + <Unit filename="../lib/cryptopp/tigertab.cpp" /> + <Unit filename="../lib/cryptopp/trdlocal.cpp" /> + <Unit filename="../lib/cryptopp/trdlocal.h" /> + <Unit filename="../lib/cryptopp/trunhash.h" /> + <Unit filename="../lib/cryptopp/ttmac.cpp" /> + <Unit filename="../lib/cryptopp/ttmac.h" /> + <Unit filename="../lib/cryptopp/vmac.cpp" /> + <Unit filename="../lib/cryptopp/vmac.h" /> + <Unit filename="../lib/cryptopp/wait.cpp" /> + <Unit filename="../lib/cryptopp/wait.h" /> + <Unit filename="../lib/cryptopp/wake.h" /> + <Unit filename="../lib/cryptopp/winpipes.cpp" /> + <Unit filename="../lib/cryptopp/winpipes.h" /> + <Unit filename="../lib/cryptopp/words.h" /> <Extensions> <code_completion /> <envvars /> diff --git a/VC2008/CryptoPP.vcproj b/VC2008/CryptoPP.vcproj index 6c56d3cce..530467eeb 100644 --- a/VC2008/CryptoPP.vcproj +++ b/VC2008/CryptoPP.vcproj @@ -439,7 +439,7 @@ Filter=".cpp" > <File - RelativePath="..\CryptoPP\adler32.cpp" + RelativePath="..\lib\cryptopp\adler32.cpp" > <FileConfiguration Name="Release|Win32" @@ -495,7 +495,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\algebra.cpp" + RelativePath="..\lib\cryptopp\algebra.cpp" > <FileConfiguration Name="Release|Win32" @@ -551,7 +551,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\algparam.cpp" + RelativePath="..\lib\cryptopp\algparam.cpp" > <FileConfiguration Name="Release|Win32" @@ -607,7 +607,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\asn.cpp" + RelativePath="..\lib\cryptopp\asn.cpp" > <FileConfiguration Name="Release|Win32" @@ -663,11 +663,11 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\.\authenc.cpp" + RelativePath="..\lib\cryptopp\authenc.cpp" > </File> <File - RelativePath="..\CryptoPP\base32.cpp" + RelativePath="..\lib\cryptopp\base32.cpp" > <FileConfiguration Name="Release|Win32" @@ -723,7 +723,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\base64.cpp" + RelativePath="..\lib\cryptopp\base64.cpp" > <FileConfiguration Name="Release|Win32" @@ -779,7 +779,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\basecode.cpp" + RelativePath="..\lib\cryptopp\basecode.cpp" > <FileConfiguration Name="Release|Win32" @@ -835,7 +835,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\cbcmac.cpp" + RelativePath="..\lib\cryptopp\cbcmac.cpp" > <FileConfiguration Name="Release|Win32" @@ -891,11 +891,11 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\.\ccm.cpp" + RelativePath="..\lib\cryptopp\ccm.cpp" > </File> <File - RelativePath="..\CryptoPP\channels.cpp" + RelativePath="..\lib\cryptopp\channels.cpp" > <FileConfiguration Name="Release|Win32" @@ -951,15 +951,15 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\.\cmac.cpp" + RelativePath="..\lib\cryptopp\cmac.cpp" > </File> <File - RelativePath="..\CryptoPP\.\cpu.cpp" + RelativePath="..\lib\cryptopp\cpu.cpp" > </File> <File - RelativePath="..\CryptoPP\crc.cpp" + RelativePath="..\lib\cryptopp\crc.cpp" > <FileConfiguration Name="Release|Win32" @@ -1015,7 +1015,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\cryptlib.cpp" + RelativePath="..\lib\cryptopp\cryptlib.cpp" > <FileConfiguration Name="Release|Win32" @@ -1071,7 +1071,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\default.cpp" + RelativePath="..\lib\cryptopp\default.cpp" > <FileConfiguration Name="Release|Win32" @@ -1127,15 +1127,15 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\des.cpp" + RelativePath="..\lib\cryptopp\des.cpp" > </File> <File - RelativePath="..\CryptoPP\dessp.cpp" + RelativePath="..\lib\cryptopp\dessp.cpp" > </File> <File - RelativePath="..\CryptoPP\dh.cpp" + RelativePath="..\lib\cryptopp\dh.cpp" > <FileConfiguration Name="Release|Win32" @@ -1191,7 +1191,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\dh2.cpp" + RelativePath="..\lib\cryptopp\dh2.cpp" > <FileConfiguration Name="Release|Win32" @@ -1247,7 +1247,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\dll.cpp" + RelativePath="..\lib\cryptopp\dll.cpp" > <FileConfiguration Name="Release|Win32" @@ -1309,7 +1309,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\dsa.cpp" + RelativePath="..\lib\cryptopp\dsa.cpp" > <FileConfiguration Name="Release|Win32" @@ -1365,11 +1365,11 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\.\eax.cpp" + RelativePath="..\lib\cryptopp\eax.cpp" > </File> <File - RelativePath="..\CryptoPP\ec2n.cpp" + RelativePath="..\lib\cryptopp\ec2n.cpp" > <FileConfiguration Name="Release|Win32" @@ -1425,7 +1425,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\eccrypto.cpp" + RelativePath="..\lib\cryptopp\eccrypto.cpp" > <FileConfiguration Name="Release|Win32" @@ -1487,7 +1487,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\ecp.cpp" + RelativePath="..\lib\cryptopp\ecp.cpp" > <FileConfiguration Name="Release|Win32" @@ -1543,7 +1543,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\elgamal.cpp" + RelativePath="..\lib\cryptopp\elgamal.cpp" > <FileConfiguration Name="Release|Win32" @@ -1599,11 +1599,11 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\emsa2.cpp" + RelativePath="..\lib\cryptopp\emsa2.cpp" > </File> <File - RelativePath="..\CryptoPP\eprecomp.cpp" + RelativePath="..\lib\cryptopp\eprecomp.cpp" > <FileConfiguration Name="Release|Win32" @@ -1665,7 +1665,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\esign.cpp" + RelativePath="..\lib\cryptopp\esign.cpp" > <FileConfiguration Name="Release|Win32" @@ -1721,7 +1721,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\files.cpp" + RelativePath="..\lib\cryptopp\files.cpp" > <FileConfiguration Name="Release|Win32" @@ -1777,7 +1777,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\filters.cpp" + RelativePath="..\lib\cryptopp\filters.cpp" > <FileConfiguration Name="Release|Win32" @@ -1833,7 +1833,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\fips140.cpp" + RelativePath="..\lib\cryptopp\fips140.cpp" > <FileConfiguration Name="Release|Win32" @@ -1889,11 +1889,11 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\.\gcm.cpp" + RelativePath="..\lib\cryptopp\gcm.cpp" > </File> <File - RelativePath="..\CryptoPP\gf256.cpp" + RelativePath="..\lib\cryptopp\gf256.cpp" > <FileConfiguration Name="Release|Win32" @@ -1949,7 +1949,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\gf2_32.cpp" + RelativePath="..\lib\cryptopp\gf2_32.cpp" > <FileConfiguration Name="Release|Win32" @@ -2005,7 +2005,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\gf2n.cpp" + RelativePath="..\lib\cryptopp\gf2n.cpp" > <FileConfiguration Name="Release|Win32" @@ -2061,7 +2061,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\gfpcrypt.cpp" + RelativePath="..\lib\cryptopp\gfpcrypt.cpp" > <FileConfiguration Name="Release|Win32" @@ -2117,7 +2117,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\hex.cpp" + RelativePath="..\lib\cryptopp\hex.cpp" > <FileConfiguration Name="Release|Win32" @@ -2173,7 +2173,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\hmac.cpp" + RelativePath="..\lib\cryptopp\hmac.cpp" > <FileConfiguration Name="Release|Win32" @@ -2229,7 +2229,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\hrtimer.cpp" + RelativePath="..\lib\cryptopp\hrtimer.cpp" > <FileConfiguration Name="Release|Win32" @@ -2285,7 +2285,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\integer.cpp" + RelativePath="..\lib\cryptopp\integer.cpp" > <FileConfiguration Name="Release|Win32" @@ -2342,7 +2342,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\iterhash.cpp" + RelativePath="..\lib\cryptopp\iterhash.cpp" > <FileConfiguration Name="Release|Win32" @@ -2404,7 +2404,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\luc.cpp" + RelativePath="..\lib\cryptopp\luc.cpp" > <FileConfiguration Name="Release|Win32" @@ -2460,7 +2460,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\md2.cpp" + RelativePath="..\lib\cryptopp\md2.cpp" > <FileConfiguration Name="Release|Win32" @@ -2516,7 +2516,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\md4.cpp" + RelativePath="..\lib\cryptopp\md4.cpp" > <FileConfiguration Name="Release|Win32" @@ -2572,7 +2572,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\md5.cpp" + RelativePath="..\lib\cryptopp\md5.cpp" > <FileConfiguration Name="Release|Win32" @@ -2628,7 +2628,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\misc.cpp" + RelativePath="..\lib\cryptopp\misc.cpp" > <FileConfiguration Name="Release|Win32" @@ -2684,7 +2684,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\modes.cpp" + RelativePath="..\lib\cryptopp\modes.cpp" > <FileConfiguration Name="Release|Win32" @@ -2740,7 +2740,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\mqueue.cpp" + RelativePath="..\lib\cryptopp\mqueue.cpp" > <FileConfiguration Name="Release|Win32" @@ -2796,7 +2796,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\mqv.cpp" + RelativePath="..\lib\cryptopp\mqv.cpp" > <FileConfiguration Name="Release|Win32" @@ -2852,7 +2852,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\nbtheory.cpp" + RelativePath="..\lib\cryptopp\nbtheory.cpp" > <FileConfiguration Name="Release|Win32" @@ -2908,7 +2908,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\network.cpp" + RelativePath="..\lib\cryptopp\network.cpp" > <FileConfiguration Name="Release|Win32" @@ -2964,7 +2964,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\oaep.cpp" + RelativePath="..\lib\cryptopp\oaep.cpp" > <FileConfiguration Name="Release|Win32" @@ -3020,7 +3020,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\osrng.cpp" + RelativePath="..\lib\cryptopp\osrng.cpp" > <FileConfiguration Name="Release|Win32" @@ -3076,7 +3076,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\pch.cpp" + RelativePath="..\lib\cryptopp\pch.cpp" > <FileConfiguration Name="Release|Win32" @@ -3138,7 +3138,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\pkcspad.cpp" + RelativePath="..\lib\cryptopp\pkcspad.cpp" > <FileConfiguration Name="Release|Win32" @@ -3194,7 +3194,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\polynomi.cpp" + RelativePath="..\lib\cryptopp\polynomi.cpp" > <FileConfiguration Name="Release|Win32" @@ -3250,11 +3250,11 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\pssr.cpp" + RelativePath="..\lib\cryptopp\pssr.cpp" > </File> <File - RelativePath="..\CryptoPP\pubkey.cpp" + RelativePath="..\lib\cryptopp\pubkey.cpp" > <FileConfiguration Name="Release|Win32" @@ -3310,7 +3310,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\queue.cpp" + RelativePath="..\lib\cryptopp\queue.cpp" > <FileConfiguration Name="Release|Win32" @@ -3366,7 +3366,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\rabin.cpp" + RelativePath="..\lib\cryptopp\rabin.cpp" > <FileConfiguration Name="Release|Win32" @@ -3422,7 +3422,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\randpool.cpp" + RelativePath="..\lib\cryptopp\randpool.cpp" > <FileConfiguration Name="Release|Win32" @@ -3478,7 +3478,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\rdtables.cpp" + RelativePath="..\lib\cryptopp\rdtables.cpp" > <FileConfiguration Name="Release|Win32" @@ -3534,7 +3534,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\rijndael.cpp" + RelativePath="..\lib\cryptopp\rijndael.cpp" > <FileConfiguration Name="Release|Win32" @@ -3590,7 +3590,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\rng.cpp" + RelativePath="..\lib\cryptopp\rng.cpp" > <FileConfiguration Name="Release|Win32" @@ -3646,7 +3646,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\rsa.cpp" + RelativePath="..\lib\cryptopp\rsa.cpp" > <FileConfiguration Name="Release|Win32" @@ -3702,7 +3702,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\rw.cpp" + RelativePath="..\lib\cryptopp\rw.cpp" > <FileConfiguration Name="Release|Win32" @@ -3758,7 +3758,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\safer.cpp" + RelativePath="..\lib\cryptopp\safer.cpp" > <FileConfiguration Name="Release|Win32" @@ -3814,7 +3814,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\seal.cpp" + RelativePath="..\lib\cryptopp\seal.cpp" > <FileConfiguration Name="Release|Win32" @@ -3870,11 +3870,11 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\.\seed.cpp" + RelativePath="..\lib\cryptopp\seed.cpp" > </File> <File - RelativePath="..\CryptoPP\sha.cpp" + RelativePath="..\lib\cryptopp\sha.cpp" > <FileConfiguration Name="Release|Win32" @@ -3930,7 +3930,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\shacal2.cpp" + RelativePath="..\lib\cryptopp\shacal2.cpp" > <FileConfiguration Name="Release|Win32" @@ -3986,7 +3986,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\simple.cpp" + RelativePath="..\lib\cryptopp\simple.cpp" > <FileConfiguration Name="Release|Win32" @@ -4042,7 +4042,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\socketft.cpp" + RelativePath="..\lib\cryptopp\socketft.cpp" > <FileConfiguration Name="Release|Win32" @@ -4098,7 +4098,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\square.cpp" + RelativePath="..\lib\cryptopp\square.cpp" > <FileConfiguration Name="Release|Win32" @@ -4154,7 +4154,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\squaretb.cpp" + RelativePath="..\lib\cryptopp\squaretb.cpp" > <FileConfiguration Name="Release|Win32" @@ -4210,7 +4210,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\strciphr.cpp" + RelativePath="..\lib\cryptopp\strciphr.cpp" > <FileConfiguration Name="Release|Win32" @@ -4266,7 +4266,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\tea.cpp" + RelativePath="..\lib\cryptopp\tea.cpp" > <FileConfiguration Name="Release|Win32" @@ -4322,7 +4322,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\tiger.cpp" + RelativePath="..\lib\cryptopp\tiger.cpp" > <FileConfiguration Name="Release|Win32" @@ -4378,7 +4378,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\tigertab.cpp" + RelativePath="..\lib\cryptopp\tigertab.cpp" > <FileConfiguration Name="Release|Win32" @@ -4434,7 +4434,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\trdlocal.cpp" + RelativePath="..\lib\cryptopp\trdlocal.cpp" > <FileConfiguration Name="Release|Win32" @@ -4490,7 +4490,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\ttmac.cpp" + RelativePath="..\lib\cryptopp\ttmac.cpp" > <FileConfiguration Name="Release|Win32" @@ -4546,11 +4546,11 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\.\vmac.cpp" + RelativePath="..\lib\cryptopp\vmac.cpp" > </File> <File - RelativePath="..\CryptoPP\wait.cpp" + RelativePath="..\lib\cryptopp\wait.cpp" > <FileConfiguration Name="Release|Win32" @@ -4606,7 +4606,7 @@ </FileConfiguration> </File> <File - RelativePath="..\CryptoPP\winpipes.cpp" + RelativePath="..\lib\cryptopp\winpipes.cpp" > <FileConfiguration Name="Release|Win32" @@ -4667,411 +4667,411 @@ Filter=".;.h" > <File - RelativePath="..\CryptoPP\adler32.h" + RelativePath="..\lib\cryptopp\adler32.h" > </File> <File - RelativePath="..\CryptoPP\aes.h" + RelativePath="..\lib\cryptopp\aes.h" > </File> <File - RelativePath="..\CryptoPP\algebra.h" + RelativePath="..\lib\cryptopp\algebra.h" > </File> <File - RelativePath="..\CryptoPP\algparam.h" + RelativePath="..\lib\cryptopp\algparam.h" > </File> <File - RelativePath="..\CryptoPP\arc4.h" + RelativePath="..\lib\cryptopp\arc4.h" > </File> <File - RelativePath="..\CryptoPP\argnames.h" + RelativePath="..\lib\cryptopp\argnames.h" > </File> <File - RelativePath="..\CryptoPP\asn.h" + RelativePath="..\lib\cryptopp\asn.h" > </File> <File - RelativePath="..\CryptoPP\.\authenc.h" + RelativePath="..\lib\cryptopp\authenc.h" > </File> <File - RelativePath="..\CryptoPP\base32.h" + RelativePath="..\lib\cryptopp\base32.h" > </File> <File - RelativePath="..\CryptoPP\base64.h" + RelativePath="..\lib\cryptopp\base64.h" > </File> <File - RelativePath="..\CryptoPP\basecode.h" + RelativePath="..\lib\cryptopp\basecode.h" > </File> <File - RelativePath="..\CryptoPP\cbcmac.h" + RelativePath="..\lib\cryptopp\cbcmac.h" > </File> <File - RelativePath="..\CryptoPP\.\ccm.h" + RelativePath="..\lib\cryptopp\ccm.h" > </File> <File - RelativePath="..\CryptoPP\channels.h" + RelativePath="..\lib\cryptopp\channels.h" > </File> <File - RelativePath="..\CryptoPP\.\cmac.h" + RelativePath="..\lib\cryptopp\cmac.h" > </File> <File - RelativePath="..\CryptoPP\config.h" + RelativePath="..\lib\cryptopp\config.h" > </File> <File - RelativePath="..\CryptoPP\.\cpu.h" + RelativePath="..\lib\cryptopp\cpu.h" > </File> <File - RelativePath="..\CryptoPP\crc.h" + RelativePath="..\lib\cryptopp\crc.h" > </File> <File - RelativePath="..\CryptoPP\cryptlib.h" + RelativePath="..\lib\cryptopp\cryptlib.h" > </File> <File - RelativePath="..\CryptoPP\default.h" + RelativePath="..\lib\cryptopp\default.h" > </File> <File - RelativePath="..\CryptoPP\des.h" + RelativePath="..\lib\cryptopp\des.h" > </File> <File - RelativePath="..\CryptoPP\dh.h" + RelativePath="..\lib\cryptopp\dh.h" > </File> <File - RelativePath="..\CryptoPP\dh2.h" + RelativePath="..\lib\cryptopp\dh2.h" > </File> <File - RelativePath="..\CryptoPP\dmac.h" + RelativePath="..\lib\cryptopp\dmac.h" > </File> <File - RelativePath="..\CryptoPP\dsa.h" + RelativePath="..\lib\cryptopp\dsa.h" > </File> <File - RelativePath="..\CryptoPP\.\eax.h" + RelativePath="..\lib\cryptopp\eax.h" > </File> <File - RelativePath="..\CryptoPP\ec2n.h" + RelativePath="..\lib\cryptopp\ec2n.h" > </File> <File - RelativePath="..\CryptoPP\eccrypto.h" + RelativePath="..\lib\cryptopp\eccrypto.h" > </File> <File - RelativePath="..\CryptoPP\ecp.h" + RelativePath="..\lib\cryptopp\ecp.h" > </File> <File - RelativePath="..\CryptoPP\elgamal.h" + RelativePath="..\lib\cryptopp\elgamal.h" > </File> <File - RelativePath="..\CryptoPP\emsa2.h" + RelativePath="..\lib\cryptopp\emsa2.h" > </File> <File - RelativePath="..\CryptoPP\eprecomp.h" + RelativePath="..\lib\cryptopp\eprecomp.h" > </File> <File - RelativePath="..\CryptoPP\esign.h" + RelativePath="..\lib\cryptopp\esign.h" > </File> <File - RelativePath="..\CryptoPP\files.h" + RelativePath="..\lib\cryptopp\files.h" > </File> <File - RelativePath="..\CryptoPP\filters.h" + RelativePath="..\lib\cryptopp\filters.h" > </File> <File - RelativePath="..\CryptoPP\fips140.h" + RelativePath="..\lib\cryptopp\fips140.h" > </File> <File - RelativePath="..\CryptoPP\fltrimpl.h" + RelativePath="..\lib\cryptopp\fltrimpl.h" > </File> <File - RelativePath="..\CryptoPP\.\gcm.h" + RelativePath="..\lib\cryptopp\gcm.h" > </File> <File - RelativePath="..\CryptoPP\gf256.h" + RelativePath="..\lib\cryptopp\gf256.h" > </File> <File - RelativePath="..\CryptoPP\gf2_32.h" + RelativePath="..\lib\cryptopp\gf2_32.h" > </File> <File - RelativePath="..\CryptoPP\gf2n.h" + RelativePath="..\lib\cryptopp\gf2n.h" > </File> <File - RelativePath="..\CryptoPP\gfpcrypt.h" + RelativePath="..\lib\cryptopp\gfpcrypt.h" > </File> <File - RelativePath="..\CryptoPP\gzip.h" + RelativePath="..\lib\cryptopp\gzip.h" > </File> <File - RelativePath="..\CryptoPP\hex.h" + RelativePath="..\lib\cryptopp\hex.h" > </File> <File - RelativePath="..\CryptoPP\hmac.h" + RelativePath="..\lib\cryptopp\hmac.h" > </File> <File - RelativePath="..\CryptoPP\hrtimer.h" + RelativePath="..\lib\cryptopp\hrtimer.h" > </File> <File - RelativePath="..\CryptoPP\integer.h" + RelativePath="..\lib\cryptopp\integer.h" > </File> <File - RelativePath="..\CryptoPP\iterhash.h" + RelativePath="..\lib\cryptopp\iterhash.h" > </File> <File - RelativePath="..\CryptoPP\lubyrack.h" + RelativePath="..\lib\cryptopp\lubyrack.h" > </File> <File - RelativePath="..\CryptoPP\luc.h" + RelativePath="..\lib\cryptopp\luc.h" > </File> <File - RelativePath="..\CryptoPP\md2.h" + RelativePath="..\lib\cryptopp\md2.h" > </File> <File - RelativePath="..\CryptoPP\md4.h" + RelativePath="..\lib\cryptopp\md4.h" > </File> <File - RelativePath="..\CryptoPP\md5.h" + RelativePath="..\lib\cryptopp\md5.h" > </File> <File - RelativePath="..\CryptoPP\mdc.h" + RelativePath="..\lib\cryptopp\mdc.h" > </File> <File - RelativePath="..\CryptoPP\misc.h" + RelativePath="..\lib\cryptopp\misc.h" > </File> <File - RelativePath="..\CryptoPP\modarith.h" + RelativePath="..\lib\cryptopp\modarith.h" > </File> <File - RelativePath="..\CryptoPP\modes.h" + RelativePath="..\lib\cryptopp\modes.h" > </File> <File - RelativePath="..\CryptoPP\modexppc.h" + RelativePath="..\lib\cryptopp\modexppc.h" > </File> <File - RelativePath="..\CryptoPP\mqueue.h" + RelativePath="..\lib\cryptopp\mqueue.h" > </File> <File - RelativePath="..\CryptoPP\mqv.h" + RelativePath="..\lib\cryptopp\mqv.h" > </File> <File - RelativePath="..\CryptoPP\nbtheory.h" + RelativePath="..\lib\cryptopp\nbtheory.h" > </File> <File - RelativePath="..\CryptoPP\network.h" + RelativePath="..\lib\cryptopp\network.h" > </File> <File - RelativePath="..\CryptoPP\nr.h" + RelativePath="..\lib\cryptopp\nr.h" > </File> <File - RelativePath="..\CryptoPP\oaep.h" + RelativePath="..\lib\cryptopp\oaep.h" > </File> <File - RelativePath="..\CryptoPP\oids.h" + RelativePath="..\lib\cryptopp\oids.h" > </File> <File - RelativePath="..\CryptoPP\osrng.h" + RelativePath="..\lib\cryptopp\osrng.h" > </File> <File - RelativePath="..\CryptoPP\pch.h" + RelativePath="..\lib\cryptopp\pch.h" > </File> <File - RelativePath="..\CryptoPP\pkcspad.h" + RelativePath="..\lib\cryptopp\pkcspad.h" > </File> <File - RelativePath="..\CryptoPP\polynomi.h" + RelativePath="..\lib\cryptopp\polynomi.h" > </File> <File - RelativePath="..\CryptoPP\pssr.h" + RelativePath="..\lib\cryptopp\pssr.h" > </File> <File - RelativePath="..\CryptoPP\pubkey.h" + RelativePath="..\lib\cryptopp\pubkey.h" > </File> <File - RelativePath="..\CryptoPP\pwdbased.h" + RelativePath="..\lib\cryptopp\pwdbased.h" > </File> <File - RelativePath="..\CryptoPP\queue.h" + RelativePath="..\lib\cryptopp\queue.h" > </File> <File - RelativePath="..\CryptoPP\rabin.h" + RelativePath="..\lib\cryptopp\rabin.h" > </File> <File - RelativePath="..\CryptoPP\randpool.h" + RelativePath="..\lib\cryptopp\randpool.h" > </File> <File - RelativePath="..\CryptoPP\rijndael.h" + RelativePath="..\lib\cryptopp\rijndael.h" > </File> <File - RelativePath="..\CryptoPP\rng.h" + RelativePath="..\lib\cryptopp\rng.h" > </File> <File - RelativePath="..\CryptoPP\rsa.h" + RelativePath="..\lib\cryptopp\rsa.h" > </File> <File - RelativePath="..\CryptoPP\rw.h" + RelativePath="..\lib\cryptopp\rw.h" > </File> <File - RelativePath="..\CryptoPP\safer.h" + RelativePath="..\lib\cryptopp\safer.h" > </File> <File - RelativePath="..\CryptoPP\seal.h" + RelativePath="..\lib\cryptopp\seal.h" > </File> <File - RelativePath="..\CryptoPP\secblock.h" + RelativePath="..\lib\cryptopp\secblock.h" > </File> <File - RelativePath="..\CryptoPP\seckey.h" + RelativePath="..\lib\cryptopp\seckey.h" > </File> <File - RelativePath="..\CryptoPP\.\seed.h" + RelativePath="..\lib\cryptopp\.\seed.h" > </File> <File - RelativePath="..\CryptoPP\sha.h" + RelativePath="..\lib\cryptopp\sha.h" > </File> <File - RelativePath="..\CryptoPP\shacal2.h" + RelativePath="..\lib\cryptopp\shacal2.h" > </File> <File - RelativePath="..\CryptoPP\simple.h" + RelativePath="..\lib\cryptopp\simple.h" > </File> <File - RelativePath="..\CryptoPP\smartptr.h" + RelativePath="..\lib\cryptopp\smartptr.h" > </File> <File - RelativePath="..\CryptoPP\socketft.h" + RelativePath="..\lib\cryptopp\socketft.h" > </File> <File - RelativePath="..\CryptoPP\square.h" + RelativePath="..\lib\cryptopp\square.h" > </File> <File - RelativePath="..\CryptoPP\.\stdcpp.h" + RelativePath="..\lib\cryptopp\.\stdcpp.h" > </File> <File - RelativePath="..\CryptoPP\strciphr.h" + RelativePath="..\lib\cryptopp\strciphr.h" > </File> <File - RelativePath="..\CryptoPP\tea.h" + RelativePath="..\lib\cryptopp\tea.h" > </File> <File - RelativePath="..\CryptoPP\tiger.h" + RelativePath="..\lib\cryptopp\tiger.h" > </File> <File - RelativePath="..\CryptoPP\trdlocal.h" + RelativePath="..\lib\cryptopp\trdlocal.h" > </File> <File - RelativePath="..\CryptoPP\trunhash.h" + RelativePath="..\lib\cryptopp\trunhash.h" > </File> <File - RelativePath="..\CryptoPP\ttmac.h" + RelativePath="..\lib\cryptopp\ttmac.h" > </File> <File - RelativePath="..\CryptoPP\.\vmac.h" + RelativePath="..\lib\cryptopp\.\vmac.h" > </File> <File - RelativePath="..\CryptoPP\wait.h" + RelativePath="..\lib\cryptopp\wait.h" > </File> <File - RelativePath="..\CryptoPP\wake.h" + RelativePath="..\lib\cryptopp\wake.h" > </File> <File - RelativePath="..\CryptoPP\winpipes.h" + RelativePath="..\lib\cryptopp\winpipes.h" > </File> <File - RelativePath="..\CryptoPP\words.h" + RelativePath="..\lib\cryptopp\words.h" > </File> </Filter> @@ -5079,19 +5079,19 @@ Name="Miscellaneous" > <File - RelativePath="..\CryptoPP\Doxyfile" + RelativePath="..\lib\cryptopp\Doxyfile" > </File> <File - RelativePath="..\CryptoPP\GNUmakefile" + RelativePath="..\lib\cryptopp\GNUmakefile" > </File> <File - RelativePath="..\CryptoPP\.\License.txt" + RelativePath="..\lib\cryptopp\.\License.txt" > </File> <File - RelativePath="..\CryptoPP\.\Readme.txt" + RelativePath="..\lib\cryptopp\Readme.txt" > </File> </Filter> diff --git a/VC2008/GenerateBindings.cmd b/VC2008/GenerateBindings.cmd index ac470234f..1ee0f3bf0 100644 --- a/VC2008/GenerateBindings.cmd +++ b/VC2008/GenerateBindings.cmd @@ -1,3 +1,3 @@ set ALLTOLUA_WAIT=N -cd ..\source +cd ..\src AllToLua.bat
\ No newline at end of file diff --git a/VC2008/JsonCpp.cbp b/VC2008/JsonCpp.cbp index 35aa6ea81..f4826b2f1 100644 --- a/VC2008/JsonCpp.cbp +++ b/VC2008/JsonCpp.cbp @@ -20,10 +20,10 @@ <Add option="-W" /> <Add option="-g" /> <Add option="-O0" /> - <Add directory="../jsoncpp-src-0.5.0/include" /> + <Add directory="../lib/jsoncpp/include" /> </Compiler> <ResourceCompiler> - <Add directory="../jsoncpp-src-0.5.0/include" /> + <Add directory="../lib/jsoncpp/include" /> </ResourceCompiler> </Target> <Target title="Release Win32"> @@ -39,10 +39,10 @@ <Add option="-D_LIB" /> <Add option="-W" /> <Add option="-O2" /> - <Add directory="../jsoncpp-src-0.5.0/include" /> + <Add directory="../lib/jsoncpp/include" /> </Compiler> <ResourceCompiler> - <Add directory="../jsoncpp-src-0.5.0/include" /> + <Add directory="../lib/jsoncpp/include" /> </ResourceCompiler> </Target> <Target title="Release profiled Win32"> @@ -58,20 +58,20 @@ <Add option="-D_LIB" /> <Add option="-W" /> <Add option="-O2" /> - <Add directory="../jsoncpp-src-0.5.0/include" /> + <Add directory="../lib/jsoncpp/include" /> </Compiler> <ResourceCompiler> - <Add directory="../jsoncpp-src-0.5.0/include" /> + <Add directory="../lib/jsoncpp/include" /> </ResourceCompiler> </Target> </Build> - <Unit filename="../jsoncpp-src-0.5.0/src/lib_json/json_batchallocator.h" /> - <Unit filename="../jsoncpp-src-0.5.0/src/lib_json/json_internalarray.inl" /> - <Unit filename="../jsoncpp-src-0.5.0/src/lib_json/json_internalmap.inl" /> - <Unit filename="../jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp" /> - <Unit filename="../jsoncpp-src-0.5.0/src/lib_json/json_value.cpp" /> - <Unit filename="../jsoncpp-src-0.5.0/src/lib_json/json_valueiterator.inl" /> - <Unit filename="../jsoncpp-src-0.5.0/src/lib_json/json_writer.cpp" /> + <Unit filename="../lib/jsoncpp/src/lib_json/json_batchallocator.h" /> + <Unit filename="../lib/jsoncpp/src/lib_json/json_internalarray.inl" /> + <Unit filename="../lib/jsoncpp/src/lib_json/json_internalmap.inl" /> + <Unit filename="../lib/jsoncpp/src/lib_json/json_reader.cpp" /> + <Unit filename="../lib/jsoncpp/src/lib_json/json_value.cpp" /> + <Unit filename="../lib/jsoncpp/src/lib_json/json_valueiterator.inl" /> + <Unit filename="../lib/jsoncpp/src/lib_json/json_writer.cpp" /> <Extensions> <code_completion /> <envvars /> diff --git a/VC2008/JsonCpp.vcproj b/VC2008/JsonCpp.vcproj index 5fa1ec685..8b35f170b 100644 --- a/VC2008/JsonCpp.vcproj +++ b/VC2008/JsonCpp.vcproj @@ -276,31 +276,31 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File - RelativePath="..\jsoncpp-src-0.5.0\src\lib_json\json_batchallocator.h" + RelativePath="..\lib\jsoncpp\src\lib_json\json_batchallocator.h" > </File> <File - RelativePath="..\jsoncpp-src-0.5.0\src\lib_json\json_internalarray.inl" + RelativePath="..\lib\jsoncpp\src\lib_json\json_internalarray.inl" > </File> <File - RelativePath="..\jsoncpp-src-0.5.0\src\lib_json\json_internalmap.inl" + RelativePath="..\lib\jsoncpp\src\lib_json\json_internalmap.inl" > </File> <File - RelativePath="..\jsoncpp-src-0.5.0\src\lib_json\json_reader.cpp" + RelativePath="..\lib\jsoncpp\src\lib_json\json_reader.cpp" > </File> <File - RelativePath="..\jsoncpp-src-0.5.0\src\lib_json\json_value.cpp" + RelativePath="..\lib\jsoncpp\src\lib_json\json_value.cpp" > </File> <File - RelativePath="..\jsoncpp-src-0.5.0\src\lib_json\json_valueiterator.inl" + RelativePath="..\lib\jsoncpp\src\lib_json\json_valueiterator.inl" > </File> <File - RelativePath="..\jsoncpp-src-0.5.0\src\lib_json\json_writer.cpp" + RelativePath="..\lib\jsoncpp\src\lib_json\json_writer.cpp" > </File> </Filter> diff --git a/VC2008/Lua.cbp b/VC2008/Lua.cbp index 208bf42f4..33353656a 100644 --- a/VC2008/Lua.cbp +++ b/VC2008/Lua.cbp @@ -56,123 +56,123 @@ </Compiler> </Target> </Build> - <Unit filename="../lua-5.1.4/src/lapi.c"> + <Unit filename="../lib/lua/src/lapi.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lapi.h" /> - <Unit filename="../lua-5.1.4/src/lauxlib.c"> + <Unit filename="../lib/lua/src/lapi.h" /> + <Unit filename="../lib/lua/src/lauxlib.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lauxlib.h" /> - <Unit filename="../lua-5.1.4/src/lbaselib.c"> + <Unit filename="../lib/lua/src/lauxlib.h" /> + <Unit filename="../lib/lua/src/lbaselib.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lcode.c"> + <Unit filename="../lib/lua/src/lcode.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lcode.h" /> - <Unit filename="../lua-5.1.4/src/ldblib.c"> + <Unit filename="../lib/lua/src/lcode.h" /> + <Unit filename="../lib/lua/src/ldblib.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/ldebug.c"> + <Unit filename="../lib/lua/src/ldebug.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/ldebug.h" /> - <Unit filename="../lua-5.1.4/src/ldo.c"> + <Unit filename="../lib/lua/src/ldebug.h" /> + <Unit filename="../lib/lua/src/ldo.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/ldo.h" /> - <Unit filename="../lua-5.1.4/src/ldump.c"> + <Unit filename="../lib/lua/src/ldo.h" /> + <Unit filename="../lib/lua/src/ldump.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lfunc.c"> + <Unit filename="../lib/lua/src/lfunc.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lfunc.h" /> - <Unit filename="../lua-5.1.4/src/lgc.c"> + <Unit filename="../lib/lua/src/lfunc.h" /> + <Unit filename="../lib/lua/src/lgc.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lgc.h" /> - <Unit filename="../lua-5.1.4/src/linit.c"> + <Unit filename="../lib/lua/src/lgc.h" /> + <Unit filename="../lib/lua/src/linit.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/liolib.c"> + <Unit filename="../lib/lua/src/liolib.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/llex.c"> + <Unit filename="../lib/lua/src/llex.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/llex.h" /> - <Unit filename="../lua-5.1.4/src/llimits.h" /> - <Unit filename="../lua-5.1.4/src/lmathlib.c"> + <Unit filename="../lib/lua/src/llex.h" /> + <Unit filename="../lib/lua/src/llimits.h" /> + <Unit filename="../lib/lua/src/lmathlib.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lmem.c"> + <Unit filename="../lib/lua/src/lmem.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lmem.h" /> - <Unit filename="../lua-5.1.4/src/loadlib.c"> + <Unit filename="../lib/lua/src/lmem.h" /> + <Unit filename="../lib/lua/src/loadlib.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lobject.c"> + <Unit filename="../lib/lua/src/lobject.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lobject.h" /> - <Unit filename="../lua-5.1.4/src/lopcodes.c"> + <Unit filename="../lib/lua/src/lobject.h" /> + <Unit filename="../lib/lua/src/lopcodes.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lopcodes.h" /> - <Unit filename="../lua-5.1.4/src/loslib.c"> + <Unit filename="../lib/lua/src/lopcodes.h" /> + <Unit filename="../lib/lua/src/loslib.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lparser.c"> + <Unit filename="../lib/lua/src/lparser.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lparser.h" /> - <Unit filename="../lua-5.1.4/src/lstate.c"> + <Unit filename="../lib/lua/src/lparser.h" /> + <Unit filename="../lib/lua/src/lstate.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lstate.h" /> - <Unit filename="../lua-5.1.4/src/lstring.c"> + <Unit filename="../lib/lua/src/lstate.h" /> + <Unit filename="../lib/lua/src/lstring.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lstring.h" /> - <Unit filename="../lua-5.1.4/src/lstrlib.c"> + <Unit filename="../lib/lua/src/lstring.h" /> + <Unit filename="../lib/lua/src/lstrlib.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/ltable.c"> + <Unit filename="../lib/lua/src/ltable.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/ltable.h" /> - <Unit filename="../lua-5.1.4/src/ltablib.c"> + <Unit filename="../lib/lua/src/ltable.h" /> + <Unit filename="../lib/lua/src/ltablib.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/ltm.c"> + <Unit filename="../lib/lua/src/ltm.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/ltm.h" /> - <Unit filename="../lua-5.1.4/src/lua.c"> + <Unit filename="../lib/lua/src/ltm.h" /> + <Unit filename="../lib/lua/src/lua.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lua.h" /> - <Unit filename="../lua-5.1.4/src/luac.c"> + <Unit filename="../lib/lua/src/lua.h" /> + <Unit filename="../lib/lua/src/luac.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/luaconf.h" /> - <Unit filename="../lua-5.1.4/src/lualib.h" /> - <Unit filename="../lua-5.1.4/src/lundump.c"> + <Unit filename="../lib/lua/src/luaconf.h" /> + <Unit filename="../lib/lua/src/lualib.h" /> + <Unit filename="../lib/lua/src/lundump.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lundump.h" /> - <Unit filename="../lua-5.1.4/src/lvm.c"> + <Unit filename="../lib/lua/src/lundump.h" /> + <Unit filename="../lib/lua/src/lvm.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lvm.h" /> - <Unit filename="../lua-5.1.4/src/lzio.c"> + <Unit filename="../lib/lua/src/lvm.h" /> + <Unit filename="../lib/lua/src/lzio.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../lua-5.1.4/src/lzio.h" /> - <Unit filename="../lua-5.1.4/src/print.c"> + <Unit filename="../lib/lua/src/lzio.h" /> + <Unit filename="../lib/lua/src/print.c"> <Option compilerVar="CC" /> </Unit> <Extensions> diff --git a/VC2008/Lua.vcproj b/VC2008/Lua.vcproj index cb063c53e..326ba6411 100644 --- a/VC2008/Lua.vcproj +++ b/VC2008/Lua.vcproj @@ -272,224 +272,224 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File - RelativePath="..\lua-5.1.4\src\lapi.c" + RelativePath="..\lib\lua\src\lapi.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lauxlib.c" + RelativePath="..\lib\lua\src\lauxlib.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lbaselib.c" + RelativePath="..\lib\lua\src\lbaselib.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lcode.c" + RelativePath="..\lib\lua\src\lcode.c" > </File> <File - RelativePath="..\lua-5.1.4\src\ldblib.c" + RelativePath="..\lib\lua\src\ldblib.c" > </File> <File - RelativePath="..\lua-5.1.4\src\ldebug.c" + RelativePath="..\lib\lua\src\ldebug.c" > </File> <File - RelativePath="..\lua-5.1.4\src\ldo.c" + RelativePath="..\lib\lua\src\ldo.c" > </File> <File - RelativePath="..\lua-5.1.4\src\ldump.c" + RelativePath="..\lib\lua\src\ldump.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lfunc.c" + RelativePath="..\lib\lua\src\lfunc.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lgc.c" + RelativePath="..\lib\lua\src\lgc.c" > </File> <File - RelativePath="..\lua-5.1.4\src\linit.c" + RelativePath="..\lib\lua\src\linit.c" > </File> <File - RelativePath="..\lua-5.1.4\src\liolib.c" + RelativePath="..\lib\lua\src\liolib.c" > </File> <File - RelativePath="..\lua-5.1.4\src\llex.c" + RelativePath="..\lib\lua\src\llex.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lmathlib.c" + RelativePath="..\lib\lua\src\lmathlib.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lmem.c" + RelativePath="..\lib\lua\src\lmem.c" > </File> <File - RelativePath="..\lua-5.1.4\src\loadlib.c" + RelativePath="..\lib\lua\src\loadlib.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lobject.c" + RelativePath="..\lib\lua\src\lobject.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lopcodes.c" + RelativePath="..\lib\lua\src\lopcodes.c" > </File> <File - RelativePath="..\lua-5.1.4\src\loslib.c" + RelativePath="..\lib\lua\src\loslib.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lparser.c" + RelativePath="..\lib\lua\src\lparser.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lstate.c" + RelativePath="..\lib\lua\src\lstate.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lstring.c" + RelativePath="..\lib\lua\src\lstring.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lstrlib.c" + RelativePath="..\lib\lua\src\lstrlib.c" > </File> <File - RelativePath="..\lua-5.1.4\src\ltable.c" + RelativePath="..\lib\lua\src\ltable.c" > </File> <File - RelativePath="..\lua-5.1.4\src\ltablib.c" + RelativePath="..\lib\lua\src\ltablib.c" > </File> <File - RelativePath="..\lua-5.1.4\src\ltm.c" + RelativePath="..\lib\lua\src\ltm.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lua.c" + RelativePath="..\lib\lua\src\lua.c" > </File> <File - RelativePath="..\lua-5.1.4\src\luac.c" + RelativePath="..\lib\lua\src\luac.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lundump.c" + RelativePath="..\lib\lua\src\lundump.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lvm.c" + RelativePath="..\lib\lua\src\lvm.c" > </File> <File - RelativePath="..\lua-5.1.4\src\lzio.c" + RelativePath="..\lib\lua\src\lzio.c" > </File> <File - RelativePath="..\lua-5.1.4\src\print.c" + RelativePath="..\lib\lua\src\print.c" > </File> </Filter> <File - RelativePath="..\lua-5.1.4\src\lapi.h" + RelativePath="..\lib\lua\src\lapi.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lauxlib.h" + RelativePath="..\lib\lua\src\lauxlib.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lcode.h" + RelativePath="..\lib\lua\src\lcode.h" > </File> <File - RelativePath="..\lua-5.1.4\src\ldebug.h" + RelativePath="..\lib\lua\src\ldebug.h" > </File> <File - RelativePath="..\lua-5.1.4\src\ldo.h" + RelativePath="..\lib\lua\src\ldo.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lfunc.h" + RelativePath="..\lib\lua\src\lfunc.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lgc.h" + RelativePath="..\lib\lua\src\lgc.h" > </File> <File - RelativePath="..\lua-5.1.4\src\llex.h" + RelativePath="..\lib\lua\src\llex.h" > </File> <File - RelativePath="..\lua-5.1.4\src\llimits.h" + RelativePath="..\lib\lua\src\llimits.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lmem.h" + RelativePath="..\lib\lua\src\lmem.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lobject.h" + RelativePath="..\lib\lua\src\lobject.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lopcodes.h" + RelativePath="..\lib\lua\src\lopcodes.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lparser.h" + RelativePath="..\lib\lua\src\lparser.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lstate.h" + RelativePath="..\lib\lua\src\lstate.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lstring.h" + RelativePath="..\lib\lua\src\lstring.h" > </File> <File - RelativePath="..\lua-5.1.4\src\ltable.h" + RelativePath="..\lib\lua\src\ltable.h" > </File> <File - RelativePath="..\lua-5.1.4\src\ltm.h" + RelativePath="..\lib\lua\src\ltm.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lua.h" + RelativePath="..\lib\lua\src\lua.h" > </File> <File - RelativePath="..\lua-5.1.4\src\luaconf.h" + RelativePath="..\lib\lua\src\luaconf.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lualib.h" + RelativePath="..\lib\lua\src\lualib.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lundump.h" + RelativePath="..\lib\lua\src\lundump.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lvm.h" + RelativePath="..\lib\lua\src\lvm.h" > </File> <File - RelativePath="..\lua-5.1.4\src\lzio.h" + RelativePath="..\lib\lua\src\lzio.h" > </File> </Files> diff --git a/VC2008/MCServer.cbp b/VC2008/MCServer.cbp index c44a1a445..0d63e9291 100644 --- a/VC2008/MCServer.cbp +++ b/VC2008/MCServer.cbp @@ -23,9 +23,6 @@ <Add directory="../jsoncpp-src-0.5.0/include" /> <Add directory="../lua-5.1.4/src" /> <Add directory="../tolua++-1.0.93/include" /> - <Add directory="../squirrel_3_0_1_stable/include" /> - <Add directory="../squirrel_3_0_1_stable" /> - <Add directory="../squirrel_3_0_1_stable/sqrat" /> <Add directory=".." /> <Add directory="../expat" /> </Compiler> @@ -34,9 +31,6 @@ <Add directory="../jsoncpp-src-0.5.0/include" /> <Add directory="../lua-5.1.4/src" /> <Add directory="../tolua++-1.0.93/include" /> - <Add directory="../squirrel_3_0_1_stable/include" /> - <Add directory="../squirrel_3_0_1_stable" /> - <Add directory="../squirrel_3_0_1_stable/sqrat" /> <Add directory=".." /> <Add directory="../expat" /> </ResourceCompiler> @@ -60,26 +54,20 @@ <Add option="-DXML_STATIC" /> <Add option="-W" /> <Add option="-O3" /> - <Add directory="../zlib-1.2.7" /> - <Add directory="../jsoncpp-src-0.5.0/include" /> - <Add directory="../lua-5.1.4/src" /> - <Add directory="../tolua++-1.0.93/include" /> - <Add directory="../squirrel_3_0_1_stable/include" /> - <Add directory="../squirrel_3_0_1_stable" /> - <Add directory="../squirrel_3_0_1_stable/sqrat" /> + <Add directory="../lib/zlib" /> + <Add directory="../lib/jsoncpp/include" /> + <Add directory="../lib/lua/src" /> + <Add directory="../lib/tolua++/include" /> <Add directory=".." /> - <Add directory="../expat" /> + <Add directory="../lib/expat" /> </Compiler> <ResourceCompiler> - <Add directory="../zlib-1.2.7" /> - <Add directory="../jsoncpp-src-0.5.0/include" /> - <Add directory="../lua-5.1.4/src" /> - <Add directory="../tolua++-1.0.93/include" /> - <Add directory="../squirrel_3_0_1_stable/include" /> - <Add directory="../squirrel_3_0_1_stable" /> - <Add directory="../squirrel_3_0_1_stable/sqrat" /> + <Add directory="../lib/zlib" /> + <Add directory="../lib/jsoncpp/include" /> + <Add directory="../lib/lua/src" /> + <Add directory="../lib/tolua++/include" /> <Add directory=".." /> - <Add directory="../expat" /> + <Add directory="../lib/expat" /> </ResourceCompiler> <Linker> <Add library="ws2_32" /> @@ -100,26 +88,20 @@ <Add option="-DXML_STATIC" /> <Add option="-W" /> <Add option="-O3" /> - <Add directory="../zlib-1.2.7" /> - <Add directory="../jsoncpp-src-0.5.0/include" /> - <Add directory="../lua-5.1.4/src" /> - <Add directory="../tolua++-1.0.93/include" /> - <Add directory="../squirrel_3_0_1_stable/include" /> - <Add directory="../squirrel_3_0_1_stable" /> - <Add directory="../squirrel_3_0_1_stable/sqrat" /> + <Add directory="../lib/zlib" /> + <Add directory="../lib/jsoncpp/include" /> + <Add directory="../lib/lua/src" /> + <Add directory="../lib/tolua++/include" /> <Add directory=".." /> - <Add directory="../expat" /> + <Add directory="../lib/expat" /> </Compiler> <ResourceCompiler> - <Add directory="../zlib-1.2.7" /> - <Add directory="../jsoncpp-src-0.5.0/include" /> - <Add directory="../lua-5.1.4/src" /> - <Add directory="../tolua++-1.0.93/include" /> - <Add directory="../squirrel_3_0_1_stable/include" /> - <Add directory="../squirrel_3_0_1_stable" /> - <Add directory="../squirrel_3_0_1_stable/sqrat" /> + <Add directory="../lib/zlib" /> + <Add directory="../lib/jsoncpp/include" /> + <Add directory="../lib/lua/src" /> + <Add directory="../lib/tolua++/include" /> <Add directory=".." /> - <Add directory="../expat" /> + <Add directory="../lib/expat" /> </ResourceCompiler> <Linker> <Add library="ws2_32" /> @@ -130,7 +112,7 @@ </Build> <Compiler> <Add option="-fpermissive" /> - <Add directory="../source" /> + <Add directory="../src" /> </Compiler> <Unit filename="../Android/jni/Android.mk"> <Option target="<{~None~}>" /> @@ -191,416 +173,403 @@ <Unit filename="../MCServer/terrain.ini" /> <Unit filename="../MCServer/users.ini" /> <Unit filename="../MCServer/webadmin.ini" /> - <Unit filename="../iniFile/iniFile.cpp" /> - <Unit filename="../iniFile/iniFile.h" /> - <Unit filename="../source/AllToLua.pkg"> + <Unit filename="../lib/iniFile/iniFile.cpp" /> + <Unit filename="../lib/iniFile/iniFile.h" /> + <Unit filename="../src/AllToLua.pkg"> <Option target="<{~None~}>" /> </Unit> - <Unit filename="../source/Authenticator.cpp" /> - <Unit filename="../source/Authenticator.h" /> - <Unit filename="../source/Bindings.cpp" /> - <Unit filename="../source/Bindings.h" /> - <Unit filename="../source/BlockArea.cpp" /> - <Unit filename="../source/BlockArea.h" /> - <Unit filename="../source/BlockEntity.h" /> - <Unit filename="../source/BlockEntityWithItems.h" /> - <Unit filename="../source/BlockID.cpp" /> - <Unit filename="../source/BlockID.h" /> - <Unit filename="../source/Blocks/BlockBed.cpp" /> - <Unit filename="../source/Blocks/BlockBed.h" /> - <Unit filename="../source/Blocks/BlockBrewingStand.h" /> - <Unit filename="../source/Blocks/BlockCactus.h" /> - <Unit filename="../source/Blocks/BlockCauldron.h" /> - <Unit filename="../source/Blocks/BlockChest.h" /> - <Unit filename="../source/Blocks/BlockCloth.h" /> - <Unit filename="../source/Blocks/BlockCobWeb.h" /> - <Unit filename="../source/Blocks/BlockCrops.h" /> - <Unit filename="../source/Blocks/BlockDirt.h" /> - <Unit filename="../source/Blocks/BlockDispenser.h" /> - <Unit filename="../source/Blocks/BlockDoor.cpp" /> - <Unit filename="../source/Blocks/BlockDoor.h" /> - <Unit filename="../source/Blocks/BlockEnderchest.h" /> - <Unit filename="../source/Blocks/BlockEntity.h" /> - <Unit filename="../source/Blocks/BlockFarmland.h" /> - <Unit filename="../source/Blocks/BlockFenceGate.h" /> - <Unit filename="../source/Blocks/BlockFire.h" /> - <Unit filename="../source/Blocks/BlockFlower.h" /> - <Unit filename="../source/Blocks/BlockFlowerPot.h" /> - <Unit filename="../source/Blocks/BlockFluid.h" /> - <Unit filename="../source/Blocks/BlockFurnace.h" /> - <Unit filename="../source/Blocks/BlockGlass.h" /> - <Unit filename="../source/Blocks/BlockGlowstone.h" /> - <Unit filename="../source/Blocks/BlockGravel.h" /> - <Unit filename="../source/Blocks/BlockHandler.cpp" /> - <Unit filename="../source/Blocks/BlockHandler.h" /> - <Unit filename="../source/Blocks/BlockIce.h" /> - <Unit filename="../source/Blocks/BlockLadder.h" /> - <Unit filename="../source/Blocks/BlockLeaves.h" /> - <Unit filename="../source/Blocks/BlockLever.cpp" /> - <Unit filename="../source/Blocks/BlockLever.h" /> - <Unit filename="../source/Blocks/BlockMelon.h" /> - <Unit filename="../source/Blocks/BlockMushroom.h" /> - <Unit filename="../source/Blocks/BlockMycelium.h" /> - <Unit filename="../source/Blocks/BlockNote.h" /> - <Unit filename="../source/Blocks/BlockOre.h" /> - <Unit filename="../source/Blocks/BlockPiston.cpp" /> - <Unit filename="../source/Blocks/BlockPiston.h" /> - <Unit filename="../source/Blocks/BlockRail.h" /> - <Unit filename="../source/Blocks/BlockRedstone.cpp" /> - <Unit filename="../source/Blocks/BlockRedstone.h" /> - <Unit filename="../source/Blocks/BlockRedstoneOre.h" /> - <Unit filename="../source/Blocks/BlockRedstoneRepeater.cpp" /> - <Unit filename="../source/Blocks/BlockRedstoneRepeater.h" /> - <Unit filename="../source/Blocks/BlockRedstoneTorch.h" /> - <Unit filename="../source/Blocks/BlockSand.h" /> - <Unit filename="../source/Blocks/BlockSapling.h" /> - <Unit filename="../source/Blocks/BlockSign.h" /> - <Unit filename="../source/Blocks/BlockSlab.h" /> - <Unit filename="../source/Blocks/BlockSnow.h" /> - <Unit filename="../source/Blocks/BlockStairs.h" /> - <Unit filename="../source/Blocks/BlockStems.h" /> - <Unit filename="../source/Blocks/BlockStone.h" /> - <Unit filename="../source/Blocks/BlockSugarcane.h" /> - <Unit filename="../source/Blocks/BlockTNT.h" /> - <Unit filename="../source/Blocks/BlockTallGrass.h" /> - <Unit filename="../source/Blocks/BlockTorch.h" /> - <Unit filename="../source/Blocks/BlockVine.h" /> - <Unit filename="../source/Blocks/BlockWood.h" /> - <Unit filename="../source/Blocks/BlockWorkbench.h" /> - <Unit filename="../source/ByteBuffer.cpp" /> - <Unit filename="../source/ByteBuffer.h" /> - <Unit filename="../source/ChatColor.cpp" /> - <Unit filename="../source/ChatColor.h" /> - <Unit filename="../source/ChestEntity.cpp" /> - <Unit filename="../source/ChestEntity.h" /> - <Unit filename="../source/Chunk.cpp" /> - <Unit filename="../source/Chunk.h" /> - <Unit filename="../source/Chunk.inl.h" /> - <Unit filename="../source/ChunkDef.h" /> - <Unit filename="../source/ChunkMap.cpp" /> - <Unit filename="../source/ChunkMap.h" /> - <Unit filename="../source/ChunkSender.cpp" /> - <Unit filename="../source/ChunkSender.h" /> - <Unit filename="../source/ClientHandle.cpp" /> - <Unit filename="../source/ClientHandle.h" /> - <Unit filename="../source/CraftingRecipes.cpp" /> - <Unit filename="../source/CraftingRecipes.h" /> - <Unit filename="../source/Cuboid.cpp" /> - <Unit filename="../source/Cuboid.h" /> - <Unit filename="../source/Defines.h" /> - <Unit filename="../source/DispenserEntity.cpp" /> - <Unit filename="../source/DispenserEntity.h" /> - <Unit filename="../source/Doors.h" /> - <Unit filename="../source/DropperEntity.h" /> - <Unit filename="../source/Endianness.h" /> - <Unit filename="../source/Entity.cpp" /> - <Unit filename="../source/Entity.h" /> - <Unit filename="../source/FallingBlock.cpp" /> - <Unit filename="../source/FallingBlock.h" /> - <Unit filename="../source/FurnaceEntity.cpp" /> - <Unit filename="../source/FurnaceEntity.h" /> - <Unit filename="../source/FurnaceRecipe.cpp" /> - <Unit filename="../source/FurnaceRecipe.h" /> - <Unit filename="../source/Generating/BioGen.cpp" /> - <Unit filename="../source/Generating/BioGen.h" /> - <Unit filename="../source/Generating/Caves.cpp" /> - <Unit filename="../source/Generating/Caves.h" /> - <Unit filename="../source/Generating/ChunkDesc.cpp" /> - <Unit filename="../source/Generating/ChunkDesc.h" /> - <Unit filename="../source/Generating/ChunkGenerator.cpp" /> - <Unit filename="../source/Generating/ChunkGenerator.h" /> - <Unit filename="../source/Generating/CompoGen.cpp" /> - <Unit filename="../source/Generating/CompoGen.h" /> - <Unit filename="../source/Generating/ComposableGenerator.cpp" /> - <Unit filename="../source/Generating/ComposableGenerator.h" /> - <Unit filename="../source/Generating/DistortedHeightmap.cpp" /> - <Unit filename="../source/Generating/DistortedHeightmap.h" /> - <Unit filename="../source/Generating/FinishGen.cpp" /> - <Unit filename="../source/Generating/FinishGen.h" /> - <Unit filename="../source/Generating/HeiGen.cpp" /> - <Unit filename="../source/Generating/HeiGen.h" /> - <Unit filename="../source/Generating/MineShafts.cpp" /> - <Unit filename="../source/Generating/MineShafts.h" /> - <Unit filename="../source/Generating/Noise3DGenerator.cpp" /> - <Unit filename="../source/Generating/Noise3DGenerator.h" /> - <Unit filename="../source/Generating/Ravines.cpp" /> - <Unit filename="../source/Generating/Ravines.h" /> - <Unit filename="../source/Generating/StructGen.cpp" /> - <Unit filename="../source/Generating/StructGen.h" /> - <Unit filename="../source/Generating/Trees.cpp" /> - <Unit filename="../source/Generating/Trees.h" /> - <Unit filename="../source/Globals.cpp" /> - <Unit filename="../source/Globals.h" /> - <Unit filename="../source/Group.cpp" /> - <Unit filename="../source/Group.h" /> - <Unit filename="../source/GroupManager.cpp" /> - <Unit filename="../source/GroupManager.h" /> - <Unit filename="../source/Inventory.cpp" /> - <Unit filename="../source/Inventory.h" /> - <Unit filename="../source/Item.cpp" /> - <Unit filename="../source/Item.h" /> - <Unit filename="../source/ItemGrid.cpp" /> - <Unit filename="../source/ItemGrid.h" /> - <Unit filename="../source/Items/ItemBed.h" /> - <Unit filename="../source/Items/ItemBrewingStand.h" /> - <Unit filename="../source/Items/ItemBucket.h" /> - <Unit filename="../source/Items/ItemCauldron.h" /> - <Unit filename="../source/Items/ItemCloth.h" /> - <Unit filename="../source/Items/ItemDoor.h" /> - <Unit filename="../source/Items/ItemDye.h" /> - <Unit filename="../source/Items/ItemFlowerPot.h" /> - <Unit filename="../source/Items/ItemFood.h" /> - <Unit filename="../source/Items/ItemHandler.cpp" /> - <Unit filename="../source/Items/ItemHandler.h" /> - <Unit filename="../source/Items/ItemHoe.h" /> - <Unit filename="../source/Items/ItemLeaves.h" /> - <Unit filename="../source/Items/ItemLighter.h" /> - <Unit filename="../source/Items/ItemMinecart.h" /> - <Unit filename="../source/Items/ItemPickaxe.h" /> - <Unit filename="../source/Items/ItemRedstoneDust.h" /> - <Unit filename="../source/Items/ItemRedstoneRepeater.h" /> - <Unit filename="../source/Items/ItemSapling.h" /> - <Unit filename="../source/Items/ItemSeeds.h" /> - <Unit filename="../source/Items/ItemShears.h" /> - <Unit filename="../source/Items/ItemShovel.h" /> - <Unit filename="../source/Items/ItemSign.h" /> - <Unit filename="../source/Items/ItemSlab.h" /> - <Unit filename="../source/Items/ItemSpawnEgg.h" /> - <Unit filename="../source/Items/ItemSugarcane.h" /> - <Unit filename="../source/Items/ItemSword.h" /> - <Unit filename="../source/Items/ItemWood.h" /> - <Unit filename="../source/JukeboxEntity.cpp" /> - <Unit filename="../source/JukeboxEntity.h" /> - <Unit filename="../source/Ladder.h" /> - <Unit filename="../source/LeakFinder.h" /> - <Unit filename="../source/LightingThread.cpp" /> - <Unit filename="../source/LightingThread.h" /> - <Unit filename="../source/LinearInterpolation.cpp" /> - <Unit filename="../source/LinearInterpolation.h" /> - <Unit filename="../source/LinearUpscale.h" /> - <Unit filename="../source/Log.cpp" /> - <Unit filename="../source/Log.h" /> - <Unit filename="../source/LuaExpat/lxplib.c"> + <Unit filename="../src/Authenticator.cpp" /> + <Unit filename="../src/Authenticator.h" /> + <Unit filename="../src/Bindings.cpp" /> + <Unit filename="../src/Bindings.h" /> + <Unit filename="../src/BlockArea.cpp" /> + <Unit filename="../src/BlockArea.h" /> + <Unit filename="../src/BlockEntity.h" /> + <Unit filename="../src/BlockEntityWithItems.h" /> + <Unit filename="../src/BlockID.cpp" /> + <Unit filename="../src/BlockID.h" /> + <Unit filename="../src/Blocks/BlockBed.cpp" /> + <Unit filename="../src/Blocks/BlockBed.h" /> + <Unit filename="../src/Blocks/BlockBrewingStand.h" /> + <Unit filename="../src/Blocks/BlockCactus.h" /> + <Unit filename="../src/Blocks/BlockCauldron.h" /> + <Unit filename="../src/Blocks/BlockChest.h" /> + <Unit filename="../src/Blocks/BlockCloth.h" /> + <Unit filename="../src/Blocks/BlockCobWeb.h" /> + <Unit filename="../src/Blocks/BlockCrops.h" /> + <Unit filename="../src/Blocks/BlockDirt.h" /> + <Unit filename="../src/Blocks/BlockDispenser.h" /> + <Unit filename="../src/Blocks/BlockDoor.cpp" /> + <Unit filename="../src/Blocks/BlockDoor.h" /> + <Unit filename="../src/Blocks/BlockEnderchest.h" /> + <Unit filename="../src/Blocks/BlockEntity.h" /> + <Unit filename="../src/Blocks/BlockFarmland.h" /> + <Unit filename="../src/Blocks/BlockFenceGate.h" /> + <Unit filename="../src/Blocks/BlockFire.h" /> + <Unit filename="../src/Blocks/BlockFlower.h" /> + <Unit filename="../src/Blocks/BlockFlowerPot.h" /> + <Unit filename="../src/Blocks/BlockFluid.h" /> + <Unit filename="../src/Blocks/BlockFurnace.h" /> + <Unit filename="../src/Blocks/BlockGlass.h" /> + <Unit filename="../src/Blocks/BlockGlowstone.h" /> + <Unit filename="../src/Blocks/BlockGravel.h" /> + <Unit filename="../src/Blocks/BlockHandler.cpp" /> + <Unit filename="../src/Blocks/BlockHandler.h" /> + <Unit filename="../src/Blocks/BlockIce.h" /> + <Unit filename="../src/Blocks/BlockLadder.h" /> + <Unit filename="../src/Blocks/BlockLeaves.h" /> + <Unit filename="../src/Blocks/BlockLever.cpp" /> + <Unit filename="../src/Blocks/BlockLever.h" /> + <Unit filename="../src/Blocks/BlockMelon.h" /> + <Unit filename="../src/Blocks/BlockMushroom.h" /> + <Unit filename="../src/Blocks/BlockMycelium.h" /> + <Unit filename="../src/Blocks/BlockNote.h" /> + <Unit filename="../src/Blocks/BlockOre.h" /> + <Unit filename="../src/Blocks/BlockPiston.cpp" /> + <Unit filename="../src/Blocks/BlockPiston.h" /> + <Unit filename="../src/Blocks/BlockRail.h" /> + <Unit filename="../src/Blocks/BlockRedstone.cpp" /> + <Unit filename="../src/Blocks/BlockRedstone.h" /> + <Unit filename="../src/Blocks/BlockRedstoneOre.h" /> + <Unit filename="../src/Blocks/BlockRedstoneRepeater.cpp" /> + <Unit filename="../src/Blocks/BlockRedstoneRepeater.h" /> + <Unit filename="../src/Blocks/BlockRedstoneTorch.h" /> + <Unit filename="../src/Blocks/BlockSand.h" /> + <Unit filename="../src/Blocks/BlockSapling.h" /> + <Unit filename="../src/Blocks/BlockSign.h" /> + <Unit filename="../src/Blocks/BlockSlab.h" /> + <Unit filename="../src/Blocks/BlockSnow.h" /> + <Unit filename="../src/Blocks/BlockStairs.h" /> + <Unit filename="../src/Blocks/BlockStems.h" /> + <Unit filename="../src/Blocks/BlockStone.h" /> + <Unit filename="../src/Blocks/BlockSugarcane.h" /> + <Unit filename="../src/Blocks/BlockTNT.h" /> + <Unit filename="../src/Blocks/BlockTallGrass.h" /> + <Unit filename="../src/Blocks/BlockTorch.h" /> + <Unit filename="../src/Blocks/BlockVine.h" /> + <Unit filename="../src/Blocks/BlockWood.h" /> + <Unit filename="../src/Blocks/BlockWorkbench.h" /> + <Unit filename="../src/ByteBuffer.cpp" /> + <Unit filename="../src/ByteBuffer.h" /> + <Unit filename="../src/ChatColor.cpp" /> + <Unit filename="../src/ChatColor.h" /> + <Unit filename="../src/ChestEntity.cpp" /> + <Unit filename="../src/ChestEntity.h" /> + <Unit filename="../src/Chunk.cpp" /> + <Unit filename="../src/Chunk.h" /> + <Unit filename="../src/Chunk.inl.h" /> + <Unit filename="../src/ChunkDef.h" /> + <Unit filename="../src/ChunkMap.cpp" /> + <Unit filename="../src/ChunkMap.h" /> + <Unit filename="../src/ChunkSender.cpp" /> + <Unit filename="../src/ChunkSender.h" /> + <Unit filename="../src/ClientHandle.cpp" /> + <Unit filename="../src/ClientHandle.h" /> + <Unit filename="../src/CraftingRecipes.cpp" /> + <Unit filename="../src/CraftingRecipes.h" /> + <Unit filename="../src/Cuboid.cpp" /> + <Unit filename="../src/Cuboid.h" /> + <Unit filename="../src/Defines.h" /> + <Unit filename="../src/DispenserEntity.cpp" /> + <Unit filename="../src/DispenserEntity.h" /> + <Unit filename="../src/Doors.h" /> + <Unit filename="../src/DropperEntity.h" /> + <Unit filename="../src/Endianness.h" /> + <Unit filename="../src/Entity.cpp" /> + <Unit filename="../src/Entity.h" /> + <Unit filename="../src/FallingBlock.cpp" /> + <Unit filename="../src/FallingBlock.h" /> + <Unit filename="../src/FurnaceEntity.cpp" /> + <Unit filename="../src/FurnaceEntity.h" /> + <Unit filename="../src/FurnaceRecipe.cpp" /> + <Unit filename="../src/FurnaceRecipe.h" /> + <Unit filename="../src/Generating/BioGen.cpp" /> + <Unit filename="../src/Generating/BioGen.h" /> + <Unit filename="../src/Generating/Caves.cpp" /> + <Unit filename="../src/Generating/Caves.h" /> + <Unit filename="../src/Generating/ChunkDesc.cpp" /> + <Unit filename="../src/Generating/ChunkDesc.h" /> + <Unit filename="../src/Generating/ChunkGenerator.cpp" /> + <Unit filename="../src/Generating/ChunkGenerator.h" /> + <Unit filename="../src/Generating/CompoGen.cpp" /> + <Unit filename="../src/Generating/CompoGen.h" /> + <Unit filename="../src/Generating/ComposableGenerator.cpp" /> + <Unit filename="../src/Generating/ComposableGenerator.h" /> + <Unit filename="../src/Generating/DistortedHeightmap.cpp" /> + <Unit filename="../src/Generating/DistortedHeightmap.h" /> + <Unit filename="../src/Generating/FinishGen.cpp" /> + <Unit filename="../src/Generating/FinishGen.h" /> + <Unit filename="../src/Generating/HeiGen.cpp" /> + <Unit filename="../src/Generating/HeiGen.h" /> + <Unit filename="../src/Generating/MineShafts.cpp" /> + <Unit filename="../src/Generating/MineShafts.h" /> + <Unit filename="../src/Generating/Noise3DGenerator.cpp" /> + <Unit filename="../src/Generating/Noise3DGenerator.h" /> + <Unit filename="../src/Generating/Ravines.cpp" /> + <Unit filename="../src/Generating/Ravines.h" /> + <Unit filename="../src/Generating/StructGen.cpp" /> + <Unit filename="../src/Generating/StructGen.h" /> + <Unit filename="../src/Generating/Trees.cpp" /> + <Unit filename="../src/Generating/Trees.h" /> + <Unit filename="../src/Globals.cpp" /> + <Unit filename="../src/Globals.h" /> + <Unit filename="../src/Group.cpp" /> + <Unit filename="../src/Group.h" /> + <Unit filename="../src/GroupManager.cpp" /> + <Unit filename="../src/GroupManager.h" /> + <Unit filename="../src/Inventory.cpp" /> + <Unit filename="../src/Inventory.h" /> + <Unit filename="../src/Item.cpp" /> + <Unit filename="../src/Item.h" /> + <Unit filename="../src/ItemGrid.cpp" /> + <Unit filename="../src/ItemGrid.h" /> + <Unit filename="../src/Items/ItemBed.h" /> + <Unit filename="../src/Items/ItemBrewingStand.h" /> + <Unit filename="../src/Items/ItemBucket.h" /> + <Unit filename="../src/Items/ItemCauldron.h" /> + <Unit filename="../src/Items/ItemCloth.h" /> + <Unit filename="../src/Items/ItemDoor.h" /> + <Unit filename="../src/Items/ItemDye.h" /> + <Unit filename="../src/Items/ItemFlowerPot.h" /> + <Unit filename="../src/Items/ItemFood.h" /> + <Unit filename="../src/Items/ItemHandler.cpp" /> + <Unit filename="../src/Items/ItemHandler.h" /> + <Unit filename="../src/Items/ItemHoe.h" /> + <Unit filename="../src/Items/ItemLeaves.h" /> + <Unit filename="../src/Items/ItemLighter.h" /> + <Unit filename="../src/Items/ItemMinecart.h" /> + <Unit filename="../src/Items/ItemPickaxe.h" /> + <Unit filename="../src/Items/ItemRedstoneDust.h" /> + <Unit filename="../src/Items/ItemRedstoneRepeater.h" /> + <Unit filename="../src/Items/ItemSapling.h" /> + <Unit filename="../src/Items/ItemSeeds.h" /> + <Unit filename="../src/Items/ItemShears.h" /> + <Unit filename="../src/Items/ItemShovel.h" /> + <Unit filename="../src/Items/ItemSign.h" /> + <Unit filename="../src/Items/ItemSlab.h" /> + <Unit filename="../src/Items/ItemSpawnEgg.h" /> + <Unit filename="../src/Items/ItemSugarcane.h" /> + <Unit filename="../src/Items/ItemSword.h" /> + <Unit filename="../src/Items/ItemWood.h" /> + <Unit filename="../src/JukeboxEntity.cpp" /> + <Unit filename="../src/JukeboxEntity.h" /> + <Unit filename="../src/Ladder.h" /> + <Unit filename="../src/LeakFinder.h" /> + <Unit filename="../src/LightingThread.cpp" /> + <Unit filename="../src/LightingThread.h" /> + <Unit filename="../src/LinearInterpolation.cpp" /> + <Unit filename="../src/LinearInterpolation.h" /> + <Unit filename="../src/LinearUpscale.h" /> + <Unit filename="../src/Log.cpp" /> + <Unit filename="../src/Log.h" /> + <Unit filename="../lib/luaexpat/lxplib.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../source/LuaExpat/lxplib.h" /> - <Unit filename="../source/LuaFunctions.h" /> - <Unit filename="../source/MCLogger.cpp" /> - <Unit filename="../source/MCLogger.h" /> - <Unit filename="../source/ManualBindings.cpp" /> - <Unit filename="../source/ManualBindings.h" /> - <Unit filename="../source/Matrix4f.cpp" /> - <Unit filename="../source/Matrix4f.h" /> - <Unit filename="../source/MemoryLeak.h" /> - <Unit filename="../source/MersenneTwister.h" /> - <Unit filename="../source/Minecart.cpp" /> - <Unit filename="../source/Minecart.h" /> - <Unit filename="../source/Mobs/AggressiveMonster.cpp" /> - <Unit filename="../source/Mobs/AggressiveMonster.h" /> - <Unit filename="../source/Mobs/Bat.h" /> - <Unit filename="../source/Mobs/Blaze.cpp" /> - <Unit filename="../source/Mobs/Blaze.h" /> - <Unit filename="../source/Mobs/Cavespider.cpp" /> - <Unit filename="../source/Mobs/Cavespider.h" /> - <Unit filename="../source/Mobs/Chicken.cpp" /> - <Unit filename="../source/Mobs/Chicken.h" /> - <Unit filename="../source/Mobs/Cow.cpp" /> - <Unit filename="../source/Mobs/Cow.h" /> - <Unit filename="../source/Mobs/Creeper.cpp" /> - <Unit filename="../source/Mobs/Creeper.h" /> - <Unit filename="../source/Mobs/Enderman.cpp" /> - <Unit filename="../source/Mobs/Enderman.h" /> - <Unit filename="../source/Mobs/Ghast.cpp" /> - <Unit filename="../source/Mobs/Ghast.h" /> - <Unit filename="../source/Mobs/Magmacube.cpp" /> - <Unit filename="../source/Mobs/Magmacube.h" /> - <Unit filename="../source/Mobs/Monster.cpp" /> - <Unit filename="../source/Mobs/Monster.h" /> - <Unit filename="../source/Mobs/Mooshroom.cpp" /> - <Unit filename="../source/Mobs/Mooshroom.h" /> - <Unit filename="../source/Mobs/Ocelot.h" /> - <Unit filename="../source/Mobs/PassiveAggressiveMonster.cpp" /> - <Unit filename="../source/Mobs/PassiveAggressiveMonster.h" /> - <Unit filename="../source/Mobs/PassiveMonster.cpp" /> - <Unit filename="../source/Mobs/PassiveMonster.h" /> - <Unit filename="../source/Mobs/Pig.cpp" /> - <Unit filename="../source/Mobs/Pig.h" /> - <Unit filename="../source/Mobs/Sheep.cpp" /> - <Unit filename="../source/Mobs/Sheep.h" /> - <Unit filename="../source/Mobs/Silverfish.h" /> - <Unit filename="../source/Mobs/Skeleton.cpp" /> - <Unit filename="../source/Mobs/Skeleton.h" /> - <Unit filename="../source/Mobs/Slime.cpp" /> - <Unit filename="../source/Mobs/Slime.h" /> - <Unit filename="../source/Mobs/Spider.cpp" /> - <Unit filename="../source/Mobs/Spider.h" /> - <Unit filename="../source/Mobs/Squid.cpp" /> - <Unit filename="../source/Mobs/Squid.h" /> - <Unit filename="../source/Mobs/Villager.cpp" /> - <Unit filename="../source/Mobs/Villager.h" /> - <Unit filename="../source/Mobs/Witch.cpp" /> - <Unit filename="../source/Mobs/Witch.h" /> - <Unit filename="../source/Mobs/Wolf.h" /> - <Unit filename="../source/Mobs/Zombie.cpp" /> - <Unit filename="../source/Mobs/Zombie.h" /> - <Unit filename="../source/Mobs/Zombiepigman.cpp" /> - <Unit filename="../source/Mobs/Zombiepigman.h" /> - <Unit filename="../source/MonsterConfig.cpp" /> - <Unit filename="../source/MonsterConfig.h" /> - <Unit filename="../source/Noise.cpp" /> - <Unit filename="../source/Noise.h" /> - <Unit filename="../source/NoteEntity.cpp" /> - <Unit filename="../source/NoteEntity.h" /> - <Unit filename="../source/OSSupport/BlockingTCPLink.cpp" /> - <Unit filename="../source/OSSupport/BlockingTCPLink.h" /> - <Unit filename="../source/OSSupport/CriticalSection.cpp" /> - <Unit filename="../source/OSSupport/CriticalSection.h" /> - <Unit filename="../source/OSSupport/Event.cpp" /> - <Unit filename="../source/OSSupport/Event.h" /> - <Unit filename="../source/OSSupport/File.cpp" /> - <Unit filename="../source/OSSupport/File.h" /> - <Unit filename="../source/OSSupport/GZipFile.cpp" /> - <Unit filename="../source/OSSupport/GZipFile.h" /> - <Unit filename="../source/OSSupport/IsThread.cpp" /> - <Unit filename="../source/OSSupport/IsThread.h" /> - <Unit filename="../source/OSSupport/ListenThread.cpp" /> - <Unit filename="../source/OSSupport/ListenThread.h" /> - <Unit filename="../source/OSSupport/MakeDir.cpp" /> - <Unit filename="../source/OSSupport/MakeDir.h" /> - <Unit filename="../source/OSSupport/Semaphore.cpp" /> - <Unit filename="../source/OSSupport/Semaphore.h" /> - <Unit filename="../source/OSSupport/Sleep.cpp" /> - <Unit filename="../source/OSSupport/Sleep.h" /> - <Unit filename="../source/OSSupport/Socket.cpp" /> - <Unit filename="../source/OSSupport/Socket.h" /> - <Unit filename="../source/OSSupport/SocketThreads.cpp" /> - <Unit filename="../source/OSSupport/SocketThreads.h" /> - <Unit filename="../source/OSSupport/Thread.cpp" /> - <Unit filename="../source/OSSupport/Thread.h" /> - <Unit filename="../source/OSSupport/Timer.cpp" /> - <Unit filename="../source/OSSupport/Timer.h" /> - <Unit filename="../source/Pawn.cpp" /> - <Unit filename="../source/Pawn.h" /> - <Unit filename="../source/Pickup.cpp" /> - <Unit filename="../source/Pickup.h" /> - <Unit filename="../source/Piston.cpp" /> - <Unit filename="../source/Piston.h" /> - <Unit filename="../source/Player.cpp" /> - <Unit filename="../source/Player.h" /> - <Unit filename="../source/Plugin.cpp" /> - <Unit filename="../source/Plugin.h" /> - <Unit filename="../source/PluginManager.cpp" /> - <Unit filename="../source/PluginManager.h" /> - <Unit filename="../source/Plugin_NewLua.cpp" /> - <Unit filename="../source/Plugin_NewLua.h" /> - <Unit filename="../source/Plugin_Squirrel.cpp" /> - <Unit filename="../source/Plugin_Squirrel.h" /> - <Unit filename="../source/ProbabDistrib.cpp" /> - <Unit filename="../source/ProbabDistrib.h" /> - <Unit filename="../source/Protocol/ChunkDataSerializer.cpp" /> - <Unit filename="../source/Protocol/ChunkDataSerializer.h" /> - <Unit filename="../source/Protocol/Protocol.h" /> - <Unit filename="../source/Protocol/Protocol125.cpp" /> - <Unit filename="../source/Protocol/Protocol125.h" /> - <Unit filename="../source/Protocol/Protocol132.cpp" /> - <Unit filename="../source/Protocol/Protocol132.h" /> - <Unit filename="../source/Protocol/Protocol14x.cpp" /> - <Unit filename="../source/Protocol/Protocol14x.h" /> - <Unit filename="../source/Protocol/Protocol15x.cpp" /> - <Unit filename="../source/Protocol/Protocol15x.h" /> - <Unit filename="../source/Protocol/ProtocolRecognizer.cpp" /> - <Unit filename="../source/Protocol/ProtocolRecognizer.h" /> - <Unit filename="../source/ReferenceManager.cpp" /> - <Unit filename="../source/ReferenceManager.h" /> - <Unit filename="../source/Root.cpp" /> - <Unit filename="../source/Root.h" /> - <Unit filename="../source/SQLite/lsqlite3.c"> + <Unit filename="../lib/luaexpat/lxplib.h" /> + <Unit filename="../src/LuaFunctions.h" /> + <Unit filename="../src/MCLogger.cpp" /> + <Unit filename="../src/MCLogger.h" /> + <Unit filename="../src/ManualBindings.cpp" /> + <Unit filename="../src/ManualBindings.h" /> + <Unit filename="../src/Matrix4f.cpp" /> + <Unit filename="../src/Matrix4f.h" /> + <Unit filename="../src/MemoryLeak.h" /> + <Unit filename="../src/MersenneTwister.h" /> + <Unit filename="../src/Minecart.cpp" /> + <Unit filename="../src/Minecart.h" /> + <Unit filename="../src/Mobs/AggressiveMonster.cpp" /> + <Unit filename="../src/Mobs/AggressiveMonster.h" /> + <Unit filename="../src/Mobs/Bat.h" /> + <Unit filename="../src/Mobs/Blaze.cpp" /> + <Unit filename="../src/Mobs/Blaze.h" /> + <Unit filename="../src/Mobs/Cavespider.cpp" /> + <Unit filename="../src/Mobs/Cavespider.h" /> + <Unit filename="../src/Mobs/Chicken.cpp" /> + <Unit filename="../src/Mobs/Chicken.h" /> + <Unit filename="../src/Mobs/Cow.cpp" /> + <Unit filename="../src/Mobs/Cow.h" /> + <Unit filename="../src/Mobs/Creeper.cpp" /> + <Unit filename="../src/Mobs/Creeper.h" /> + <Unit filename="../src/Mobs/Enderman.cpp" /> + <Unit filename="../src/Mobs/Enderman.h" /> + <Unit filename="../src/Mobs/Ghast.cpp" /> + <Unit filename="../src/Mobs/Ghast.h" /> + <Unit filename="../src/Mobs/Magmacube.cpp" /> + <Unit filename="../src/Mobs/Magmacube.h" /> + <Unit filename="../src/Mobs/Monster.cpp" /> + <Unit filename="../src/Mobs/Monster.h" /> + <Unit filename="../src/Mobs/Mooshroom.cpp" /> + <Unit filename="../src/Mobs/Mooshroom.h" /> + <Unit filename="../src/Mobs/Ocelot.h" /> + <Unit filename="../src/Mobs/PassiveAggressiveMonster.cpp" /> + <Unit filename="../src/Mobs/PassiveAggressiveMonster.h" /> + <Unit filename="../src/Mobs/PassiveMonster.cpp" /> + <Unit filename="../src/Mobs/PassiveMonster.h" /> + <Unit filename="../src/Mobs/Pig.cpp" /> + <Unit filename="../src/Mobs/Pig.h" /> + <Unit filename="../src/Mobs/Sheep.cpp" /> + <Unit filename="../src/Mobs/Sheep.h" /> + <Unit filename="../src/Mobs/Silverfish.h" /> + <Unit filename="../src/Mobs/Skeleton.cpp" /> + <Unit filename="../src/Mobs/Skeleton.h" /> + <Unit filename="../src/Mobs/Slime.cpp" /> + <Unit filename="../src/Mobs/Slime.h" /> + <Unit filename="../src/Mobs/Spider.cpp" /> + <Unit filename="../src/Mobs/Spider.h" /> + <Unit filename="../src/Mobs/Squid.cpp" /> + <Unit filename="../src/Mobs/Squid.h" /> + <Unit filename="../src/Mobs/Villager.cpp" /> + <Unit filename="../src/Mobs/Villager.h" /> + <Unit filename="../src/Mobs/Witch.cpp" /> + <Unit filename="../src/Mobs/Witch.h" /> + <Unit filename="../src/Mobs/Wolf.h" /> + <Unit filename="../src/Mobs/Zombie.cpp" /> + <Unit filename="../src/Mobs/Zombie.h" /> + <Unit filename="../src/Mobs/Zombiepigman.cpp" /> + <Unit filename="../src/Mobs/Zombiepigman.h" /> + <Unit filename="../src/MonsterConfig.cpp" /> + <Unit filename="../src/MonsterConfig.h" /> + <Unit filename="../src/Noise.cpp" /> + <Unit filename="../src/Noise.h" /> + <Unit filename="../src/NoteEntity.cpp" /> + <Unit filename="../src/NoteEntity.h" /> + <Unit filename="../src/OSSupport/BlockingTCPLink.cpp" /> + <Unit filename="../src/OSSupport/BlockingTCPLink.h" /> + <Unit filename="../src/OSSupport/CriticalSection.cpp" /> + <Unit filename="../src/OSSupport/CriticalSection.h" /> + <Unit filename="../src/OSSupport/Event.cpp" /> + <Unit filename="../src/OSSupport/Event.h" /> + <Unit filename="../src/OSSupport/File.cpp" /> + <Unit filename="../src/OSSupport/File.h" /> + <Unit filename="../src/OSSupport/GZipFile.cpp" /> + <Unit filename="../src/OSSupport/GZipFile.h" /> + <Unit filename="../src/OSSupport/IsThread.cpp" /> + <Unit filename="../src/OSSupport/IsThread.h" /> + <Unit filename="../src/OSSupport/ListenThread.cpp" /> + <Unit filename="../src/OSSupport/ListenThread.h" /> + <Unit filename="../src/OSSupport/MakeDir.cpp" /> + <Unit filename="../src/OSSupport/MakeDir.h" /> + <Unit filename="../src/OSSupport/Semaphore.cpp" /> + <Unit filename="../src/OSSupport/Semaphore.h" /> + <Unit filename="../src/OSSupport/Sleep.cpp" /> + <Unit filename="../src/OSSupport/Sleep.h" /> + <Unit filename="../src/OSSupport/Socket.cpp" /> + <Unit filename="../src/OSSupport/Socket.h" /> + <Unit filename="../src/OSSupport/SocketThreads.cpp" /> + <Unit filename="../src/OSSupport/SocketThreads.h" /> + <Unit filename="../src/OSSupport/Thread.cpp" /> + <Unit filename="../src/OSSupport/Thread.h" /> + <Unit filename="../src/OSSupport/Timer.cpp" /> + <Unit filename="../src/OSSupport/Timer.h" /> + <Unit filename="../src/Pawn.cpp" /> + <Unit filename="../src/Pawn.h" /> + <Unit filename="../src/Pickup.cpp" /> + <Unit filename="../src/Pickup.h" /> + <Unit filename="../src/Piston.cpp" /> + <Unit filename="../src/Piston.h" /> + <Unit filename="../src/Player.cpp" /> + <Unit filename="../src/Player.h" /> + <Unit filename="../src/Plugin.cpp" /> + <Unit filename="../src/Plugin.h" /> + <Unit filename="../src/PluginManager.cpp" /> + <Unit filename="../src/PluginManager.h" /> + <Unit filename="../src/ProbabDistrib.cpp" /> + <Unit filename="../src/ProbabDistrib.h" /> + <Unit filename="../src/Protocol/ChunkDataSerializer.cpp" /> + <Unit filename="../src/Protocol/ChunkDataSerializer.h" /> + <Unit filename="../src/Protocol/Protocol.h" /> + <Unit filename="../src/Protocol/Protocol125.cpp" /> + <Unit filename="../src/Protocol/Protocol125.h" /> + <Unit filename="../src/Protocol/Protocol132.cpp" /> + <Unit filename="../src/Protocol/Protocol132.h" /> + <Unit filename="../src/Protocol/Protocol14x.cpp" /> + <Unit filename="../src/Protocol/Protocol14x.h" /> + <Unit filename="../src/Protocol/Protocol15x.cpp" /> + <Unit filename="../src/Protocol/Protocol15x.h" /> + <Unit filename="../src/Protocol/ProtocolRecognizer.cpp" /> + <Unit filename="../src/Protocol/ProtocolRecognizer.h" /> + <Unit filename="../src/ReferenceManager.cpp" /> + <Unit filename="../src/ReferenceManager.h" /> + <Unit filename="../src/Root.cpp" /> + <Unit filename="../src/Root.h" /> + <Unit filename="../lib/sqlite/lsqlite3.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../source/SQLite/sqlite3.c"> + <Unit filename="../lib/sqlite/sqlite3.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../source/SQLite/sqlite3.h" /> - <Unit filename="../source/SQLite/urls.txt" /> - <Unit filename="../source/Server.cpp" /> - <Unit filename="../source/Server.h" /> - <Unit filename="../source/Sign.h" /> - <Unit filename="../source/SignEntity.cpp" /> - <Unit filename="../source/SignEntity.h" /> - <Unit filename="../source/Simulator/DelayedFluidSimulator.cpp" /> - <Unit filename="../source/Simulator/DelayedFluidSimulator.h" /> - <Unit filename="../source/Simulator/FireSimulator.cpp" /> - <Unit filename="../source/Simulator/FireSimulator.h" /> - <Unit filename="../source/Simulator/FloodyFluidSimulator.cpp" /> - <Unit filename="../source/Simulator/FloodyFluidSimulator.h" /> - <Unit filename="../source/Simulator/FluidSimulator.cpp" /> - <Unit filename="../source/Simulator/FluidSimulator.h" /> - <Unit filename="../source/Simulator/NoopFluidSimulator.h" /> - <Unit filename="../source/Simulator/RedstoneSimulator.cpp" /> - <Unit filename="../source/Simulator/RedstoneSimulator.h" /> - <Unit filename="../source/Simulator/SandSimulator.cpp" /> - <Unit filename="../source/Simulator/SandSimulator.h" /> - <Unit filename="../source/Simulator/Simulator.cpp" /> - <Unit filename="../source/Simulator/Simulator.h" /> - <Unit filename="../source/Simulator/SimulatorManager.cpp" /> - <Unit filename="../source/Simulator/SimulatorManager.h" /> - <Unit filename="../source/Simulator/VaporizeFluidSimulator.cpp" /> - <Unit filename="../source/Simulator/VaporizeFluidSimulator.h" /> - <Unit filename="../source/SquirrelCommandBinder.cpp" /> - <Unit filename="../source/SquirrelCommandBinder.h" /> - <Unit filename="../source/StackWalker.h" /> - <Unit filename="../source/Stairs.h" /> - <Unit filename="../source/StringCompression.cpp" /> - <Unit filename="../source/StringCompression.h" /> - <Unit filename="../source/StringMap.cpp" /> - <Unit filename="../source/StringMap.h" /> - <Unit filename="../source/StringUtils.cpp" /> - <Unit filename="../source/StringUtils.h" /> - <Unit filename="../source/TNTEntity.cpp" /> - <Unit filename="../source/TNTEntity.h" /> - <Unit filename="../source/Torch.h" /> - <Unit filename="../source/Tracer.cpp" /> - <Unit filename="../source/Tracer.h" /> - <Unit filename="../source/UI/SlotArea.cpp" /> - <Unit filename="../source/UI/SlotArea.h" /> - <Unit filename="../source/UI/Window.cpp" /> - <Unit filename="../source/UI/Window.h" /> - <Unit filename="../source/UI/WindowOwner.h" /> - <Unit filename="../source/Vector3d.cpp" /> - <Unit filename="../source/Vector3d.h" /> - <Unit filename="../source/Vector3f.cpp" /> - <Unit filename="../source/Vector3f.h" /> - <Unit filename="../source/Vector3i.cpp" /> - <Unit filename="../source/Vector3i.h" /> - <Unit filename="../source/Vine.h" /> - <Unit filename="../source/WebAdmin.cpp" /> - <Unit filename="../source/WebAdmin.h" /> - <Unit filename="../source/WebPlugin.cpp" /> - <Unit filename="../source/WebPlugin.h" /> - <Unit filename="../source/World.cpp" /> - <Unit filename="../source/World.h" /> - <Unit filename="../source/WorldStorage/FastNBT.cpp" /> - <Unit filename="../source/WorldStorage/FastNBT.h" /> - <Unit filename="../source/WorldStorage/NBTChunkSerializer.cpp" /> - <Unit filename="../source/WorldStorage/NBTChunkSerializer.h" /> - <Unit filename="../source/WorldStorage/WSSAnvil.cpp" /> - <Unit filename="../source/WorldStorage/WSSAnvil.h" /> - <Unit filename="../source/WorldStorage/WSSCompact.cpp" /> - <Unit filename="../source/WorldStorage/WSSCompact.h" /> - <Unit filename="../source/WorldStorage/WorldStorage.cpp" /> - <Unit filename="../source/WorldStorage/WorldStorage.h" /> - <Unit filename="../source/main.cpp" /> - <Unit filename="../source/md5/md5.cpp" /> - <Unit filename="../source/md5/md5.h" /> - <Unit filename="../source/squirrelbindings/SquirrelArray.h" /> - <Unit filename="../source/squirrelbindings/SquirrelBaseClass.h" /> - <Unit filename="../source/squirrelbindings/SquirrelBindings.cpp" /> - <Unit filename="../source/squirrelbindings/SquirrelBindings.h" /> - <Unit filename="../source/squirrelbindings/SquirrelFunctions.cpp" /> - <Unit filename="../source/squirrelbindings/SquirrelFunctions.h" /> - <Unit filename="../source/squirrelbindings/SquirrelObject.h" /> - <Unit filename="../source/tolua++.h" /> - <Unit filename="../source/tolua_base.h" /> + <Unit filename="../lib/sqlite/sqlite3.h" /> + <Unit filename="../lib/sqlite/urls.txt" /> + <Unit filename="../src/Server.cpp" /> + <Unit filename="../src/Server.h" /> + <Unit filename="../src/Sign.h" /> + <Unit filename="../src/SignEntity.cpp" /> + <Unit filename="../src/SignEntity.h" /> + <Unit filename="../src/Simulator/DelayedFluidSimulator.cpp" /> + <Unit filename="../src/Simulator/DelayedFluidSimulator.h" /> + <Unit filename="../src/Simulator/FireSimulator.cpp" /> + <Unit filename="../src/Simulator/FireSimulator.h" /> + <Unit filename="../src/Simulator/FloodyFluidSimulator.cpp" /> + <Unit filename="../src/Simulator/FloodyFluidSimulator.h" /> + <Unit filename="../src/Simulator/FluidSimulator.cpp" /> + <Unit filename="../src/Simulator/FluidSimulator.h" /> + <Unit filename="../src/Simulator/NoopFluidSimulator.h" /> + <Unit filename="../src/Simulator/RedstoneSimulator.cpp" /> + <Unit filename="../src/Simulator/RedstoneSimulator.h" /> + <Unit filename="../src/Simulator/SandSimulator.cpp" /> + <Unit filename="../src/Simulator/SandSimulator.h" /> + <Unit filename="../src/Simulator/Simulator.cpp" /> + <Unit filename="../src/Simulator/Simulator.h" /> + <Unit filename="../src/Simulator/SimulatorManager.cpp" /> + <Unit filename="../src/Simulator/SimulatorManager.h" /> + <Unit filename="../src/Simulator/VaporizeFluidSimulator.cpp" /> + <Unit filename="../src/Simulator/VaporizeFluidSimulator.h" /> + <Unit filename="../src/StackWalker.h" /> + <Unit filename="../src/Stairs.h" /> + <Unit filename="../src/StringCompression.cpp" /> + <Unit filename="../src/StringCompression.h" /> + <Unit filename="../src/StringMap.cpp" /> + <Unit filename="../src/StringMap.h" /> + <Unit filename="../src/StringUtils.cpp" /> + <Unit filename="../src/StringUtils.h" /> + <Unit filename="../src/TNTEntity.cpp" /> + <Unit filename="../src/TNTEntity.h" /> + <Unit filename="../src/Torch.h" /> + <Unit filename="../src/Tracer.cpp" /> + <Unit filename="../src/Tracer.h" /> + <Unit filename="../src/UI/SlotArea.cpp" /> + <Unit filename="../src/UI/SlotArea.h" /> + <Unit filename="../src/UI/Window.cpp" /> + <Unit filename="../src/UI/Window.h" /> + <Unit filename="../src/UI/WindowOwner.h" /> + <Unit filename="../src/Vector3d.cpp" /> + <Unit filename="../src/Vector3d.h" /> + <Unit filename="../src/Vector3f.cpp" /> + <Unit filename="../src/Vector3f.h" /> + <Unit filename="../src/Vector3i.cpp" /> + <Unit filename="../src/Vector3i.h" /> + <Unit filename="../src/Vine.h" /> + <Unit filename="../src/WebAdmin.cpp" /> + <Unit filename="../src/WebAdmin.h" /> + <Unit filename="../src/WebPlugin.cpp" /> + <Unit filename="../src/WebPlugin.h" /> + <Unit filename="../src/World.cpp" /> + <Unit filename="../src/World.h" /> + <Unit filename="../src/WorldStorage/FastNBT.cpp" /> + <Unit filename="../src/WorldStorage/FastNBT.h" /> + <Unit filename="../src/WorldStorage/NBTChunkSerializer.cpp" /> + <Unit filename="../src/WorldStorage/NBTChunkSerializer.h" /> + <Unit filename="../src/WorldStorage/WSSAnvil.cpp" /> + <Unit filename="../src/WorldStorage/WSSAnvil.h" /> + <Unit filename="../src/WorldStorage/WSSCompact.cpp" /> + <Unit filename="../src/WorldStorage/WSSCompact.h" /> + <Unit filename="../src/WorldStorage/WorldStorage.cpp" /> + <Unit filename="../src/WorldStorage/WorldStorage.h" /> + <Unit filename="../src/main.cpp" /> + <Unit filename="../lib/md5/md5.cpp" /> + <Unit filename="../lib/md5/md5.h" /> + <Unit filename="../src/tolua++.h" /> + <Unit filename="../src/tolua_base.h" /> <Unit filename="../webadmin/template.html" /> <Unit filename="MCServer.rc"> <Option compilerVar="WINDRES" /> diff --git a/VC2008/MCServer.vcproj b/VC2008/MCServer.vcproj index f9acdd852..2a2ddb4ee 100644 --- a/VC2008/MCServer.vcproj +++ b/VC2008/MCServer.vcproj @@ -42,7 +42,7 @@ Name="VCCLCompilerTool" AdditionalOptions="/MP" Optimization="0" - AdditionalIncludeDirectories=""../zlib-1.2.7";"../jsoncpp-src-0.5.0/include";"../lua-5.1.4/src";"../tolua++-1.0.93/include";..;../expat" + AdditionalIncludeDirectories=""../lib/jsoncpp/include";../lib" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;XML_STATIC" MinimalRebuild="false" BasicRuntimeChecks="3" @@ -121,7 +121,7 @@ EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" WholeProgramOptimization="true" - AdditionalIncludeDirectories=""../zlib-1.2.7";"../jsoncpp-src-0.5.0/include";"../lua-5.1.4/src";"../tolua++-1.0.93/include";..;../expat" + AdditionalIncludeDirectories=""../lib/jsoncpp/include";../lib" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;XML_STATIC" RuntimeLibrary="0" UsePrecompiledHeader="2" @@ -200,7 +200,7 @@ EnableIntrinsicFunctions="true" FavorSizeOrSpeed="1" WholeProgramOptimization="true" - AdditionalIncludeDirectories=""../zlib-1.2.7";"../jsoncpp-src-0.5.0/include";"../lua-5.1.4/src";"../tolua++-1.0.93/include";..;../expat" + AdditionalIncludeDirectories=""../lib/jsoncpp/include";../lib" PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;XML_STATIC" RuntimeLibrary="0" UsePrecompiledHeader="2" @@ -277,7 +277,7 @@ Name="VCCLCompilerTool" AdditionalOptions="/MP" Optimization="0" - AdditionalIncludeDirectories=""../zlib-1.2.7";"../jsoncpp-src-0.5.0/include";"../lua-5.1.4/src";"../tolua++-1.0.93/include";..;../expat" + AdditionalIncludeDirectories=""../lib/jsoncpp/include";../lib" PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;XML_STATIC" MinimalRebuild="false" BasicRuntimeChecks="3" @@ -359,163 +359,163 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File - RelativePath="..\source\Authenticator.cpp" + RelativePath="..\src\Authenticator.cpp" > </File> <File - RelativePath="..\source\Authenticator.h" + RelativePath="..\src\Authenticator.h" > </File> <File - RelativePath="..\source\BlockArea.cpp" + RelativePath="..\src\BlockArea.cpp" > </File> <File - RelativePath="..\source\BlockArea.h" + RelativePath="..\src\BlockArea.h" > </File> <File - RelativePath="..\source\BlockID.cpp" + RelativePath="..\src\BlockID.cpp" > </File> <File - RelativePath="..\source\BlockID.h" + RelativePath="..\src\BlockID.h" > </File> <File - RelativePath="..\source\BlockTracer.h" + RelativePath="..\src\BlockTracer.h" > </File> <File - RelativePath="..\source\BoundingBox.cpp" + RelativePath="..\src\BoundingBox.cpp" > </File> <File - RelativePath="..\source\BoundingBox.h" + RelativePath="..\src\BoundingBox.h" > </File> <File - RelativePath="..\source\ByteBuffer.cpp" + RelativePath="..\src\ByteBuffer.cpp" > </File> <File - RelativePath="..\source\ByteBuffer.h" + RelativePath="..\src\ByteBuffer.h" > </File> <File - RelativePath="..\source\ChatColor.cpp" + RelativePath="..\src\ChatColor.cpp" > </File> <File - RelativePath="..\source\ChatColor.h" + RelativePath="..\src\ChatColor.h" > </File> <File - RelativePath="..\source\Chunk.cpp" + RelativePath="..\src\Chunk.cpp" > </File> <File - RelativePath="..\source\Chunk.h" + RelativePath="..\src\Chunk.h" > </File> <File - RelativePath="..\source\Chunk.inl.h" + RelativePath="..\src\Chunk.inl.h" > </File> <File - RelativePath="..\source\ChunkDef.h" + RelativePath="..\src\ChunkDef.h" > </File> <File - RelativePath="..\source\ChunkMap.cpp" + RelativePath="..\src\ChunkMap.cpp" > </File> <File - RelativePath="..\source\ChunkMap.h" + RelativePath="..\src\ChunkMap.h" > </File> <File - RelativePath="..\source\ChunkSender.cpp" + RelativePath="..\src\ChunkSender.cpp" > </File> <File - RelativePath="..\source\ChunkSender.h" + RelativePath="..\src\ChunkSender.h" > </File> <File - RelativePath="..\source\ClientHandle.cpp" + RelativePath="..\src\ClientHandle.cpp" > </File> <File - RelativePath="..\source\ClientHandle.h" + RelativePath="..\src\ClientHandle.h" > </File> <File - RelativePath="..\source\CommandOutput.cpp" + RelativePath="..\src\CommandOutput.cpp" > </File> <File - RelativePath="..\source\CommandOutput.h" + RelativePath="..\src\CommandOutput.h" > </File> <File - RelativePath="..\source\CraftingRecipes.cpp" + RelativePath="..\src\CraftingRecipes.cpp" > </File> <File - RelativePath="..\source\CraftingRecipes.h" + RelativePath="..\src\CraftingRecipes.h" > </File> <File - RelativePath="..\source\Cuboid.cpp" + RelativePath="..\src\Cuboid.cpp" > </File> <File - RelativePath="..\source\Cuboid.h" + RelativePath="..\src\Cuboid.h" > </File> <File - RelativePath="..\source\DeadlockDetect.cpp" + RelativePath="..\src\DeadlockDetect.cpp" > </File> <File - RelativePath="..\source\DeadlockDetect.h" + RelativePath="..\src\DeadlockDetect.h" > </File> <File - RelativePath="..\source\Defines.h" + RelativePath="..\src\Defines.h" > </File> <File - RelativePath="..\source\Enchantments.cpp" + RelativePath="..\src\Enchantments.cpp" > </File> <File - RelativePath="..\source\Enchantments.h" + RelativePath="..\src\Enchantments.h" > </File> <File - RelativePath="..\source\Endianness.h" + RelativePath="..\src\Endianness.h" > </File> <File - RelativePath="..\source\FastRandom.cpp" + RelativePath="..\src\FastRandom.cpp" > </File> <File - RelativePath="..\source\FastRandom.h" + RelativePath="..\src\FastRandom.h" > </File> <File - RelativePath="..\source\FurnaceRecipe.cpp" + RelativePath="..\src\FurnaceRecipe.cpp" > </File> <File - RelativePath="..\source\FurnaceRecipe.h" + RelativePath="..\src\FurnaceRecipe.h" > </File> <File - RelativePath="..\source\Globals.cpp" + RelativePath="..\src\Globals.cpp" > <FileConfiguration Name="Debug|Win32" @@ -551,55 +551,55 @@ </FileConfiguration> </File> <File - RelativePath="..\source\Globals.h" + RelativePath="..\src\Globals.h" > </File> <File - RelativePath="..\source\Group.cpp" + RelativePath="..\src\Group.cpp" > </File> <File - RelativePath="..\source\Group.h" + RelativePath="..\src\Group.h" > </File> <File - RelativePath="..\source\GroupManager.cpp" + RelativePath="..\src\GroupManager.cpp" > </File> <File - RelativePath="..\source\GroupManager.h" + RelativePath="..\src\GroupManager.h" > </File> <File - RelativePath="..\source\Inventory.cpp" + RelativePath="..\src\Inventory.cpp" > </File> <File - RelativePath="..\source\Inventory.h" + RelativePath="..\src\Inventory.h" > </File> <File - RelativePath="..\source\Item.cpp" + RelativePath="..\src\Item.cpp" > </File> <File - RelativePath="..\source\Item.h" + RelativePath="..\src\Item.h" > </File> <File - RelativePath="..\source\ItemGrid.cpp" + RelativePath="..\src\ItemGrid.cpp" > </File> <File - RelativePath="..\source\ItemGrid.h" + RelativePath="..\src\ItemGrid.h" > </File> <File - RelativePath="..\source\Ladder.h" + RelativePath="..\src\Ladder.h" > </File> <File - RelativePath="..\source\LeakFinder.cpp" + RelativePath="..\src\LeakFinder.cpp" > <FileConfiguration Name="Debug|Win32" @@ -639,115 +639,115 @@ </FileConfiguration> </File> <File - RelativePath="..\source\LeakFinder.h" + RelativePath="..\src\LeakFinder.h" > </File> <File - RelativePath="..\source\LightingThread.cpp" + RelativePath="..\src\LightingThread.cpp" > </File> <File - RelativePath="..\source\LightingThread.h" + RelativePath="..\src\LightingThread.h" > </File> <File - RelativePath="..\source\LinearInterpolation.cpp" + RelativePath="..\src\LinearInterpolation.cpp" > </File> <File - RelativePath="..\source\LinearInterpolation.h" + RelativePath="..\src\LinearInterpolation.h" > </File> <File - RelativePath="..\source\LinearUpscale.h" + RelativePath="..\src\LinearUpscale.h" > </File> <File - RelativePath="..\source\LineBlockTracer.cpp" + RelativePath="..\src\LineBlockTracer.cpp" > </File> <File - RelativePath="..\source\LineBlockTracer.h" + RelativePath="..\src\LineBlockTracer.h" > </File> <File - RelativePath="..\source\Log.cpp" + RelativePath="..\src\Log.cpp" > </File> <File - RelativePath="..\source\Log.h" + RelativePath="..\src\Log.h" > </File> <File - RelativePath="..\source\main.cpp" + RelativePath="..\src\main.cpp" > </File> <File - RelativePath="..\source\Matrix4f.cpp" + RelativePath="..\src\Matrix4f.cpp" > </File> <File - RelativePath="..\source\Matrix4f.h" + RelativePath="..\src\Matrix4f.h" > </File> <File - RelativePath="..\source\MCLogger.cpp" + RelativePath="..\src\MCLogger.cpp" > </File> <File - RelativePath="..\source\MCLogger.h" + RelativePath="..\src\MCLogger.h" > </File> <File - RelativePath="..\source\MemoryLeak.h" + RelativePath="..\src\MemoryLeak.h" > </File> <File - RelativePath="..\source\MersenneTwister.h" + RelativePath="..\src\MersenneTwister.h" > </File> <File - RelativePath="..\source\MobCensus.cpp" + RelativePath="..\src\MobCensus.cpp" > </File> <File - RelativePath="..\source\MobCensus.h" + RelativePath="..\src\MobCensus.h" > </File> <File - RelativePath="..\source\MobFamilyCollecter.cpp" + RelativePath="..\src\MobFamilyCollecter.cpp" > </File> <File - RelativePath="..\source\MobFamilyCollecter.h" + RelativePath="..\src\MobFamilyCollecter.h" > </File> <File - RelativePath="..\source\MobProximityCounter.cpp" + RelativePath="..\src\MobProximityCounter.cpp" > </File> <File - RelativePath="..\source\MobProximityCounter.h" + RelativePath="..\src\MobProximityCounter.h" > </File> <File - RelativePath="..\source\MobSpawner.cpp" + RelativePath="..\src\MobSpawner.cpp" > </File> <File - RelativePath="..\source\MobSpawner.h" + RelativePath="..\src\MobSpawner.h" > </File> <File - RelativePath="..\source\MonsterConfig.cpp" + RelativePath="..\src\MonsterConfig.cpp" > </File> <File - RelativePath="..\source\MonsterConfig.h" + RelativePath="..\src\MonsterConfig.h" > </File> <File - RelativePath="..\source\Noise.cpp" + RelativePath="..\src\Noise.cpp" > <FileConfiguration Name="Debug|Win32" @@ -777,63 +777,63 @@ </FileConfiguration> </File> <File - RelativePath="..\source\Noise.h" + RelativePath="..\src\Noise.h" > </File> <File - RelativePath="..\source\Piston.cpp" + RelativePath="..\src\Piston.cpp" > </File> <File - RelativePath="..\source\Piston.h" + RelativePath="..\src\Piston.h" > </File> <File - RelativePath="..\source\ProbabDistrib.cpp" + RelativePath="..\src\ProbabDistrib.cpp" > </File> <File - RelativePath="..\source\ProbabDistrib.h" + RelativePath="..\src\ProbabDistrib.h" > </File> <File - RelativePath="..\source\RCONServer.cpp" + RelativePath="..\src\RCONServer.cpp" > </File> <File - RelativePath="..\source\RCONServer.h" + RelativePath="..\src\RCONServer.h" > </File> <File - RelativePath="..\source\ReferenceManager.cpp" + RelativePath="..\src\ReferenceManager.cpp" > </File> <File - RelativePath="..\source\ReferenceManager.h" + RelativePath="..\src\ReferenceManager.h" > </File> <File - RelativePath="..\source\Root.cpp" + RelativePath="..\src\Root.cpp" > </File> <File - RelativePath="..\source\Root.h" + RelativePath="..\src\Root.h" > </File> <File - RelativePath="..\source\Server.cpp" + RelativePath="..\src\Server.cpp" > </File> <File - RelativePath="..\source\Server.h" + RelativePath="..\src\Server.h" > </File> <File - RelativePath="..\source\Sign.h" + RelativePath="..\src\Sign.h" > </File> <File - RelativePath="..\source\StackWalker.cpp" + RelativePath="..\src\StackWalker.cpp" > <FileConfiguration Name="Debug|Win32" @@ -873,330 +873,330 @@ </FileConfiguration> </File> <File - RelativePath="..\source\StackWalker.h" + RelativePath="..\src\StackWalker.h" > </File> <File - RelativePath="..\source\StringCompression.cpp" + RelativePath="..\src\StringCompression.cpp" > </File> <File - RelativePath="..\source\StringCompression.h" + RelativePath="..\src\StringCompression.h" > </File> <File - RelativePath="..\source\StringUtils.cpp" + RelativePath="..\src\StringUtils.cpp" > </File> <File - RelativePath="..\source\StringUtils.h" + RelativePath="..\src\StringUtils.h" > </File> <File - RelativePath="..\source\Tracer.cpp" + RelativePath="..\src\Tracer.cpp" > </File> <File - RelativePath="..\source\Tracer.h" + RelativePath="..\src\Tracer.h" > </File> <File - RelativePath="..\source\Vector3d.cpp" + RelativePath="..\src\Vector3d.cpp" > </File> <File - RelativePath="..\source\Vector3d.h" + RelativePath="..\src\Vector3d.h" > </File> <File - RelativePath="..\source\Vector3f.cpp" + RelativePath="..\src\Vector3f.cpp" > </File> <File - RelativePath="..\source\Vector3f.h" + RelativePath="..\src\Vector3f.h" > </File> <File - RelativePath="..\source\Vector3i.cpp" + RelativePath="..\src\Vector3i.cpp" > </File> <File - RelativePath="..\source\Vector3i.h" + RelativePath="..\src\Vector3i.h" > </File> <File - RelativePath="..\source\WebAdmin.cpp" + RelativePath="..\src\WebAdmin.cpp" > </File> <File - RelativePath="..\source\WebAdmin.h" + RelativePath="..\src\WebAdmin.h" > </File> <File - RelativePath="..\source\World.cpp" + RelativePath="..\src\World.cpp" > </File> <File - RelativePath="..\source\World.h" + RelativePath="..\src\World.h" > </File> <Filter Name="Mobs" > <File - RelativePath="..\source\Mobs\AggressiveMonster.cpp" + RelativePath="..\src\Mobs\AggressiveMonster.cpp" > </File> <File - RelativePath="..\source\Mobs\AggressiveMonster.h" + RelativePath="..\src\Mobs\AggressiveMonster.h" > </File> <File - RelativePath="..\source\Mobs\Bat.cpp" + RelativePath="..\src\Mobs\Bat.cpp" > </File> <File - RelativePath="..\source\Mobs\Bat.h" + RelativePath="..\src\Mobs\Bat.h" > </File> <File - RelativePath="..\source\Mobs\Blaze.cpp" + RelativePath="..\src\Mobs\Blaze.cpp" > </File> <File - RelativePath="..\source\Mobs\Blaze.h" + RelativePath="..\src\Mobs\Blaze.h" > </File> <File - RelativePath="..\source\Mobs\Cavespider.cpp" + RelativePath="..\src\Mobs\Cavespider.cpp" > </File> <File - RelativePath="..\source\Mobs\Cavespider.h" + RelativePath="..\src\Mobs\Cavespider.h" > </File> <File - RelativePath="..\source\Mobs\Chicken.cpp" + RelativePath="..\src\Mobs\Chicken.cpp" > </File> <File - RelativePath="..\source\Mobs\Chicken.h" + RelativePath="..\src\Mobs\Chicken.h" > </File> <File - RelativePath="..\source\Mobs\Cow.cpp" + RelativePath="..\src\Mobs\Cow.cpp" > </File> <File - RelativePath="..\source\Mobs\Cow.h" + RelativePath="..\src\Mobs\Cow.h" > </File> <File - RelativePath="..\source\Mobs\Creeper.cpp" + RelativePath="..\src\Mobs\Creeper.cpp" > </File> <File - RelativePath="..\source\Mobs\Creeper.h" + RelativePath="..\src\Mobs\Creeper.h" > </File> <File - RelativePath="..\source\Mobs\EnderDragon.cpp" + RelativePath="..\src\Mobs\EnderDragon.cpp" > </File> <File - RelativePath="..\source\Mobs\EnderDragon.h" + RelativePath="..\src\Mobs\EnderDragon.h" > </File> <File - RelativePath="..\source\Mobs\Enderman.cpp" + RelativePath="..\src\Mobs\Enderman.cpp" > </File> <File - RelativePath="..\source\Mobs\Enderman.h" + RelativePath="..\src\Mobs\Enderman.h" > </File> <File - RelativePath="..\source\Mobs\Ghast.cpp" + RelativePath="..\src\Mobs\Ghast.cpp" > </File> <File - RelativePath="..\source\Mobs\Ghast.h" + RelativePath="..\src\Mobs\Ghast.h" > </File> <File - RelativePath="..\source\Mobs\Giant.cpp" + RelativePath="..\src\Mobs\Giant.cpp" > </File> <File - RelativePath="..\source\Mobs\Giant.h" + RelativePath="..\src\Mobs\Giant.h" > </File> <File - RelativePath="..\source\Mobs\Horse.cpp" + RelativePath="..\src\Mobs\Horse.cpp" > </File> <File - RelativePath="..\source\Mobs\Horse.h" + RelativePath="..\src\Mobs\Horse.h" > </File> <File - RelativePath="..\source\Mobs\IronGolem.cpp" + RelativePath="..\src\Mobs\IronGolem.cpp" > </File> <File - RelativePath="..\source\Mobs\IronGolem.h" + RelativePath="..\src\Mobs\IronGolem.h" > </File> <File - RelativePath="..\source\Mobs\MagmaCube.cpp" + RelativePath="..\src\Mobs\MagmaCube.cpp" > </File> <File - RelativePath="..\source\Mobs\MagmaCube.h" + RelativePath="..\src\Mobs\MagmaCube.h" > </File> <File - RelativePath="..\source\Mobs\Monster.cpp" + RelativePath="..\src\Mobs\Monster.cpp" > </File> <File - RelativePath="..\source\Mobs\Monster.h" + RelativePath="..\src\Mobs\Monster.h" > </File> <File - RelativePath="..\source\Mobs\Mooshroom.cpp" + RelativePath="..\src\Mobs\Mooshroom.cpp" > </File> <File - RelativePath="..\source\Mobs\Mooshroom.h" + RelativePath="..\src\Mobs\Mooshroom.h" > </File> <File - RelativePath="..\source\Mobs\Ocelot.h" + RelativePath="..\src\Mobs\Ocelot.h" > </File> <File - RelativePath="..\source\Mobs\PassiveAggressiveMonster.cpp" + RelativePath="..\src\Mobs\PassiveAggressiveMonster.cpp" > </File> <File - RelativePath="..\source\Mobs\PassiveAggressiveMonster.h" + RelativePath="..\src\Mobs\PassiveAggressiveMonster.h" > </File> <File - RelativePath="..\source\Mobs\PassiveMonster.cpp" + RelativePath="..\src\Mobs\PassiveMonster.cpp" > </File> <File - RelativePath="..\source\Mobs\PassiveMonster.h" + RelativePath="..\src\Mobs\PassiveMonster.h" > </File> <File - RelativePath="..\source\Mobs\Pig.cpp" + RelativePath="..\src\Mobs\Pig.cpp" > </File> <File - RelativePath="..\source\Mobs\Pig.h" + RelativePath="..\src\Mobs\Pig.h" > </File> <File - RelativePath="..\source\Mobs\Sheep.cpp" + RelativePath="..\src\Mobs\Sheep.cpp" > </File> <File - RelativePath="..\source\Mobs\Sheep.h" + RelativePath="..\src\Mobs\Sheep.h" > </File> <File - RelativePath="..\source\Mobs\Silverfish.h" + RelativePath="..\src\Mobs\Silverfish.h" > </File> <File - RelativePath="..\source\Mobs\Skeleton.cpp" + RelativePath="..\src\Mobs\Skeleton.cpp" > </File> <File - RelativePath="..\source\Mobs\Skeleton.h" + RelativePath="..\src\Mobs\Skeleton.h" > </File> <File - RelativePath="..\source\Mobs\Slime.cpp" + RelativePath="..\src\Mobs\Slime.cpp" > </File> <File - RelativePath="..\source\Mobs\Slime.h" + RelativePath="..\src\Mobs\Slime.h" > </File> <File - RelativePath="..\source\Mobs\SnowGolem.cpp" + RelativePath="..\src\Mobs\SnowGolem.cpp" > </File> <File - RelativePath="..\source\Mobs\SnowGolem.h" + RelativePath="..\src\Mobs\SnowGolem.h" > </File> <File - RelativePath="..\source\Mobs\Spider.cpp" + RelativePath="..\src\Mobs\Spider.cpp" > </File> <File - RelativePath="..\source\Mobs\Spider.h" + RelativePath="..\src\Mobs\Spider.h" > </File> <File - RelativePath="..\source\Mobs\Squid.cpp" + RelativePath="..\src\Mobs\Squid.cpp" > </File> <File - RelativePath="..\source\Mobs\Squid.h" + RelativePath="..\src\Mobs\Squid.h" > </File> <File - RelativePath="..\source\Mobs\Villager.cpp" + RelativePath="..\src\Mobs\Villager.cpp" > </File> <File - RelativePath="..\source\Mobs\Villager.h" + RelativePath="..\src\Mobs\Villager.h" > </File> <File - RelativePath="..\source\Mobs\Witch.cpp" + RelativePath="..\src\Mobs\Witch.cpp" > </File> <File - RelativePath="..\source\Mobs\Witch.h" + RelativePath="..\src\Mobs\Witch.h" > </File> <File - RelativePath="..\source\Mobs\Wither.cpp" + RelativePath="..\src\Mobs\Wither.cpp" > </File> <File - RelativePath="..\source\Mobs\Wither.h" + RelativePath="..\src\Mobs\Wither.h" > </File> <File - RelativePath="..\source\Mobs\Wolf.cpp" + RelativePath="..\src\Mobs\Wolf.cpp" > </File> <File - RelativePath="..\source\Mobs\Wolf.h" + RelativePath="..\src\Mobs\Wolf.h" > </File> <File - RelativePath="..\source\Mobs\Zombie.cpp" + RelativePath="..\src\Mobs\Zombie.cpp" > </File> <File - RelativePath="..\source\Mobs\Zombie.h" + RelativePath="..\src\Mobs\Zombie.h" > </File> <File - RelativePath="..\source\Mobs\ZombiePigman.cpp" + RelativePath="..\src\Mobs\ZombiePigman.cpp" > </File> <File - RelativePath="..\source\Mobs\ZombiePigman.h" + RelativePath="..\src\Mobs\ZombiePigman.h" > </File> </Filter> @@ -1204,83 +1204,87 @@ Name="Entities" > <File - RelativePath="..\source\Entities\Boat.cpp" + RelativePath="..\src\Entities\Boat.cpp" > </File> <File - RelativePath="..\source\Entities\Boat.h" + RelativePath="..\src\Entities\Boat.h" > </File> <File - RelativePath="..\source\Entities\Entity.cpp" + RelativePath="..\src\Entities\Entity.cpp" > </File> <File - RelativePath="..\source\Entities\Entity.h" + RelativePath="..\src\Entities\Entity.h" > </File> <File - RelativePath="..\source\Entities\FallingBlock.cpp" + RelativePath="..\src\Entities\ExpOrb.cpp" > </File> <File - RelativePath="..\source\Entities\FallingBlock.h" + RelativePath="..\src\Entities\ExpOrb.h" > </File> <File - RelativePath="..\source\Entities\Minecart.cpp" + RelativePath="..\src\Entities\FallingBlock.cpp" > </File> <File - RelativePath="..\source\Entities\Minecart.h" + RelativePath="..\src\Entities\FallingBlock.h" > </File> <File - RelativePath="..\source\Entities\Pawn.cpp" + RelativePath="..\src\Entities\Minecart.cpp" > </File> <File - RelativePath="..\source\Entities\Pawn.h" + RelativePath="..\src\Entities\Minecart.h" > </File> <File - RelativePath="..\source\Entities\Pickup.cpp" + RelativePath="..\src\Entities\Pawn.cpp" > </File> <File - RelativePath="..\source\Entities\Pickup.h" + RelativePath="..\src\Entities\Pawn.h" > </File> <File - RelativePath="..\source\Entities\Player.cpp" + RelativePath="..\src\Entities\Pickup.cpp" > </File> <File - RelativePath="..\source\Entities\Player.h" + RelativePath="..\src\Entities\Pickup.h" > </File> <File - RelativePath="..\source\Entities\ProjectileEntity.cpp" + RelativePath="..\src\Entities\Player.cpp" > </File> <File - RelativePath="..\source\Entities\ProjectileEntity.h" + RelativePath="..\src\Entities\Player.h" > </File> <File - RelativePath="..\source\Entities\ExpOrb.cpp" + RelativePath="..\src\Entities\ProjectileEntity.cpp" > </File> <File - RelativePath="..\source\Entities\ExpOrb.h" + RelativePath="..\src\Entities\ProjectileEntity.h" > </File> <File - RelativePath="..\source\Entities\TNTEntity.cpp" + RelativePath="..\src\Entities\TNTEntity.cpp" > </File> <File - RelativePath="..\source\Entities\TNTEntity.h" + RelativePath="..\src\Entities\TNTEntity.cpp" + > + </File> + <File + RelativePath="..\src\Entities\TNTEntity.h" > </File> </Filter> @@ -1288,23 +1292,23 @@ Name="UI" > <File - RelativePath="..\source\UI\SlotArea.cpp" + RelativePath="..\src\UI\SlotArea.cpp" > </File> <File - RelativePath="..\source\UI\SlotArea.h" + RelativePath="..\src\UI\SlotArea.h" > </File> <File - RelativePath="..\source\UI\Window.cpp" + RelativePath="..\src\UI\Window.cpp" > </File> <File - RelativePath="..\source\UI\Window.h" + RelativePath="..\src\UI\Window.h" > </File> <File - RelativePath="..\source\UI\WindowOwner.h" + RelativePath="..\src\UI\WindowOwner.h" > </File> </Filter> @@ -1312,79 +1316,79 @@ Name="Simulator" > <File - RelativePath="..\source\Simulator\DelayedFluidSimulator.cpp" + RelativePath="..\src\Simulator\DelayedFluidSimulator.cpp" > </File> <File - RelativePath="..\source\Simulator\DelayedFluidSimulator.h" + RelativePath="..\src\Simulator\DelayedFluidSimulator.h" > </File> <File - RelativePath="..\source\Simulator\FireSimulator.cpp" + RelativePath="..\src\Simulator\FireSimulator.cpp" > </File> <File - RelativePath="..\source\Simulator\FireSimulator.h" + RelativePath="..\src\Simulator\FireSimulator.h" > </File> <File - RelativePath="..\source\Simulator\FloodyFluidSimulator.cpp" + RelativePath="..\src\Simulator\FloodyFluidSimulator.cpp" > </File> <File - RelativePath="..\source\Simulator\FloodyFluidSimulator.h" + RelativePath="..\src\Simulator\FloodyFluidSimulator.h" > </File> <File - RelativePath="..\source\Simulator\FluidSimulator.cpp" + RelativePath="..\src\Simulator\FluidSimulator.cpp" > </File> <File - RelativePath="..\source\Simulator\FluidSimulator.h" + RelativePath="..\src\Simulator\FluidSimulator.h" > </File> <File - RelativePath="..\source\Simulator\NoopFluidSimulator.h" + RelativePath="..\src\Simulator\NoopFluidSimulator.h" > </File> <File - RelativePath="..\source\Simulator\RedstoneSimulator.cpp" + RelativePath="..\src\Simulator\RedstoneSimulator.cpp" > </File> <File - RelativePath="..\source\Simulator\RedstoneSimulator.h" + RelativePath="..\src\Simulator\RedstoneSimulator.h" > </File> <File - RelativePath="..\source\Simulator\SandSimulator.cpp" + RelativePath="..\src\Simulator\SandSimulator.cpp" > </File> <File - RelativePath="..\source\Simulator\SandSimulator.h" + RelativePath="..\src\Simulator\SandSimulator.h" > </File> <File - RelativePath="..\source\Simulator\Simulator.cpp" + RelativePath="..\src\Simulator\Simulator.cpp" > </File> <File - RelativePath="..\source\Simulator\Simulator.h" + RelativePath="..\src\Simulator\Simulator.h" > </File> <File - RelativePath="..\source\Simulator\SimulatorManager.cpp" + RelativePath="..\src\Simulator\SimulatorManager.cpp" > </File> <File - RelativePath="..\source\Simulator\SimulatorManager.h" + RelativePath="..\src\Simulator\SimulatorManager.h" > </File> <File - RelativePath="..\source\Simulator\VaporizeFluidSimulator.cpp" + RelativePath="..\src\Simulator\VaporizeFluidSimulator.cpp" > </File> <File - RelativePath="..\source\Simulator\VaporizeFluidSimulator.h" + RelativePath="..\src\Simulator\VaporizeFluidSimulator.h" > </File> </Filter> @@ -1392,107 +1396,107 @@ Name="OSSupport" > <File - RelativePath="..\source\OSSupport\BlockingTCPLink.cpp" + RelativePath="..\src\OSSupport\BlockingTCPLink.cpp" > </File> <File - RelativePath="..\source\OSSupport\BlockingTCPLink.h" + RelativePath="..\src\OSSupport\BlockingTCPLink.h" > </File> <File - RelativePath="..\source\OSSupport\CriticalSection.cpp" + RelativePath="..\src\OSSupport\CriticalSection.cpp" > </File> <File - RelativePath="..\source\OSSupport\CriticalSection.h" + RelativePath="..\src\OSSupport\CriticalSection.h" > </File> <File - RelativePath="..\source\OSSupport\Event.cpp" + RelativePath="..\src\OSSupport\Event.cpp" > </File> <File - RelativePath="..\source\OSSupport\Event.h" + RelativePath="..\src\OSSupport\Event.h" > </File> <File - RelativePath="..\source\OSSupport\File.cpp" + RelativePath="..\src\OSSupport\File.cpp" > </File> <File - RelativePath="..\source\OSSupport\File.h" + RelativePath="..\src\OSSupport\File.h" > </File> <File - RelativePath="..\source\OSSupport\GZipFile.cpp" + RelativePath="..\src\OSSupport\GZipFile.cpp" > </File> <File - RelativePath="..\source\OSSupport\GZipFile.h" + RelativePath="..\src\OSSupport\GZipFile.h" > </File> <File - RelativePath="..\source\OSSupport\IsThread.cpp" + RelativePath="..\src\OSSupport\IsThread.cpp" > </File> <File - RelativePath="..\source\OSSupport\IsThread.h" + RelativePath="..\src\OSSupport\IsThread.h" > </File> <File - RelativePath="..\source\OSSupport\ListenThread.cpp" + RelativePath="..\src\OSSupport\ListenThread.cpp" > </File> <File - RelativePath="..\source\OSSupport\ListenThread.h" + RelativePath="..\src\OSSupport\ListenThread.h" > </File> <File - RelativePath="..\source\OSSupport\Semaphore.cpp" + RelativePath="..\src\OSSupport\Semaphore.cpp" > </File> <File - RelativePath="..\source\OSSupport\Semaphore.h" + RelativePath="..\src\OSSupport\Semaphore.h" > </File> <File - RelativePath="..\source\OSSupport\Sleep.cpp" + RelativePath="..\src\OSSupport\Sleep.cpp" > </File> <File - RelativePath="..\source\OSSupport\Sleep.h" + RelativePath="..\src\OSSupport\Sleep.h" > </File> <File - RelativePath="..\source\OSSupport\Socket.cpp" + RelativePath="..\src\OSSupport\Socket.cpp" > </File> <File - RelativePath="..\source\OSSupport\Socket.h" + RelativePath="..\src\OSSupport\Socket.h" > </File> <File - RelativePath="..\source\OSSupport\SocketThreads.cpp" + RelativePath="..\src\OSSupport\SocketThreads.cpp" > </File> <File - RelativePath="..\source\OSSupport\SocketThreads.h" + RelativePath="..\src\OSSupport\SocketThreads.h" > </File> <File - RelativePath="..\source\OSSupport\Thread.cpp" + RelativePath="..\src\OSSupport\Thread.cpp" > </File> <File - RelativePath="..\source\OSSupport\Thread.h" + RelativePath="..\src\OSSupport\Thread.h" > </File> <File - RelativePath="..\source\OSSupport\Timer.cpp" + RelativePath="..\src\OSSupport\Timer.cpp" > </File> <File - RelativePath="..\source\OSSupport\Timer.h" + RelativePath="..\src\OSSupport\Timer.h" > </File> <Filter @@ -1684,7 +1688,7 @@ Name="Bindings" > <File - RelativePath="..\source\AllToLua.pkg" + RelativePath="..\src\AllToLua.pkg" > <FileConfiguration Name="Debug|Win32" @@ -1693,7 +1697,7 @@ <Tool Name="VCCustomBuildTool" CommandLine="GenerateBindings.cmd
" - AdditionalDependencies=""cTorch.h";"cStairs.h";"cLadder.h";"../iniFile/iniFile.h";"BlockID.h";"PacketID.h";"Defines.h";"LuaFunctions.h";"cStringMap.h";"cChatColor.h";"cClientHandle.h";"cEntity.h";"cPawn.h";"cPlayer.h";"cPluginManager.h";"cPlugin.h";"cPlugin_NewLua.h";"cPlugin_Lua.h";"cServer.h";"cWorld.h";"cInventory.h";"cItem.h";"cWebAdmin.h";"cWebPlugin.h";"cWebPlugin_Lua.h";"cPickup.h";"cRoot.h";"cTCPLink.h";"Vector3f.h";"Vector3d.h";"Vector3i.h";"Matrix4f.h";"cCuboid.h";"cMCLogger.h";"cTracer.h";"cGroup.h";"BlockArea.h";"packets/cPacket_Login.h";"packets/cPacket_BlockDig.h";"packets/cPacket_BlockPlace.h"" + AdditionalDependencies=""cTorch.h";"cStairs.h";"cLadder.h";"../lib/inifile/iniFile.h";"BlockID.h";"PacketID.h";"Defines.h";"LuaFunctions.h";"cStringMap.h";"cChatColor.h";"cClientHandle.h";"cEntity.h";"cPawn.h";"cPlayer.h";"cPluginManager.h";"cPlugin.h";"cPlugin_NewLua.h";"cPlugin_Lua.h";"cServer.h";"cWorld.h";"cInventory.h";"cItem.h";"cWebAdmin.h";"cWebPlugin.h";"cWebPlugin_Lua.h";"cPickup.h";"cRoot.h";"cTCPLink.h";"Vector3f.h";"Vector3d.h";"Vector3i.h";"Matrix4f.h";"cCuboid.h";"cMCLogger.h";"cTracer.h";"cGroup.h";"BlockArea.h";"packets/cPacket_Login.h";"packets/cPacket_BlockDig.h";"packets/cPacket_BlockPlace.h"" Outputs="Bindings.cpp" /> </FileConfiguration> @@ -1704,7 +1708,7 @@ <Tool Name="VCCustomBuildTool" CommandLine="GenerateBindings.cmd
" - AdditionalDependencies=""cTorch.h";"cStairs.h";"cLadder.h";"../iniFile/iniFile.h";"BlockID.h";"PacketID.h";"Defines.h";"LuaFunctions.h";"cStringMap.h";"cChatColor.h";"cClientHandle.h";"cEntity.h";"cPawn.h";"cPlayer.h";"cPluginManager.h";"cPlugin.h";"cPlugin_NewLua.h";"cPlugin_Lua.h";"cServer.h";"cWorld.h";"cInventory.h";"cItem.h";"cWebAdmin.h";"cWebPlugin.h";"cWebPlugin_Lua.h";"cPickup.h";"cRoot.h";"cTCPLink.h";"Vector3f.h";"Vector3d.h";"Vector3i.h";"Matrix4f.h";"cCuboid.h";"cMCLogger.h";"cTracer.h";"cGroup.h";"BlockArea.h";"packets/cPacket_Login.h";"packets/cPacket_BlockDig.h";"packets/cPacket_BlockPlace.h"" + AdditionalDependencies=""cTorch.h";"cStairs.h";"cLadder.h";"../lib/inifile/iniFile.h";"BlockID.h";"PacketID.h";"Defines.h";"LuaFunctions.h";"cStringMap.h";"cChatColor.h";"cClientHandle.h";"cEntity.h";"cPawn.h";"cPlayer.h";"cPluginManager.h";"cPlugin.h";"cPlugin_NewLua.h";"cPlugin_Lua.h";"cServer.h";"cWorld.h";"cInventory.h";"cItem.h";"cWebAdmin.h";"cWebPlugin.h";"cWebPlugin_Lua.h";"cPickup.h";"cRoot.h";"cTCPLink.h";"Vector3f.h";"Vector3d.h";"Vector3i.h";"Matrix4f.h";"cCuboid.h";"cMCLogger.h";"cTracer.h";"cGroup.h";"BlockArea.h";"packets/cPacket_Login.h";"packets/cPacket_BlockDig.h";"packets/cPacket_BlockPlace.h"" Outputs="Bindings.cpp" /> </FileConfiguration> @@ -1715,7 +1719,7 @@ <Tool Name="VCCustomBuildTool" CommandLine="GenerateBindings.cmd
" - AdditionalDependencies=""cTorch.h";"cStairs.h";"cLadder.h";"../iniFile/iniFile.h";"BlockID.h";"PacketID.h";"Defines.h";"LuaFunctions.h";"cStringMap.h";"cChatColor.h";"cClientHandle.h";"cEntity.h";"cPawn.h";"cPlayer.h";"cPluginManager.h";"cPlugin.h";"cPlugin_NewLua.h";"cPlugin_Lua.h";"cServer.h";"cWorld.h";"cInventory.h";"cItem.h";"cWebAdmin.h";"cWebPlugin.h";"cWebPlugin_Lua.h";"cPickup.h";"cRoot.h";"cTCPLink.h";"Vector3f.h";"Vector3d.h";"Vector3i.h";"Matrix4f.h";"cCuboid.h";"cMCLogger.h";"cTracer.h";"cGroup.h";"BlockArea.h";"packets/cPacket_Login.h";"packets/cPacket_BlockDig.h";"packets/cPacket_BlockPlace.h"" + AdditionalDependencies=""cTorch.h";"cStairs.h";"cLadder.h";"../lib/inifile/iniFile.h";"BlockID.h";"PacketID.h";"Defines.h";"LuaFunctions.h";"cStringMap.h";"cChatColor.h";"cClientHandle.h";"cEntity.h";"cPawn.h";"cPlayer.h";"cPluginManager.h";"cPlugin.h";"cPlugin_NewLua.h";"cPlugin_Lua.h";"cServer.h";"cWorld.h";"cInventory.h";"cItem.h";"cWebAdmin.h";"cWebPlugin.h";"cWebPlugin_Lua.h";"cPickup.h";"cRoot.h";"cTCPLink.h";"Vector3f.h";"Vector3d.h";"Vector3i.h";"Matrix4f.h";"cCuboid.h";"cMCLogger.h";"cTracer.h";"cGroup.h";"BlockArea.h";"packets/cPacket_Login.h";"packets/cPacket_BlockDig.h";"packets/cPacket_BlockPlace.h"" Outputs="Bindings.cpp" /> </FileConfiguration> @@ -1726,7 +1730,7 @@ <Tool Name="VCCustomBuildTool" CommandLine="GenerateBindings.cmd
" - AdditionalDependencies=""cTorch.h";"cStairs.h";"cLadder.h";"../iniFile/iniFile.h";"BlockID.h";"PacketID.h";"Defines.h";"LuaFunctions.h";"cStringMap.h";"cChatColor.h";"cClientHandle.h";"cEntity.h";"cPawn.h";"cPlayer.h";"cPluginManager.h";"cPlugin.h";"cPlugin_NewLua.h";"cPlugin_Lua.h";"cServer.h";"cWorld.h";"cInventory.h";"cItem.h";"cWebAdmin.h";"cWebPlugin.h";"cWebPlugin_Lua.h";"cPickup.h";"cRoot.h";"cTCPLink.h";"Vector3f.h";"Vector3d.h";"Vector3i.h";"Matrix4f.h";"cCuboid.h";"cMCLogger.h";"cTracer.h";"cGroup.h";"BlockArea.h";"packets/cPacket_Login.h";"packets/cPacket_BlockDig.h";"packets/cPacket_BlockPlace.h"" + AdditionalDependencies=""cTorch.h";"cStairs.h";"cLadder.h";"../lib/inifile/iniFile.h";"BlockID.h";"PacketID.h";"Defines.h";"LuaFunctions.h";"cStringMap.h";"cChatColor.h";"cClientHandle.h";"cEntity.h";"cPawn.h";"cPlayer.h";"cPluginManager.h";"cPlugin.h";"cPlugin_NewLua.h";"cPlugin_Lua.h";"cServer.h";"cWorld.h";"cInventory.h";"cItem.h";"cWebAdmin.h";"cWebPlugin.h";"cWebPlugin_Lua.h";"cPickup.h";"cRoot.h";"cTCPLink.h";"Vector3f.h";"Vector3d.h";"Vector3i.h";"Matrix4f.h";"cCuboid.h";"cMCLogger.h";"cTracer.h";"cGroup.h";"BlockArea.h";"packets/cPacket_Login.h";"packets/cPacket_BlockDig.h";"packets/cPacket_BlockPlace.h"" Outputs="Bindings.cpp" /> </FileConfiguration> @@ -1736,7 +1740,7 @@ > </File> <File - RelativePath="..\source\Bindings.cpp" + RelativePath="..\src\Bindings.cpp" > <FileConfiguration Name="Debug|Win32" @@ -1772,75 +1776,75 @@ </FileConfiguration> </File> <File - RelativePath="..\source\Bindings.h" + RelativePath="..\src\Bindings.h" > </File> <File - RelativePath="..\source\LuaFunctions.h" + RelativePath="..\src\LuaFunctions.h" > </File> <File - RelativePath="..\source\LuaState.cpp" + RelativePath="..\src\LuaState.cpp" > </File> <File - RelativePath="..\source\LuaState.h" + RelativePath="..\src\LuaState.h" > </File> <File - RelativePath="..\source\LuaWindow.cpp" + RelativePath="..\src\LuaWindow.cpp" > </File> <File - RelativePath="..\source\LuaWindow.h" + RelativePath="..\src\LuaWindow.h" > </File> <File - RelativePath="..\source\ManualBindings.cpp" + RelativePath="..\src\ManualBindings.cpp" > </File> <File - RelativePath="..\source\ManualBindings.h" + RelativePath="..\src\ManualBindings.h" > </File> <File - RelativePath="..\source\Plugin.cpp" + RelativePath="..\src\Plugin.cpp" > </File> <File - RelativePath="..\source\Plugin.h" + RelativePath="..\src\Plugin.h" > </File> <File - RelativePath="..\source\PluginLua.cpp" + RelativePath="..\src\PluginLua.cpp" > </File> <File - RelativePath="..\source\PluginLua.h" + RelativePath="..\src\PluginLua.h" > </File> <File - RelativePath="..\source\PluginManager.cpp" + RelativePath="..\src\PluginManager.cpp" > </File> <File - RelativePath="..\source\PluginManager.h" + RelativePath="..\src\PluginManager.h" > </File> <File - RelativePath="..\source\tolua++.h" + RelativePath="..\src\tolua++.h" > </File> <File - RelativePath="..\source\tolua_base.h" + RelativePath="..\src\tolua_base.h" > </File> <File - RelativePath="..\source\WebPlugin.cpp" + RelativePath="..\src\WebPlugin.cpp" > </File> <File - RelativePath="..\source\WebPlugin.h" + RelativePath="..\src\WebPlugin.h" > </File> </Filter> @@ -1848,15 +1852,15 @@ Name="External" > <File - RelativePath="..\iniFile\iniFile.cpp" + RelativePath="..\lib\inifile\iniFile.cpp" > </File> <File - RelativePath="..\iniFile\iniFile.h" + RelativePath="..\lib\inifile\iniFile.h" > </File> <File - RelativePath="..\source\md5\md5.cpp" + RelativePath="..\lib\md5\md5.cpp" > <FileConfiguration Name="Debug|Win32" @@ -1896,7 +1900,7 @@ </FileConfiguration> </File> <File - RelativePath="..\source\md5\md5.h" + RelativePath="..\lib\md5\md5.h" > </File> </Filter> @@ -1904,43 +1908,43 @@ Name="WorldStorage" > <File - RelativePath="..\source\WorldStorage\FastNBT.cpp" + RelativePath="..\src\WorldStorage\FastNBT.cpp" > </File> <File - RelativePath="..\source\WorldStorage\FastNBT.h" + RelativePath="..\src\WorldStorage\FastNBT.h" > </File> <File - RelativePath="..\source\WorldStorage\NBTChunkSerializer.cpp" + RelativePath="..\src\WorldStorage\NBTChunkSerializer.cpp" > </File> <File - RelativePath="..\source\WorldStorage\NBTChunkSerializer.h" + RelativePath="..\src\WorldStorage\NBTChunkSerializer.h" > </File> <File - RelativePath="..\source\WorldStorage\WorldStorage.cpp" + RelativePath="..\src\WorldStorage\WorldStorage.cpp" > </File> <File - RelativePath="..\source\WorldStorage\WorldStorage.h" + RelativePath="..\src\WorldStorage\WorldStorage.h" > </File> <File - RelativePath="..\source\WorldStorage\WSSAnvil.cpp" + RelativePath="..\src\WorldStorage\WSSAnvil.cpp" > </File> <File - RelativePath="..\source\WorldStorage\WSSAnvil.h" + RelativePath="..\src\WorldStorage\WSSAnvil.h" > </File> <File - RelativePath="..\source\WorldStorage\WSSCompact.cpp" + RelativePath="..\src\WorldStorage\WSSCompact.cpp" > </File> <File - RelativePath="..\source\WorldStorage\WSSCompact.h" + RelativePath="..\src\WorldStorage\WSSCompact.h" > </File> </Filter> @@ -1948,123 +1952,123 @@ Name="Generating" > <File - RelativePath="..\source\Generating\BioGen.cpp" + RelativePath="..\src\Generating\BioGen.cpp" > </File> <File - RelativePath="..\source\Generating\BioGen.h" + RelativePath="..\src\Generating\BioGen.h" > </File> <File - RelativePath="..\source\Generating\Caves.cpp" + RelativePath="..\src\Generating\Caves.cpp" > </File> <File - RelativePath="..\source\Generating\Caves.h" + RelativePath="..\src\Generating\Caves.h" > </File> <File - RelativePath="..\source\Generating\ChunkDesc.cpp" + RelativePath="..\src\Generating\ChunkDesc.cpp" > </File> <File - RelativePath="..\source\Generating\ChunkDesc.h" + RelativePath="..\src\Generating\ChunkDesc.h" > </File> <File - RelativePath="..\source\Generating\ChunkGenerator.cpp" + RelativePath="..\src\Generating\ChunkGenerator.cpp" > </File> <File - RelativePath="..\source\Generating\ChunkGenerator.h" + RelativePath="..\src\Generating\ChunkGenerator.h" > </File> <File - RelativePath="..\source\Generating\CompoGen.cpp" + RelativePath="..\src\Generating\CompoGen.cpp" > </File> <File - RelativePath="..\source\Generating\CompoGen.h" + RelativePath="..\src\Generating\CompoGen.h" > </File> <File - RelativePath="..\source\Generating\ComposableGenerator.cpp" + RelativePath="..\src\Generating\ComposableGenerator.cpp" > </File> <File - RelativePath="..\source\Generating\ComposableGenerator.h" + RelativePath="..\src\Generating\ComposableGenerator.h" > </File> <File - RelativePath="..\source\Generating\DistortedHeightmap.cpp" + RelativePath="..\src\Generating\DistortedHeightmap.cpp" > </File> <File - RelativePath="..\source\Generating\DistortedHeightmap.h" + RelativePath="..\src\Generating\DistortedHeightmap.h" > </File> <File - RelativePath="..\source\Generating\EndGen.cpp" + RelativePath="..\src\Generating\EndGen.cpp" > </File> <File - RelativePath="..\source\Generating\EndGen.h" + RelativePath="..\src\Generating\EndGen.h" > </File> <File - RelativePath="..\source\Generating\FinishGen.cpp" + RelativePath="..\src\Generating\FinishGen.cpp" > </File> <File - RelativePath="..\source\Generating\FinishGen.h" + RelativePath="..\src\Generating\FinishGen.h" > </File> <File - RelativePath="..\source\Generating\HeiGen.cpp" + RelativePath="..\src\Generating\HeiGen.cpp" > </File> <File - RelativePath="..\source\Generating\HeiGen.h" + RelativePath="..\src\Generating\HeiGen.h" > </File> <File - RelativePath="..\source\Generating\MineShafts.cpp" + RelativePath="..\src\Generating\MineShafts.cpp" > </File> <File - RelativePath="..\source\Generating\MineShafts.h" + RelativePath="..\src\Generating\MineShafts.h" > </File> <File - RelativePath="..\source\Generating\Noise3DGenerator.cpp" + RelativePath="..\src\Generating\Noise3DGenerator.cpp" > </File> <File - RelativePath="..\source\Generating\Noise3DGenerator.h" + RelativePath="..\src\Generating\Noise3DGenerator.h" > </File> <File - RelativePath="..\source\Generating\Ravines.cpp" + RelativePath="..\src\Generating\Ravines.cpp" > </File> <File - RelativePath="..\source\Generating\Ravines.h" + RelativePath="..\src\Generating\Ravines.h" > </File> <File - RelativePath="..\source\Generating\StructGen.cpp" + RelativePath="..\src\Generating\StructGen.cpp" > </File> <File - RelativePath="..\source\Generating\StructGen.h" + RelativePath="..\src\Generating\StructGen.h" > </File> <File - RelativePath="..\source\Generating\Trees.cpp" + RelativePath="..\src\Generating\Trees.cpp" > </File> <File - RelativePath="..\source\Generating\Trees.h" + RelativePath="..\src\Generating\Trees.h" > </File> </Filter> @@ -2072,283 +2076,283 @@ Name="Blocks" > <File - RelativePath="..\source\Blocks\BlockBed.cpp" + RelativePath="..\src\Blocks\BlockBed.cpp" > </File> <File - RelativePath="..\source\blocks\BlockBed.h" + RelativePath="..\src\blocks\BlockBed.h" > </File> <File - RelativePath="..\source\Blocks\BlockBrewingStand.h" + RelativePath="..\src\Blocks\BlockBrewingStand.h" > </File> <File - RelativePath="..\source\Blocks\BlockButton.cpp" + RelativePath="..\src\Blocks\BlockButton.cpp" > </File> <File - RelativePath="..\source\Blocks\BlockButton.h" + RelativePath="..\src\Blocks\BlockButton.h" > </File> <File - RelativePath="..\source\blocks\BlockCactus.h" + RelativePath="..\src\blocks\BlockCactus.h" > </File> <File - RelativePath="..\source\Blocks\BlockCarpet.h" + RelativePath="..\src\Blocks\BlockCarpet.h" > </File> <File - RelativePath="..\source\Blocks\BlockCauldron.h" + RelativePath="..\src\Blocks\BlockCauldron.h" > </File> <File - RelativePath="..\source\blocks\BlockChest.h" + RelativePath="..\src\blocks\BlockChest.h" > </File> <File - RelativePath="..\source\blocks\BlockCloth.h" + RelativePath="..\src\blocks\BlockCloth.h" > </File> <File - RelativePath="..\source\Blocks\BlockCobWeb.h" + RelativePath="..\src\Blocks\BlockCobWeb.h" > </File> <File - RelativePath="..\source\Blocks\BlockComparator.cpp" + RelativePath="..\src\Blocks\BlockComparator.cpp" > </File> <File - RelativePath="..\source\Blocks\BlockComparator.h" + RelativePath="..\src\Blocks\BlockComparator.h" > </File> <File - RelativePath="..\source\blocks\BlockCrops.h" + RelativePath="..\src\blocks\BlockCrops.h" > </File> <File - RelativePath="..\source\Blocks\BlockDeadBush.h" + RelativePath="..\src\Blocks\BlockDeadBush.h" > </File> <File - RelativePath="..\source\blocks\BlockDirt.h" + RelativePath="..\src\blocks\BlockDirt.h" > </File> <File - RelativePath="..\source\blocks\BlockDoor.cpp" + RelativePath="..\src\blocks\BlockDoor.cpp" > </File> <File - RelativePath="..\source\blocks\BlockDoor.h" + RelativePath="..\src\blocks\BlockDoor.h" > </File> <File - RelativePath="..\source\blocks\BlockDropSpenser.h" + RelativePath="..\src\blocks\BlockDropSpenser.h" > </File> <File - RelativePath="..\source\Blocks\BlockEnderchest.h" + RelativePath="..\src\Blocks\BlockEnderchest.h" > </File> <File - RelativePath="..\source\blocks\BlockEntity.h" + RelativePath="..\src\blocks\BlockEntity.h" > </File> <File - RelativePath="..\source\Blocks\BlockFarmland.h" + RelativePath="..\src\Blocks\BlockFarmland.h" > </File> <File - RelativePath="..\source\Blocks\BlockFenceGate.h" + RelativePath="..\src\Blocks\BlockFenceGate.h" > </File> <File - RelativePath="..\source\blocks\BlockFire.h" + RelativePath="..\src\blocks\BlockFire.h" > </File> <File - RelativePath="..\source\blocks\BlockFlower.h" + RelativePath="..\src\blocks\BlockFlower.h" > </File> <File - RelativePath="..\source\Blocks\BlockFlowerPot.h" + RelativePath="..\src\Blocks\BlockFlowerPot.h" > </File> <File - RelativePath="..\source\blocks\BlockFluid.h" + RelativePath="..\src\blocks\BlockFluid.h" > </File> <File - RelativePath="..\source\blocks\BlockFurnace.h" + RelativePath="..\src\blocks\BlockFurnace.h" > </File> <File - RelativePath="..\source\Blocks\BlockGlass.h" + RelativePath="..\src\Blocks\BlockGlass.h" > </File> <File - RelativePath="..\source\blocks\BlockGlowstone.h" + RelativePath="..\src\blocks\BlockGlowstone.h" > </File> <File - RelativePath="..\source\blocks\BlockGravel.h" + RelativePath="..\src\blocks\BlockGravel.h" > </File> <File - RelativePath="..\source\blocks\BlockHandler.cpp" + RelativePath="..\src\blocks\BlockHandler.cpp" > </File> <File - RelativePath="..\source\blocks\BlockHandler.h" + RelativePath="..\src\blocks\BlockHandler.h" > </File> <File - RelativePath="..\source\Blocks\BlockHopper.h" + RelativePath="..\src\Blocks\BlockHopper.h" > </File> <File - RelativePath="..\source\blocks\BlockIce.h" + RelativePath="..\src\blocks\BlockIce.h" > </File> <File - RelativePath="..\source\blocks\BlockLadder.h" + RelativePath="..\src\blocks\BlockLadder.h" > </File> <File - RelativePath="..\source\blocks\BlockLeaves.h" + RelativePath="..\src\blocks\BlockLeaves.h" > </File> <File - RelativePath="..\source\Blocks\BlockLever.cpp" + RelativePath="..\src\Blocks\BlockLever.cpp" > </File> <File - RelativePath="..\source\Blocks\BlockLever.h" + RelativePath="..\src\Blocks\BlockLever.h" > </File> <File - RelativePath="..\source\blocks\BlockMelon.h" + RelativePath="..\src\blocks\BlockMelon.h" > </File> <File - RelativePath="..\source\blocks\BlockMushroom.h" + RelativePath="..\src\blocks\BlockMushroom.h" > </File> <File - RelativePath="..\source\Blocks\BlockMycelium.h" + RelativePath="..\src\Blocks\BlockMycelium.h" > </File> <File - RelativePath="..\source\blocks\BlockNote.h" + RelativePath="..\src\blocks\BlockNote.h" > </File> <File - RelativePath="..\source\blocks\BlockOre.h" + RelativePath="..\src\blocks\BlockOre.h" > </File> <File - RelativePath="..\source\blocks\BlockPiston.cpp" + RelativePath="..\src\blocks\BlockPiston.cpp" > </File> <File - RelativePath="..\source\blocks\BlockPiston.h" + RelativePath="..\src\blocks\BlockPiston.h" > </File> <File - RelativePath="..\source\blocks\BlockPlanks.h" + RelativePath="..\src\blocks\BlockPlanks.h" > </File> <File - RelativePath="..\source\blocks\BlockPortal.h" + RelativePath="..\src\blocks\BlockPortal.h" > </File> <File - RelativePath="..\source\Blocks\BlockPumpkin.h" + RelativePath="..\src\Blocks\BlockPumpkin.h" > </File> <File - RelativePath="..\source\Blocks\BlockRail.h" + RelativePath="..\src\Blocks\BlockRail.h" > </File> <File - RelativePath="..\source\blocks\BlockRedstone.cpp" + RelativePath="..\src\blocks\BlockRedstone.cpp" > </File> <File - RelativePath="..\source\blocks\BlockRedstone.h" + RelativePath="..\src\blocks\BlockRedstone.h" > </File> <File - RelativePath="..\source\blocks\BlockRedstoneOre.h" + RelativePath="..\src\blocks\BlockRedstoneOre.h" > </File> <File - RelativePath="..\source\blocks\BlockRedstoneRepeater.cpp" + RelativePath="..\src\blocks\BlockRedstoneRepeater.cpp" > </File> <File - RelativePath="..\source\blocks\BlockRedstoneRepeater.h" + RelativePath="..\src\blocks\BlockRedstoneRepeater.h" > </File> <File - RelativePath="..\source\blocks\BlockRedstoneTorch.h" + RelativePath="..\src\blocks\BlockRedstoneTorch.h" > </File> <File - RelativePath="..\source\blocks\BlockSand.h" + RelativePath="..\src\blocks\BlockSand.h" > </File> <File - RelativePath="..\source\blocks\BlockSapling.h" + RelativePath="..\src\blocks\BlockSapling.h" > </File> <File - RelativePath="..\source\blocks\BlockSign.h" + RelativePath="..\src\blocks\BlockSign.h" > </File> <File - RelativePath="..\source\blocks\BlockSlab.h" + RelativePath="..\src\blocks\BlockSlab.h" > </File> <File - RelativePath="..\source\blocks\BlockSnow.h" + RelativePath="..\src\blocks\BlockSnow.h" > </File> <File - RelativePath="..\source\blocks\BlockStairs.h" + RelativePath="..\src\blocks\BlockStairs.h" > </File> <File - RelativePath="..\source\blocks\BlockStems.h" + RelativePath="..\src\blocks\BlockStems.h" > </File> <File - RelativePath="..\source\blocks\BlockStone.h" + RelativePath="..\src\blocks\BlockStone.h" > </File> <File - RelativePath="..\source\blocks\BlockSugarcane.h" + RelativePath="..\src\blocks\BlockSugarcane.h" > </File> <File - RelativePath="..\source\blocks\BlockTallGrass.h" + RelativePath="..\src\blocks\BlockTallGrass.h" > </File> <File - RelativePath="..\source\blocks\BlockTorch.h" + RelativePath="..\src\blocks\BlockTorch.h" > </File> <File - RelativePath="..\source\blocks\BlockVine.h" + RelativePath="..\src\blocks\BlockVine.h" > </File> <File - RelativePath="..\source\blocks\BlockWood.h" + RelativePath="..\src\blocks\BlockWood.h" > </File> <File - RelativePath="..\source\blocks\BlockWorkbench.h" + RelativePath="..\src\blocks\BlockWorkbench.h" > </File> </Filter> @@ -2356,123 +2360,123 @@ Name="Items" > <File - RelativePath="..\source\items\ItemBed.h" + RelativePath="..\src\items\ItemBed.h" > </File> <File - RelativePath="..\source\Items\ItemBoat.h" + RelativePath="..\src\Items\ItemBoat.h" > </File> <File - RelativePath="..\source\Items\ItemBow.h" + RelativePath="..\src\Items\ItemBow.h" > </File> <File - RelativePath="..\source\Items\ItemBrewingStand.h" + RelativePath="..\src\Items\ItemBrewingStand.h" > </File> <File - RelativePath="..\source\items\ItemBucket.h" + RelativePath="..\src\items\ItemBucket.h" > </File> <File - RelativePath="..\source\Items\ItemCauldron.h" + RelativePath="..\src\Items\ItemCauldron.h" > </File> <File - RelativePath="..\source\items\ItemCloth.h" + RelativePath="..\src\items\ItemCloth.h" > </File> <File - RelativePath="..\source\Items\ItemComparator.h" + RelativePath="..\src\Items\ItemComparator.h" > </File> <File - RelativePath="..\source\items\ItemDoor.h" + RelativePath="..\src\items\ItemDoor.h" > </File> <File - RelativePath="..\source\items\ItemDye.h" + RelativePath="..\src\items\ItemDye.h" > </File> <File - RelativePath="..\source\Items\ItemFlowerPot.h" + RelativePath="..\src\Items\ItemFlowerPot.h" > </File> <File - RelativePath="..\source\items\ItemFood.h" + RelativePath="..\src\items\ItemFood.h" > </File> <File - RelativePath="..\source\items\ItemHandler.cpp" + RelativePath="..\src\items\ItemHandler.cpp" > </File> <File - RelativePath="..\source\items\ItemHandler.h" + RelativePath="..\src\items\ItemHandler.h" > </File> <File - RelativePath="..\source\items\ItemHoe.h" + RelativePath="..\src\items\ItemHoe.h" > </File> <File - RelativePath="..\source\items\ItemLeaves.h" + RelativePath="..\src\items\ItemLeaves.h" > </File> <File - RelativePath="..\source\items\ItemLighter.h" + RelativePath="..\src\items\ItemLighter.h" > </File> <File - RelativePath="..\source\Items\ItemMinecart.h" + RelativePath="..\src\Items\ItemMinecart.h" > </File> <File - RelativePath="..\source\items\ItemPickaxe.h" + RelativePath="..\src\items\ItemPickaxe.h" > </File> <File - RelativePath="..\source\items\ItemRedstoneDust.h" + RelativePath="..\src\items\ItemRedstoneDust.h" > </File> <File - RelativePath="..\source\items\ItemRedstoneRepeater.h" + RelativePath="..\src\items\ItemRedstoneRepeater.h" > </File> <File - RelativePath="..\source\items\ItemSapling.h" + RelativePath="..\src\items\ItemSapling.h" > </File> <File - RelativePath="..\source\items\ItemSeeds.h" + RelativePath="..\src\items\ItemSeeds.h" > </File> <File - RelativePath="..\source\items\ItemShears.h" + RelativePath="..\src\items\ItemShears.h" > </File> <File - RelativePath="..\source\items\ItemShovel.h" + RelativePath="..\src\items\ItemShovel.h" > </File> <File - RelativePath="..\source\items\ItemSign.h" + RelativePath="..\src\items\ItemSign.h" > </File> <File - RelativePath="..\source\Items\ItemSpawnEgg.h" + RelativePath="..\src\Items\ItemSpawnEgg.h" > </File> <File - RelativePath="..\source\items\ItemSugarcane.h" + RelativePath="..\src\items\ItemSugarcane.h" > </File> <File - RelativePath="..\source\items\ItemSword.h" + RelativePath="..\src\items\ItemSword.h" > </File> <File - RelativePath="..\source\Items\ItemThrowable.h" + RelativePath="..\src\Items\ItemThrowable.h" > </File> </Filter> @@ -2480,71 +2484,71 @@ Name="Protocol" > <File - RelativePath="..\source\Protocol\ChunkDataSerializer.cpp" + RelativePath="..\src\Protocol\ChunkDataSerializer.cpp" > </File> <File - RelativePath="..\source\Protocol\ChunkDataSerializer.h" + RelativePath="..\src\Protocol\ChunkDataSerializer.h" > </File> <File - RelativePath="..\source\Protocol\Protocol.h" + RelativePath="..\src\Protocol\Protocol.h" > </File> <File - RelativePath="..\source\Protocol\Protocol125.cpp" + RelativePath="..\src\Protocol\Protocol125.cpp" > </File> <File - RelativePath="..\source\Protocol\Protocol125.h" + RelativePath="..\src\Protocol\Protocol125.h" > </File> <File - RelativePath="..\source\Protocol\Protocol132.cpp" + RelativePath="..\src\Protocol\Protocol132.cpp" > </File> <File - RelativePath="..\source\Protocol\Protocol132.h" + RelativePath="..\src\Protocol\Protocol132.h" > </File> <File - RelativePath="..\source\Protocol\Protocol14x.cpp" + RelativePath="..\src\Protocol\Protocol14x.cpp" > </File> <File - RelativePath="..\source\Protocol\Protocol14x.h" + RelativePath="..\src\Protocol\Protocol14x.h" > </File> <File - RelativePath="..\source\Protocol\Protocol15x.cpp" + RelativePath="..\src\Protocol\Protocol15x.cpp" > </File> <File - RelativePath="..\source\Protocol\Protocol15x.h" + RelativePath="..\src\Protocol\Protocol15x.h" > </File> <File - RelativePath="..\source\Protocol\Protocol16x.cpp" + RelativePath="..\src\Protocol\Protocol16x.cpp" > </File> <File - RelativePath="..\source\Protocol\Protocol16x.h" + RelativePath="..\src\Protocol\Protocol16x.h" > </File> <File - RelativePath="..\source\Protocol\Protocol17x.cpp" + RelativePath="..\src\Protocol\Protocol17x.cpp" > </File> <File - RelativePath="..\source\Protocol\Protocol17x.h" + RelativePath="..\src\Protocol\Protocol17x.h" > </File> <File - RelativePath="..\source\Protocol\ProtocolRecognizer.cpp" + RelativePath="..\src\Protocol\ProtocolRecognizer.cpp" > </File> <File - RelativePath="..\source\Protocol\ProtocolRecognizer.h" + RelativePath="..\src\Protocol\ProtocolRecognizer.h" > </File> </Filter> @@ -2552,7 +2556,7 @@ Name="SQLite" > <File - RelativePath="..\source\sqlite\lsqlite3.c" + RelativePath="..\lib\sqlite\lsqlite3.c" > <FileConfiguration Name="Debug|Win32" @@ -2588,7 +2592,7 @@ </FileConfiguration> </File> <File - RelativePath="..\source\sqlite\sqlite3.c" + RelativePath="..\lib\sqlite\sqlite3.c" > <FileConfiguration Name="Debug|Win32" @@ -2624,11 +2628,11 @@ </FileConfiguration> </File> <File - RelativePath="..\source\sqlite\sqlite3.h" + RelativePath="..\lib\sqlite\sqlite3.h" > </File> <File - RelativePath="..\source\sqlite\urls.txt" + RelativePath="..\lib\sqlite\urls.txt" > </File> </Filter> @@ -2636,7 +2640,7 @@ Name="LuaExpat" > <File - RelativePath="..\source\LuaExpat\lxplib.c" + RelativePath="..\lib\luaexpat\lxplib.c" > <FileConfiguration Name="Debug|Win32" @@ -2672,7 +2676,7 @@ </FileConfiguration> </File> <File - RelativePath="..\source\LuaExpat\lxplib.h" + RelativePath="..\lib\luaexpat\lxplib.h" > </File> </Filter> @@ -2680,87 +2684,87 @@ Name="BlockEntities" > <File - RelativePath="..\source\BlockEntities\BlockEntity.cpp" + RelativePath="..\src\BlockEntities\BlockEntity.cpp" > </File> <File - RelativePath="..\source\BlockEntities\BlockEntity.h" + RelativePath="..\src\BlockEntities\BlockEntity.h" > </File> <File - RelativePath="..\source\BlockEntities\BlockEntityWithItems.h" + RelativePath="..\src\BlockEntities\BlockEntityWithItems.h" > </File> <File - RelativePath="..\source\BlockEntities\ChestEntity.cpp" + RelativePath="..\src\BlockEntities\ChestEntity.cpp" > </File> <File - RelativePath="..\source\BlockEntities\ChestEntity.h" + RelativePath="..\src\BlockEntities\ChestEntity.h" > </File> <File - RelativePath="..\source\BlockEntities\DispenserEntity.cpp" + RelativePath="..\src\BlockEntities\DispenserEntity.cpp" > </File> <File - RelativePath="..\source\BlockEntities\DispenserEntity.h" + RelativePath="..\src\BlockEntities\DispenserEntity.h" > </File> <File - RelativePath="..\source\BlockEntities\DropperEntity.cpp" + RelativePath="..\src\BlockEntities\DropperEntity.cpp" > </File> <File - RelativePath="..\source\BlockEntities\DropperEntity.h" + RelativePath="..\src\BlockEntities\DropperEntity.h" > </File> <File - RelativePath="..\source\BlockEntities\DropSpenserEntity.cpp" + RelativePath="..\src\BlockEntities\DropSpenserEntity.cpp" > </File> <File - RelativePath="..\source\BlockEntities\DropSpenserEntity.h" + RelativePath="..\src\BlockEntities\DropSpenserEntity.h" > </File> <File - RelativePath="..\source\BlockEntities\FurnaceEntity.cpp" + RelativePath="..\src\BlockEntities\FurnaceEntity.cpp" > </File> <File - RelativePath="..\source\BlockEntities\FurnaceEntity.h" + RelativePath="..\src\BlockEntities\FurnaceEntity.h" > </File> <File - RelativePath="..\source\BlockEntities\HopperEntity.cpp" + RelativePath="..\src\BlockEntities\HopperEntity.cpp" > </File> <File - RelativePath="..\source\BlockEntities\HopperEntity.h" + RelativePath="..\src\BlockEntities\HopperEntity.h" > </File> <File - RelativePath="..\source\BlockEntities\JukeboxEntity.cpp" + RelativePath="..\src\BlockEntities\JukeboxEntity.cpp" > </File> <File - RelativePath="..\source\BlockEntities\JukeboxEntity.h" + RelativePath="..\src\BlockEntities\JukeboxEntity.h" > </File> <File - RelativePath="..\source\BlockEntities\NoteEntity.cpp" + RelativePath="..\src\BlockEntities\NoteEntity.cpp" > </File> <File - RelativePath="..\source\BlockEntities\NoteEntity.h" + RelativePath="..\src\BlockEntities\NoteEntity.h" > </File> <File - RelativePath="..\source\BlockEntities\SignEntity.cpp" + RelativePath="..\src\BlockEntities\SignEntity.cpp" > </File> <File - RelativePath="..\source\BlockEntities\SignEntity.h" + RelativePath="..\src\BlockEntities\SignEntity.h" > </File> </Filter> @@ -2768,59 +2772,59 @@ Name="HTTPServer" > <File - RelativePath="..\source\HTTPServer\EnvelopeParser.cpp" + RelativePath="..\src\HTTPServer\EnvelopeParser.cpp" > </File> <File - RelativePath="..\source\HTTPServer\EnvelopeParser.h" + RelativePath="..\src\HTTPServer\EnvelopeParser.h" > </File> <File - RelativePath="..\source\HTTPServer\HTTPConnection.cpp" + RelativePath="..\src\HTTPServer\HTTPConnection.cpp" > </File> <File - RelativePath="..\source\HTTPServer\HTTPConnection.h" + RelativePath="..\src\HTTPServer\HTTPConnection.h" > </File> <File - RelativePath="..\source\HTTPServer\HTTPFormParser.cpp" + RelativePath="..\src\HTTPServer\HTTPFormParser.cpp" > </File> <File - RelativePath="..\source\HTTPServer\HTTPFormParser.h" + RelativePath="..\src\HTTPServer\HTTPFormParser.h" > </File> <File - RelativePath="..\source\HTTPServer\HTTPMessage.cpp" + RelativePath="..\src\HTTPServer\HTTPMessage.cpp" > </File> <File - RelativePath="..\source\HTTPServer\HTTPMessage.h" + RelativePath="..\src\HTTPServer\HTTPMessage.h" > </File> <File - RelativePath="..\source\HTTPServer\HTTPServer.cpp" + RelativePath="..\src\HTTPServer\HTTPServer.cpp" > </File> <File - RelativePath="..\source\HTTPServer\HTTPServer.h" + RelativePath="..\src\HTTPServer\HTTPServer.h" > </File> <File - RelativePath="..\source\HTTPServer\MultipartParser.cpp" + RelativePath="..\src\HTTPServer\MultipartParser.cpp" > </File> <File - RelativePath="..\source\HTTPServer\MultipartParser.h" + RelativePath="..\src\HTTPServer\MultipartParser.h" > </File> <File - RelativePath="..\source\HTTPServer\NameValueParser.cpp" + RelativePath="..\src\HTTPServer\NameValueParser.cpp" > </File> <File - RelativePath="..\source\HTTPServer\NameValueParser.h" + RelativePath="..\src\HTTPServer\NameValueParser.h" > </File> </Filter> diff --git a/VC2008/ToLua.cbp b/VC2008/ToLua.cbp index f22bfda4a..c7f24afcc 100644 --- a/VC2008/ToLua.cbp +++ b/VC2008/ToLua.cbp @@ -21,12 +21,12 @@ <Add option="-W" /> <Add option="-g" /> <Add option="-O0" /> - <Add directory="../tolua++-1.0.93/include" /> - <Add directory="../lua-5.1.4/src" /> + <Add directory="../lib/tolua++/include" /> + <Add directory="../lib/lua/src" /> </Compiler> <ResourceCompiler> - <Add directory="../tolua++-1.0.93/include" /> - <Add directory="../lua-5.1.4/src" /> + <Add directory="../lib/tolua++/include" /> + <Add directory="../lib/lua/src" /> </ResourceCompiler> </Target> <Target title="Release Win32"> @@ -43,12 +43,12 @@ <Add option="-D_CRT_SECURE_NO_WARNINGS" /> <Add option="-W" /> <Add option="-O2" /> - <Add directory="../tolua++-1.0.93/include" /> - <Add directory="../lua-5.1.4/src" /> + <Add directory="../lib/tolua++/include" /> + <Add directory="../lib/lua/src" /> </Compiler> <ResourceCompiler> - <Add directory="../tolua++-1.0.93/include" /> - <Add directory="../lua-5.1.4/src" /> + <Add directory="../lib/tolua++/include" /> + <Add directory="../lib/lua/src" /> </ResourceCompiler> </Target> <Target title="Release profiled Win32"> @@ -65,32 +65,32 @@ <Add option="-D_CRT_SECURE_NO_WARNINGS" /> <Add option="-W" /> <Add option="-O2" /> - <Add directory="../tolua++-1.0.93/include" /> - <Add directory="../lua-5.1.4/src" /> + <Add directory="../lib/tolua++/include" /> + <Add directory="../lib/lua/src" /> </Compiler> <ResourceCompiler> - <Add directory="../tolua++-1.0.93/include" /> - <Add directory="../lua-5.1.4/src" /> + <Add directory="../lib/tolua++/include" /> + <Add directory="../lib/lua/src" /> </ResourceCompiler> </Target> </Build> - <Unit filename="../tolua++-1.0.93/src/bin/tolua.c"> + <Unit filename="../lib/tolua++/src/bin/tolua.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../tolua++-1.0.93/src/lib/tolua_event.c"> + <Unit filename="../lib/tolua++/src/lib/tolua_event.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../tolua++-1.0.93/src/lib/tolua_event.h" /> - <Unit filename="../tolua++-1.0.93/src/lib/tolua_is.c"> + <Unit filename="../lib/tolua++/src/lib/tolua_event.h" /> + <Unit filename="../lib/tolua++/src/lib/tolua_is.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../tolua++-1.0.93/src/lib/tolua_map.c"> + <Unit filename="../lib/tolua++/src/lib/tolua_map.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../tolua++-1.0.93/src/lib/tolua_push.c"> + <Unit filename="../lib/tolua++/src/lib/tolua_push.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../tolua++-1.0.93/src/lib/tolua_to.c"> + <Unit filename="../lib/tolua++/src/lib/tolua_to.c"> <Option compilerVar="CC" /> </Unit> <Extensions> diff --git a/VC2008/ToLua.vcproj b/VC2008/ToLua.vcproj index dd5cfb217..24a5d8b4f 100644 --- a/VC2008/ToLua.vcproj +++ b/VC2008/ToLua.vcproj @@ -41,7 +41,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="../tolua++-1.0.93/include;../lua-5.1.4/src" + AdditionalIncludeDirectories="../lib/tolua++/include;../lib/lua/src" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -105,7 +105,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="../tolua++-1.0.93/include;../lua-5.1.4/src" + AdditionalIncludeDirectories="../lib/tolua++/include;../lib/lua/src" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -168,7 +168,7 @@ Name="VCCLCompilerTool" Optimization="2" EnableIntrinsicFunctions="true" - AdditionalIncludeDirectories="../tolua++-1.0.93/include;../lua-5.1.4/src" + AdditionalIncludeDirectories="../lib/tolua++/include;../lib/lua/src" PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -229,7 +229,7 @@ <Tool Name="VCCLCompilerTool" Optimization="0" - AdditionalIncludeDirectories="../tolua++-1.0.93/include;../lua-5.1.4/src" + AdditionalIncludeDirectories="../lib/tolua++/include;../lib/lua/src" PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS" MinimalRebuild="true" BasicRuntimeChecks="3" @@ -276,31 +276,31 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File - RelativePath="..\tolua++-1.0.93\src\bin\tolua.c" + RelativePath="..\lib\tolua++\src\bin\tolua.c" > </File> <File - RelativePath="..\tolua++-1.0.93\src\lib\tolua_event.c" + RelativePath="..\lib\tolua++\src\lib\tolua_event.c" > </File> <File - RelativePath="..\tolua++-1.0.93\src\lib\tolua_event.h" + RelativePath="..\lib\tolua++\src\lib\tolua_event.h" > </File> <File - RelativePath="..\tolua++-1.0.93\src\lib\tolua_is.c" + RelativePath="..\lib\tolua++\src\lib\tolua_is.c" > </File> <File - RelativePath="..\tolua++-1.0.93\src\lib\tolua_map.c" + RelativePath="..\lib\tolua++\src\lib\tolua_map.c" > </File> <File - RelativePath="..\tolua++-1.0.93\src\lib\tolua_push.c" + RelativePath="..\lib\tolua++\src\lib\tolua_push.c" > </File> <File - RelativePath="..\tolua++-1.0.93\src\lib\tolua_to.c" + RelativePath="..\lib\tolua++\src\lib\tolua_to.c" > </File> </Filter> diff --git a/VC2008/expat.cbp b/VC2008/expat.cbp index 6cd3f6234..6c89eff8d 100644 --- a/VC2008/expat.cbp +++ b/VC2008/expat.cbp @@ -40,32 +40,32 @@ </Compiler> </Target> </Build> - <Unit filename="../expat/ascii.h" /> - <Unit filename="../expat/asciitab.h" /> - <Unit filename="../expat/expat.h" /> - <Unit filename="../expat/expat_external.h" /> - <Unit filename="../expat/iasciitab.h" /> - <Unit filename="../expat/internal.h" /> - <Unit filename="../expat/latin1tab.h" /> - <Unit filename="../expat/nametab.h" /> - <Unit filename="../expat/utf8tab.h" /> - <Unit filename="../expat/winconfig.h" /> - <Unit filename="../expat/xmlparse.c"> + <Unit filename="../lib/expat/ascii.h" /> + <Unit filename="../lib/expat/asciitab.h" /> + <Unit filename="../lib/expat/expat.h" /> + <Unit filename="../lib/expat/expat_external.h" /> + <Unit filename="../lib/expat/iasciitab.h" /> + <Unit filename="../lib/expat/internal.h" /> + <Unit filename="../lib/expat/latin1tab.h" /> + <Unit filename="../lib/expat/nametab.h" /> + <Unit filename="../lib/expat/utf8tab.h" /> + <Unit filename="../lib/expat/winconfig.h" /> + <Unit filename="../lib/expat/xmlparse.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../expat/xmlrole.c"> + <Unit filename="../lib/expat/xmlrole.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../expat/xmlrole.h" /> - <Unit filename="../expat/xmltok.c"> + <Unit filename="../lib/expat/xmlrole.h" /> + <Unit filename="../lib/expat/xmltok.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../expat/xmltok.h" /> - <Unit filename="../expat/xmltok_impl.c"> + <Unit filename="../lib/expat/xmltok.h" /> + <Unit filename="../lib/expat/xmltok_impl.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../expat/xmltok_impl.h" /> - <Unit filename="../expat/xmltok_ns.c"> + <Unit filename="../lib/expat/xmltok_impl.h" /> + <Unit filename="../lib/expat/xmltok_ns.c"> <Option compilerVar="CC" /> </Unit> <Extensions> diff --git a/VC2008/expat.vcproj b/VC2008/expat.vcproj index 148fd0cad..a02549192 100644 --- a/VC2008/expat.vcproj +++ b/VC2008/expat.vcproj @@ -149,75 +149,75 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File - RelativePath="..\expat\ascii.h" + RelativePath="..\lib\expat\ascii.h" > </File> <File - RelativePath="..\expat\asciitab.h" + RelativePath="..\lib\expat\asciitab.h" > </File> <File - RelativePath="..\expat\expat.h" + RelativePath="..\lib\expat\expat.h" > </File> <File - RelativePath="..\expat\expat_external.h" + RelativePath="..\lib\expat\expat_external.h" > </File> <File - RelativePath="..\expat\iasciitab.h" + RelativePath="..\lib\expat\iasciitab.h" > </File> <File - RelativePath="..\expat\internal.h" + RelativePath="..\lib\expat\internal.h" > </File> <File - RelativePath="..\expat\latin1tab.h" + RelativePath="..\lib\expat\latin1tab.h" > </File> <File - RelativePath="..\expat\nametab.h" + RelativePath="..\lib\expat\nametab.h" > </File> <File - RelativePath="..\expat\utf8tab.h" + RelativePath="..\lib\expat\utf8tab.h" > </File> <File - RelativePath="..\expat\winconfig.h" + RelativePath="..\lib\expat\winconfig.h" > </File> <File - RelativePath="..\expat\xmlparse.c" + RelativePath="..\lib\expat\xmlparse.c" > </File> <File - RelativePath="..\expat\xmlrole.c" + RelativePath="..\lib\expat\xmlrole.c" > </File> <File - RelativePath="..\expat\xmlrole.h" + RelativePath="..\lib\expat\xmlrole.h" > </File> <File - RelativePath="..\expat\xmltok.c" + RelativePath="..\lib\expat\xmltok.c" > </File> <File - RelativePath="..\expat\xmltok.h" + RelativePath="..\lib\expat\xmltok.h" > </File> <File - RelativePath="..\expat\xmltok_impl.c" + RelativePath="..\lib\expat\xmltok_impl.c" > </File> <File - RelativePath="..\expat\xmltok_impl.h" + RelativePath="..\lib\expat\xmltok_impl.h" > </File> <File - RelativePath="..\expat\xmltok_ns.c" + RelativePath="..\lib\expat\xmltok_ns.c" > </File> </Filter> diff --git a/VC2008/zlib.cbp b/VC2008/zlib.cbp index 2b7d759da..1d24c24ce 100644 --- a/VC2008/zlib.cbp +++ b/VC2008/zlib.cbp @@ -56,62 +56,62 @@ </Compiler> </Target> </Build> - <Unit filename="../zlib-1.2.7/adler32.c"> + <Unit filename="../lib/zlib/adler32.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/compress.c"> + <Unit filename="../lib/zlib/compress.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/crc32.c"> + <Unit filename="../lib/zlib/crc32.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/crc32.h" /> - <Unit filename="../zlib-1.2.7/deflate.c"> + <Unit filename="../lib/zlib/crc32.h" /> + <Unit filename="../lib/zlib/deflate.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/deflate.h" /> - <Unit filename="../zlib-1.2.7/gzclose.c"> + <Unit filename="../lib/zlib/deflate.h" /> + <Unit filename="../lib/zlib/gzclose.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/gzguts.h" /> - <Unit filename="../zlib-1.2.7/gzlib.c"> + <Unit filename="../lib/zlib/gzguts.h" /> + <Unit filename="../lib/zlib/gzlib.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/gzread.c"> + <Unit filename="../lib/zlib/gzread.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/gzwrite.c"> + <Unit filename="../lib/zlib/gzwrite.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/infback.c"> + <Unit filename="../lib/zlib/infback.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/inffast.c"> + <Unit filename="../lib/zlib/inffast.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/inffast.h" /> - <Unit filename="../zlib-1.2.7/inffixed.h" /> - <Unit filename="../zlib-1.2.7/inflate.c"> + <Unit filename="../lib/zlib/inffast.h" /> + <Unit filename="../lib/zlib/inffixed.h" /> + <Unit filename="../lib/zlib/inflate.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/inflate.h" /> - <Unit filename="../zlib-1.2.7/inftrees.c"> + <Unit filename="../lib/zlib/inflate.h" /> + <Unit filename="../lib/zlib/inftrees.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/inftrees.h" /> - <Unit filename="../zlib-1.2.7/trees.c"> + <Unit filename="../lib/zlib/inftrees.h" /> + <Unit filename="../lib/zlib/trees.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/trees.h" /> - <Unit filename="../zlib-1.2.7/uncompr.c"> + <Unit filename="../lib/zlib/trees.h" /> + <Unit filename="../lib/zlib/uncompr.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/zconf.h" /> - <Unit filename="../zlib-1.2.7/zlib.h" /> - <Unit filename="../zlib-1.2.7/zutil.c"> + <Unit filename="../lib/zlib/zconf.h" /> + <Unit filename="../lib/zlib/zlib.h" /> + <Unit filename="../lib/zlib/zutil.c"> <Option compilerVar="CC" /> </Unit> - <Unit filename="../zlib-1.2.7/zutil.h" /> + <Unit filename="../lib/zlib/zutil.h" /> <Extensions> <code_completion /> <envvars /> diff --git a/VC2008/zlib.vcproj b/VC2008/zlib.vcproj index 6858b5610..1e07afc4c 100644 --- a/VC2008/zlib.vcproj +++ b/VC2008/zlib.vcproj @@ -276,107 +276,107 @@ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" > <File - RelativePath="..\zlib-1.2.7\adler32.c" + RelativePath="..\lib\zlib\adler32.c" > </File> <File - RelativePath="..\zlib-1.2.7\compress.c" + RelativePath="..\lib\zlib\compress.c" > </File> <File - RelativePath="..\zlib-1.2.7\crc32.c" + RelativePath="..\lib\zlib\crc32.c" > </File> <File - RelativePath="..\zlib-1.2.7\crc32.h" + RelativePath="..\lib\zlib\crc32.h" > </File> <File - RelativePath="..\zlib-1.2.7\deflate.c" + RelativePath="..\lib\zlib\deflate.c" > </File> <File - RelativePath="..\zlib-1.2.7\deflate.h" + RelativePath="..\lib\zlib\deflate.h" > </File> <File - RelativePath="..\zlib-1.2.7\gzclose.c" + RelativePath="..\lib\zlib\gzclose.c" > </File> <File - RelativePath="..\zlib-1.2.7\gzguts.h" + RelativePath="..\lib\zlib\gzguts.h" > </File> <File - RelativePath="..\zlib-1.2.7\gzlib.c" + RelativePath="..\lib\zlib\gzlib.c" > </File> <File - RelativePath="..\zlib-1.2.7\gzread.c" + RelativePath="..\lib\zlib\gzread.c" > </File> <File - RelativePath="..\zlib-1.2.7\gzwrite.c" + RelativePath="..\lib\zlib\gzwrite.c" > </File> <File - RelativePath="..\zlib-1.2.7\infback.c" + RelativePath="..\lib\zlib\infback.c" > </File> <File - RelativePath="..\zlib-1.2.7\inffast.c" + RelativePath="..\lib\zlib\inffast.c" > </File> <File - RelativePath="..\zlib-1.2.7\inffast.h" + RelativePath="..\lib\zlib\inffast.h" > </File> <File - RelativePath="..\zlib-1.2.7\inffixed.h" + RelativePath="..\lib\zlib\inffixed.h" > </File> <File - RelativePath="..\zlib-1.2.7\inflate.c" + RelativePath="..\lib\zlib\inflate.c" > </File> <File - RelativePath="..\zlib-1.2.7\inflate.h" + RelativePath="..\lib\zlib\inflate.h" > </File> <File - RelativePath="..\zlib-1.2.7\inftrees.c" + RelativePath="..\lib\zlib\inftrees.c" > </File> <File - RelativePath="..\zlib-1.2.7\inftrees.h" + RelativePath="..\lib\zlib\inftrees.h" > </File> <File - RelativePath="..\zlib-1.2.7\trees.c" + RelativePath="..\lib\zlib\trees.c" > </File> <File - RelativePath="..\zlib-1.2.7\trees.h" + RelativePath="..\lib\zlib\trees.h" > </File> <File - RelativePath="..\zlib-1.2.7\uncompr.c" + RelativePath="..\lib\zlib\uncompr.c" > </File> <File - RelativePath="..\zlib-1.2.7\zconf.h" + RelativePath="..\lib\zlib\zconf.h" > </File> <File - RelativePath="..\zlib-1.2.7\zlib.h" + RelativePath="..\lib\zlib\zlib.h" > </File> <File - RelativePath="..\zlib-1.2.7\zutil.c" + RelativePath="..\lib\zlib\zutil.c" > </File> <File - RelativePath="..\zlib-1.2.7\zutil.h" + RelativePath="..\lib\zlib\zutil.h" > </File> </Filter> diff --git a/VC2013/.gitignore b/VC2013/.gitignore index 9d46443bd..8e2fd484d 100644 --- a/VC2013/.gitignore +++ b/VC2013/.gitignore @@ -8,3 +8,4 @@ ipch/** *.suo *.obj *.sdf +*.opensdf
\ No newline at end of file diff --git a/VC2013/CryptoPP.vcxproj b/VC2013/CryptoPP.vcxproj index 0d7ef9774..7355ab64b 100644 --- a/VC2013/CryptoPP.vcxproj +++ b/VC2013/CryptoPP.vcxproj @@ -289,97 +289,97 @@ </Lib> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\CryptoPP\adler32.cpp"> + <ClCompile Include="..\lib\cryptopp\adler32.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\algebra.cpp"> + <ClCompile Include="..\lib\cryptopp\algebra.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\algparam.cpp"> + <ClCompile Include="..\lib\cryptopp\algparam.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\asn.cpp"> + <ClCompile Include="..\lib\cryptopp\asn.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\authenc.cpp" /> - <ClCompile Include="..\CryptoPP\base32.cpp"> + <ClCompile Include="..\lib\cryptopp\authenc.cpp" /> + <ClCompile Include="..\lib\cryptopp\base32.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\base64.cpp"> + <ClCompile Include="..\lib\cryptopp\base64.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\basecode.cpp"> + <ClCompile Include="..\lib\cryptopp\basecode.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\cbcmac.cpp"> + <ClCompile Include="..\lib\cryptopp\cbcmac.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\ccm.cpp" /> - <ClCompile Include="..\CryptoPP\channels.cpp"> + <ClCompile Include="..\lib\cryptopp\ccm.cpp" /> + <ClCompile Include="..\lib\cryptopp\channels.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\cmac.cpp" /> - <ClCompile Include="..\CryptoPP\cpu.cpp" /> - <ClCompile Include="..\CryptoPP\crc.cpp"> + <ClCompile Include="..\lib\cryptopp\cmac.cpp" /> + <ClCompile Include="..\lib\cryptopp\cpu.cpp" /> + <ClCompile Include="..\lib\cryptopp\crc.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\cryptlib.cpp"> + <ClCompile Include="..\lib\cryptopp\cryptlib.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\default.cpp"> + <ClCompile Include="..\lib\cryptopp\default.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\des.cpp" /> - <ClCompile Include="..\CryptoPP\dessp.cpp" /> - <ClCompile Include="..\CryptoPP\dh.cpp"> + <ClCompile Include="..\lib\cryptopp\des.cpp" /> + <ClCompile Include="..\lib\cryptopp\dessp.cpp" /> + <ClCompile Include="..\lib\cryptopp\dh.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\dh2.cpp"> + <ClCompile Include="..\lib\cryptopp\dh2.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\dll.cpp"> + <ClCompile Include="..\lib\cryptopp\dll.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'"> </PrecompiledHeader> @@ -397,20 +397,20 @@ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> </PrecompiledHeader> </ClCompile> - <ClCompile Include="..\CryptoPP\dsa.cpp"> + <ClCompile Include="..\lib\cryptopp\dsa.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\eax.cpp" /> - <ClCompile Include="..\CryptoPP\ec2n.cpp"> + <ClCompile Include="..\lib\cryptopp\eax.cpp" /> + <ClCompile Include="..\lib\cryptopp\ec2n.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\eccrypto.cpp"> + <ClCompile Include="..\lib\cryptopp\eccrypto.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">true</ExcludedFromBuild> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">true</ExcludedFromBuild> @@ -422,20 +422,20 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> </ClCompile> - <ClCompile Include="..\CryptoPP\ecp.cpp"> + <ClCompile Include="..\lib\cryptopp\ecp.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\elgamal.cpp"> + <ClCompile Include="..\lib\cryptopp\elgamal.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\emsa2.cpp" /> - <ClCompile Include="..\CryptoPP\eprecomp.cpp"> + <ClCompile Include="..\lib\cryptopp\emsa2.cpp" /> + <ClCompile Include="..\lib\cryptopp\eprecomp.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">true</ExcludedFromBuild> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">true</ExcludedFromBuild> @@ -447,74 +447,74 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> </ClCompile> - <ClCompile Include="..\CryptoPP\esign.cpp"> + <ClCompile Include="..\lib\cryptopp\esign.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\files.cpp"> + <ClCompile Include="..\lib\cryptopp\files.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\filters.cpp"> + <ClCompile Include="..\lib\cryptopp\filters.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\fips140.cpp"> + <ClCompile Include="..\lib\cryptopp\fips140.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\gcm.cpp" /> - <ClCompile Include="..\CryptoPP\gf256.cpp"> + <ClCompile Include="..\lib\cryptopp\gcm.cpp" /> + <ClCompile Include="..\lib\cryptopp\gf256.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\gf2_32.cpp"> + <ClCompile Include="..\lib\cryptopp\gf2_32.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\gf2n.cpp"> + <ClCompile Include="..\lib\cryptopp\gf2n.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\gfpcrypt.cpp"> + <ClCompile Include="..\lib\cryptopp\gfpcrypt.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\hex.cpp"> + <ClCompile Include="..\lib\cryptopp\hex.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\hmac.cpp"> + <ClCompile Include="..\lib\cryptopp\hmac.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\hrtimer.cpp"> + <ClCompile Include="..\lib\cryptopp\hrtimer.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\integer.cpp"> + <ClCompile Include="..\lib\cryptopp\integer.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> @@ -522,7 +522,7 @@ <AssemblerListingLocation Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> </AssemblerListingLocation> </ClCompile> - <ClCompile Include="..\CryptoPP\iterhash.cpp"> + <ClCompile Include="..\lib\cryptopp\iterhash.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'"> </PrecompiledHeader> @@ -540,79 +540,79 @@ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> </PrecompiledHeader> </ClCompile> - <ClCompile Include="..\CryptoPP\luc.cpp"> + <ClCompile Include="..\lib\cryptopp\luc.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\md2.cpp"> + <ClCompile Include="..\lib\cryptopp\md2.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\md4.cpp"> + <ClCompile Include="..\lib\cryptopp\md4.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\md5.cpp"> + <ClCompile Include="..\lib\cryptopp\md5.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\misc.cpp"> + <ClCompile Include="..\lib\cryptopp\misc.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\modes.cpp"> + <ClCompile Include="..\lib\cryptopp\modes.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\mqueue.cpp"> + <ClCompile Include="..\lib\cryptopp\mqueue.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\mqv.cpp"> + <ClCompile Include="..\lib\cryptopp\mqv.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\nbtheory.cpp"> + <ClCompile Include="..\lib\cryptopp\nbtheory.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\network.cpp"> + <ClCompile Include="..\lib\cryptopp\network.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\oaep.cpp"> + <ClCompile Include="..\lib\cryptopp\oaep.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\osrng.cpp"> + <ClCompile Include="..\lib\cryptopp\osrng.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\pch.cpp"> + <ClCompile Include="..\lib\cryptopp\pch.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Create</PrecompiledHeader> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> @@ -624,166 +624,166 @@ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader> </ClCompile> - <ClCompile Include="..\CryptoPP\pkcspad.cpp"> + <ClCompile Include="..\lib\cryptopp\pkcspad.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\polynomi.cpp"> + <ClCompile Include="..\lib\cryptopp\polynomi.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\pssr.cpp" /> - <ClCompile Include="..\CryptoPP\pubkey.cpp"> + <ClCompile Include="..\lib\cryptopp\pssr.cpp" /> + <ClCompile Include="..\lib\cryptopp\pubkey.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\queue.cpp"> + <ClCompile Include="..\lib\cryptopp\queue.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\rabin.cpp"> + <ClCompile Include="..\lib\cryptopp\rabin.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\randpool.cpp"> + <ClCompile Include="..\lib\cryptopp\randpool.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\rdtables.cpp"> + <ClCompile Include="..\lib\cryptopp\rdtables.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\rijndael.cpp"> + <ClCompile Include="..\lib\cryptopp\rijndael.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\rng.cpp"> + <ClCompile Include="..\lib\cryptopp\rng.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\rsa.cpp"> + <ClCompile Include="..\lib\cryptopp\rsa.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\rw.cpp"> + <ClCompile Include="..\lib\cryptopp\rw.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\safer.cpp"> + <ClCompile Include="..\lib\cryptopp\safer.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\seal.cpp"> + <ClCompile Include="..\lib\cryptopp\seal.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\seed.cpp" /> - <ClCompile Include="..\CryptoPP\sha.cpp"> + <ClCompile Include="..\lib\cryptopp\seed.cpp" /> + <ClCompile Include="..\lib\cryptopp\sha.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\shacal2.cpp"> + <ClCompile Include="..\lib\cryptopp\shacal2.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\simple.cpp"> + <ClCompile Include="..\lib\cryptopp\simple.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\socketft.cpp"> + <ClCompile Include="..\lib\cryptopp\socketft.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\square.cpp"> + <ClCompile Include="..\lib\cryptopp\square.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\squaretb.cpp"> + <ClCompile Include="..\lib\cryptopp\squaretb.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\strciphr.cpp"> + <ClCompile Include="..\lib\cryptopp\strciphr.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\tea.cpp"> + <ClCompile Include="..\lib\cryptopp\tea.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\tiger.cpp"> + <ClCompile Include="..\lib\cryptopp\tiger.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\tigertab.cpp"> + <ClCompile Include="..\lib\cryptopp\tigertab.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\trdlocal.cpp"> + <ClCompile Include="..\lib\cryptopp\trdlocal.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\ttmac.cpp"> + <ClCompile Include="..\lib\cryptopp\ttmac.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\vmac.cpp" /> - <ClCompile Include="..\CryptoPP\wait.cpp"> + <ClCompile Include="..\lib\cryptopp\vmac.cpp" /> + <ClCompile Include="..\lib\cryptopp\wait.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization> </ClCompile> - <ClCompile Include="..\CryptoPP\winpipes.cpp"> + <ClCompile Include="..\lib\cryptopp\winpipes.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Debug|x64'">Disabled</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='DLL-Import Release|x64'">MaxSpeed</Optimization> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization> @@ -791,116 +791,116 @@ </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\CryptoPP\adler32.h" /> - <ClInclude Include="..\CryptoPP\aes.h" /> - <ClInclude Include="..\CryptoPP\algebra.h" /> - <ClInclude Include="..\CryptoPP\algparam.h" /> - <ClInclude Include="..\CryptoPP\arc4.h" /> - <ClInclude Include="..\CryptoPP\argnames.h" /> - <ClInclude Include="..\CryptoPP\asn.h" /> - <ClInclude Include="..\CryptoPP\authenc.h" /> - <ClInclude Include="..\CryptoPP\base32.h" /> - <ClInclude Include="..\CryptoPP\base64.h" /> - <ClInclude Include="..\CryptoPP\basecode.h" /> - <ClInclude Include="..\CryptoPP\cbcmac.h" /> - <ClInclude Include="..\CryptoPP\ccm.h" /> - <ClInclude Include="..\CryptoPP\channels.h" /> - <ClInclude Include="..\CryptoPP\cmac.h" /> - <ClInclude Include="..\CryptoPP\config.h" /> - <ClInclude Include="..\CryptoPP\cpu.h" /> - <ClInclude Include="..\CryptoPP\crc.h" /> - <ClInclude Include="..\CryptoPP\cryptlib.h" /> - <ClInclude Include="..\CryptoPP\default.h" /> - <ClInclude Include="..\CryptoPP\des.h" /> - <ClInclude Include="..\CryptoPP\dh.h" /> - <ClInclude Include="..\CryptoPP\dh2.h" /> - <ClInclude Include="..\CryptoPP\dmac.h" /> - <ClInclude Include="..\CryptoPP\dsa.h" /> - <ClInclude Include="..\CryptoPP\eax.h" /> - <ClInclude Include="..\CryptoPP\ec2n.h" /> - <ClInclude Include="..\CryptoPP\eccrypto.h" /> - <ClInclude Include="..\CryptoPP\ecp.h" /> - <ClInclude Include="..\CryptoPP\elgamal.h" /> - <ClInclude Include="..\CryptoPP\emsa2.h" /> - <ClInclude Include="..\CryptoPP\eprecomp.h" /> - <ClInclude Include="..\CryptoPP\esign.h" /> - <ClInclude Include="..\CryptoPP\files.h" /> - <ClInclude Include="..\CryptoPP\filters.h" /> - <ClInclude Include="..\CryptoPP\fips140.h" /> - <ClInclude Include="..\CryptoPP\fltrimpl.h" /> - <ClInclude Include="..\CryptoPP\gcm.h" /> - <ClInclude Include="..\CryptoPP\gf256.h" /> - <ClInclude Include="..\CryptoPP\gf2_32.h" /> - <ClInclude Include="..\CryptoPP\gf2n.h" /> - <ClInclude Include="..\CryptoPP\gfpcrypt.h" /> - <ClInclude Include="..\CryptoPP\gzip.h" /> - <ClInclude Include="..\CryptoPP\hex.h" /> - <ClInclude Include="..\CryptoPP\hmac.h" /> - <ClInclude Include="..\CryptoPP\hrtimer.h" /> - <ClInclude Include="..\CryptoPP\integer.h" /> - <ClInclude Include="..\CryptoPP\iterhash.h" /> - <ClInclude Include="..\CryptoPP\lubyrack.h" /> - <ClInclude Include="..\CryptoPP\luc.h" /> - <ClInclude Include="..\CryptoPP\md2.h" /> - <ClInclude Include="..\CryptoPP\md4.h" /> - <ClInclude Include="..\CryptoPP\md5.h" /> - <ClInclude Include="..\CryptoPP\mdc.h" /> - <ClInclude Include="..\CryptoPP\misc.h" /> - <ClInclude Include="..\CryptoPP\modarith.h" /> - <ClInclude Include="..\CryptoPP\modes.h" /> - <ClInclude Include="..\CryptoPP\modexppc.h" /> - <ClInclude Include="..\CryptoPP\mqueue.h" /> - <ClInclude Include="..\CryptoPP\mqv.h" /> - <ClInclude Include="..\CryptoPP\nbtheory.h" /> - <ClInclude Include="..\CryptoPP\network.h" /> - <ClInclude Include="..\CryptoPP\nr.h" /> - <ClInclude Include="..\CryptoPP\oaep.h" /> - <ClInclude Include="..\CryptoPP\oids.h" /> - <ClInclude Include="..\CryptoPP\osrng.h" /> - <ClInclude Include="..\CryptoPP\pch.h" /> - <ClInclude Include="..\CryptoPP\pkcspad.h" /> - <ClInclude Include="..\CryptoPP\polynomi.h" /> - <ClInclude Include="..\CryptoPP\pssr.h" /> - <ClInclude Include="..\CryptoPP\pubkey.h" /> - <ClInclude Include="..\CryptoPP\pwdbased.h" /> - <ClInclude Include="..\CryptoPP\queue.h" /> - <ClInclude Include="..\CryptoPP\rabin.h" /> - <ClInclude Include="..\CryptoPP\randpool.h" /> - <ClInclude Include="..\CryptoPP\rijndael.h" /> - <ClInclude Include="..\CryptoPP\rng.h" /> - <ClInclude Include="..\CryptoPP\rsa.h" /> - <ClInclude Include="..\CryptoPP\rw.h" /> - <ClInclude Include="..\CryptoPP\safer.h" /> - <ClInclude Include="..\CryptoPP\seal.h" /> - <ClInclude Include="..\CryptoPP\secblock.h" /> - <ClInclude Include="..\CryptoPP\seckey.h" /> - <ClInclude Include="..\CryptoPP\seed.h" /> - <ClInclude Include="..\CryptoPP\sha.h" /> - <ClInclude Include="..\CryptoPP\shacal2.h" /> - <ClInclude Include="..\CryptoPP\simple.h" /> - <ClInclude Include="..\CryptoPP\smartptr.h" /> - <ClInclude Include="..\CryptoPP\socketft.h" /> - <ClInclude Include="..\CryptoPP\square.h" /> - <ClInclude Include="..\CryptoPP\stdcpp.h" /> - <ClInclude Include="..\CryptoPP\strciphr.h" /> - <ClInclude Include="..\CryptoPP\tea.h" /> - <ClInclude Include="..\CryptoPP\tiger.h" /> - <ClInclude Include="..\CryptoPP\trdlocal.h" /> - <ClInclude Include="..\CryptoPP\trunhash.h" /> - <ClInclude Include="..\CryptoPP\ttmac.h" /> - <ClInclude Include="..\CryptoPP\vmac.h" /> - <ClInclude Include="..\CryptoPP\wait.h" /> - <ClInclude Include="..\CryptoPP\wake.h" /> - <ClInclude Include="..\CryptoPP\winpipes.h" /> - <ClInclude Include="..\CryptoPP\words.h" /> + <ClInclude Include="..\lib\cryptopp\adler32.h" /> + <ClInclude Include="..\lib\cryptopp\aes.h" /> + <ClInclude Include="..\lib\cryptopp\algebra.h" /> + <ClInclude Include="..\lib\cryptopp\algparam.h" /> + <ClInclude Include="..\lib\cryptopp\arc4.h" /> + <ClInclude Include="..\lib\cryptopp\argnames.h" /> + <ClInclude Include="..\lib\cryptopp\asn.h" /> + <ClInclude Include="..\lib\cryptopp\authenc.h" /> + <ClInclude Include="..\lib\cryptopp\base32.h" /> + <ClInclude Include="..\lib\cryptopp\base64.h" /> + <ClInclude Include="..\lib\cryptopp\basecode.h" /> + <ClInclude Include="..\lib\cryptopp\cbcmac.h" /> + <ClInclude Include="..\lib\cryptopp\ccm.h" /> + <ClInclude Include="..\lib\cryptopp\channels.h" /> + <ClInclude Include="..\lib\cryptopp\cmac.h" /> + <ClInclude Include="..\lib\cryptopp\config.h" /> + <ClInclude Include="..\lib\cryptopp\cpu.h" /> + <ClInclude Include="..\lib\cryptopp\crc.h" /> + <ClInclude Include="..\lib\cryptopp\cryptlib.h" /> + <ClInclude Include="..\lib\cryptopp\default.h" /> + <ClInclude Include="..\lib\cryptopp\des.h" /> + <ClInclude Include="..\lib\cryptopp\dh.h" /> + <ClInclude Include="..\lib\cryptopp\dh2.h" /> + <ClInclude Include="..\lib\cryptopp\dmac.h" /> + <ClInclude Include="..\lib\cryptopp\dsa.h" /> + <ClInclude Include="..\lib\cryptopp\eax.h" /> + <ClInclude Include="..\lib\cryptopp\ec2n.h" /> + <ClInclude Include="..\lib\cryptopp\eccrypto.h" /> + <ClInclude Include="..\lib\cryptopp\ecp.h" /> + <ClInclude Include="..\lib\cryptopp\elgamal.h" /> + <ClInclude Include="..\lib\cryptopp\emsa2.h" /> + <ClInclude Include="..\lib\cryptopp\eprecomp.h" /> + <ClInclude Include="..\lib\cryptopp\esign.h" /> + <ClInclude Include="..\lib\cryptopp\files.h" /> + <ClInclude Include="..\lib\cryptopp\filters.h" /> + <ClInclude Include="..\lib\cryptopp\fips140.h" /> + <ClInclude Include="..\lib\cryptopp\fltrimpl.h" /> + <ClInclude Include="..\lib\cryptopp\gcm.h" /> + <ClInclude Include="..\lib\cryptopp\gf256.h" /> + <ClInclude Include="..\lib\cryptopp\gf2_32.h" /> + <ClInclude Include="..\lib\cryptopp\gf2n.h" /> + <ClInclude Include="..\lib\cryptopp\gfpcrypt.h" /> + <ClInclude Include="..\lib\cryptopp\gzip.h" /> + <ClInclude Include="..\lib\cryptopp\hex.h" /> + <ClInclude Include="..\lib\cryptopp\hmac.h" /> + <ClInclude Include="..\lib\cryptopp\hrtimer.h" /> + <ClInclude Include="..\lib\cryptopp\integer.h" /> + <ClInclude Include="..\lib\cryptopp\iterhash.h" /> + <ClInclude Include="..\lib\cryptopp\lubyrack.h" /> + <ClInclude Include="..\lib\cryptopp\luc.h" /> + <ClInclude Include="..\lib\cryptopp\md2.h" /> + <ClInclude Include="..\lib\cryptopp\md4.h" /> + <ClInclude Include="..\lib\cryptopp\md5.h" /> + <ClInclude Include="..\lib\cryptopp\mdc.h" /> + <ClInclude Include="..\lib\cryptopp\misc.h" /> + <ClInclude Include="..\lib\cryptopp\modarith.h" /> + <ClInclude Include="..\lib\cryptopp\modes.h" /> + <ClInclude Include="..\lib\cryptopp\modexppc.h" /> + <ClInclude Include="..\lib\cryptopp\mqueue.h" /> + <ClInclude Include="..\lib\cryptopp\mqv.h" /> + <ClInclude Include="..\lib\cryptopp\nbtheory.h" /> + <ClInclude Include="..\lib\cryptopp\network.h" /> + <ClInclude Include="..\lib\cryptopp\nr.h" /> + <ClInclude Include="..\lib\cryptopp\oaep.h" /> + <ClInclude Include="..\lib\cryptopp\oids.h" /> + <ClInclude Include="..\lib\cryptopp\osrng.h" /> + <ClInclude Include="..\lib\cryptopp\pch.h" /> + <ClInclude Include="..\lib\cryptopp\pkcspad.h" /> + <ClInclude Include="..\lib\cryptopp\polynomi.h" /> + <ClInclude Include="..\lib\cryptopp\pssr.h" /> + <ClInclude Include="..\lib\cryptopp\pubkey.h" /> + <ClInclude Include="..\lib\cryptopp\pwdbased.h" /> + <ClInclude Include="..\lib\cryptopp\queue.h" /> + <ClInclude Include="..\lib\cryptopp\rabin.h" /> + <ClInclude Include="..\lib\cryptopp\randpool.h" /> + <ClInclude Include="..\lib\cryptopp\rijndael.h" /> + <ClInclude Include="..\lib\cryptopp\rng.h" /> + <ClInclude Include="..\lib\cryptopp\rsa.h" /> + <ClInclude Include="..\lib\cryptopp\rw.h" /> + <ClInclude Include="..\lib\cryptopp\safer.h" /> + <ClInclude Include="..\lib\cryptopp\seal.h" /> + <ClInclude Include="..\lib\cryptopp\secblock.h" /> + <ClInclude Include="..\lib\cryptopp\seckey.h" /> + <ClInclude Include="..\lib\cryptopp\seed.h" /> + <ClInclude Include="..\lib\cryptopp\sha.h" /> + <ClInclude Include="..\lib\cryptopp\shacal2.h" /> + <ClInclude Include="..\lib\cryptopp\simple.h" /> + <ClInclude Include="..\lib\cryptopp\smartptr.h" /> + <ClInclude Include="..\lib\cryptopp\socketft.h" /> + <ClInclude Include="..\lib\cryptopp\square.h" /> + <ClInclude Include="..\lib\cryptopp\stdcpp.h" /> + <ClInclude Include="..\lib\cryptopp\strciphr.h" /> + <ClInclude Include="..\lib\cryptopp\tea.h" /> + <ClInclude Include="..\lib\cryptopp\tiger.h" /> + <ClInclude Include="..\lib\cryptopp\trdlocal.h" /> + <ClInclude Include="..\lib\cryptopp\trunhash.h" /> + <ClInclude Include="..\lib\cryptopp\ttmac.h" /> + <ClInclude Include="..\lib\cryptopp\vmac.h" /> + <ClInclude Include="..\lib\cryptopp\wait.h" /> + <ClInclude Include="..\lib\cryptopp\wake.h" /> + <ClInclude Include="..\lib\cryptopp\winpipes.h" /> + <ClInclude Include="..\lib\cryptopp\words.h" /> </ItemGroup> <ItemGroup> - <None Include="..\CryptoPP\Doxyfile" /> - <None Include="..\CryptoPP\GNUmakefile" /> + <None Include="..\lib\cryptopp\Doxyfile" /> + <None Include="..\lib\cryptopp\GNUmakefile" /> </ItemGroup> <ItemGroup> - <Text Include="..\CryptoPP\License.txt" /> - <Text Include="..\CryptoPP\Readme.txt" /> + <Text Include="..\lib\cryptopp\License.txt" /> + <Text Include="..\lib\cryptopp\Readme.txt" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/VC2013/CryptoPP.vcxproj.filters b/VC2013/CryptoPP.vcxproj.filters index 2a56447c6..793db552c 100644 --- a/VC2013/CryptoPP.vcxproj.filters +++ b/VC2013/CryptoPP.vcxproj.filters @@ -2,598 +2,598 @@ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ItemGroup> <Filter Include="Source Files"> - <UniqueIdentifier>{66d19353-af6a-4f52-9546-f52f44dd13cc}</UniqueIdentifier> + <UniqueIdentifier>{21031ece-70f0-4aa6-9069-6947175663ea}</UniqueIdentifier> <Extensions>.cpp</Extensions> </Filter> <Filter Include="Header Files"> - <UniqueIdentifier>{512ceb0e-67f5-47b1-b19b-59352a5e0785}</UniqueIdentifier> + <UniqueIdentifier>{20dd9259-32b4-4f5b-9af8-c689a12627ec}</UniqueIdentifier> <Extensions>.;.h</Extensions> </Filter> <Filter Include="Miscellaneous"> - <UniqueIdentifier>{b7c7d4fa-281f-482d-be38-d8106878975c}</UniqueIdentifier> + <UniqueIdentifier>{9a225122-4fcd-43c9-868a-6caf0dd272ce}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\CryptoPP\adler32.cpp"> + <ClCompile Include="..\lib\cryptopp\adler32.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\algebra.cpp"> + <ClCompile Include="..\lib\cryptopp\algebra.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\algparam.cpp"> + <ClCompile Include="..\lib\cryptopp\algparam.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\asn.cpp"> + <ClCompile Include="..\lib\cryptopp\asn.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\authenc.cpp"> + <ClCompile Include="..\lib\cryptopp\authenc.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\base32.cpp"> + <ClCompile Include="..\lib\cryptopp\base32.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\base64.cpp"> + <ClCompile Include="..\lib\cryptopp\base64.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\basecode.cpp"> + <ClCompile Include="..\lib\cryptopp\basecode.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\cbcmac.cpp"> + <ClCompile Include="..\lib\cryptopp\cbcmac.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\ccm.cpp"> + <ClCompile Include="..\lib\cryptopp\ccm.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\channels.cpp"> + <ClCompile Include="..\lib\cryptopp\channels.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\cmac.cpp"> + <ClCompile Include="..\lib\cryptopp\cmac.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\cpu.cpp"> + <ClCompile Include="..\lib\cryptopp\cpu.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\crc.cpp"> + <ClCompile Include="..\lib\cryptopp\crc.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\cryptlib.cpp"> + <ClCompile Include="..\lib\cryptopp\cryptlib.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\default.cpp"> + <ClCompile Include="..\lib\cryptopp\default.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\des.cpp"> + <ClCompile Include="..\lib\cryptopp\des.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\dessp.cpp"> + <ClCompile Include="..\lib\cryptopp\dessp.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\dh.cpp"> + <ClCompile Include="..\lib\cryptopp\dh.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\dh2.cpp"> + <ClCompile Include="..\lib\cryptopp\dh2.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\dll.cpp"> + <ClCompile Include="..\lib\cryptopp\dll.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\dsa.cpp"> + <ClCompile Include="..\lib\cryptopp\dsa.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\eax.cpp"> + <ClCompile Include="..\lib\cryptopp\eax.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\ec2n.cpp"> + <ClCompile Include="..\lib\cryptopp\ec2n.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\eccrypto.cpp"> + <ClCompile Include="..\lib\cryptopp\eccrypto.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\ecp.cpp"> + <ClCompile Include="..\lib\cryptopp\ecp.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\elgamal.cpp"> + <ClCompile Include="..\lib\cryptopp\elgamal.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\emsa2.cpp"> + <ClCompile Include="..\lib\cryptopp\emsa2.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\eprecomp.cpp"> + <ClCompile Include="..\lib\cryptopp\eprecomp.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\esign.cpp"> + <ClCompile Include="..\lib\cryptopp\esign.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\files.cpp"> + <ClCompile Include="..\lib\cryptopp\files.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\filters.cpp"> + <ClCompile Include="..\lib\cryptopp\filters.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\fips140.cpp"> + <ClCompile Include="..\lib\cryptopp\fips140.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\gcm.cpp"> + <ClCompile Include="..\lib\cryptopp\gcm.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\gf256.cpp"> + <ClCompile Include="..\lib\cryptopp\gf256.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\gf2_32.cpp"> + <ClCompile Include="..\lib\cryptopp\gf2_32.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\gf2n.cpp"> + <ClCompile Include="..\lib\cryptopp\gf2n.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\gfpcrypt.cpp"> + <ClCompile Include="..\lib\cryptopp\gfpcrypt.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\hex.cpp"> + <ClCompile Include="..\lib\cryptopp\hex.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\hmac.cpp"> + <ClCompile Include="..\lib\cryptopp\hmac.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\hrtimer.cpp"> + <ClCompile Include="..\lib\cryptopp\hrtimer.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\integer.cpp"> + <ClCompile Include="..\lib\cryptopp\integer.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\iterhash.cpp"> + <ClCompile Include="..\lib\cryptopp\iterhash.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\luc.cpp"> + <ClCompile Include="..\lib\cryptopp\luc.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\md2.cpp"> + <ClCompile Include="..\lib\cryptopp\md2.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\md4.cpp"> + <ClCompile Include="..\lib\cryptopp\md4.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\md5.cpp"> + <ClCompile Include="..\lib\cryptopp\md5.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\misc.cpp"> + <ClCompile Include="..\lib\cryptopp\misc.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\modes.cpp"> + <ClCompile Include="..\lib\cryptopp\modes.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\mqueue.cpp"> + <ClCompile Include="..\lib\cryptopp\mqueue.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\mqv.cpp"> + <ClCompile Include="..\lib\cryptopp\mqv.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\nbtheory.cpp"> + <ClCompile Include="..\lib\cryptopp\nbtheory.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\network.cpp"> + <ClCompile Include="..\lib\cryptopp\network.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\oaep.cpp"> + <ClCompile Include="..\lib\cryptopp\oaep.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\osrng.cpp"> + <ClCompile Include="..\lib\cryptopp\osrng.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\pch.cpp"> + <ClCompile Include="..\lib\cryptopp\pch.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\pkcspad.cpp"> + <ClCompile Include="..\lib\cryptopp\pkcspad.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\polynomi.cpp"> + <ClCompile Include="..\lib\cryptopp\polynomi.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\pssr.cpp"> + <ClCompile Include="..\lib\cryptopp\pssr.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\pubkey.cpp"> + <ClCompile Include="..\lib\cryptopp\pubkey.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\queue.cpp"> + <ClCompile Include="..\lib\cryptopp\queue.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\rabin.cpp"> + <ClCompile Include="..\lib\cryptopp\rabin.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\randpool.cpp"> + <ClCompile Include="..\lib\cryptopp\randpool.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\rdtables.cpp"> + <ClCompile Include="..\lib\cryptopp\rdtables.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\rijndael.cpp"> + <ClCompile Include="..\lib\cryptopp\rijndael.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\rng.cpp"> + <ClCompile Include="..\lib\cryptopp\rng.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\rsa.cpp"> + <ClCompile Include="..\lib\cryptopp\rsa.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\rw.cpp"> + <ClCompile Include="..\lib\cryptopp\rw.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\safer.cpp"> + <ClCompile Include="..\lib\cryptopp\safer.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\seal.cpp"> + <ClCompile Include="..\lib\cryptopp\seal.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\seed.cpp"> + <ClCompile Include="..\lib\cryptopp\seed.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\sha.cpp"> + <ClCompile Include="..\lib\cryptopp\sha.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\shacal2.cpp"> + <ClCompile Include="..\lib\cryptopp\shacal2.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\simple.cpp"> + <ClCompile Include="..\lib\cryptopp\simple.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\socketft.cpp"> + <ClCompile Include="..\lib\cryptopp\socketft.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\square.cpp"> + <ClCompile Include="..\lib\cryptopp\square.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\squaretb.cpp"> + <ClCompile Include="..\lib\cryptopp\squaretb.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\strciphr.cpp"> + <ClCompile Include="..\lib\cryptopp\strciphr.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\tea.cpp"> + <ClCompile Include="..\lib\cryptopp\tea.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\tiger.cpp"> + <ClCompile Include="..\lib\cryptopp\tiger.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\tigertab.cpp"> + <ClCompile Include="..\lib\cryptopp\tigertab.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\trdlocal.cpp"> + <ClCompile Include="..\lib\cryptopp\trdlocal.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\ttmac.cpp"> + <ClCompile Include="..\lib\cryptopp\ttmac.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\vmac.cpp"> + <ClCompile Include="..\lib\cryptopp\vmac.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\wait.cpp"> + <ClCompile Include="..\lib\cryptopp\wait.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\CryptoPP\winpipes.cpp"> + <ClCompile Include="..\lib\cryptopp\winpipes.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\CryptoPP\adler32.h"> + <ClInclude Include="..\lib\cryptopp\adler32.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\aes.h"> + <ClInclude Include="..\lib\cryptopp\aes.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\algebra.h"> + <ClInclude Include="..\lib\cryptopp\algebra.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\algparam.h"> + <ClInclude Include="..\lib\cryptopp\algparam.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\arc4.h"> + <ClInclude Include="..\lib\cryptopp\arc4.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\argnames.h"> + <ClInclude Include="..\lib\cryptopp\argnames.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\asn.h"> + <ClInclude Include="..\lib\cryptopp\asn.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\authenc.h"> + <ClInclude Include="..\lib\cryptopp\authenc.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\base32.h"> + <ClInclude Include="..\lib\cryptopp\base32.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\base64.h"> + <ClInclude Include="..\lib\cryptopp\base64.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\basecode.h"> + <ClInclude Include="..\lib\cryptopp\basecode.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\cbcmac.h"> + <ClInclude Include="..\lib\cryptopp\cbcmac.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\ccm.h"> + <ClInclude Include="..\lib\cryptopp\ccm.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\channels.h"> + <ClInclude Include="..\lib\cryptopp\channels.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\cmac.h"> + <ClInclude Include="..\lib\cryptopp\cmac.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\config.h"> + <ClInclude Include="..\lib\cryptopp\config.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\cpu.h"> + <ClInclude Include="..\lib\cryptopp\cpu.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\crc.h"> + <ClInclude Include="..\lib\cryptopp\crc.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\cryptlib.h"> + <ClInclude Include="..\lib\cryptopp\cryptlib.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\default.h"> + <ClInclude Include="..\lib\cryptopp\default.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\des.h"> + <ClInclude Include="..\lib\cryptopp\des.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\dh.h"> + <ClInclude Include="..\lib\cryptopp\dh.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\dh2.h"> + <ClInclude Include="..\lib\cryptopp\dh2.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\dmac.h"> + <ClInclude Include="..\lib\cryptopp\dmac.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\dsa.h"> + <ClInclude Include="..\lib\cryptopp\dsa.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\eax.h"> + <ClInclude Include="..\lib\cryptopp\eax.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\ec2n.h"> + <ClInclude Include="..\lib\cryptopp\ec2n.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\eccrypto.h"> + <ClInclude Include="..\lib\cryptopp\eccrypto.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\ecp.h"> + <ClInclude Include="..\lib\cryptopp\ecp.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\elgamal.h"> + <ClInclude Include="..\lib\cryptopp\elgamal.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\emsa2.h"> + <ClInclude Include="..\lib\cryptopp\emsa2.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\eprecomp.h"> + <ClInclude Include="..\lib\cryptopp\eprecomp.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\esign.h"> + <ClInclude Include="..\lib\cryptopp\esign.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\files.h"> + <ClInclude Include="..\lib\cryptopp\files.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\filters.h"> + <ClInclude Include="..\lib\cryptopp\filters.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\fips140.h"> + <ClInclude Include="..\lib\cryptopp\fips140.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\fltrimpl.h"> + <ClInclude Include="..\lib\cryptopp\fltrimpl.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\gcm.h"> + <ClInclude Include="..\lib\cryptopp\gcm.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\gf256.h"> + <ClInclude Include="..\lib\cryptopp\gf256.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\gf2_32.h"> + <ClInclude Include="..\lib\cryptopp\gf2_32.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\gf2n.h"> + <ClInclude Include="..\lib\cryptopp\gf2n.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\gfpcrypt.h"> + <ClInclude Include="..\lib\cryptopp\gfpcrypt.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\gzip.h"> + <ClInclude Include="..\lib\cryptopp\gzip.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\hex.h"> + <ClInclude Include="..\lib\cryptopp\hex.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\hmac.h"> + <ClInclude Include="..\lib\cryptopp\hmac.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\hrtimer.h"> + <ClInclude Include="..\lib\cryptopp\hrtimer.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\integer.h"> + <ClInclude Include="..\lib\cryptopp\integer.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\iterhash.h"> + <ClInclude Include="..\lib\cryptopp\iterhash.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\lubyrack.h"> + <ClInclude Include="..\lib\cryptopp\lubyrack.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\luc.h"> + <ClInclude Include="..\lib\cryptopp\luc.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\md2.h"> + <ClInclude Include="..\lib\cryptopp\md2.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\md4.h"> + <ClInclude Include="..\lib\cryptopp\md4.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\md5.h"> + <ClInclude Include="..\lib\cryptopp\md5.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\mdc.h"> + <ClInclude Include="..\lib\cryptopp\mdc.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\misc.h"> + <ClInclude Include="..\lib\cryptopp\misc.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\modarith.h"> + <ClInclude Include="..\lib\cryptopp\modarith.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\modes.h"> + <ClInclude Include="..\lib\cryptopp\modes.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\modexppc.h"> + <ClInclude Include="..\lib\cryptopp\modexppc.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\mqueue.h"> + <ClInclude Include="..\lib\cryptopp\mqueue.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\mqv.h"> + <ClInclude Include="..\lib\cryptopp\mqv.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\nbtheory.h"> + <ClInclude Include="..\lib\cryptopp\nbtheory.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\network.h"> + <ClInclude Include="..\lib\cryptopp\network.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\nr.h"> + <ClInclude Include="..\lib\cryptopp\nr.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\oaep.h"> + <ClInclude Include="..\lib\cryptopp\oaep.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\oids.h"> + <ClInclude Include="..\lib\cryptopp\oids.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\osrng.h"> + <ClInclude Include="..\lib\cryptopp\osrng.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\pch.h"> + <ClInclude Include="..\lib\cryptopp\pch.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\pkcspad.h"> + <ClInclude Include="..\lib\cryptopp\pkcspad.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\polynomi.h"> + <ClInclude Include="..\lib\cryptopp\polynomi.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\pssr.h"> + <ClInclude Include="..\lib\cryptopp\pssr.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\pubkey.h"> + <ClInclude Include="..\lib\cryptopp\pubkey.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\pwdbased.h"> + <ClInclude Include="..\lib\cryptopp\pwdbased.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\queue.h"> + <ClInclude Include="..\lib\cryptopp\queue.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\rabin.h"> + <ClInclude Include="..\lib\cryptopp\rabin.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\randpool.h"> + <ClInclude Include="..\lib\cryptopp\randpool.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\rijndael.h"> + <ClInclude Include="..\lib\cryptopp\rijndael.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\rng.h"> + <ClInclude Include="..\lib\cryptopp\rng.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\rsa.h"> + <ClInclude Include="..\lib\cryptopp\rsa.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\rw.h"> + <ClInclude Include="..\lib\cryptopp\rw.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\safer.h"> + <ClInclude Include="..\lib\cryptopp\safer.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\seal.h"> + <ClInclude Include="..\lib\cryptopp\seal.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\secblock.h"> + <ClInclude Include="..\lib\cryptopp\secblock.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\seckey.h"> + <ClInclude Include="..\lib\cryptopp\seckey.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\seed.h"> + <ClInclude Include="..\lib\cryptopp\seed.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\sha.h"> + <ClInclude Include="..\lib\cryptopp\sha.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\shacal2.h"> + <ClInclude Include="..\lib\cryptopp\shacal2.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\simple.h"> + <ClInclude Include="..\lib\cryptopp\simple.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\smartptr.h"> + <ClInclude Include="..\lib\cryptopp\smartptr.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\socketft.h"> + <ClInclude Include="..\lib\cryptopp\socketft.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\square.h"> + <ClInclude Include="..\lib\cryptopp\square.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\stdcpp.h"> + <ClInclude Include="..\lib\cryptopp\stdcpp.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\strciphr.h"> + <ClInclude Include="..\lib\cryptopp\strciphr.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\tea.h"> + <ClInclude Include="..\lib\cryptopp\tea.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\tiger.h"> + <ClInclude Include="..\lib\cryptopp\tiger.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\trdlocal.h"> + <ClInclude Include="..\lib\cryptopp\trdlocal.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\trunhash.h"> + <ClInclude Include="..\lib\cryptopp\trunhash.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\ttmac.h"> + <ClInclude Include="..\lib\cryptopp\ttmac.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\vmac.h"> + <ClInclude Include="..\lib\cryptopp\vmac.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\wait.h"> + <ClInclude Include="..\lib\cryptopp\wait.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\wake.h"> + <ClInclude Include="..\lib\cryptopp\wake.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\winpipes.h"> + <ClInclude Include="..\lib\cryptopp\winpipes.h"> <Filter>Header Files</Filter> </ClInclude> - <ClInclude Include="..\CryptoPP\words.h"> + <ClInclude Include="..\lib\cryptopp\words.h"> <Filter>Header Files</Filter> </ClInclude> </ItemGroup> <ItemGroup> - <None Include="..\CryptoPP\Doxyfile"> + <None Include="..\lib\cryptopp\Doxyfile"> <Filter>Miscellaneous</Filter> </None> - <None Include="..\CryptoPP\GNUmakefile"> + <None Include="..\lib\cryptopp\GNUmakefile"> <Filter>Miscellaneous</Filter> </None> </ItemGroup> <ItemGroup> - <Text Include="..\CryptoPP\License.txt"> + <Text Include="..\lib\cryptopp\License.txt"> <Filter>Miscellaneous</Filter> </Text> - <Text Include="..\CryptoPP\Readme.txt"> + <Text Include="..\lib\cryptopp\Readme.txt"> <Filter>Miscellaneous</Filter> </Text> </ItemGroup> diff --git a/VC2013/GenerateBindings.cmd b/VC2013/GenerateBindings.cmd new file mode 100644 index 000000000..1ee0f3bf0 --- /dev/null +++ b/VC2013/GenerateBindings.cmd @@ -0,0 +1,3 @@ +set ALLTOLUA_WAIT=N +cd ..\src +AllToLua.bat
\ No newline at end of file diff --git a/VC2013/JsonCpp.vcxproj b/VC2013/JsonCpp.vcxproj index c1490d4bb..f1dd1c7b5 100644 --- a/VC2013/JsonCpp.vcxproj +++ b/VC2013/JsonCpp.vcxproj @@ -134,17 +134,17 @@ </ClCompile> </ItemDefinitionGroup> <ItemGroup> - <ClInclude Include="..\jsoncpp-src-0.5.0\src\lib_json\json_batchallocator.h" /> + <ClInclude Include="..\lib\jsoncpp\src\lib_json\json_batchallocator.h" /> </ItemGroup> <ItemGroup> - <None Include="..\jsoncpp-src-0.5.0\src\lib_json\json_internalarray.inl" /> - <None Include="..\jsoncpp-src-0.5.0\src\lib_json\json_internalmap.inl" /> - <None Include="..\jsoncpp-src-0.5.0\src\lib_json\json_valueiterator.inl" /> + <None Include="..\lib\jsoncpp\src\lib_json\json_internalarray.inl" /> + <None Include="..\lib\jsoncpp\src\lib_json\json_internalmap.inl" /> + <None Include="..\lib\jsoncpp\src\lib_json\json_valueiterator.inl" /> </ItemGroup> <ItemGroup> - <ClCompile Include="..\jsoncpp-src-0.5.0\src\lib_json\json_reader.cpp" /> - <ClCompile Include="..\jsoncpp-src-0.5.0\src\lib_json\json_value.cpp" /> - <ClCompile Include="..\jsoncpp-src-0.5.0\src\lib_json\json_writer.cpp" /> + <ClCompile Include="..\lib\jsoncpp\src\lib_json\json_reader.cpp" /> + <ClCompile Include="..\lib\jsoncpp\src\lib_json\json_value.cpp" /> + <ClCompile Include="..\lib\jsoncpp\src\lib_json\json_writer.cpp" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/VC2013/JsonCpp.vcxproj.filters b/VC2013/JsonCpp.vcxproj.filters index cf8ea5d00..b46dae3fd 100644 --- a/VC2013/JsonCpp.vcxproj.filters +++ b/VC2013/JsonCpp.vcxproj.filters @@ -7,29 +7,29 @@ </Filter> </ItemGroup> <ItemGroup> - <ClInclude Include="..\jsoncpp-src-0.5.0\src\lib_json\json_batchallocator.h"> + <ClInclude Include="..\lib\jsoncpp\src\lib_json\json_batchallocator.h"> <Filter>Source Files</Filter> </ClInclude> </ItemGroup> <ItemGroup> - <None Include="..\jsoncpp-src-0.5.0\src\lib_json\json_internalarray.inl"> + <None Include="..\lib\jsoncpp\src\lib_json\json_internalarray.inl"> <Filter>Source Files</Filter> </None> - <None Include="..\jsoncpp-src-0.5.0\src\lib_json\json_internalmap.inl"> + <None Include="..\lib\jsoncpp\src\lib_json\json_internalmap.inl"> <Filter>Source Files</Filter> </None> - <None Include="..\jsoncpp-src-0.5.0\src\lib_json\json_valueiterator.inl"> + <None Include="..\lib\jsoncpp\src\lib_json\json_valueiterator.inl"> <Filter>Source Files</Filter> </None> </ItemGroup> <ItemGroup> - <ClCompile Include="..\jsoncpp-src-0.5.0\src\lib_json\json_reader.cpp"> + <ClCompile Include="..\lib\jsoncpp\src\lib_json\json_reader.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\jsoncpp-src-0.5.0\src\lib_json\json_value.cpp"> + <ClCompile Include="..\lib\jsoncpp\src\lib_json\json_value.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\jsoncpp-src-0.5.0\src\lib_json\json_writer.cpp"> + <ClCompile Include="..\lib\jsoncpp\src\lib_json\json_writer.cpp"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> diff --git a/VC2013/Lua.vcxproj b/VC2013/Lua.vcxproj index 453ccb984..2488aa6aa 100644 --- a/VC2013/Lua.vcxproj +++ b/VC2013/Lua.vcxproj @@ -130,63 +130,63 @@ </ClCompile> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\lua-5.1.4\src\lapi.c" /> - <ClCompile Include="..\lua-5.1.4\src\lauxlib.c" /> - <ClCompile Include="..\lua-5.1.4\src\lbaselib.c" /> - <ClCompile Include="..\lua-5.1.4\src\lcode.c" /> - <ClCompile Include="..\lua-5.1.4\src\ldblib.c" /> - <ClCompile Include="..\lua-5.1.4\src\ldebug.c" /> - <ClCompile Include="..\lua-5.1.4\src\ldo.c" /> - <ClCompile Include="..\lua-5.1.4\src\ldump.c" /> - <ClCompile Include="..\lua-5.1.4\src\lfunc.c" /> - <ClCompile Include="..\lua-5.1.4\src\lgc.c" /> - <ClCompile Include="..\lua-5.1.4\src\linit.c" /> - <ClCompile Include="..\lua-5.1.4\src\liolib.c" /> - <ClCompile Include="..\lua-5.1.4\src\llex.c" /> - <ClCompile Include="..\lua-5.1.4\src\lmathlib.c" /> - <ClCompile Include="..\lua-5.1.4\src\lmem.c" /> - <ClCompile Include="..\lua-5.1.4\src\loadlib.c" /> - <ClCompile Include="..\lua-5.1.4\src\lobject.c" /> - <ClCompile Include="..\lua-5.1.4\src\lopcodes.c" /> - <ClCompile Include="..\lua-5.1.4\src\loslib.c" /> - <ClCompile Include="..\lua-5.1.4\src\lparser.c" /> - <ClCompile Include="..\lua-5.1.4\src\lstate.c" /> - <ClCompile Include="..\lua-5.1.4\src\lstring.c" /> - <ClCompile Include="..\lua-5.1.4\src\lstrlib.c" /> - <ClCompile Include="..\lua-5.1.4\src\ltable.c" /> - <ClCompile Include="..\lua-5.1.4\src\ltablib.c" /> - <ClCompile Include="..\lua-5.1.4\src\ltm.c" /> - <ClCompile Include="..\lua-5.1.4\src\lua.c" /> - <ClCompile Include="..\lua-5.1.4\src\luac.c" /> - <ClCompile Include="..\lua-5.1.4\src\lundump.c" /> - <ClCompile Include="..\lua-5.1.4\src\lvm.c" /> - <ClCompile Include="..\lua-5.1.4\src\lzio.c" /> - <ClCompile Include="..\lua-5.1.4\src\print.c" /> + <ClCompile Include="..\lib\lua\src\lapi.c" /> + <ClCompile Include="..\lib\lua\src\lauxlib.c" /> + <ClCompile Include="..\lib\lua\src\lbaselib.c" /> + <ClCompile Include="..\lib\lua\src\lcode.c" /> + <ClCompile Include="..\lib\lua\src\ldblib.c" /> + <ClCompile Include="..\lib\lua\src\ldebug.c" /> + <ClCompile Include="..\lib\lua\src\ldo.c" /> + <ClCompile Include="..\lib\lua\src\ldump.c" /> + <ClCompile Include="..\lib\lua\src\lfunc.c" /> + <ClCompile Include="..\lib\lua\src\lgc.c" /> + <ClCompile Include="..\lib\lua\src\linit.c" /> + <ClCompile Include="..\lib\lua\src\liolib.c" /> + <ClCompile Include="..\lib\lua\src\llex.c" /> + <ClCompile Include="..\lib\lua\src\lmathlib.c" /> + <ClCompile Include="..\lib\lua\src\lmem.c" /> + <ClCompile Include="..\lib\lua\src\loadlib.c" /> + <ClCompile Include="..\lib\lua\src\lobject.c" /> + <ClCompile Include="..\lib\lua\src\lopcodes.c" /> + <ClCompile Include="..\lib\lua\src\loslib.c" /> + <ClCompile Include="..\lib\lua\src\lparser.c" /> + <ClCompile Include="..\lib\lua\src\lstate.c" /> + <ClCompile Include="..\lib\lua\src\lstring.c" /> + <ClCompile Include="..\lib\lua\src\lstrlib.c" /> + <ClCompile Include="..\lib\lua\src\ltable.c" /> + <ClCompile Include="..\lib\lua\src\ltablib.c" /> + <ClCompile Include="..\lib\lua\src\ltm.c" /> + <ClCompile Include="..\lib\lua\src\lua.c" /> + <ClCompile Include="..\lib\lua\src\luac.c" /> + <ClCompile Include="..\lib\lua\src\lundump.c" /> + <ClCompile Include="..\lib\lua\src\lvm.c" /> + <ClCompile Include="..\lib\lua\src\lzio.c" /> + <ClCompile Include="..\lib\lua\src\print.c" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\lua-5.1.4\src\lapi.h" /> - <ClInclude Include="..\lua-5.1.4\src\lauxlib.h" /> - <ClInclude Include="..\lua-5.1.4\src\lcode.h" /> - <ClInclude Include="..\lua-5.1.4\src\ldebug.h" /> - <ClInclude Include="..\lua-5.1.4\src\ldo.h" /> - <ClInclude Include="..\lua-5.1.4\src\lfunc.h" /> - <ClInclude Include="..\lua-5.1.4\src\lgc.h" /> - <ClInclude Include="..\lua-5.1.4\src\llex.h" /> - <ClInclude Include="..\lua-5.1.4\src\llimits.h" /> - <ClInclude Include="..\lua-5.1.4\src\lmem.h" /> - <ClInclude Include="..\lua-5.1.4\src\lobject.h" /> - <ClInclude Include="..\lua-5.1.4\src\lopcodes.h" /> - <ClInclude Include="..\lua-5.1.4\src\lparser.h" /> - <ClInclude Include="..\lua-5.1.4\src\lstate.h" /> - <ClInclude Include="..\lua-5.1.4\src\lstring.h" /> - <ClInclude Include="..\lua-5.1.4\src\ltable.h" /> - <ClInclude Include="..\lua-5.1.4\src\ltm.h" /> - <ClInclude Include="..\lua-5.1.4\src\lua.h" /> - <ClInclude Include="..\lua-5.1.4\src\luaconf.h" /> - <ClInclude Include="..\lua-5.1.4\src\lualib.h" /> - <ClInclude Include="..\lua-5.1.4\src\lundump.h" /> - <ClInclude Include="..\lua-5.1.4\src\lvm.h" /> - <ClInclude Include="..\lua-5.1.4\src\lzio.h" /> + <ClInclude Include="..\lib\lua\src\lapi.h" /> + <ClInclude Include="..\lib\lua\src\lauxlib.h" /> + <ClInclude Include="..\lib\lua\src\lcode.h" /> + <ClInclude Include="..\lib\lua\src\ldebug.h" /> + <ClInclude Include="..\lib\lua\src\ldo.h" /> + <ClInclude Include="..\lib\lua\src\lfunc.h" /> + <ClInclude Include="..\lib\lua\src\lgc.h" /> + <ClInclude Include="..\lib\lua\src\llex.h" /> + <ClInclude Include="..\lib\lua\src\llimits.h" /> + <ClInclude Include="..\lib\lua\src\lmem.h" /> + <ClInclude Include="..\lib\lua\src\lobject.h" /> + <ClInclude Include="..\lib\lua\src\lopcodes.h" /> + <ClInclude Include="..\lib\lua\src\lparser.h" /> + <ClInclude Include="..\lib\lua\src\lstate.h" /> + <ClInclude Include="..\lib\lua\src\lstring.h" /> + <ClInclude Include="..\lib\lua\src\ltable.h" /> + <ClInclude Include="..\lib\lua\src\ltm.h" /> + <ClInclude Include="..\lib\lua\src\lua.h" /> + <ClInclude Include="..\lib\lua\src\luaconf.h" /> + <ClInclude Include="..\lib\lua\src\lualib.h" /> + <ClInclude Include="..\lib\lua\src\lundump.h" /> + <ClInclude Include="..\lib\lua\src\lvm.h" /> + <ClInclude Include="..\lib\lua\src\lzio.h" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/VC2013/Lua.vcxproj.filters b/VC2013/Lua.vcxproj.filters index 0ddb91719..21cc86850 100644 --- a/VC2013/Lua.vcxproj.filters +++ b/VC2013/Lua.vcxproj.filters @@ -7,126 +7,126 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\lua-5.1.4\src\lapi.c"> + <ClCompile Include="..\lib\lua\src\lapi.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lauxlib.c"> + <ClCompile Include="..\lib\lua\src\lauxlib.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lbaselib.c"> + <ClCompile Include="..\lib\lua\src\lbaselib.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lcode.c"> + <ClCompile Include="..\lib\lua\src\lcode.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\ldblib.c"> + <ClCompile Include="..\lib\lua\src\ldblib.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\ldebug.c"> + <ClCompile Include="..\lib\lua\src\ldebug.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\ldo.c"> + <ClCompile Include="..\lib\lua\src\ldo.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\ldump.c"> + <ClCompile Include="..\lib\lua\src\ldump.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lfunc.c"> + <ClCompile Include="..\lib\lua\src\lfunc.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lgc.c"> + <ClCompile Include="..\lib\lua\src\lgc.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\linit.c"> + <ClCompile Include="..\lib\lua\src\linit.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\liolib.c"> + <ClCompile Include="..\lib\lua\src\liolib.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\llex.c"> + <ClCompile Include="..\lib\lua\src\llex.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lmathlib.c"> + <ClCompile Include="..\lib\lua\src\lmathlib.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lmem.c"> + <ClCompile Include="..\lib\lua\src\lmem.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\loadlib.c"> + <ClCompile Include="..\lib\lua\src\loadlib.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lobject.c"> + <ClCompile Include="..\lib\lua\src\lobject.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lopcodes.c"> + <ClCompile Include="..\lib\lua\src\lopcodes.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\loslib.c"> + <ClCompile Include="..\lib\lua\src\loslib.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lparser.c"> + <ClCompile Include="..\lib\lua\src\lparser.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lstate.c"> + <ClCompile Include="..\lib\lua\src\lstate.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lstring.c"> + <ClCompile Include="..\lib\lua\src\lstring.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lstrlib.c"> + <ClCompile Include="..\lib\lua\src\lstrlib.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\ltable.c"> + <ClCompile Include="..\lib\lua\src\ltable.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\ltablib.c"> + <ClCompile Include="..\lib\lua\src\ltablib.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\ltm.c"> + <ClCompile Include="..\lib\lua\src\ltm.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lua.c"> + <ClCompile Include="..\lib\lua\src\lua.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\luac.c"> + <ClCompile Include="..\lib\lua\src\luac.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lundump.c"> + <ClCompile Include="..\lib\lua\src\lundump.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lvm.c"> + <ClCompile Include="..\lib\lua\src\lvm.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\lzio.c"> + <ClCompile Include="..\lib\lua\src\lzio.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\lua-5.1.4\src\print.c"> + <ClCompile Include="..\lib\lua\src\print.c"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\lua-5.1.4\src\lapi.h" /> - <ClInclude Include="..\lua-5.1.4\src\lauxlib.h" /> - <ClInclude Include="..\lua-5.1.4\src\lcode.h" /> - <ClInclude Include="..\lua-5.1.4\src\ldebug.h" /> - <ClInclude Include="..\lua-5.1.4\src\ldo.h" /> - <ClInclude Include="..\lua-5.1.4\src\lfunc.h" /> - <ClInclude Include="..\lua-5.1.4\src\lgc.h" /> - <ClInclude Include="..\lua-5.1.4\src\llex.h" /> - <ClInclude Include="..\lua-5.1.4\src\llimits.h" /> - <ClInclude Include="..\lua-5.1.4\src\lmem.h" /> - <ClInclude Include="..\lua-5.1.4\src\lobject.h" /> - <ClInclude Include="..\lua-5.1.4\src\lopcodes.h" /> - <ClInclude Include="..\lua-5.1.4\src\lparser.h" /> - <ClInclude Include="..\lua-5.1.4\src\lstate.h" /> - <ClInclude Include="..\lua-5.1.4\src\lstring.h" /> - <ClInclude Include="..\lua-5.1.4\src\ltable.h" /> - <ClInclude Include="..\lua-5.1.4\src\ltm.h" /> - <ClInclude Include="..\lua-5.1.4\src\lua.h" /> - <ClInclude Include="..\lua-5.1.4\src\luaconf.h" /> - <ClInclude Include="..\lua-5.1.4\src\lualib.h" /> - <ClInclude Include="..\lua-5.1.4\src\lundump.h" /> - <ClInclude Include="..\lua-5.1.4\src\lvm.h" /> - <ClInclude Include="..\lua-5.1.4\src\lzio.h" /> + <ClInclude Include="..\lib\lua\src\lapi.h" /> + <ClInclude Include="..\lib\lua\src\lauxlib.h" /> + <ClInclude Include="..\lib\lua\src\lcode.h" /> + <ClInclude Include="..\lib\lua\src\ldebug.h" /> + <ClInclude Include="..\lib\lua\src\ldo.h" /> + <ClInclude Include="..\lib\lua\src\lfunc.h" /> + <ClInclude Include="..\lib\lua\src\lgc.h" /> + <ClInclude Include="..\lib\lua\src\llex.h" /> + <ClInclude Include="..\lib\lua\src\llimits.h" /> + <ClInclude Include="..\lib\lua\src\lmem.h" /> + <ClInclude Include="..\lib\lua\src\lobject.h" /> + <ClInclude Include="..\lib\lua\src\lopcodes.h" /> + <ClInclude Include="..\lib\lua\src\lparser.h" /> + <ClInclude Include="..\lib\lua\src\lstate.h" /> + <ClInclude Include="..\lib\lua\src\lstring.h" /> + <ClInclude Include="..\lib\lua\src\ltable.h" /> + <ClInclude Include="..\lib\lua\src\ltm.h" /> + <ClInclude Include="..\lib\lua\src\lua.h" /> + <ClInclude Include="..\lib\lua\src\luaconf.h" /> + <ClInclude Include="..\lib\lua\src\lualib.h" /> + <ClInclude Include="..\lib\lua\src\lundump.h" /> + <ClInclude Include="..\lib\lua\src\lvm.h" /> + <ClInclude Include="..\lib\lua\src\lzio.h" /> </ItemGroup> </Project>
\ No newline at end of file diff --git a/VC2013/MCServer.ipgset b/VC2013/MCServer.ipgset deleted file mode 100644 index 16f00e1ca..000000000 --- a/VC2013/MCServer.ipgset +++ /dev/null @@ -1,317 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<PerformanceGuideStateManager xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.intel.com"> - <Checkpoints xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" /> - <CompletionStatusMap xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>PerformanceGuide</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>Introduction</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>true</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>GettingStarted</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>true</IsDone> - <NextAlwaysEnabled>true</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>GetPerformanceBaseline</d2p1:Key> - <d2p1:Value> - <IsCurrent>true</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>CheckPerfBaseline</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>true</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>ProfileApp</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>ReviewHotspots</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>true</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>UseIntelCompiler</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>SelectFilesForIntelC</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>GetPerformanceProgressWithIntelC</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>CheckPerfProgressIntelC</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>true</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>DetermineIntelCompilerOptions</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>GetPerformanceProgressWithNewOptions</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>CheckPerfProgressNewOptions</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>true</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>UseGAP</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>ReviewGAPAdvice</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>true</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>GetPerformanceProgressWithGAP</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>CheckPerfProgressGAP</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>true</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>UsePGO</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>CheckPerfProgressPGO</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>true</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>ContinueOptimizations</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>ParallelAmplifier</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>true</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>ParallelAdvisor</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>true</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:KeyValueOfstringStateY1yixN8r> - <d2p1:Key>Summary</d2p1:Key> - <d2p1:Value> - <IsCurrent>false</IsCurrent> - <IsDone>false</IsDone> - <NextAlwaysEnabled>false</NextAlwaysEnabled> - <NextAlwaysFocused>false</NextAlwaysFocused> - <ShowDoneStatus>false</ShowDoneStatus> - </d2p1:Value> - </d2p1:KeyValueOfstringStateY1yixN8r> - </CompletionStatusMap> - <GapAdvices xmlns:d2p1="http://schemas.datacontract.org/2004/07/Intel.PerformanceGuide" /> - <GapAnalysisHasBeenRun>false</GapAnalysisHasBeenRun> - <Hotspots /> - <IppMatches /> - <IppSearchHasBeenRun>false</IppSearchHasBeenRun> - <OptionSelectorDialogState xmlns:d2p1="http://schemas.datacontract.org/2004/07/Intel.PerformanceGuide" /> - <OptionSelectorHasBeenRun>false</OptionSelectorHasBeenRun> - <SearchIppDialogState> - <Domains> - <IppDomainViewModel> - <DomainName>Image Color Conversion</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - <IppDomainViewModel> - <DomainName>Symmetric Cryptography</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - <IppDomainViewModel> - <DomainName>One-Way Hash Primitives</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - <IppDomainViewModel> - <DomainName>Public Key Cryptography</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - <IppDomainViewModel> - <DomainName>Image Geometry Transforms</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - <IppDomainViewModel> - <DomainName>Image Compression</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - <IppDomainViewModel> - <DomainName>Video Coding</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - <IppDomainViewModel> - <DomainName>Computer Vision</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - <IppDomainViewModel> - <DomainName>Data Integrity</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - <IppDomainViewModel> - <DomainName>Digital Signal Processing</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - <IppDomainViewModel> - <DomainName>Speech And Telephony Encode/Decode</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - <IppDomainViewModel> - <DomainName>Data Compression</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - <IppDomainViewModel> - <DomainName>Audio Coding</DomainName> - <isSelected>true</isSelected> - </IppDomainViewModel> - </Domains> - <SearchInComments>true</SearchInComments> - </SearchIppDialogState> - <UIState>0</UIState> - <WorkflowSettings xmlns:d2p1="http://schemas.datacontract.org/2004/07/Intel.PerformanceGuide"> - <d2p1:CopyFromConfigurationName></d2p1:CopyFromConfigurationName> - <d2p1:CreateNewConfiguration>true</d2p1:CreateNewConfiguration> - <d2p1:NewConfigurationName></d2p1:NewConfigurationName> - <d2p1:UseDebugSettingsToRun>true</d2p1:UseDebugSettingsToRun> - </WorkflowSettings> -</PerformanceGuideStateManager>
\ No newline at end of file diff --git a/VC2013/MCServer.sln b/VC2013/MCServer.sln index d122a0d48..9dcfc802e 100644 --- a/VC2013/MCServer.sln +++ b/VC2013/MCServer.sln @@ -1,16 +1,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 +# Visual Studio Express 2013 for Windows Desktop VisualStudioVersion = 12.0.21005.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MCServer", "MCServer.vcxproj", "{32012054-0C96-4C43-AB27-174FF8E72D66}" - ProjectSection(ProjectDependencies) = postProject - {082E8185-7B3A-4945-8C82-9132341A329D} = {082E8185-7B3A-4945-8C82-9132341A329D} - {5FCFAF8D-FF2C-456D-A72C-1D76F913AD96} = {5FCFAF8D-FF2C-456D-A72C-1D76F913AD96} - {3423EC9A-52E4-4A4D-9753-EDEBC38785EF} = {3423EC9A-52E4-4A4D-9753-EDEBC38785EF} - {EEAB54AD-114C-4AB8-8482-0A52D502BD35} = {EEAB54AD-114C-4AB8-8482-0A52D502BD35} - {5AAA90B9-946D-4034-83F3-676B06A6E326} = {5AAA90B9-946D-4034-83F3-676B06A6E326} - {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA} = {EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA} - EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlib", "zlib.vcxproj", "{EA9D50FD-937A-4EF5-8C37-5F4175AF4FEA}" EndProject diff --git a/VC2013/MCServer.vcxproj b/VC2013/MCServer.vcxproj index cd9f6eb4f..ecb568e9a 100644 --- a/VC2013/MCServer.vcxproj +++ b/VC2013/MCServer.vcxproj @@ -64,7 +64,7 @@ <_ProjectFileVersion>12.0.21005.1</_ProjectFileVersion> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <OutDir>..\MCServer\</OutDir> + <OutDir>Debug\</OutDir> <IntDir>Debug\</IntDir> <LinkIncremental>true</LinkIncremental> </PropertyGroup> @@ -83,9 +83,9 @@ </PropertyGroup> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> - <AdditionalOptions>/MP /FS %(AdditionalOptions)</AdditionalOptions> + <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>../zlib-1.2.7;../jsoncpp-src-0.5.0/include;../lua-5.1.4/src;../tolua++-1.0.93/include;..;../expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>../lib/zlib;../lib/jsoncpp/include;../lib/lua/src;../lib/tolua++/include;..;../lib/expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -94,13 +94,10 @@ <PrecompiledHeaderFile>Globals.h</PrecompiledHeaderFile> <WarningLevel>Level3</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> - <IntrinsicFunctions>false</IntrinsicFunctions> - <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> - <EnableFiberSafeOptimizations>false</EnableFiberSafeOptimizations> </ClCompile> <Link> <AdditionalDependencies>ws2_32.lib;Psapi.lib;%(AdditionalDependencies)</AdditionalDependencies> - <OutputFile>$(ProjectDir)\..\MCServer\$(ProjectName).exe</OutputFile> + <OutputFile>$(ProjectDir)\..\MCServer\$(ProjectName)_debug.exe</OutputFile> <GenerateDebugInformation>true</GenerateDebugInformation> <SubSystem>Console</SubSystem> <TargetMachine>MachineX86</TargetMachine> @@ -113,7 +110,7 @@ <IntrinsicFunctions>true</IntrinsicFunctions> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <WholeProgramOptimization>true</WholeProgramOptimization> - <AdditionalIncludeDirectories>../zlib-1.2.7;../jsoncpp-src-0.5.0/include;../lua-5.1.4/src;../tolua++-1.0.93/include;..;../expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>../lib/zlib;../lib/jsoncpp/include;../lib/lua/src;../lib/tolua++/include;..;../lib/expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <PrecompiledHeader>Use</PrecompiledHeader> @@ -139,7 +136,7 @@ <IntrinsicFunctions>true</IntrinsicFunctions> <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> <WholeProgramOptimization>true</WholeProgramOptimization> - <AdditionalIncludeDirectories>../zlib-1.2.7;../jsoncpp-src-0.5.0/include;../lua-5.1.4/src;../tolua++-1.0.93/include;..;../expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>../lib/zlib;../lib/jsoncpp/include;../lib/lua/src;../lib/tolua++/include;..;../lib/expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <PrecompiledHeader>Use</PrecompiledHeader> @@ -163,7 +160,7 @@ <ClCompile> <AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>../zlib-1.2.7;../jsoncpp-src-0.5.0/include;../lua-5.1.4/src;../tolua++-1.0.93/include;..;../expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>../lib/zlib;../lib/jsoncpp/include;../lib/lua/src;../lib/tolua++/include;..;../lib/expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>false</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -189,293 +186,293 @@ </ItemGroup> <ItemGroup> <ClInclude Include="resource_MCServer.h" /> - <ClInclude Include="..\source\Authenticator.h" /> - <ClInclude Include="..\source\BlockArea.h" /> - <ClInclude Include="..\source\BlockID.h" /> - <ClInclude Include="..\source\BlockTracer.h" /> - <ClInclude Include="..\source\BoundingBox.h" /> - <ClInclude Include="..\source\ByteBuffer.h" /> - <ClInclude Include="..\source\ChatColor.h" /> - <ClInclude Include="..\source\Chunk.h" /> - <ClInclude Include="..\source\Chunk.inl.h" /> - <ClInclude Include="..\source\ChunkDef.h" /> - <ClInclude Include="..\source\ChunkMap.h" /> - <ClInclude Include="..\source\ChunkSender.h" /> - <ClInclude Include="..\source\ClientHandle.h" /> - <ClInclude Include="..\source\CommandOutput.h" /> - <ClInclude Include="..\source\CraftingRecipes.h" /> - <ClInclude Include="..\source\Cuboid.h" /> - <ClInclude Include="..\source\DeadlockDetect.h" /> - <ClInclude Include="..\source\Defines.h" /> - <ClInclude Include="..\source\Enchantments.h" /> - <ClInclude Include="..\source\Endianness.h" /> - <ClInclude Include="..\source\FastRandom.h" /> - <ClInclude Include="..\source\FurnaceRecipe.h" /> - <ClInclude Include="..\source\Globals.h" /> - <ClInclude Include="..\source\Group.h" /> - <ClInclude Include="..\source\GroupManager.h" /> - <ClInclude Include="..\source\Inventory.h" /> - <ClInclude Include="..\source\Item.h" /> - <ClInclude Include="..\source\ItemGrid.h" /> - <ClInclude Include="..\source\Ladder.h" /> - <ClInclude Include="..\source\LeakFinder.h" /> - <ClInclude Include="..\source\LightingThread.h" /> - <ClInclude Include="..\source\LinearInterpolation.h" /> - <ClInclude Include="..\source\LinearUpscale.h" /> - <ClInclude Include="..\source\LineBlockTracer.h" /> - <ClInclude Include="..\source\Log.h" /> - <ClInclude Include="..\source\Matrix4f.h" /> - <ClInclude Include="..\source\MCLogger.h" /> - <ClInclude Include="..\source\MemoryLeak.h" /> - <ClInclude Include="..\source\MersenneTwister.h" /> - <ClInclude Include="..\source\MobCensus.h" /> - <ClInclude Include="..\source\MobFamilyCollecter.h" /> - <ClInclude Include="..\source\MobProximityCounter.h" /> - <ClInclude Include="..\source\MobSpawner.h" /> - <ClInclude Include="..\source\MonsterConfig.h" /> - <ClInclude Include="..\source\Noise.h" /> - <ClInclude Include="..\source\Piston.h" /> - <ClInclude Include="..\source\ProbabDistrib.h" /> - <ClInclude Include="..\source\RCONServer.h" /> - <ClInclude Include="..\source\ReferenceManager.h" /> - <ClInclude Include="..\source\Root.h" /> - <ClInclude Include="..\source\Server.h" /> - <ClInclude Include="..\source\Sign.h" /> - <ClInclude Include="..\source\StackWalker.h" /> - <ClInclude Include="..\source\StringCompression.h" /> - <ClInclude Include="..\source\StringUtils.h" /> - <ClInclude Include="..\source\Tracer.h" /> - <ClInclude Include="..\source\Vector3d.h" /> - <ClInclude Include="..\source\Vector3f.h" /> - <ClInclude Include="..\source\Vector3i.h" /> - <ClInclude Include="..\source\WebAdmin.h" /> - <ClInclude Include="..\source\World.h" /> - <ClInclude Include="..\source\Mobs\AggressiveMonster.h" /> - <ClInclude Include="..\source\Mobs\Bat.h" /> - <ClInclude Include="..\source\Mobs\Blaze.h" /> - <ClInclude Include="..\source\Mobs\Cavespider.h" /> - <ClInclude Include="..\source\Mobs\Chicken.h" /> - <ClInclude Include="..\source\Mobs\Cow.h" /> - <ClInclude Include="..\source\Mobs\Creeper.h" /> - <ClInclude Include="..\source\Mobs\EnderDragon.h" /> - <ClInclude Include="..\source\Mobs\Enderman.h" /> - <ClInclude Include="..\source\Mobs\Ghast.h" /> - <ClInclude Include="..\source\Mobs\Giant.h" /> - <ClInclude Include="..\source\Mobs\Horse.h" /> - <ClInclude Include="..\source\Mobs\IronGolem.h" /> - <ClInclude Include="..\source\Mobs\MagmaCube.h" /> - <ClInclude Include="..\source\Mobs\Monster.h" /> - <ClInclude Include="..\source\Mobs\Mooshroom.h" /> - <ClInclude Include="..\source\Mobs\Ocelot.h" /> - <ClInclude Include="..\source\Mobs\PassiveAggressiveMonster.h" /> - <ClInclude Include="..\source\Mobs\PassiveMonster.h" /> - <ClInclude Include="..\source\Mobs\Pig.h" /> - <ClInclude Include="..\source\Mobs\Sheep.h" /> - <ClInclude Include="..\source\Mobs\Silverfish.h" /> - <ClInclude Include="..\source\Mobs\Skeleton.h" /> - <ClInclude Include="..\source\Mobs\Slime.h" /> - <ClInclude Include="..\source\Mobs\SnowGolem.h" /> - <ClInclude Include="..\source\Mobs\Spider.h" /> - <ClInclude Include="..\source\Mobs\Squid.h" /> - <ClInclude Include="..\source\Mobs\Villager.h" /> - <ClInclude Include="..\source\Mobs\Witch.h" /> - <ClInclude Include="..\source\Mobs\Wither.h" /> - <ClInclude Include="..\source\Mobs\Wolf.h" /> - <ClInclude Include="..\source\Mobs\Zombie.h" /> - <ClInclude Include="..\source\Mobs\ZombiePigman.h" /> - <ClInclude Include="..\source\Entities\Boat.h" /> - <ClInclude Include="..\source\Entities\Entity.h" /> - <ClInclude Include="..\source\Entities\FallingBlock.h" /> - <ClInclude Include="..\source\Entities\Minecart.h" /> - <ClInclude Include="..\source\Entities\Pawn.h" /> - <ClInclude Include="..\source\Entities\Pickup.h" /> - <ClInclude Include="..\source\Entities\Player.h" /> - <ClInclude Include="..\source\Entities\ProjectileEntity.h" /> - <ClInclude Include="..\source\Entities\TNTEntity.h" /> - <ClInclude Include="..\source\UI\SlotArea.h" /> - <ClInclude Include="..\source\UI\Window.h" /> - <ClInclude Include="..\source\UI\WindowOwner.h" /> - <ClInclude Include="..\source\Simulator\DelayedFluidSimulator.h" /> - <ClInclude Include="..\source\Simulator\FireSimulator.h" /> - <ClInclude Include="..\source\Simulator\FloodyFluidSimulator.h" /> - <ClInclude Include="..\source\Simulator\FluidSimulator.h" /> - <ClInclude Include="..\source\Simulator\NoopFluidSimulator.h" /> - <ClInclude Include="..\source\Simulator\RedstoneSimulator.h" /> - <ClInclude Include="..\source\Simulator\SandSimulator.h" /> - <ClInclude Include="..\source\Simulator\Simulator.h" /> - <ClInclude Include="..\source\Simulator\SimulatorManager.h" /> - <ClInclude Include="..\source\Simulator\VaporizeFluidSimulator.h" /> - <ClInclude Include="..\source\OSSupport\BlockingTCPLink.h" /> - <ClInclude Include="..\source\OSSupport\CriticalSection.h" /> - <ClInclude Include="..\source\OSSupport\Event.h" /> - <ClInclude Include="..\source\OSSupport\File.h" /> - <ClInclude Include="..\source\OSSupport\GZipFile.h" /> - <ClInclude Include="..\source\OSSupport\IsThread.h" /> - <ClInclude Include="..\source\OSSupport\ListenThread.h" /> - <ClInclude Include="..\source\OSSupport\Semaphore.h" /> - <ClInclude Include="..\source\OSSupport\Sleep.h" /> - <ClInclude Include="..\source\OSSupport\Socket.h" /> - <ClInclude Include="..\source\OSSupport\SocketThreads.h" /> - <ClInclude Include="..\source\OSSupport\Thread.h" /> - <ClInclude Include="..\source\OSSupport\Timer.h" /> + <ClInclude Include="..\src\Authenticator.h" /> + <ClInclude Include="..\src\BlockArea.h" /> + <ClInclude Include="..\src\BlockID.h" /> + <ClInclude Include="..\src\BlockTracer.h" /> + <ClInclude Include="..\src\BoundingBox.h" /> + <ClInclude Include="..\src\ByteBuffer.h" /> + <ClInclude Include="..\src\ChatColor.h" /> + <ClInclude Include="..\src\Chunk.h" /> + <ClInclude Include="..\src\Chunk.inl.h" /> + <ClInclude Include="..\src\ChunkDef.h" /> + <ClInclude Include="..\src\ChunkMap.h" /> + <ClInclude Include="..\src\ChunkSender.h" /> + <ClInclude Include="..\src\ClientHandle.h" /> + <ClInclude Include="..\src\CommandOutput.h" /> + <ClInclude Include="..\src\CraftingRecipes.h" /> + <ClInclude Include="..\src\Cuboid.h" /> + <ClInclude Include="..\src\DeadlockDetect.h" /> + <ClInclude Include="..\src\Defines.h" /> + <ClInclude Include="..\src\Enchantments.h" /> + <ClInclude Include="..\src\Endianness.h" /> + <ClInclude Include="..\src\FastRandom.h" /> + <ClInclude Include="..\src\FurnaceRecipe.h" /> + <ClInclude Include="..\src\Globals.h" /> + <ClInclude Include="..\src\Group.h" /> + <ClInclude Include="..\src\GroupManager.h" /> + <ClInclude Include="..\src\Inventory.h" /> + <ClInclude Include="..\src\Item.h" /> + <ClInclude Include="..\src\ItemGrid.h" /> + <ClInclude Include="..\src\Ladder.h" /> + <ClInclude Include="..\src\LeakFinder.h" /> + <ClInclude Include="..\src\LightingThread.h" /> + <ClInclude Include="..\src\LinearInterpolation.h" /> + <ClInclude Include="..\src\LinearUpscale.h" /> + <ClInclude Include="..\src\LineBlockTracer.h" /> + <ClInclude Include="..\src\Log.h" /> + <ClInclude Include="..\src\Matrix4f.h" /> + <ClInclude Include="..\src\MCLogger.h" /> + <ClInclude Include="..\src\MemoryLeak.h" /> + <ClInclude Include="..\src\MersenneTwister.h" /> + <ClInclude Include="..\src\MobCensus.h" /> + <ClInclude Include="..\src\MobFamilyCollecter.h" /> + <ClInclude Include="..\src\MobProximityCounter.h" /> + <ClInclude Include="..\src\MobSpawner.h" /> + <ClInclude Include="..\src\MonsterConfig.h" /> + <ClInclude Include="..\src\Noise.h" /> + <ClInclude Include="..\src\Piston.h" /> + <ClInclude Include="..\src\ProbabDistrib.h" /> + <ClInclude Include="..\src\RCONServer.h" /> + <ClInclude Include="..\src\ReferenceManager.h" /> + <ClInclude Include="..\src\Root.h" /> + <ClInclude Include="..\src\Server.h" /> + <ClInclude Include="..\src\Sign.h" /> + <ClInclude Include="..\src\StackWalker.h" /> + <ClInclude Include="..\src\StringCompression.h" /> + <ClInclude Include="..\src\StringUtils.h" /> + <ClInclude Include="..\src\Tracer.h" /> + <ClInclude Include="..\src\Vector3d.h" /> + <ClInclude Include="..\src\Vector3f.h" /> + <ClInclude Include="..\src\Vector3i.h" /> + <ClInclude Include="..\src\WebAdmin.h" /> + <ClInclude Include="..\src\World.h" /> + <ClInclude Include="..\src\Mobs\AggressiveMonster.h" /> + <ClInclude Include="..\src\Mobs\Bat.h" /> + <ClInclude Include="..\src\Mobs\Blaze.h" /> + <ClInclude Include="..\src\Mobs\Cavespider.h" /> + <ClInclude Include="..\src\Mobs\Chicken.h" /> + <ClInclude Include="..\src\Mobs\Cow.h" /> + <ClInclude Include="..\src\Mobs\Creeper.h" /> + <ClInclude Include="..\src\Mobs\EnderDragon.h" /> + <ClInclude Include="..\src\Mobs\Enderman.h" /> + <ClInclude Include="..\src\Mobs\Ghast.h" /> + <ClInclude Include="..\src\Mobs\Giant.h" /> + <ClInclude Include="..\src\Mobs\Horse.h" /> + <ClInclude Include="..\src\Mobs\IronGolem.h" /> + <ClInclude Include="..\src\Mobs\MagmaCube.h" /> + <ClInclude Include="..\src\Mobs\Monster.h" /> + <ClInclude Include="..\src\Mobs\Mooshroom.h" /> + <ClInclude Include="..\src\Mobs\Ocelot.h" /> + <ClInclude Include="..\src\Mobs\PassiveAggressiveMonster.h" /> + <ClInclude Include="..\src\Mobs\PassiveMonster.h" /> + <ClInclude Include="..\src\Mobs\Pig.h" /> + <ClInclude Include="..\src\Mobs\Sheep.h" /> + <ClInclude Include="..\src\Mobs\Silverfish.h" /> + <ClInclude Include="..\src\Mobs\Skeleton.h" /> + <ClInclude Include="..\src\Mobs\Slime.h" /> + <ClInclude Include="..\src\Mobs\SnowGolem.h" /> + <ClInclude Include="..\src\Mobs\Spider.h" /> + <ClInclude Include="..\src\Mobs\Squid.h" /> + <ClInclude Include="..\src\Mobs\Villager.h" /> + <ClInclude Include="..\src\Mobs\Witch.h" /> + <ClInclude Include="..\src\Mobs\Wither.h" /> + <ClInclude Include="..\src\Mobs\Wolf.h" /> + <ClInclude Include="..\src\Mobs\Zombie.h" /> + <ClInclude Include="..\src\Mobs\ZombiePigman.h" /> + <ClInclude Include="..\src\Entities\Boat.h" /> + <ClInclude Include="..\src\Entities\Entity.h" /> + <ClInclude Include="..\src\Entities\FallingBlock.h" /> + <ClInclude Include="..\src\Entities\Minecart.h" /> + <ClInclude Include="..\src\Entities\Pawn.h" /> + <ClInclude Include="..\src\Entities\Pickup.h" /> + <ClInclude Include="..\src\Entities\Player.h" /> + <ClInclude Include="..\src\Entities\ProjectileEntity.h" /> + <ClInclude Include="..\src\Entities\TNTEntity.h" /> + <ClInclude Include="..\src\UI\SlotArea.h" /> + <ClInclude Include="..\src\UI\Window.h" /> + <ClInclude Include="..\src\UI\WindowOwner.h" /> + <ClInclude Include="..\src\Simulator\DelayedFluidSimulator.h" /> + <ClInclude Include="..\src\Simulator\FireSimulator.h" /> + <ClInclude Include="..\src\Simulator\FloodyFluidSimulator.h" /> + <ClInclude Include="..\src\Simulator\FluidSimulator.h" /> + <ClInclude Include="..\src\Simulator\NoopFluidSimulator.h" /> + <ClInclude Include="..\src\Simulator\RedstoneSimulator.h" /> + <ClInclude Include="..\src\Simulator\SandSimulator.h" /> + <ClInclude Include="..\src\Simulator\Simulator.h" /> + <ClInclude Include="..\src\Simulator\SimulatorManager.h" /> + <ClInclude Include="..\src\Simulator\VaporizeFluidSimulator.h" /> + <ClInclude Include="..\src\OSSupport\BlockingTCPLink.h" /> + <ClInclude Include="..\src\OSSupport\CriticalSection.h" /> + <ClInclude Include="..\src\OSSupport\Event.h" /> + <ClInclude Include="..\src\OSSupport\File.h" /> + <ClInclude Include="..\src\OSSupport\GZipFile.h" /> + <ClInclude Include="..\src\OSSupport\IsThread.h" /> + <ClInclude Include="..\src\OSSupport\ListenThread.h" /> + <ClInclude Include="..\src\OSSupport\Semaphore.h" /> + <ClInclude Include="..\src\OSSupport\Sleep.h" /> + <ClInclude Include="..\src\OSSupport\Socket.h" /> + <ClInclude Include="..\src\OSSupport\SocketThreads.h" /> + <ClInclude Include="..\src\OSSupport\Thread.h" /> + <ClInclude Include="..\src\OSSupport\Timer.h" /> <CustomBuild Include="..\Android\jni\ToJava.h"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release profiled|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> </CustomBuild> - <ClInclude Include="..\source\Bindings.h" /> - <ClInclude Include="..\source\LuaFunctions.h" /> - <ClInclude Include="..\source\LuaState.h" /> - <ClInclude Include="..\source\LuaWindow.h" /> - <ClInclude Include="..\source\ManualBindings.h" /> - <ClInclude Include="..\source\Plugin.h" /> - <ClInclude Include="..\source\PluginLua.h" /> - <ClInclude Include="..\source\PluginManager.h" /> - <ClInclude Include="..\source\tolua++.h" /> - <ClInclude Include="..\source\tolua_base.h" /> - <ClInclude Include="..\source\WebPlugin.h" /> - <ClInclude Include="..\iniFile\iniFile.h" /> - <ClInclude Include="..\source\md5\md5.h" /> - <ClInclude Include="..\source\WorldStorage\FastNBT.h" /> - <ClInclude Include="..\source\WorldStorage\NBTChunkSerializer.h" /> - <ClInclude Include="..\source\WorldStorage\WorldStorage.h" /> - <ClInclude Include="..\source\WorldStorage\WSSAnvil.h" /> - <ClInclude Include="..\source\WorldStorage\WSSCompact.h" /> - <ClInclude Include="..\source\Generating\BioGen.h" /> - <ClInclude Include="..\source\Generating\Caves.h" /> - <ClInclude Include="..\source\Generating\ChunkDesc.h" /> - <ClInclude Include="..\source\Generating\ChunkGenerator.h" /> - <ClInclude Include="..\source\Generating\CompoGen.h" /> - <ClInclude Include="..\source\Generating\ComposableGenerator.h" /> - <ClInclude Include="..\source\Generating\DistortedHeightmap.h" /> - <ClInclude Include="..\source\Generating\EndGen.h" /> - <ClInclude Include="..\source\Generating\FinishGen.h" /> - <ClInclude Include="..\source\Generating\HeiGen.h" /> - <ClInclude Include="..\source\Generating\MineShafts.h" /> - <ClInclude Include="..\source\Generating\Noise3DGenerator.h" /> - <ClInclude Include="..\source\Generating\Ravines.h" /> - <ClInclude Include="..\source\Generating\StructGen.h" /> - <ClInclude Include="..\source\Generating\Trees.h" /> - <ClInclude Include="..\source\blocks\BlockBed.h" /> - <ClInclude Include="..\source\Blocks\BlockBrewingStand.h" /> - <ClInclude Include="..\source\Blocks\BlockButton.h" /> - <ClInclude Include="..\source\blocks\BlockCactus.h" /> - <ClInclude Include="..\source\Blocks\BlockCarpet.h" /> - <ClInclude Include="..\source\Blocks\BlockCauldron.h" /> - <ClInclude Include="..\source\blocks\BlockChest.h" /> - <ClInclude Include="..\source\blocks\BlockCloth.h" /> - <ClInclude Include="..\source\Blocks\BlockCobWeb.h" /> - <ClInclude Include="..\source\Blocks\BlockComparator.h" /> - <ClInclude Include="..\source\blocks\BlockCrops.h" /> - <ClInclude Include="..\source\Blocks\BlockDeadBush.h" /> - <ClInclude Include="..\source\blocks\BlockDirt.h" /> - <ClInclude Include="..\source\blocks\BlockDoor.h" /> - <ClInclude Include="..\source\blocks\BlockDropSpenser.h" /> - <ClInclude Include="..\source\Blocks\BlockEnderchest.h" /> - <ClInclude Include="..\source\blocks\BlockEntity.h" /> - <ClInclude Include="..\source\Blocks\BlockFarmland.h" /> - <ClInclude Include="..\source\Blocks\BlockFenceGate.h" /> - <ClInclude Include="..\source\blocks\BlockFire.h" /> - <ClInclude Include="..\source\blocks\BlockFlower.h" /> - <ClInclude Include="..\source\Blocks\BlockFlowerPot.h" /> - <ClInclude Include="..\source\blocks\BlockFluid.h" /> - <ClInclude Include="..\source\blocks\BlockFurnace.h" /> - <ClInclude Include="..\source\Blocks\BlockGlass.h" /> - <ClInclude Include="..\source\blocks\BlockGlowstone.h" /> - <ClInclude Include="..\source\blocks\BlockGravel.h" /> - <ClInclude Include="..\source\blocks\BlockHandler.h" /> - <ClInclude Include="..\source\Blocks\BlockHopper.h" /> - <ClInclude Include="..\source\blocks\BlockIce.h" /> - <ClInclude Include="..\source\blocks\BlockLadder.h" /> - <ClInclude Include="..\source\blocks\BlockLeaves.h" /> - <ClInclude Include="..\source\Blocks\BlockLever.h" /> - <ClInclude Include="..\source\blocks\BlockMelon.h" /> - <ClInclude Include="..\source\blocks\BlockMushroom.h" /> - <ClInclude Include="..\source\Blocks\BlockMycelium.h" /> - <ClInclude Include="..\source\blocks\BlockNote.h" /> - <ClInclude Include="..\source\blocks\BlockOre.h" /> - <ClInclude Include="..\source\blocks\BlockPiston.h" /> - <ClInclude Include="..\source\blocks\BlockPlanks.h" /> - <ClInclude Include="..\source\blocks\BlockPortal.h" /> - <ClInclude Include="..\source\Blocks\BlockPumpkin.h" /> - <ClInclude Include="..\source\Blocks\BlockRail.h" /> - <ClInclude Include="..\source\blocks\BlockRedstone.h" /> - <ClInclude Include="..\source\blocks\BlockRedstoneOre.h" /> - <ClInclude Include="..\source\blocks\BlockRedstoneRepeater.h" /> - <ClInclude Include="..\source\blocks\BlockRedstoneTorch.h" /> - <ClInclude Include="..\source\blocks\BlockSand.h" /> - <ClInclude Include="..\source\blocks\BlockSapling.h" /> - <ClInclude Include="..\source\blocks\BlockSign.h" /> - <ClInclude Include="..\source\blocks\BlockSlab.h" /> - <ClInclude Include="..\source\blocks\BlockSnow.h" /> - <ClInclude Include="..\source\blocks\BlockStairs.h" /> - <ClInclude Include="..\source\blocks\BlockStems.h" /> - <ClInclude Include="..\source\blocks\BlockStone.h" /> - <ClInclude Include="..\source\blocks\BlockSugarcane.h" /> - <ClInclude Include="..\source\blocks\BlockTallGrass.h" /> - <ClInclude Include="..\source\blocks\BlockTorch.h" /> - <ClInclude Include="..\source\blocks\BlockVine.h" /> - <ClInclude Include="..\source\blocks\BlockWood.h" /> - <ClInclude Include="..\source\blocks\BlockWorkbench.h" /> - <ClInclude Include="..\source\items\ItemBed.h" /> - <ClInclude Include="..\source\Items\ItemBoat.h" /> - <ClInclude Include="..\source\Items\ItemBow.h" /> - <ClInclude Include="..\source\Items\ItemBrewingStand.h" /> - <ClInclude Include="..\source\items\ItemBucket.h" /> - <ClInclude Include="..\source\Items\ItemCauldron.h" /> - <ClInclude Include="..\source\items\ItemCloth.h" /> - <ClInclude Include="..\source\Items\ItemComparator.h" /> - <ClInclude Include="..\source\items\ItemDoor.h" /> - <ClInclude Include="..\source\items\ItemDye.h" /> - <ClInclude Include="..\source\Items\ItemFlowerPot.h" /> - <ClInclude Include="..\source\items\ItemFood.h" /> - <ClInclude Include="..\source\items\ItemHandler.h" /> - <ClInclude Include="..\source\items\ItemHoe.h" /> - <ClInclude Include="..\source\items\ItemLeaves.h" /> - <ClInclude Include="..\source\items\ItemLighter.h" /> - <ClInclude Include="..\source\Items\ItemMinecart.h" /> - <ClInclude Include="..\source\items\ItemPickaxe.h" /> - <ClInclude Include="..\source\items\ItemRedstoneDust.h" /> - <ClInclude Include="..\source\items\ItemRedstoneRepeater.h" /> - <ClInclude Include="..\source\items\ItemSapling.h" /> - <ClInclude Include="..\source\items\ItemSeeds.h" /> - <ClInclude Include="..\source\items\ItemShears.h" /> - <ClInclude Include="..\source\items\ItemShovel.h" /> - <ClInclude Include="..\source\items\ItemSign.h" /> - <ClInclude Include="..\source\Items\ItemSpawnEgg.h" /> - <ClInclude Include="..\source\items\ItemSugarcane.h" /> - <ClInclude Include="..\source\items\ItemSword.h" /> - <ClInclude Include="..\source\Items\ItemThrowable.h" /> - <ClInclude Include="..\source\Protocol\ChunkDataSerializer.h" /> - <ClInclude Include="..\source\Protocol\Protocol.h" /> - <ClInclude Include="..\source\Protocol\Protocol125.h" /> - <ClInclude Include="..\source\Protocol\Protocol132.h" /> - <ClInclude Include="..\source\Protocol\Protocol14x.h" /> - <ClInclude Include="..\source\Protocol\Protocol15x.h" /> - <ClInclude Include="..\source\Protocol\Protocol16x.h" /> - <ClInclude Include="..\source\Protocol\Protocol17x.h" /> - <ClInclude Include="..\source\Protocol\ProtocolRecognizer.h" /> - <ClInclude Include="..\source\sqlite\sqlite3.h" /> - <ClInclude Include="..\source\LuaExpat\lxplib.h" /> - <ClInclude Include="..\source\BlockEntities\BlockEntity.h" /> - <ClInclude Include="..\source\BlockEntities\BlockEntityWithItems.h" /> - <ClInclude Include="..\source\BlockEntities\ChestEntity.h" /> - <ClInclude Include="..\source\BlockEntities\DispenserEntity.h" /> - <ClInclude Include="..\source\BlockEntities\DropperEntity.h" /> - <ClInclude Include="..\source\BlockEntities\DropSpenserEntity.h" /> - <ClInclude Include="..\source\BlockEntities\FurnaceEntity.h" /> - <ClInclude Include="..\source\BlockEntities\HopperEntity.h" /> - <ClInclude Include="..\source\BlockEntities\JukeboxEntity.h" /> - <ClInclude Include="..\source\BlockEntities\NoteEntity.h" /> - <ClInclude Include="..\source\BlockEntities\SignEntity.h" /> - <ClInclude Include="..\source\HTTPServer\EnvelopeParser.h" /> - <ClInclude Include="..\source\HTTPServer\HTTPConnection.h" /> - <ClInclude Include="..\source\HTTPServer\HTTPFormParser.h" /> - <ClInclude Include="..\source\HTTPServer\HTTPMessage.h" /> - <ClInclude Include="..\source\HTTPServer\HTTPServer.h" /> - <ClInclude Include="..\source\HTTPServer\MultipartParser.h" /> - <ClInclude Include="..\source\HTTPServer\NameValueParser.h" /> + <ClInclude Include="..\src\Bindings.h" /> + <ClInclude Include="..\src\LuaFunctions.h" /> + <ClInclude Include="..\src\LuaState.h" /> + <ClInclude Include="..\src\LuaWindow.h" /> + <ClInclude Include="..\src\ManualBindings.h" /> + <ClInclude Include="..\src\Plugin.h" /> + <ClInclude Include="..\src\PluginLua.h" /> + <ClInclude Include="..\src\PluginManager.h" /> + <ClInclude Include="..\src\tolua++.h" /> + <ClInclude Include="..\src\tolua_base.h" /> + <ClInclude Include="..\src\WebPlugin.h" /> + <ClInclude Include="..\lib\inifile\iniFile.h" /> + <ClInclude Include="..\lib\md5\md5.h" /> + <ClInclude Include="..\src\WorldStorage\FastNBT.h" /> + <ClInclude Include="..\src\WorldStorage\NBTChunkSerializer.h" /> + <ClInclude Include="..\src\WorldStorage\WorldStorage.h" /> + <ClInclude Include="..\src\WorldStorage\WSSAnvil.h" /> + <ClInclude Include="..\src\WorldStorage\WSSCompact.h" /> + <ClInclude Include="..\src\Generating\BioGen.h" /> + <ClInclude Include="..\src\Generating\Caves.h" /> + <ClInclude Include="..\src\Generating\ChunkDesc.h" /> + <ClInclude Include="..\src\Generating\ChunkGenerator.h" /> + <ClInclude Include="..\src\Generating\CompoGen.h" /> + <ClInclude Include="..\src\Generating\ComposableGenerator.h" /> + <ClInclude Include="..\src\Generating\DistortedHeightmap.h" /> + <ClInclude Include="..\src\Generating\EndGen.h" /> + <ClInclude Include="..\src\Generating\FinishGen.h" /> + <ClInclude Include="..\src\Generating\HeiGen.h" /> + <ClInclude Include="..\src\Generating\MineShafts.h" /> + <ClInclude Include="..\src\Generating\Noise3DGenerator.h" /> + <ClInclude Include="..\src\Generating\Ravines.h" /> + <ClInclude Include="..\src\Generating\StructGen.h" /> + <ClInclude Include="..\src\Generating\Trees.h" /> + <ClInclude Include="..\src\blocks\BlockBed.h" /> + <ClInclude Include="..\src\Blocks\BlockBrewingStand.h" /> + <ClInclude Include="..\src\Blocks\BlockButton.h" /> + <ClInclude Include="..\src\blocks\BlockCactus.h" /> + <ClInclude Include="..\src\Blocks\BlockCarpet.h" /> + <ClInclude Include="..\src\Blocks\BlockCauldron.h" /> + <ClInclude Include="..\src\blocks\BlockChest.h" /> + <ClInclude Include="..\src\blocks\BlockCloth.h" /> + <ClInclude Include="..\src\Blocks\BlockCobWeb.h" /> + <ClInclude Include="..\src\Blocks\BlockComparator.h" /> + <ClInclude Include="..\src\blocks\BlockCrops.h" /> + <ClInclude Include="..\src\Blocks\BlockDeadBush.h" /> + <ClInclude Include="..\src\blocks\BlockDirt.h" /> + <ClInclude Include="..\src\blocks\BlockDoor.h" /> + <ClInclude Include="..\src\blocks\BlockDropSpenser.h" /> + <ClInclude Include="..\src\Blocks\BlockEnderchest.h" /> + <ClInclude Include="..\src\blocks\BlockEntity.h" /> + <ClInclude Include="..\src\Blocks\BlockFarmland.h" /> + <ClInclude Include="..\src\Blocks\BlockFenceGate.h" /> + <ClInclude Include="..\src\blocks\BlockFire.h" /> + <ClInclude Include="..\src\blocks\BlockFlower.h" /> + <ClInclude Include="..\src\Blocks\BlockFlowerPot.h" /> + <ClInclude Include="..\src\blocks\BlockFluid.h" /> + <ClInclude Include="..\src\blocks\BlockFurnace.h" /> + <ClInclude Include="..\src\Blocks\BlockGlass.h" /> + <ClInclude Include="..\src\blocks\BlockGlowstone.h" /> + <ClInclude Include="..\src\blocks\BlockGravel.h" /> + <ClInclude Include="..\src\blocks\BlockHandler.h" /> + <ClInclude Include="..\src\Blocks\BlockHopper.h" /> + <ClInclude Include="..\src\blocks\BlockIce.h" /> + <ClInclude Include="..\src\blocks\BlockLadder.h" /> + <ClInclude Include="..\src\blocks\BlockLeaves.h" /> + <ClInclude Include="..\src\Blocks\BlockLever.h" /> + <ClInclude Include="..\src\blocks\BlockMelon.h" /> + <ClInclude Include="..\src\blocks\BlockMushroom.h" /> + <ClInclude Include="..\src\Blocks\BlockMycelium.h" /> + <ClInclude Include="..\src\blocks\BlockNote.h" /> + <ClInclude Include="..\src\blocks\BlockOre.h" /> + <ClInclude Include="..\src\blocks\BlockPiston.h" /> + <ClInclude Include="..\src\blocks\BlockPlanks.h" /> + <ClInclude Include="..\src\blocks\BlockPortal.h" /> + <ClInclude Include="..\src\Blocks\BlockPumpkin.h" /> + <ClInclude Include="..\src\Blocks\BlockRail.h" /> + <ClInclude Include="..\src\blocks\BlockRedstone.h" /> + <ClInclude Include="..\src\blocks\BlockRedstoneOre.h" /> + <ClInclude Include="..\src\blocks\BlockRedstoneRepeater.h" /> + <ClInclude Include="..\src\blocks\BlockRedstoneTorch.h" /> + <ClInclude Include="..\src\blocks\BlockSand.h" /> + <ClInclude Include="..\src\blocks\BlockSapling.h" /> + <ClInclude Include="..\src\blocks\BlockSign.h" /> + <ClInclude Include="..\src\blocks\BlockSlab.h" /> + <ClInclude Include="..\src\blocks\BlockSnow.h" /> + <ClInclude Include="..\src\blocks\BlockStairs.h" /> + <ClInclude Include="..\src\blocks\BlockStems.h" /> + <ClInclude Include="..\src\blocks\BlockStone.h" /> + <ClInclude Include="..\src\blocks\BlockSugarcane.h" /> + <ClInclude Include="..\src\blocks\BlockTallGrass.h" /> + <ClInclude Include="..\src\blocks\BlockTorch.h" /> + <ClInclude Include="..\src\blocks\BlockVine.h" /> + <ClInclude Include="..\src\blocks\BlockWood.h" /> + <ClInclude Include="..\src\blocks\BlockWorkbench.h" /> + <ClInclude Include="..\src\items\ItemBed.h" /> + <ClInclude Include="..\src\Items\ItemBoat.h" /> + <ClInclude Include="..\src\Items\ItemBow.h" /> + <ClInclude Include="..\src\Items\ItemBrewingStand.h" /> + <ClInclude Include="..\src\items\ItemBucket.h" /> + <ClInclude Include="..\src\Items\ItemCauldron.h" /> + <ClInclude Include="..\src\items\ItemCloth.h" /> + <ClInclude Include="..\src\Items\ItemComparator.h" /> + <ClInclude Include="..\src\items\ItemDoor.h" /> + <ClInclude Include="..\src\items\ItemDye.h" /> + <ClInclude Include="..\src\Items\ItemFlowerPot.h" /> + <ClInclude Include="..\src\items\ItemFood.h" /> + <ClInclude Include="..\src\items\ItemHandler.h" /> + <ClInclude Include="..\src\items\ItemHoe.h" /> + <ClInclude Include="..\src\items\ItemLeaves.h" /> + <ClInclude Include="..\src\items\ItemLighter.h" /> + <ClInclude Include="..\src\Items\ItemMinecart.h" /> + <ClInclude Include="..\src\items\ItemPickaxe.h" /> + <ClInclude Include="..\src\items\ItemRedstoneDust.h" /> + <ClInclude Include="..\src\items\ItemRedstoneRepeater.h" /> + <ClInclude Include="..\src\items\ItemSapling.h" /> + <ClInclude Include="..\src\items\ItemSeeds.h" /> + <ClInclude Include="..\src\items\ItemShears.h" /> + <ClInclude Include="..\src\items\ItemShovel.h" /> + <ClInclude Include="..\src\items\ItemSign.h" /> + <ClInclude Include="..\src\Items\ItemSpawnEgg.h" /> + <ClInclude Include="..\src\items\ItemSugarcane.h" /> + <ClInclude Include="..\src\items\ItemSword.h" /> + <ClInclude Include="..\src\Items\ItemThrowable.h" /> + <ClInclude Include="..\src\Protocol\ChunkDataSerializer.h" /> + <ClInclude Include="..\src\Protocol\Protocol.h" /> + <ClInclude Include="..\src\Protocol\Protocol125.h" /> + <ClInclude Include="..\src\Protocol\Protocol132.h" /> + <ClInclude Include="..\src\Protocol\Protocol14x.h" /> + <ClInclude Include="..\src\Protocol\Protocol15x.h" /> + <ClInclude Include="..\src\Protocol\Protocol16x.h" /> + <ClInclude Include="..\src\Protocol\Protocol17x.h" /> + <ClInclude Include="..\src\Protocol\ProtocolRecognizer.h" /> + <ClInclude Include="..\lib\sqlite\sqlite3.h" /> + <ClInclude Include="..\lib\luaexpat\lxplib.h" /> + <ClInclude Include="..\src\BlockEntities\BlockEntity.h" /> + <ClInclude Include="..\src\BlockEntities\BlockEntityWithItems.h" /> + <ClInclude Include="..\src\BlockEntities\ChestEntity.h" /> + <ClInclude Include="..\src\BlockEntities\DispenserEntity.h" /> + <ClInclude Include="..\src\BlockEntities\DropperEntity.h" /> + <ClInclude Include="..\src\BlockEntities\DropSpenserEntity.h" /> + <ClInclude Include="..\src\BlockEntities\FurnaceEntity.h" /> + <ClInclude Include="..\src\BlockEntities\HopperEntity.h" /> + <ClInclude Include="..\src\BlockEntities\JukeboxEntity.h" /> + <ClInclude Include="..\src\BlockEntities\NoteEntity.h" /> + <ClInclude Include="..\src\BlockEntities\SignEntity.h" /> + <ClInclude Include="..\src\HTTPServer\EnvelopeParser.h" /> + <ClInclude Include="..\src\HTTPServer\HTTPConnection.h" /> + <ClInclude Include="..\src\HTTPServer\HTTPFormParser.h" /> + <ClInclude Include="..\src\HTTPServer\HTTPMessage.h" /> + <ClInclude Include="..\src\HTTPServer\HTTPServer.h" /> + <ClInclude Include="..\src\HTTPServer\MultipartParser.h" /> + <ClInclude Include="..\src\HTTPServer\NameValueParser.h" /> </ItemGroup> <ItemGroup> <None Include="..\webadmin\template.html" /> @@ -491,26 +488,26 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release profiled|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> </CustomBuild> - <CustomBuild Include="..\source\AllToLua.pkg"> + <CustomBuild Include="..\src\AllToLua.pkg"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">true</ExcludedFromBuild> <Command Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">GenerateBindings.cmd </Command> - <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">cTorch.h;cStairs.h;cLadder.h;../iniFile/iniFile.h;BlockID.h;PacketID.h;Defines.h;LuaFunctions.h;cStringMap.h;cChatColor.h;cClientHandle.h;cEntity.h;cPawn.h;cPlayer.h;cPluginManager.h;cPlugin.h;cPlugin_NewLua.h;cPlugin_Lua.h;cServer.h;cWorld.h;cInventory.h;cItem.h;cWebAdmin.h;cWebPlugin.h;cWebPlugin_Lua.h;cPickup.h;cRoot.h;cTCPLink.h;Vector3f.h;Vector3d.h;Vector3i.h;Matrix4f.h;cCuboid.h;cMCLogger.h;cTracer.h;cGroup.h;BlockArea.h;packets/cPacket_Login.h;packets/cPacket_BlockDig.h;packets/cPacket_BlockPlace.h;%(AdditionalInputs)</AdditionalInputs> + <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">cTorch.h;cStairs.h;cLadder.h;../lib/inifile/iniFile.h;BlockID.h;PacketID.h;Defines.h;LuaFunctions.h;cStringMap.h;cChatColor.h;cClientHandle.h;cEntity.h;cPawn.h;cPlayer.h;cPluginManager.h;cPlugin.h;cPlugin_NewLua.h;cPlugin_Lua.h;cServer.h;cWorld.h;cInventory.h;cItem.h;cWebAdmin.h;cWebPlugin.h;cWebPlugin_Lua.h;cPickup.h;cRoot.h;cTCPLink.h;Vector3f.h;Vector3d.h;Vector3i.h;Matrix4f.h;cCuboid.h;cMCLogger.h;cTracer.h;cGroup.h;BlockArea.h;packets/cPacket_Login.h;packets/cPacket_BlockDig.h;packets/cPacket_BlockPlace.h;%(AdditionalInputs)</AdditionalInputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">Bindings.cpp;%(Outputs)</Outputs> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">GenerateBindings.cmd </Command> - <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cTorch.h;cStairs.h;cLadder.h;../iniFile/iniFile.h;BlockID.h;PacketID.h;Defines.h;LuaFunctions.h;cStringMap.h;cChatColor.h;cClientHandle.h;cEntity.h;cPawn.h;cPlayer.h;cPluginManager.h;cPlugin.h;cPlugin_NewLua.h;cPlugin_Lua.h;cServer.h;cWorld.h;cInventory.h;cItem.h;cWebAdmin.h;cWebPlugin.h;cWebPlugin_Lua.h;cPickup.h;cRoot.h;cTCPLink.h;Vector3f.h;Vector3d.h;Vector3i.h;Matrix4f.h;cCuboid.h;cMCLogger.h;cTracer.h;cGroup.h;BlockArea.h;packets/cPacket_Login.h;packets/cPacket_BlockDig.h;packets/cPacket_BlockPlace.h;%(AdditionalInputs)</AdditionalInputs> + <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">cTorch.h;cStairs.h;cLadder.h;../lib/inifile/iniFile.h;BlockID.h;PacketID.h;Defines.h;LuaFunctions.h;cStringMap.h;cChatColor.h;cClientHandle.h;cEntity.h;cPawn.h;cPlayer.h;cPluginManager.h;cPlugin.h;cPlugin_NewLua.h;cPlugin_Lua.h;cServer.h;cWorld.h;cInventory.h;cItem.h;cWebAdmin.h;cWebPlugin.h;cWebPlugin_Lua.h;cPickup.h;cRoot.h;cTCPLink.h;Vector3f.h;Vector3d.h;Vector3i.h;Matrix4f.h;cCuboid.h;cMCLogger.h;cTracer.h;cGroup.h;BlockArea.h;packets/cPacket_Login.h;packets/cPacket_BlockDig.h;packets/cPacket_BlockPlace.h;%(AdditionalInputs)</AdditionalInputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Bindings.cpp;%(Outputs)</Outputs> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release profiled|Win32'">true</ExcludedFromBuild> <Command Condition="'$(Configuration)|$(Platform)'=='Release profiled|Win32'">GenerateBindings.cmd </Command> - <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release profiled|Win32'">cTorch.h;cStairs.h;cLadder.h;../iniFile/iniFile.h;BlockID.h;PacketID.h;Defines.h;LuaFunctions.h;cStringMap.h;cChatColor.h;cClientHandle.h;cEntity.h;cPawn.h;cPlayer.h;cPluginManager.h;cPlugin.h;cPlugin_NewLua.h;cPlugin_Lua.h;cServer.h;cWorld.h;cInventory.h;cItem.h;cWebAdmin.h;cWebPlugin.h;cWebPlugin_Lua.h;cPickup.h;cRoot.h;cTCPLink.h;Vector3f.h;Vector3d.h;Vector3i.h;Matrix4f.h;cCuboid.h;cMCLogger.h;cTracer.h;cGroup.h;BlockArea.h;packets/cPacket_Login.h;packets/cPacket_BlockDig.h;packets/cPacket_BlockPlace.h;%(AdditionalInputs)</AdditionalInputs> + <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release profiled|Win32'">cTorch.h;cStairs.h;cLadder.h;../lib/inifile/iniFile.h;BlockID.h;PacketID.h;Defines.h;LuaFunctions.h;cStringMap.h;cChatColor.h;cClientHandle.h;cEntity.h;cPawn.h;cPlayer.h;cPluginManager.h;cPlugin.h;cPlugin_NewLua.h;cPlugin_Lua.h;cServer.h;cWorld.h;cInventory.h;cItem.h;cWebAdmin.h;cWebPlugin.h;cWebPlugin_Lua.h;cPickup.h;cRoot.h;cTCPLink.h;Vector3f.h;Vector3d.h;Vector3i.h;Matrix4f.h;cCuboid.h;cMCLogger.h;cTracer.h;cGroup.h;BlockArea.h;packets/cPacket_Login.h;packets/cPacket_BlockDig.h;packets/cPacket_BlockPlace.h;%(AdditionalInputs)</AdditionalInputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release profiled|Win32'">Bindings.cpp;%(Outputs)</Outputs> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">GenerateBindings.cmd </Command> - <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cTorch.h;cStairs.h;cLadder.h;../iniFile/iniFile.h;BlockID.h;PacketID.h;Defines.h;LuaFunctions.h;cStringMap.h;cChatColor.h;cClientHandle.h;cEntity.h;cPawn.h;cPlayer.h;cPluginManager.h;cPlugin.h;cPlugin_NewLua.h;cPlugin_Lua.h;cServer.h;cWorld.h;cInventory.h;cItem.h;cWebAdmin.h;cWebPlugin.h;cWebPlugin_Lua.h;cPickup.h;cRoot.h;cTCPLink.h;Vector3f.h;Vector3d.h;Vector3i.h;Matrix4f.h;cCuboid.h;cMCLogger.h;cTracer.h;cGroup.h;BlockArea.h;packets/cPacket_Login.h;packets/cPacket_BlockDig.h;packets/cPacket_BlockPlace.h;%(AdditionalInputs)</AdditionalInputs> + <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cTorch.h;cStairs.h;cLadder.h;../lib/inifile/iniFile.h;BlockID.h;PacketID.h;Defines.h;LuaFunctions.h;cStringMap.h;cChatColor.h;cClientHandle.h;cEntity.h;cPawn.h;cPlayer.h;cPluginManager.h;cPlugin.h;cPlugin_NewLua.h;cPlugin_Lua.h;cServer.h;cWorld.h;cInventory.h;cItem.h;cWebAdmin.h;cWebPlugin.h;cWebPlugin_Lua.h;cPickup.h;cRoot.h;cTCPLink.h;Vector3f.h;Vector3d.h;Vector3i.h;Matrix4f.h;cCuboid.h;cMCLogger.h;cTracer.h;cGroup.h;BlockArea.h;packets/cPacket_Login.h;packets/cPacket_BlockDig.h;packets/cPacket_BlockPlace.h;%(AdditionalInputs)</AdditionalInputs> <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Bindings.cpp;%(Outputs)</Outputs> </CustomBuild> <None Include="..\MCServer\groups.ini" /> @@ -566,35 +563,35 @@ <None Include="..\MCServer\Plugins\APIDump\main.lua" /> </ItemGroup> <ItemGroup> - <ClCompile Include="..\source\Authenticator.cpp" /> - <ClCompile Include="..\source\BlockArea.cpp" /> - <ClCompile Include="..\source\BlockID.cpp" /> - <ClCompile Include="..\source\BoundingBox.cpp" /> - <ClCompile Include="..\source\ByteBuffer.cpp" /> - <ClCompile Include="..\source\ChatColor.cpp" /> - <ClCompile Include="..\source\Chunk.cpp" /> - <ClCompile Include="..\source\ChunkMap.cpp" /> - <ClCompile Include="..\source\ChunkSender.cpp" /> - <ClCompile Include="..\source\ClientHandle.cpp" /> - <ClCompile Include="..\source\CommandOutput.cpp" /> - <ClCompile Include="..\source\CraftingRecipes.cpp" /> - <ClCompile Include="..\source\Cuboid.cpp" /> - <ClCompile Include="..\source\DeadlockDetect.cpp" /> - <ClCompile Include="..\source\Enchantments.cpp" /> - <ClCompile Include="..\source\FastRandom.cpp" /> - <ClCompile Include="..\source\FurnaceRecipe.cpp" /> - <ClCompile Include="..\source\Globals.cpp"> + <ClCompile Include="..\src\Authenticator.cpp" /> + <ClCompile Include="..\src\BlockArea.cpp" /> + <ClCompile Include="..\src\BlockID.cpp" /> + <ClCompile Include="..\src\BoundingBox.cpp" /> + <ClCompile Include="..\src\ByteBuffer.cpp" /> + <ClCompile Include="..\src\ChatColor.cpp" /> + <ClCompile Include="..\src\Chunk.cpp" /> + <ClCompile Include="..\src\ChunkMap.cpp" /> + <ClCompile Include="..\src\ChunkSender.cpp" /> + <ClCompile Include="..\src\ClientHandle.cpp" /> + <ClCompile Include="..\src\CommandOutput.cpp" /> + <ClCompile Include="..\src\CraftingRecipes.cpp" /> + <ClCompile Include="..\src\Cuboid.cpp" /> + <ClCompile Include="..\src\DeadlockDetect.cpp" /> + <ClCompile Include="..\src\Enchantments.cpp" /> + <ClCompile Include="..\src\FastRandom.cpp" /> + <ClCompile Include="..\src\FurnaceRecipe.cpp" /> + <ClCompile Include="..\src\Globals.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release profiled|Win32'">Create</PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader> </ClCompile> - <ClCompile Include="..\source\Group.cpp" /> - <ClCompile Include="..\source\GroupManager.cpp" /> - <ClCompile Include="..\source\Inventory.cpp" /> - <ClCompile Include="..\source\Item.cpp" /> - <ClCompile Include="..\source\ItemGrid.cpp" /> - <ClCompile Include="..\source\LeakFinder.cpp"> + <ClCompile Include="..\src\Group.cpp" /> + <ClCompile Include="..\src\GroupManager.cpp" /> + <ClCompile Include="..\src\Inventory.cpp" /> + <ClCompile Include="..\src\Item.cpp" /> + <ClCompile Include="..\src\ItemGrid.cpp" /> + <ClCompile Include="..\src\LeakFinder.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'"> </PrecompiledHeader> <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">Level3</WarningLevel> @@ -608,19 +605,19 @@ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> </PrecompiledHeader> </ClCompile> - <ClCompile Include="..\source\LightingThread.cpp" /> - <ClCompile Include="..\source\LinearInterpolation.cpp" /> - <ClCompile Include="..\source\LineBlockTracer.cpp" /> - <ClCompile Include="..\source\Log.cpp" /> - <ClCompile Include="..\source\main.cpp" /> - <ClCompile Include="..\source\Matrix4f.cpp" /> - <ClCompile Include="..\source\MCLogger.cpp" /> - <ClCompile Include="..\source\MobCensus.cpp" /> - <ClCompile Include="..\source\MobFamilyCollecter.cpp" /> - <ClCompile Include="..\source\MobProximityCounter.cpp" /> - <ClCompile Include="..\source\MobSpawner.cpp" /> - <ClCompile Include="..\source\MonsterConfig.cpp" /> - <ClCompile Include="..\source\Noise.cpp"> + <ClCompile Include="..\src\LightingThread.cpp" /> + <ClCompile Include="..\src\LinearInterpolation.cpp" /> + <ClCompile Include="..\src\LineBlockTracer.cpp" /> + <ClCompile Include="..\src\Log.cpp" /> + <ClCompile Include="..\src\main.cpp" /> + <ClCompile Include="..\src\Matrix4f.cpp" /> + <ClCompile Include="..\src\MCLogger.cpp" /> + <ClCompile Include="..\src\MobCensus.cpp" /> + <ClCompile Include="..\src\MobFamilyCollecter.cpp" /> + <ClCompile Include="..\src\MobProximityCounter.cpp" /> + <ClCompile Include="..\src\MobSpawner.cpp" /> + <ClCompile Include="..\src\MonsterConfig.cpp" /> + <ClCompile Include="..\src\Noise.cpp"> <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">MaxSpeed</Optimization> <IntrinsicFunctions Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">true</IntrinsicFunctions> <FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">Speed</FavorSizeOrSpeed> @@ -636,13 +633,13 @@ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> </PrecompiledHeader> </ClCompile> - <ClCompile Include="..\source\Piston.cpp" /> - <ClCompile Include="..\source\ProbabDistrib.cpp" /> - <ClCompile Include="..\source\RCONServer.cpp" /> - <ClCompile Include="..\source\ReferenceManager.cpp" /> - <ClCompile Include="..\source\Root.cpp" /> - <ClCompile Include="..\source\Server.cpp" /> - <ClCompile Include="..\source\StackWalker.cpp"> + <ClCompile Include="..\src\Piston.cpp" /> + <ClCompile Include="..\src\ProbabDistrib.cpp" /> + <ClCompile Include="..\src\RCONServer.cpp" /> + <ClCompile Include="..\src\ReferenceManager.cpp" /> + <ClCompile Include="..\src\Root.cpp" /> + <ClCompile Include="..\src\Server.cpp" /> + <ClCompile Include="..\src\StackWalker.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'"> </PrecompiledHeader> <WarningLevel Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">Level3</WarningLevel> @@ -656,78 +653,78 @@ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> </PrecompiledHeader> </ClCompile> - <ClCompile Include="..\source\StringCompression.cpp" /> - <ClCompile Include="..\source\StringUtils.cpp" /> - <ClCompile Include="..\source\Tracer.cpp" /> - <ClCompile Include="..\source\Vector3d.cpp" /> - <ClCompile Include="..\source\Vector3f.cpp" /> - <ClCompile Include="..\source\Vector3i.cpp" /> - <ClCompile Include="..\source\WebAdmin.cpp" /> - <ClCompile Include="..\source\World.cpp" /> - <ClCompile Include="..\source\Mobs\AggressiveMonster.cpp" /> - <ClCompile Include="..\source\Mobs\Bat.cpp" /> - <ClCompile Include="..\source\Mobs\Blaze.cpp" /> - <ClCompile Include="..\source\Mobs\Cavespider.cpp" /> - <ClCompile Include="..\source\Mobs\Chicken.cpp" /> - <ClCompile Include="..\source\Mobs\Cow.cpp" /> - <ClCompile Include="..\source\Mobs\Creeper.cpp" /> - <ClCompile Include="..\source\Mobs\EnderDragon.cpp" /> - <ClCompile Include="..\source\Mobs\Enderman.cpp" /> - <ClCompile Include="..\source\Mobs\Ghast.cpp" /> - <ClCompile Include="..\source\Mobs\Giant.cpp" /> - <ClCompile Include="..\source\Mobs\Horse.cpp" /> - <ClCompile Include="..\source\Mobs\IronGolem.cpp" /> - <ClCompile Include="..\source\Mobs\MagmaCube.cpp" /> - <ClCompile Include="..\source\Mobs\Monster.cpp" /> - <ClCompile Include="..\source\Mobs\Mooshroom.cpp" /> - <ClCompile Include="..\source\Mobs\PassiveAggressiveMonster.cpp" /> - <ClCompile Include="..\source\Mobs\PassiveMonster.cpp" /> - <ClCompile Include="..\source\Mobs\Pig.cpp" /> - <ClCompile Include="..\source\Mobs\Sheep.cpp" /> - <ClCompile Include="..\source\Mobs\Skeleton.cpp" /> - <ClCompile Include="..\source\Mobs\Slime.cpp" /> - <ClCompile Include="..\source\Mobs\SnowGolem.cpp" /> - <ClCompile Include="..\source\Mobs\Spider.cpp" /> - <ClCompile Include="..\source\Mobs\Squid.cpp" /> - <ClCompile Include="..\source\Mobs\Villager.cpp" /> - <ClCompile Include="..\source\Mobs\Witch.cpp" /> - <ClCompile Include="..\source\Mobs\Wither.cpp" /> - <ClCompile Include="..\source\Mobs\Wolf.cpp" /> - <ClCompile Include="..\source\Mobs\Zombie.cpp" /> - <ClCompile Include="..\source\Mobs\ZombiePigman.cpp" /> - <ClCompile Include="..\source\Entities\Boat.cpp" /> - <ClCompile Include="..\source\Entities\Entity.cpp" /> - <ClCompile Include="..\source\Entities\FallingBlock.cpp" /> - <ClCompile Include="..\source\Entities\Minecart.cpp" /> - <ClCompile Include="..\source\Entities\Pawn.cpp" /> - <ClCompile Include="..\source\Entities\Pickup.cpp" /> - <ClCompile Include="..\source\Entities\Player.cpp" /> - <ClCompile Include="..\source\Entities\ProjectileEntity.cpp" /> - <ClCompile Include="..\source\Entities\TNTEntity.cpp" /> - <ClCompile Include="..\source\UI\SlotArea.cpp" /> - <ClCompile Include="..\source\UI\Window.cpp" /> - <ClCompile Include="..\source\Simulator\DelayedFluidSimulator.cpp" /> - <ClCompile Include="..\source\Simulator\FireSimulator.cpp" /> - <ClCompile Include="..\source\Simulator\FloodyFluidSimulator.cpp" /> - <ClCompile Include="..\source\Simulator\FluidSimulator.cpp" /> - <ClCompile Include="..\source\Simulator\RedstoneSimulator.cpp" /> - <ClCompile Include="..\source\Simulator\SandSimulator.cpp" /> - <ClCompile Include="..\source\Simulator\Simulator.cpp" /> - <ClCompile Include="..\source\Simulator\SimulatorManager.cpp" /> - <ClCompile Include="..\source\Simulator\VaporizeFluidSimulator.cpp" /> - <ClCompile Include="..\source\OSSupport\BlockingTCPLink.cpp" /> - <ClCompile Include="..\source\OSSupport\CriticalSection.cpp" /> - <ClCompile Include="..\source\OSSupport\Event.cpp" /> - <ClCompile Include="..\source\OSSupport\File.cpp" /> - <ClCompile Include="..\source\OSSupport\GZipFile.cpp" /> - <ClCompile Include="..\source\OSSupport\IsThread.cpp" /> - <ClCompile Include="..\source\OSSupport\ListenThread.cpp" /> - <ClCompile Include="..\source\OSSupport\Semaphore.cpp" /> - <ClCompile Include="..\source\OSSupport\Sleep.cpp" /> - <ClCompile Include="..\source\OSSupport\Socket.cpp" /> - <ClCompile Include="..\source\OSSupport\SocketThreads.cpp" /> - <ClCompile Include="..\source\OSSupport\Thread.cpp" /> - <ClCompile Include="..\source\OSSupport\Timer.cpp" /> + <ClCompile Include="..\src\StringCompression.cpp" /> + <ClCompile Include="..\src\StringUtils.cpp" /> + <ClCompile Include="..\src\Tracer.cpp" /> + <ClCompile Include="..\src\Vector3d.cpp" /> + <ClCompile Include="..\src\Vector3f.cpp" /> + <ClCompile Include="..\src\Vector3i.cpp" /> + <ClCompile Include="..\src\WebAdmin.cpp" /> + <ClCompile Include="..\src\World.cpp" /> + <ClCompile Include="..\src\Mobs\AggressiveMonster.cpp" /> + <ClCompile Include="..\src\Mobs\Bat.cpp" /> + <ClCompile Include="..\src\Mobs\Blaze.cpp" /> + <ClCompile Include="..\src\Mobs\Cavespider.cpp" /> + <ClCompile Include="..\src\Mobs\Chicken.cpp" /> + <ClCompile Include="..\src\Mobs\Cow.cpp" /> + <ClCompile Include="..\src\Mobs\Creeper.cpp" /> + <ClCompile Include="..\src\Mobs\EnderDragon.cpp" /> + <ClCompile Include="..\src\Mobs\Enderman.cpp" /> + <ClCompile Include="..\src\Mobs\Ghast.cpp" /> + <ClCompile Include="..\src\Mobs\Giant.cpp" /> + <ClCompile Include="..\src\Mobs\Horse.cpp" /> + <ClCompile Include="..\src\Mobs\IronGolem.cpp" /> + <ClCompile Include="..\src\Mobs\MagmaCube.cpp" /> + <ClCompile Include="..\src\Mobs\Monster.cpp" /> + <ClCompile Include="..\src\Mobs\Mooshroom.cpp" /> + <ClCompile Include="..\src\Mobs\PassiveAggressiveMonster.cpp" /> + <ClCompile Include="..\src\Mobs\PassiveMonster.cpp" /> + <ClCompile Include="..\src\Mobs\Pig.cpp" /> + <ClCompile Include="..\src\Mobs\Sheep.cpp" /> + <ClCompile Include="..\src\Mobs\Skeleton.cpp" /> + <ClCompile Include="..\src\Mobs\Slime.cpp" /> + <ClCompile Include="..\src\Mobs\SnowGolem.cpp" /> + <ClCompile Include="..\src\Mobs\Spider.cpp" /> + <ClCompile Include="..\src\Mobs\Squid.cpp" /> + <ClCompile Include="..\src\Mobs\Villager.cpp" /> + <ClCompile Include="..\src\Mobs\Witch.cpp" /> + <ClCompile Include="..\src\Mobs\Wither.cpp" /> + <ClCompile Include="..\src\Mobs\Wolf.cpp" /> + <ClCompile Include="..\src\Mobs\Zombie.cpp" /> + <ClCompile Include="..\src\Mobs\ZombiePigman.cpp" /> + <ClCompile Include="..\src\Entities\Boat.cpp" /> + <ClCompile Include="..\src\Entities\Entity.cpp" /> + <ClCompile Include="..\src\Entities\FallingBlock.cpp" /> + <ClCompile Include="..\src\Entities\Minecart.cpp" /> + <ClCompile Include="..\src\Entities\Pawn.cpp" /> + <ClCompile Include="..\src\Entities\Pickup.cpp" /> + <ClCompile Include="..\src\Entities\Player.cpp" /> + <ClCompile Include="..\src\Entities\ProjectileEntity.cpp" /> + <ClCompile Include="..\src\Entities\TNTEntity.cpp" /> + <ClCompile Include="..\src\UI\SlotArea.cpp" /> + <ClCompile Include="..\src\UI\Window.cpp" /> + <ClCompile Include="..\src\Simulator\DelayedFluidSimulator.cpp" /> + <ClCompile Include="..\src\Simulator\FireSimulator.cpp" /> + <ClCompile Include="..\src\Simulator\FloodyFluidSimulator.cpp" /> + <ClCompile Include="..\src\Simulator\FluidSimulator.cpp" /> + <ClCompile Include="..\src\Simulator\RedstoneSimulator.cpp" /> + <ClCompile Include="..\src\Simulator\SandSimulator.cpp" /> + <ClCompile Include="..\src\Simulator\Simulator.cpp" /> + <ClCompile Include="..\src\Simulator\SimulatorManager.cpp" /> + <ClCompile Include="..\src\Simulator\VaporizeFluidSimulator.cpp" /> + <ClCompile Include="..\src\OSSupport\BlockingTCPLink.cpp" /> + <ClCompile Include="..\src\OSSupport\CriticalSection.cpp" /> + <ClCompile Include="..\src\OSSupport\Event.cpp" /> + <ClCompile Include="..\src\OSSupport\File.cpp" /> + <ClCompile Include="..\src\OSSupport\GZipFile.cpp" /> + <ClCompile Include="..\src\OSSupport\IsThread.cpp" /> + <ClCompile Include="..\src\OSSupport\ListenThread.cpp" /> + <ClCompile Include="..\src\OSSupport\Semaphore.cpp" /> + <ClCompile Include="..\src\OSSupport\Sleep.cpp" /> + <ClCompile Include="..\src\OSSupport\Socket.cpp" /> + <ClCompile Include="..\src\OSSupport\SocketThreads.cpp" /> + <ClCompile Include="..\src\OSSupport\Thread.cpp" /> + <ClCompile Include="..\src\OSSupport\Timer.cpp" /> <ClCompile Include="..\Android\jni\app-android.cpp"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild> @@ -740,7 +737,7 @@ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release profiled|Win32'">true</ExcludedFromBuild> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild> </ClCompile> - <ClCompile Include="..\source\Bindings.cpp"> + <ClCompile Include="..\src\Bindings.cpp"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'"> </PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> @@ -750,15 +747,15 @@ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> </PrecompiledHeader> </ClCompile> - <ClCompile Include="..\source\LuaState.cpp" /> - <ClCompile Include="..\source\LuaWindow.cpp" /> - <ClCompile Include="..\source\ManualBindings.cpp" /> - <ClCompile Include="..\source\Plugin.cpp" /> - <ClCompile Include="..\source\PluginLua.cpp" /> - <ClCompile Include="..\source\PluginManager.cpp" /> - <ClCompile Include="..\source\WebPlugin.cpp" /> - <ClCompile Include="..\iniFile\iniFile.cpp" /> - <ClCompile Include="..\source\md5\md5.cpp"> + <ClCompile Include="..\src\LuaState.cpp" /> + <ClCompile Include="..\src\LuaWindow.cpp" /> + <ClCompile Include="..\src\ManualBindings.cpp" /> + <ClCompile Include="..\src\Plugin.cpp" /> + <ClCompile Include="..\src\PluginLua.cpp" /> + <ClCompile Include="..\src\PluginManager.cpp" /> + <ClCompile Include="..\src\WebPlugin.cpp" /> + <ClCompile Include="..\lib\inifile\iniFile.cpp" /> + <ClCompile Include="..\lib\md5\md5.cpp"> <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'"> </PrecompiledHeader> @@ -772,45 +769,45 @@ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> </PrecompiledHeader> </ClCompile> - <ClCompile Include="..\source\WorldStorage\FastNBT.cpp" /> - <ClCompile Include="..\source\WorldStorage\NBTChunkSerializer.cpp" /> - <ClCompile Include="..\source\WorldStorage\WorldStorage.cpp" /> - <ClCompile Include="..\source\WorldStorage\WSSAnvil.cpp" /> - <ClCompile Include="..\source\WorldStorage\WSSCompact.cpp" /> - <ClCompile Include="..\source\Generating\BioGen.cpp" /> - <ClCompile Include="..\source\Generating\Caves.cpp" /> - <ClCompile Include="..\source\Generating\ChunkDesc.cpp" /> - <ClCompile Include="..\source\Generating\ChunkGenerator.cpp" /> - <ClCompile Include="..\source\Generating\CompoGen.cpp" /> - <ClCompile Include="..\source\Generating\ComposableGenerator.cpp" /> - <ClCompile Include="..\source\Generating\DistortedHeightmap.cpp" /> - <ClCompile Include="..\source\Generating\EndGen.cpp" /> - <ClCompile Include="..\source\Generating\FinishGen.cpp" /> - <ClCompile Include="..\source\Generating\HeiGen.cpp" /> - <ClCompile Include="..\source\Generating\MineShafts.cpp" /> - <ClCompile Include="..\source\Generating\Noise3DGenerator.cpp" /> - <ClCompile Include="..\source\Generating\Ravines.cpp" /> - <ClCompile Include="..\source\Generating\StructGen.cpp" /> - <ClCompile Include="..\source\Generating\Trees.cpp" /> - <ClCompile Include="..\source\Blocks\BlockBed.cpp" /> - <ClCompile Include="..\source\Blocks\BlockButton.cpp" /> - <ClCompile Include="..\source\Blocks\BlockComparator.cpp" /> - <ClCompile Include="..\source\blocks\BlockDoor.cpp" /> - <ClCompile Include="..\source\blocks\BlockHandler.cpp" /> - <ClCompile Include="..\source\Blocks\BlockLever.cpp" /> - <ClCompile Include="..\source\blocks\BlockPiston.cpp" /> - <ClCompile Include="..\source\blocks\BlockRedstone.cpp" /> - <ClCompile Include="..\source\blocks\BlockRedstoneRepeater.cpp" /> - <ClCompile Include="..\source\items\ItemHandler.cpp" /> - <ClCompile Include="..\source\Protocol\ChunkDataSerializer.cpp" /> - <ClCompile Include="..\source\Protocol\Protocol125.cpp" /> - <ClCompile Include="..\source\Protocol\Protocol132.cpp" /> - <ClCompile Include="..\source\Protocol\Protocol14x.cpp" /> - <ClCompile Include="..\source\Protocol\Protocol15x.cpp" /> - <ClCompile Include="..\source\Protocol\Protocol16x.cpp" /> - <ClCompile Include="..\source\Protocol\Protocol17x.cpp" /> - <ClCompile Include="..\source\Protocol\ProtocolRecognizer.cpp" /> - <ClCompile Include="..\source\sqlite\lsqlite3.c"> + <ClCompile Include="..\src\WorldStorage\FastNBT.cpp" /> + <ClCompile Include="..\src\WorldStorage\NBTChunkSerializer.cpp" /> + <ClCompile Include="..\src\WorldStorage\WorldStorage.cpp" /> + <ClCompile Include="..\src\WorldStorage\WSSAnvil.cpp" /> + <ClCompile Include="..\src\WorldStorage\WSSCompact.cpp" /> + <ClCompile Include="..\src\Generating\BioGen.cpp" /> + <ClCompile Include="..\src\Generating\Caves.cpp" /> + <ClCompile Include="..\src\Generating\ChunkDesc.cpp" /> + <ClCompile Include="..\src\Generating\ChunkGenerator.cpp" /> + <ClCompile Include="..\src\Generating\CompoGen.cpp" /> + <ClCompile Include="..\src\Generating\ComposableGenerator.cpp" /> + <ClCompile Include="..\src\Generating\DistortedHeightmap.cpp" /> + <ClCompile Include="..\src\Generating\EndGen.cpp" /> + <ClCompile Include="..\src\Generating\FinishGen.cpp" /> + <ClCompile Include="..\src\Generating\HeiGen.cpp" /> + <ClCompile Include="..\src\Generating\MineShafts.cpp" /> + <ClCompile Include="..\src\Generating\Noise3DGenerator.cpp" /> + <ClCompile Include="..\src\Generating\Ravines.cpp" /> + <ClCompile Include="..\src\Generating\StructGen.cpp" /> + <ClCompile Include="..\src\Generating\Trees.cpp" /> + <ClCompile Include="..\src\Blocks\BlockBed.cpp" /> + <ClCompile Include="..\src\Blocks\BlockButton.cpp" /> + <ClCompile Include="..\src\Blocks\BlockComparator.cpp" /> + <ClCompile Include="..\src\blocks\BlockDoor.cpp" /> + <ClCompile Include="..\src\blocks\BlockHandler.cpp" /> + <ClCompile Include="..\src\Blocks\BlockLever.cpp" /> + <ClCompile Include="..\src\blocks\BlockPiston.cpp" /> + <ClCompile Include="..\src\blocks\BlockRedstone.cpp" /> + <ClCompile Include="..\src\blocks\BlockRedstoneRepeater.cpp" /> + <ClCompile Include="..\src\items\ItemHandler.cpp" /> + <ClCompile Include="..\src\Protocol\ChunkDataSerializer.cpp" /> + <ClCompile Include="..\src\Protocol\Protocol125.cpp" /> + <ClCompile Include="..\src\Protocol\Protocol132.cpp" /> + <ClCompile Include="..\src\Protocol\Protocol14x.cpp" /> + <ClCompile Include="..\src\Protocol\Protocol15x.cpp" /> + <ClCompile Include="..\src\Protocol\Protocol16x.cpp" /> + <ClCompile Include="..\src\Protocol\Protocol17x.cpp" /> + <ClCompile Include="..\src\Protocol\ProtocolRecognizer.cpp" /> + <ClCompile Include="..\lib\sqlite\lsqlite3.c"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'"> </PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> @@ -820,7 +817,7 @@ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> </PrecompiledHeader> </ClCompile> - <ClCompile Include="..\source\sqlite\sqlite3.c"> + <ClCompile Include="..\lib\sqlite\sqlite3.c"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'"> </PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> @@ -830,7 +827,7 @@ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> </PrecompiledHeader> </ClCompile> - <ClCompile Include="..\source\LuaExpat\lxplib.c"> + <ClCompile Include="..\lib\luaexpat\lxplib.c"> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'"> </PrecompiledHeader> <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> @@ -840,26 +837,27 @@ <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> </PrecompiledHeader> </ClCompile> - <ClCompile Include="..\source\BlockEntities\ChestEntity.cpp" /> - <ClCompile Include="..\source\BlockEntities\DispenserEntity.cpp" /> - <ClCompile Include="..\source\BlockEntities\DropperEntity.cpp" /> - <ClCompile Include="..\source\BlockEntities\DropSpenserEntity.cpp" /> - <ClCompile Include="..\source\BlockEntities\FurnaceEntity.cpp" /> - <ClCompile Include="..\source\BlockEntities\HopperEntity.cpp" /> - <ClCompile Include="..\source\BlockEntities\JukeboxEntity.cpp" /> - <ClCompile Include="..\source\BlockEntities\NoteEntity.cpp" /> - <ClCompile Include="..\source\BlockEntities\SignEntity.cpp" /> - <ClCompile Include="..\source\HTTPServer\EnvelopeParser.cpp" /> - <ClCompile Include="..\source\HTTPServer\HTTPConnection.cpp" /> - <ClCompile Include="..\source\HTTPServer\HTTPFormParser.cpp" /> - <ClCompile Include="..\source\HTTPServer\HTTPMessage.cpp" /> - <ClCompile Include="..\source\HTTPServer\HTTPServer.cpp" /> - <ClCompile Include="..\source\HTTPServer\MultipartParser.cpp" /> - <ClCompile Include="..\source\HTTPServer\NameValueParser.cpp" /> + <ClCompile Include="..\src\BlockEntities\BlockEntity.cpp" /> + <ClCompile Include="..\src\BlockEntities\ChestEntity.cpp" /> + <ClCompile Include="..\src\BlockEntities\DispenserEntity.cpp" /> + <ClCompile Include="..\src\BlockEntities\DropperEntity.cpp" /> + <ClCompile Include="..\src\BlockEntities\DropSpenserEntity.cpp" /> + <ClCompile Include="..\src\BlockEntities\FurnaceEntity.cpp" /> + <ClCompile Include="..\src\BlockEntities\HopperEntity.cpp" /> + <ClCompile Include="..\src\BlockEntities\JukeboxEntity.cpp" /> + <ClCompile Include="..\src\BlockEntities\NoteEntity.cpp" /> + <ClCompile Include="..\src\BlockEntities\SignEntity.cpp" /> + <ClCompile Include="..\src\HTTPServer\EnvelopeParser.cpp" /> + <ClCompile Include="..\src\HTTPServer\HTTPConnection.cpp" /> + <ClCompile Include="..\src\HTTPServer\HTTPFormParser.cpp" /> + <ClCompile Include="..\src\HTTPServer\HTTPMessage.cpp" /> + <ClCompile Include="..\src\HTTPServer\HTTPServer.cpp" /> + <ClCompile Include="..\src\HTTPServer\MultipartParser.cpp" /> + <ClCompile Include="..\src\HTTPServer\NameValueParser.cpp" /> </ItemGroup> <ItemGroup> <Text Include="..\MCServer\API.txt" /> - <Text Include="..\source\sqlite\urls.txt" /> + <Text Include="..\lib\sqlite\urls.txt" /> <Text Include="..\MCServer\crafting.txt" /> <Text Include="..\MCServer\furnace.txt" /> </ItemGroup> diff --git a/VC2013/MCServer.vcxproj.filters b/VC2013/MCServer.vcxproj.filters index c37f00958..1f213b900 100644 --- a/VC2013/MCServer.vcxproj.filters +++ b/VC2013/MCServer.vcxproj.filters @@ -10,73 +10,73 @@ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> </Filter> <Filter Include="Source Files\Mobs"> - <UniqueIdentifier>{74c155c0-0f2d-4d4d-bf75-cc60408854f9}</UniqueIdentifier> + <UniqueIdentifier>{0c1dd2bf-04b0-4605-b963-b187e900b4a1}</UniqueIdentifier> </Filter> <Filter Include="Source Files\Entities"> - <UniqueIdentifier>{0e9000fa-a1b6-4899-b0fb-66d8daa8c0e5}</UniqueIdentifier> + <UniqueIdentifier>{5c101216-8e22-4ad4-a27d-1572a4d95947}</UniqueIdentifier> </Filter> <Filter Include="Source Files\UI"> - <UniqueIdentifier>{a9d61705-26a1-4f89-ab9c-d73286417d25}</UniqueIdentifier> + <UniqueIdentifier>{eb7a158f-f532-4db5-9314-fca01f04a38e}</UniqueIdentifier> </Filter> <Filter Include="Source Files\Simulator"> - <UniqueIdentifier>{6f57d9e4-3758-4a17-a3a4-fd8ee5f9e398}</UniqueIdentifier> + <UniqueIdentifier>{c378fbaa-2232-4123-a58d-84f2e2e32376}</UniqueIdentifier> </Filter> <Filter Include="Source Files\OSSupport"> - <UniqueIdentifier>{b58a4bc8-5be3-438d-8c21-bc56db2e66d2}</UniqueIdentifier> + <UniqueIdentifier>{be34fc66-075c-45f0-a292-e4ace73a5726}</UniqueIdentifier> </Filter> <Filter Include="Source Files\OSSupport\Android Specific"> - <UniqueIdentifier>{6f4125b6-47ff-4de0-8294-839dab538b65}</UniqueIdentifier> + <UniqueIdentifier>{8dcfacbc-454b-4530-af61-d9db5aebb5bd}</UniqueIdentifier> </Filter> <Filter Include="Source Files\Bindings"> - <UniqueIdentifier>{6fe6ae96-c1aa-4968-b4ef-9d6f8c3f2888}</UniqueIdentifier> + <UniqueIdentifier>{3fa4b52a-1b33-4e8c-8e0c-5818dbd5de15}</UniqueIdentifier> </Filter> <Filter Include="Source Files\External"> - <UniqueIdentifier>{30704df7-b1ff-4bfc-aedf-afe4afcada3f}</UniqueIdentifier> + <UniqueIdentifier>{50cbaa98-dc12-4cc9-9ba6-4e08e885c924}</UniqueIdentifier> </Filter> <Filter Include="Source Files\WorldStorage"> - <UniqueIdentifier>{0a54250c-fdb6-4b65-9102-20cd793a9b78}</UniqueIdentifier> + <UniqueIdentifier>{889b7953-c303-448a-8cf9-ca624011d131}</UniqueIdentifier> </Filter> <Filter Include="Source Files\Generating"> - <UniqueIdentifier>{bea06b59-4fed-4e7f-ac87-2e9c0a1b6d27}</UniqueIdentifier> + <UniqueIdentifier>{9313323e-633a-4c87-812c-0dda81b2a509}</UniqueIdentifier> </Filter> <Filter Include="Source Files\Blocks"> - <UniqueIdentifier>{a5a43ccd-e85d-4723-9c8a-3f83c730f597}</UniqueIdentifier> + <UniqueIdentifier>{61f1ea93-c0b0-4296-81fa-808116542dc8}</UniqueIdentifier> </Filter> <Filter Include="Source Files\Items"> - <UniqueIdentifier>{b5f65bf0-470c-4c3c-9777-a7f3b79b8166}</UniqueIdentifier> + <UniqueIdentifier>{61efdcbf-e2d5-477f-8d67-a81c5ab3d6e6}</UniqueIdentifier> </Filter> <Filter Include="Source Files\Protocol"> - <UniqueIdentifier>{95e9878e-81c3-4b84-aa1c-d464d2a95883}</UniqueIdentifier> + <UniqueIdentifier>{86f6a355-fd04-4ba5-82b0-0fb57897da8d}</UniqueIdentifier> </Filter> <Filter Include="Source Files\SQLite"> - <UniqueIdentifier>{a67840b7-95ac-447f-9f23-d779aeaf5f49}</UniqueIdentifier> + <UniqueIdentifier>{dacfe6a2-94db-4257-8727-0f9a8c70fc8f}</UniqueIdentifier> </Filter> <Filter Include="Source Files\LuaExpat"> - <UniqueIdentifier>{bee4489c-556e-4eff-876e-b46b16eb33dc}</UniqueIdentifier> + <UniqueIdentifier>{b41f78d8-61f8-4476-86cf-d08080418dcb}</UniqueIdentifier> </Filter> <Filter Include="Source Files\BlockEntities"> - <UniqueIdentifier>{28f497b8-c75d-44e6-8e0c-8617cb56eb37}</UniqueIdentifier> + <UniqueIdentifier>{78f41ac0-8ed5-4951-8373-2aed18d9c741}</UniqueIdentifier> </Filter> <Filter Include="Source Files\HTTPServer"> - <UniqueIdentifier>{a9725758-b517-4602-a8e1-ffb950215db8}</UniqueIdentifier> + <UniqueIdentifier>{fc1463dd-e130-49cb-96cf-ee6755cf2de1}</UniqueIdentifier> </Filter> <Filter Include="Config files"> - <UniqueIdentifier>{ab501743-5b5d-449e-8ed7-bc823368a58c}</UniqueIdentifier> + <UniqueIdentifier>{a50ba11b-40c8-43ff-aa5b-aac2e4285df0}</UniqueIdentifier> </Filter> <Filter Include="Plugins"> - <UniqueIdentifier>{baf72963-ce16-452e-80b2-a653fe04b25a}</UniqueIdentifier> + <UniqueIdentifier>{37df6f7f-93ff-4c4a-89cf-77bb6feb215f}</UniqueIdentifier> </Filter> <Filter Include="Plugins\Core"> - <UniqueIdentifier>{05040adb-d357-4712-b326-d8cad05f6e40}</UniqueIdentifier> + <UniqueIdentifier>{3d8e534e-8cd7-4dc5-9626-a1ce9559c118}</UniqueIdentifier> </Filter> <Filter Include="Plugins\ChatLog"> - <UniqueIdentifier>{f2962218-2274-4d13-bd40-ff09c634ae1f}</UniqueIdentifier> + <UniqueIdentifier>{4419315f-3ef3-490d-ba0a-df22565b9a02}</UniqueIdentifier> </Filter> <Filter Include="Plugins\Debuggers"> - <UniqueIdentifier>{ad918b66-c94a-4c54-ad79-6733424e8083}</UniqueIdentifier> + <UniqueIdentifier>{3491f495-c715-4a5b-845e-1638a4ef0127}</UniqueIdentifier> </Filter> <Filter Include="Plugins\APIDump"> - <UniqueIdentifier>{7f151cf3-a835-4e77-9c43-0a3d4bd02714}</UniqueIdentifier> + <UniqueIdentifier>{4bb6b059-2004-4795-a0e7-d401affb3063}</UniqueIdentifier> </Filter> </ItemGroup> <ItemGroup> @@ -93,847 +93,847 @@ <ClInclude Include="resource_MCServer.h"> <Filter>Resource Files</Filter> </ClInclude> - <ClInclude Include="..\source\Authenticator.h"> + <ClInclude Include="..\src\Authenticator.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\BlockArea.h"> + <ClInclude Include="..\src\BlockArea.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\BlockID.h"> + <ClInclude Include="..\src\BlockID.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\BlockTracer.h"> + <ClInclude Include="..\src\BlockTracer.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\BoundingBox.h"> + <ClInclude Include="..\src\BoundingBox.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\ByteBuffer.h"> + <ClInclude Include="..\src\ByteBuffer.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\ChatColor.h"> + <ClInclude Include="..\src\ChatColor.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Chunk.h"> + <ClInclude Include="..\src\Chunk.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Chunk.inl.h"> + <ClInclude Include="..\src\Chunk.inl.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\ChunkDef.h"> + <ClInclude Include="..\src\ChunkDef.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\ChunkMap.h"> + <ClInclude Include="..\src\ChunkMap.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\ChunkSender.h"> + <ClInclude Include="..\src\ChunkSender.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\ClientHandle.h"> + <ClInclude Include="..\src\ClientHandle.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\CommandOutput.h"> + <ClInclude Include="..\src\CommandOutput.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\CraftingRecipes.h"> + <ClInclude Include="..\src\CraftingRecipes.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Cuboid.h"> + <ClInclude Include="..\src\Cuboid.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\DeadlockDetect.h"> + <ClInclude Include="..\src\DeadlockDetect.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Defines.h"> + <ClInclude Include="..\src\Defines.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Enchantments.h"> + <ClInclude Include="..\src\Enchantments.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Endianness.h"> + <ClInclude Include="..\src\Endianness.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\FastRandom.h"> + <ClInclude Include="..\src\FastRandom.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\FurnaceRecipe.h"> + <ClInclude Include="..\src\FurnaceRecipe.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Globals.h"> + <ClInclude Include="..\src\Globals.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Group.h"> + <ClInclude Include="..\src\Group.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\GroupManager.h"> + <ClInclude Include="..\src\GroupManager.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Inventory.h"> + <ClInclude Include="..\src\Inventory.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Item.h"> + <ClInclude Include="..\src\Item.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\ItemGrid.h"> + <ClInclude Include="..\src\ItemGrid.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Ladder.h"> + <ClInclude Include="..\src\Ladder.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\LeakFinder.h"> + <ClInclude Include="..\src\LeakFinder.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\LightingThread.h"> + <ClInclude Include="..\src\LightingThread.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\LinearInterpolation.h"> + <ClInclude Include="..\src\LinearInterpolation.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\LinearUpscale.h"> + <ClInclude Include="..\src\LinearUpscale.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\LineBlockTracer.h"> + <ClInclude Include="..\src\LineBlockTracer.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Log.h"> + <ClInclude Include="..\src\Log.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Matrix4f.h"> + <ClInclude Include="..\src\Matrix4f.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\MCLogger.h"> + <ClInclude Include="..\src\MCLogger.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\MemoryLeak.h"> + <ClInclude Include="..\src\MemoryLeak.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\MersenneTwister.h"> + <ClInclude Include="..\src\MersenneTwister.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\MobCensus.h"> + <ClInclude Include="..\src\MobCensus.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\MobFamilyCollecter.h"> + <ClInclude Include="..\src\MobFamilyCollecter.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\MobProximityCounter.h"> + <ClInclude Include="..\src\MobProximityCounter.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\MobSpawner.h"> + <ClInclude Include="..\src\MobSpawner.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\MonsterConfig.h"> + <ClInclude Include="..\src\MonsterConfig.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Noise.h"> + <ClInclude Include="..\src\Noise.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Piston.h"> + <ClInclude Include="..\src\Piston.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\ProbabDistrib.h"> + <ClInclude Include="..\src\ProbabDistrib.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\RCONServer.h"> + <ClInclude Include="..\src\RCONServer.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\ReferenceManager.h"> + <ClInclude Include="..\src\ReferenceManager.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Root.h"> + <ClInclude Include="..\src\Root.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Server.h"> + <ClInclude Include="..\src\Server.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Sign.h"> + <ClInclude Include="..\src\Sign.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\StackWalker.h"> + <ClInclude Include="..\src\StackWalker.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\StringCompression.h"> + <ClInclude Include="..\src\StringCompression.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\StringUtils.h"> + <ClInclude Include="..\src\StringUtils.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Tracer.h"> + <ClInclude Include="..\src\Tracer.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Vector3d.h"> + <ClInclude Include="..\src\Vector3d.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Vector3f.h"> + <ClInclude Include="..\src\Vector3f.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Vector3i.h"> + <ClInclude Include="..\src\Vector3i.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\WebAdmin.h"> + <ClInclude Include="..\src\WebAdmin.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\World.h"> + <ClInclude Include="..\src\World.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\AggressiveMonster.h"> + <ClInclude Include="..\src\Mobs\AggressiveMonster.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Bat.h"> + <ClInclude Include="..\src\Mobs\Bat.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Blaze.h"> + <ClInclude Include="..\src\Mobs\Blaze.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Cavespider.h"> + <ClInclude Include="..\src\Mobs\Cavespider.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Chicken.h"> + <ClInclude Include="..\src\Mobs\Chicken.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Cow.h"> + <ClInclude Include="..\src\Mobs\Cow.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Creeper.h"> + <ClInclude Include="..\src\Mobs\Creeper.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\EnderDragon.h"> + <ClInclude Include="..\src\Mobs\EnderDragon.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Enderman.h"> + <ClInclude Include="..\src\Mobs\Enderman.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Ghast.h"> + <ClInclude Include="..\src\Mobs\Ghast.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Giant.h"> + <ClInclude Include="..\src\Mobs\Giant.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Horse.h"> + <ClInclude Include="..\src\Mobs\Horse.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\IronGolem.h"> + <ClInclude Include="..\src\Mobs\IronGolem.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\MagmaCube.h"> + <ClInclude Include="..\src\Mobs\MagmaCube.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Monster.h"> + <ClInclude Include="..\src\Mobs\Monster.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Mooshroom.h"> + <ClInclude Include="..\src\Mobs\Mooshroom.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Ocelot.h"> + <ClInclude Include="..\src\Mobs\Ocelot.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\PassiveAggressiveMonster.h"> + <ClInclude Include="..\src\Mobs\PassiveAggressiveMonster.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\PassiveMonster.h"> + <ClInclude Include="..\src\Mobs\PassiveMonster.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Pig.h"> + <ClInclude Include="..\src\Mobs\Pig.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Sheep.h"> + <ClInclude Include="..\src\Mobs\Sheep.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Silverfish.h"> + <ClInclude Include="..\src\Mobs\Silverfish.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Skeleton.h"> + <ClInclude Include="..\src\Mobs\Skeleton.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Slime.h"> + <ClInclude Include="..\src\Mobs\Slime.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\SnowGolem.h"> + <ClInclude Include="..\src\Mobs\SnowGolem.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Spider.h"> + <ClInclude Include="..\src\Mobs\Spider.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Squid.h"> + <ClInclude Include="..\src\Mobs\Squid.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Villager.h"> + <ClInclude Include="..\src\Mobs\Villager.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Witch.h"> + <ClInclude Include="..\src\Mobs\Witch.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Wither.h"> + <ClInclude Include="..\src\Mobs\Wither.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Wolf.h"> + <ClInclude Include="..\src\Mobs\Wolf.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\Zombie.h"> + <ClInclude Include="..\src\Mobs\Zombie.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Mobs\ZombiePigman.h"> + <ClInclude Include="..\src\Mobs\ZombiePigman.h"> <Filter>Source Files\Mobs</Filter> </ClInclude> - <ClInclude Include="..\source\Entities\Boat.h"> + <ClInclude Include="..\src\Entities\Boat.h"> <Filter>Source Files\Entities</Filter> </ClInclude> - <ClInclude Include="..\source\Entities\Entity.h"> + <ClInclude Include="..\src\Entities\Entity.h"> <Filter>Source Files\Entities</Filter> </ClInclude> - <ClInclude Include="..\source\Entities\FallingBlock.h"> + <ClInclude Include="..\src\Entities\FallingBlock.h"> <Filter>Source Files\Entities</Filter> </ClInclude> - <ClInclude Include="..\source\Entities\Minecart.h"> + <ClInclude Include="..\src\Entities\Minecart.h"> <Filter>Source Files\Entities</Filter> </ClInclude> - <ClInclude Include="..\source\Entities\Pawn.h"> + <ClInclude Include="..\src\Entities\Pawn.h"> <Filter>Source Files\Entities</Filter> </ClInclude> - <ClInclude Include="..\source\Entities\Pickup.h"> + <ClInclude Include="..\src\Entities\Pickup.h"> <Filter>Source Files\Entities</Filter> </ClInclude> - <ClInclude Include="..\source\Entities\Player.h"> + <ClInclude Include="..\src\Entities\Player.h"> <Filter>Source Files\Entities</Filter> </ClInclude> - <ClInclude Include="..\source\Entities\ProjectileEntity.h"> + <ClInclude Include="..\src\Entities\ProjectileEntity.h"> <Filter>Source Files\Entities</Filter> </ClInclude> - <ClInclude Include="..\source\Entities\TNTEntity.h"> + <ClInclude Include="..\src\Entities\TNTEntity.h"> <Filter>Source Files\Entities</Filter> </ClInclude> - <ClInclude Include="..\source\UI\SlotArea.h"> + <ClInclude Include="..\src\UI\SlotArea.h"> <Filter>Source Files\UI</Filter> </ClInclude> - <ClInclude Include="..\source\UI\Window.h"> + <ClInclude Include="..\src\UI\Window.h"> <Filter>Source Files\UI</Filter> </ClInclude> - <ClInclude Include="..\source\UI\WindowOwner.h"> + <ClInclude Include="..\src\UI\WindowOwner.h"> <Filter>Source Files\UI</Filter> </ClInclude> - <ClInclude Include="..\source\Simulator\DelayedFluidSimulator.h"> + <ClInclude Include="..\src\Simulator\DelayedFluidSimulator.h"> <Filter>Source Files\Simulator</Filter> </ClInclude> - <ClInclude Include="..\source\Simulator\FireSimulator.h"> + <ClInclude Include="..\src\Simulator\FireSimulator.h"> <Filter>Source Files\Simulator</Filter> </ClInclude> - <ClInclude Include="..\source\Simulator\FloodyFluidSimulator.h"> + <ClInclude Include="..\src\Simulator\FloodyFluidSimulator.h"> <Filter>Source Files\Simulator</Filter> </ClInclude> - <ClInclude Include="..\source\Simulator\FluidSimulator.h"> + <ClInclude Include="..\src\Simulator\FluidSimulator.h"> <Filter>Source Files\Simulator</Filter> </ClInclude> - <ClInclude Include="..\source\Simulator\NoopFluidSimulator.h"> + <ClInclude Include="..\src\Simulator\NoopFluidSimulator.h"> <Filter>Source Files\Simulator</Filter> </ClInclude> - <ClInclude Include="..\source\Simulator\RedstoneSimulator.h"> + <ClInclude Include="..\src\Simulator\RedstoneSimulator.h"> <Filter>Source Files\Simulator</Filter> </ClInclude> - <ClInclude Include="..\source\Simulator\SandSimulator.h"> + <ClInclude Include="..\src\Simulator\SandSimulator.h"> <Filter>Source Files\Simulator</Filter> </ClInclude> - <ClInclude Include="..\source\Simulator\Simulator.h"> + <ClInclude Include="..\src\Simulator\Simulator.h"> <Filter>Source Files\Simulator</Filter> </ClInclude> - <ClInclude Include="..\source\Simulator\SimulatorManager.h"> + <ClInclude Include="..\src\Simulator\SimulatorManager.h"> <Filter>Source Files\Simulator</Filter> </ClInclude> - <ClInclude Include="..\source\Simulator\VaporizeFluidSimulator.h"> + <ClInclude Include="..\src\Simulator\VaporizeFluidSimulator.h"> <Filter>Source Files\Simulator</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\BlockingTCPLink.h"> + <ClInclude Include="..\src\OSSupport\BlockingTCPLink.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\CriticalSection.h"> + <ClInclude Include="..\src\OSSupport\CriticalSection.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\Event.h"> + <ClInclude Include="..\src\OSSupport\Event.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\File.h"> + <ClInclude Include="..\src\OSSupport\File.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\GZipFile.h"> + <ClInclude Include="..\src\OSSupport\GZipFile.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\IsThread.h"> + <ClInclude Include="..\src\OSSupport\IsThread.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\ListenThread.h"> + <ClInclude Include="..\src\OSSupport\ListenThread.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\Semaphore.h"> + <ClInclude Include="..\src\OSSupport\Semaphore.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\Sleep.h"> + <ClInclude Include="..\src\OSSupport\Sleep.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\Socket.h"> + <ClInclude Include="..\src\OSSupport\Socket.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\SocketThreads.h"> + <ClInclude Include="..\src\OSSupport\SocketThreads.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\Thread.h"> + <ClInclude Include="..\src\OSSupport\Thread.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\OSSupport\Timer.h"> + <ClInclude Include="..\src\OSSupport\Timer.h"> <Filter>Source Files\OSSupport</Filter> </ClInclude> - <ClInclude Include="..\source\Bindings.h"> + <ClInclude Include="..\src\Bindings.h"> <Filter>Source Files\Bindings</Filter> </ClInclude> - <ClInclude Include="..\source\LuaFunctions.h"> + <ClInclude Include="..\src\LuaFunctions.h"> <Filter>Source Files\Bindings</Filter> </ClInclude> - <ClInclude Include="..\source\LuaState.h"> + <ClInclude Include="..\src\LuaState.h"> <Filter>Source Files\Bindings</Filter> </ClInclude> - <ClInclude Include="..\source\LuaWindow.h"> + <ClInclude Include="..\src\LuaWindow.h"> <Filter>Source Files\Bindings</Filter> </ClInclude> - <ClInclude Include="..\source\ManualBindings.h"> + <ClInclude Include="..\src\ManualBindings.h"> <Filter>Source Files\Bindings</Filter> </ClInclude> - <ClInclude Include="..\source\Plugin.h"> + <ClInclude Include="..\src\Plugin.h"> <Filter>Source Files\Bindings</Filter> </ClInclude> - <ClInclude Include="..\source\PluginLua.h"> + <ClInclude Include="..\src\PluginLua.h"> <Filter>Source Files\Bindings</Filter> </ClInclude> - <ClInclude Include="..\source\PluginManager.h"> + <ClInclude Include="..\src\PluginManager.h"> <Filter>Source Files\Bindings</Filter> </ClInclude> - <ClInclude Include="..\source\tolua++.h"> + <ClInclude Include="..\src\tolua++.h"> <Filter>Source Files\Bindings</Filter> </ClInclude> - <ClInclude Include="..\source\tolua_base.h"> + <ClInclude Include="..\src\tolua_base.h"> <Filter>Source Files\Bindings</Filter> </ClInclude> - <ClInclude Include="..\source\WebPlugin.h"> + <ClInclude Include="..\src\WebPlugin.h"> <Filter>Source Files\Bindings</Filter> </ClInclude> - <ClInclude Include="..\iniFile\iniFile.h"> + <ClInclude Include="..\lib\inifile\iniFile.h"> <Filter>Source Files\External</Filter> </ClInclude> - <ClInclude Include="..\source\md5\md5.h"> + <ClInclude Include="..\lib\md5\md5.h"> <Filter>Source Files\External</Filter> </ClInclude> - <ClInclude Include="..\source\WorldStorage\FastNBT.h"> + <ClInclude Include="..\src\WorldStorage\FastNBT.h"> <Filter>Source Files\WorldStorage</Filter> </ClInclude> - <ClInclude Include="..\source\WorldStorage\NBTChunkSerializer.h"> + <ClInclude Include="..\src\WorldStorage\NBTChunkSerializer.h"> <Filter>Source Files\WorldStorage</Filter> </ClInclude> - <ClInclude Include="..\source\WorldStorage\WorldStorage.h"> + <ClInclude Include="..\src\WorldStorage\WorldStorage.h"> <Filter>Source Files\WorldStorage</Filter> </ClInclude> - <ClInclude Include="..\source\WorldStorage\WSSAnvil.h"> + <ClInclude Include="..\src\WorldStorage\WSSAnvil.h"> <Filter>Source Files\WorldStorage</Filter> </ClInclude> - <ClInclude Include="..\source\WorldStorage\WSSCompact.h"> + <ClInclude Include="..\src\WorldStorage\WSSCompact.h"> <Filter>Source Files\WorldStorage</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\BioGen.h"> + <ClInclude Include="..\src\Generating\BioGen.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\Caves.h"> + <ClInclude Include="..\src\Generating\Caves.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\ChunkDesc.h"> + <ClInclude Include="..\src\Generating\ChunkDesc.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\ChunkGenerator.h"> + <ClInclude Include="..\src\Generating\ChunkGenerator.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\CompoGen.h"> + <ClInclude Include="..\src\Generating\CompoGen.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\ComposableGenerator.h"> + <ClInclude Include="..\src\Generating\ComposableGenerator.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\DistortedHeightmap.h"> + <ClInclude Include="..\src\Generating\DistortedHeightmap.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\EndGen.h"> + <ClInclude Include="..\src\Generating\EndGen.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\FinishGen.h"> + <ClInclude Include="..\src\Generating\FinishGen.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\HeiGen.h"> + <ClInclude Include="..\src\Generating\HeiGen.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\MineShafts.h"> + <ClInclude Include="..\src\Generating\MineShafts.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\Noise3DGenerator.h"> + <ClInclude Include="..\src\Generating\Noise3DGenerator.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\Ravines.h"> + <ClInclude Include="..\src\Generating\Ravines.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\StructGen.h"> + <ClInclude Include="..\src\Generating\StructGen.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\Generating\Trees.h"> + <ClInclude Include="..\src\Generating\Trees.h"> <Filter>Source Files\Generating</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockBed.h"> + <ClInclude Include="..\src\blocks\BlockBed.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockBrewingStand.h"> + <ClInclude Include="..\src\Blocks\BlockBrewingStand.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockButton.h"> + <ClInclude Include="..\src\Blocks\BlockButton.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockCactus.h"> + <ClInclude Include="..\src\blocks\BlockCactus.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockCarpet.h"> + <ClInclude Include="..\src\Blocks\BlockCarpet.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockCauldron.h"> + <ClInclude Include="..\src\Blocks\BlockCauldron.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockChest.h"> + <ClInclude Include="..\src\blocks\BlockChest.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockCloth.h"> + <ClInclude Include="..\src\blocks\BlockCloth.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockCobWeb.h"> + <ClInclude Include="..\src\Blocks\BlockCobWeb.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockComparator.h"> + <ClInclude Include="..\src\Blocks\BlockComparator.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockCrops.h"> + <ClInclude Include="..\src\blocks\BlockCrops.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockDeadBush.h"> + <ClInclude Include="..\src\Blocks\BlockDeadBush.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockDirt.h"> + <ClInclude Include="..\src\blocks\BlockDirt.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockDoor.h"> + <ClInclude Include="..\src\blocks\BlockDoor.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockDropSpenser.h"> + <ClInclude Include="..\src\blocks\BlockDropSpenser.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockEnderchest.h"> + <ClInclude Include="..\src\Blocks\BlockEnderchest.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockEntity.h"> + <ClInclude Include="..\src\blocks\BlockEntity.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockFarmland.h"> + <ClInclude Include="..\src\Blocks\BlockFarmland.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockFenceGate.h"> + <ClInclude Include="..\src\Blocks\BlockFenceGate.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockFire.h"> + <ClInclude Include="..\src\blocks\BlockFire.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockFlower.h"> + <ClInclude Include="..\src\blocks\BlockFlower.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockFlowerPot.h"> + <ClInclude Include="..\src\Blocks\BlockFlowerPot.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockFluid.h"> + <ClInclude Include="..\src\blocks\BlockFluid.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockFurnace.h"> + <ClInclude Include="..\src\blocks\BlockFurnace.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockGlass.h"> + <ClInclude Include="..\src\Blocks\BlockGlass.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockGlowstone.h"> + <ClInclude Include="..\src\blocks\BlockGlowstone.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockGravel.h"> + <ClInclude Include="..\src\blocks\BlockGravel.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockHandler.h"> + <ClInclude Include="..\src\blocks\BlockHandler.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockHopper.h"> + <ClInclude Include="..\src\Blocks\BlockHopper.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockIce.h"> + <ClInclude Include="..\src\blocks\BlockIce.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockLadder.h"> + <ClInclude Include="..\src\blocks\BlockLadder.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockLeaves.h"> + <ClInclude Include="..\src\blocks\BlockLeaves.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockLever.h"> + <ClInclude Include="..\src\Blocks\BlockLever.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockMelon.h"> + <ClInclude Include="..\src\blocks\BlockMelon.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockMushroom.h"> + <ClInclude Include="..\src\blocks\BlockMushroom.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockMycelium.h"> + <ClInclude Include="..\src\Blocks\BlockMycelium.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockNote.h"> + <ClInclude Include="..\src\blocks\BlockNote.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockOre.h"> + <ClInclude Include="..\src\blocks\BlockOre.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockPiston.h"> + <ClInclude Include="..\src\blocks\BlockPiston.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockPlanks.h"> + <ClInclude Include="..\src\blocks\BlockPlanks.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockPortal.h"> + <ClInclude Include="..\src\blocks\BlockPortal.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockPumpkin.h"> + <ClInclude Include="..\src\Blocks\BlockPumpkin.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\Blocks\BlockRail.h"> + <ClInclude Include="..\src\Blocks\BlockRail.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockRedstone.h"> + <ClInclude Include="..\src\blocks\BlockRedstone.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockRedstoneOre.h"> + <ClInclude Include="..\src\blocks\BlockRedstoneOre.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockRedstoneRepeater.h"> + <ClInclude Include="..\src\blocks\BlockRedstoneRepeater.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockRedstoneTorch.h"> + <ClInclude Include="..\src\blocks\BlockRedstoneTorch.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockSand.h"> + <ClInclude Include="..\src\blocks\BlockSand.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockSapling.h"> + <ClInclude Include="..\src\blocks\BlockSapling.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockSign.h"> + <ClInclude Include="..\src\blocks\BlockSign.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockSlab.h"> + <ClInclude Include="..\src\blocks\BlockSlab.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockSnow.h"> + <ClInclude Include="..\src\blocks\BlockSnow.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockStairs.h"> + <ClInclude Include="..\src\blocks\BlockStairs.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockStems.h"> + <ClInclude Include="..\src\blocks\BlockStems.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockStone.h"> + <ClInclude Include="..\src\blocks\BlockStone.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockSugarcane.h"> + <ClInclude Include="..\src\blocks\BlockSugarcane.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockTallGrass.h"> + <ClInclude Include="..\src\blocks\BlockTallGrass.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockTorch.h"> + <ClInclude Include="..\src\blocks\BlockTorch.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockVine.h"> + <ClInclude Include="..\src\blocks\BlockVine.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockWood.h"> + <ClInclude Include="..\src\blocks\BlockWood.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\blocks\BlockWorkbench.h"> + <ClInclude Include="..\src\blocks\BlockWorkbench.h"> <Filter>Source Files\Blocks</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemBed.h"> + <ClInclude Include="..\src\items\ItemBed.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\Items\ItemBoat.h"> + <ClInclude Include="..\src\Items\ItemBoat.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\Items\ItemBow.h"> + <ClInclude Include="..\src\Items\ItemBow.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\Items\ItemBrewingStand.h"> + <ClInclude Include="..\src\Items\ItemBrewingStand.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemBucket.h"> + <ClInclude Include="..\src\items\ItemBucket.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\Items\ItemCauldron.h"> + <ClInclude Include="..\src\Items\ItemCauldron.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemCloth.h"> + <ClInclude Include="..\src\items\ItemCloth.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\Items\ItemComparator.h"> + <ClInclude Include="..\src\Items\ItemComparator.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemDoor.h"> + <ClInclude Include="..\src\items\ItemDoor.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemDye.h"> + <ClInclude Include="..\src\items\ItemDye.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\Items\ItemFlowerPot.h"> + <ClInclude Include="..\src\Items\ItemFlowerPot.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemFood.h"> + <ClInclude Include="..\src\items\ItemFood.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemHandler.h"> + <ClInclude Include="..\src\items\ItemHandler.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemHoe.h"> + <ClInclude Include="..\src\items\ItemHoe.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemLeaves.h"> + <ClInclude Include="..\src\items\ItemLeaves.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemLighter.h"> + <ClInclude Include="..\src\items\ItemLighter.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\Items\ItemMinecart.h"> + <ClInclude Include="..\src\Items\ItemMinecart.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemPickaxe.h"> + <ClInclude Include="..\src\items\ItemPickaxe.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemRedstoneDust.h"> + <ClInclude Include="..\src\items\ItemRedstoneDust.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemRedstoneRepeater.h"> + <ClInclude Include="..\src\items\ItemRedstoneRepeater.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemSapling.h"> + <ClInclude Include="..\src\items\ItemSapling.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemSeeds.h"> + <ClInclude Include="..\src\items\ItemSeeds.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemShears.h"> + <ClInclude Include="..\src\items\ItemShears.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemShovel.h"> + <ClInclude Include="..\src\items\ItemShovel.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemSign.h"> + <ClInclude Include="..\src\items\ItemSign.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\Items\ItemSpawnEgg.h"> + <ClInclude Include="..\src\Items\ItemSpawnEgg.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemSugarcane.h"> + <ClInclude Include="..\src\items\ItemSugarcane.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\items\ItemSword.h"> + <ClInclude Include="..\src\items\ItemSword.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\Items\ItemThrowable.h"> + <ClInclude Include="..\src\Items\ItemThrowable.h"> <Filter>Source Files\Items</Filter> </ClInclude> - <ClInclude Include="..\source\Protocol\ChunkDataSerializer.h"> + <ClInclude Include="..\src\Protocol\ChunkDataSerializer.h"> <Filter>Source Files\Protocol</Filter> </ClInclude> - <ClInclude Include="..\source\Protocol\Protocol.h"> + <ClInclude Include="..\src\Protocol\Protocol.h"> <Filter>Source Files\Protocol</Filter> </ClInclude> - <ClInclude Include="..\source\Protocol\Protocol125.h"> + <ClInclude Include="..\src\Protocol\Protocol125.h"> <Filter>Source Files\Protocol</Filter> </ClInclude> - <ClInclude Include="..\source\Protocol\Protocol132.h"> + <ClInclude Include="..\src\Protocol\Protocol132.h"> <Filter>Source Files\Protocol</Filter> </ClInclude> - <ClInclude Include="..\source\Protocol\Protocol14x.h"> + <ClInclude Include="..\src\Protocol\Protocol14x.h"> <Filter>Source Files\Protocol</Filter> </ClInclude> - <ClInclude Include="..\source\Protocol\Protocol15x.h"> + <ClInclude Include="..\src\Protocol\Protocol15x.h"> <Filter>Source Files\Protocol</Filter> </ClInclude> - <ClInclude Include="..\source\Protocol\Protocol16x.h"> + <ClInclude Include="..\src\Protocol\Protocol16x.h"> <Filter>Source Files\Protocol</Filter> </ClInclude> - <ClInclude Include="..\source\Protocol\Protocol17x.h"> + <ClInclude Include="..\src\Protocol\Protocol17x.h"> <Filter>Source Files\Protocol</Filter> </ClInclude> - <ClInclude Include="..\source\Protocol\ProtocolRecognizer.h"> + <ClInclude Include="..\src\Protocol\ProtocolRecognizer.h"> <Filter>Source Files\Protocol</Filter> </ClInclude> - <ClInclude Include="..\source\sqlite\sqlite3.h"> + <ClInclude Include="..\lib\sqlite\sqlite3.h"> <Filter>Source Files\SQLite</Filter> </ClInclude> - <ClInclude Include="..\source\LuaExpat\lxplib.h"> + <ClInclude Include="..\lib\luaexpat\lxplib.h"> <Filter>Source Files\LuaExpat</Filter> </ClInclude> - <ClInclude Include="..\source\BlockEntities\BlockEntity.h"> + <ClInclude Include="..\src\BlockEntities\BlockEntity.h"> <Filter>Source Files\BlockEntities</Filter> </ClInclude> - <ClInclude Include="..\source\BlockEntities\BlockEntityWithItems.h"> + <ClInclude Include="..\src\BlockEntities\BlockEntityWithItems.h"> <Filter>Source Files\BlockEntities</Filter> </ClInclude> - <ClInclude Include="..\source\BlockEntities\ChestEntity.h"> + <ClInclude Include="..\src\BlockEntities\ChestEntity.h"> <Filter>Source Files\BlockEntities</Filter> </ClInclude> - <ClInclude Include="..\source\BlockEntities\DispenserEntity.h"> + <ClInclude Include="..\src\BlockEntities\DispenserEntity.h"> <Filter>Source Files\BlockEntities</Filter> </ClInclude> - <ClInclude Include="..\source\BlockEntities\DropperEntity.h"> + <ClInclude Include="..\src\BlockEntities\DropperEntity.h"> <Filter>Source Files\BlockEntities</Filter> </ClInclude> - <ClInclude Include="..\source\BlockEntities\DropSpenserEntity.h"> + <ClInclude Include="..\src\BlockEntities\DropSpenserEntity.h"> <Filter>Source Files\BlockEntities</Filter> </ClInclude> - <ClInclude Include="..\source\BlockEntities\FurnaceEntity.h"> + <ClInclude Include="..\src\BlockEntities\FurnaceEntity.h"> <Filter>Source Files\BlockEntities</Filter> </ClInclude> - <ClInclude Include="..\source\BlockEntities\HopperEntity.h"> + <ClInclude Include="..\src\BlockEntities\HopperEntity.h"> <Filter>Source Files\BlockEntities</Filter> </ClInclude> - <ClInclude Include="..\source\BlockEntities\JukeboxEntity.h"> + <ClInclude Include="..\src\BlockEntities\JukeboxEntity.h"> <Filter>Source Files\BlockEntities</Filter> </ClInclude> - <ClInclude Include="..\source\BlockEntities\NoteEntity.h"> + <ClInclude Include="..\src\BlockEntities\NoteEntity.h"> <Filter>Source Files\BlockEntities</Filter> </ClInclude> - <ClInclude Include="..\source\BlockEntities\SignEntity.h"> + <ClInclude Include="..\src\BlockEntities\SignEntity.h"> <Filter>Source Files\BlockEntities</Filter> </ClInclude> - <ClInclude Include="..\source\HTTPServer\EnvelopeParser.h"> + <ClInclude Include="..\src\HTTPServer\EnvelopeParser.h"> <Filter>Source Files\HTTPServer</Filter> </ClInclude> - <ClInclude Include="..\source\HTTPServer\HTTPConnection.h"> + <ClInclude Include="..\src\HTTPServer\HTTPConnection.h"> <Filter>Source Files\HTTPServer</Filter> </ClInclude> - <ClInclude Include="..\source\HTTPServer\HTTPFormParser.h"> + <ClInclude Include="..\src\HTTPServer\HTTPFormParser.h"> <Filter>Source Files\HTTPServer</Filter> </ClInclude> - <ClInclude Include="..\source\HTTPServer\HTTPMessage.h"> + <ClInclude Include="..\src\HTTPServer\HTTPMessage.h"> <Filter>Source Files\HTTPServer</Filter> </ClInclude> - <ClInclude Include="..\source\HTTPServer\HTTPServer.h"> + <ClInclude Include="..\src\HTTPServer\HTTPServer.h"> <Filter>Source Files\HTTPServer</Filter> </ClInclude> - <ClInclude Include="..\source\HTTPServer\MultipartParser.h"> + <ClInclude Include="..\src\HTTPServer\MultipartParser.h"> <Filter>Source Files\HTTPServer</Filter> </ClInclude> - <ClInclude Include="..\source\HTTPServer\NameValueParser.h"> + <ClInclude Include="..\src\HTTPServer\NameValueParser.h"> <Filter>Source Files\HTTPServer</Filter> </ClInclude> </ItemGroup> @@ -1096,352 +1096,352 @@ </None> </ItemGroup> <ItemGroup> - <ClCompile Include="..\source\Authenticator.cpp"> + <ClCompile Include="..\src\Authenticator.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\BlockArea.cpp"> + <ClCompile Include="..\src\BlockArea.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\BlockID.cpp"> + <ClCompile Include="..\src\BlockID.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\BoundingBox.cpp"> + <ClCompile Include="..\src\BoundingBox.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\ByteBuffer.cpp"> + <ClCompile Include="..\src\ByteBuffer.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\ChatColor.cpp"> + <ClCompile Include="..\src\ChatColor.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Chunk.cpp"> + <ClCompile Include="..\src\Chunk.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\ChunkMap.cpp"> + <ClCompile Include="..\src\ChunkMap.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\ChunkSender.cpp"> + <ClCompile Include="..\src\ChunkSender.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\ClientHandle.cpp"> + <ClCompile Include="..\src\ClientHandle.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\CommandOutput.cpp"> + <ClCompile Include="..\src\CommandOutput.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\CraftingRecipes.cpp"> + <ClCompile Include="..\src\CraftingRecipes.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Cuboid.cpp"> + <ClCompile Include="..\src\Cuboid.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\DeadlockDetect.cpp"> + <ClCompile Include="..\src\DeadlockDetect.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Enchantments.cpp"> + <ClCompile Include="..\src\Enchantments.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\FastRandom.cpp"> + <ClCompile Include="..\src\FastRandom.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\FurnaceRecipe.cpp"> + <ClCompile Include="..\src\FurnaceRecipe.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Globals.cpp"> + <ClCompile Include="..\src\Globals.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Group.cpp"> + <ClCompile Include="..\src\Group.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\GroupManager.cpp"> + <ClCompile Include="..\src\GroupManager.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Inventory.cpp"> + <ClCompile Include="..\src\Inventory.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Item.cpp"> + <ClCompile Include="..\src\Item.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\ItemGrid.cpp"> + <ClCompile Include="..\src\ItemGrid.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\LeakFinder.cpp"> + <ClCompile Include="..\src\LeakFinder.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\LightingThread.cpp"> + <ClCompile Include="..\src\LightingThread.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\LinearInterpolation.cpp"> + <ClCompile Include="..\src\LinearInterpolation.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\LineBlockTracer.cpp"> + <ClCompile Include="..\src\LineBlockTracer.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Log.cpp"> + <ClCompile Include="..\src\Log.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\main.cpp"> + <ClCompile Include="..\src\main.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Matrix4f.cpp"> + <ClCompile Include="..\src\Matrix4f.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\MCLogger.cpp"> + <ClCompile Include="..\src\MCLogger.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\MobCensus.cpp"> + <ClCompile Include="..\src\MobCensus.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\MobFamilyCollecter.cpp"> + <ClCompile Include="..\src\MobFamilyCollecter.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\MobProximityCounter.cpp"> + <ClCompile Include="..\src\MobProximityCounter.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\MobSpawner.cpp"> + <ClCompile Include="..\src\MobSpawner.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\MonsterConfig.cpp"> + <ClCompile Include="..\src\MonsterConfig.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Noise.cpp"> + <ClCompile Include="..\src\Noise.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Piston.cpp"> + <ClCompile Include="..\src\Piston.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\ProbabDistrib.cpp"> + <ClCompile Include="..\src\ProbabDistrib.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\RCONServer.cpp"> + <ClCompile Include="..\src\RCONServer.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\ReferenceManager.cpp"> + <ClCompile Include="..\src\ReferenceManager.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Root.cpp"> + <ClCompile Include="..\src\Root.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Server.cpp"> + <ClCompile Include="..\src\Server.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\StackWalker.cpp"> + <ClCompile Include="..\src\StackWalker.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\StringCompression.cpp"> + <ClCompile Include="..\src\StringCompression.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\StringUtils.cpp"> + <ClCompile Include="..\src\StringUtils.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Tracer.cpp"> + <ClCompile Include="..\src\Tracer.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Vector3d.cpp"> + <ClCompile Include="..\src\Vector3d.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Vector3f.cpp"> + <ClCompile Include="..\src\Vector3f.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Vector3i.cpp"> + <ClCompile Include="..\src\Vector3i.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\WebAdmin.cpp"> + <ClCompile Include="..\src\WebAdmin.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\World.cpp"> + <ClCompile Include="..\src\World.cpp"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\AggressiveMonster.cpp"> + <ClCompile Include="..\src\Mobs\AggressiveMonster.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Bat.cpp"> + <ClCompile Include="..\src\Mobs\Bat.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Blaze.cpp"> + <ClCompile Include="..\src\Mobs\Blaze.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Cavespider.cpp"> + <ClCompile Include="..\src\Mobs\Cavespider.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Chicken.cpp"> + <ClCompile Include="..\src\Mobs\Chicken.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Cow.cpp"> + <ClCompile Include="..\src\Mobs\Cow.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Creeper.cpp"> + <ClCompile Include="..\src\Mobs\Creeper.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\EnderDragon.cpp"> + <ClCompile Include="..\src\Mobs\EnderDragon.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Enderman.cpp"> + <ClCompile Include="..\src\Mobs\Enderman.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Ghast.cpp"> + <ClCompile Include="..\src\Mobs\Ghast.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Giant.cpp"> + <ClCompile Include="..\src\Mobs\Giant.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Horse.cpp"> + <ClCompile Include="..\src\Mobs\Horse.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\IronGolem.cpp"> + <ClCompile Include="..\src\Mobs\IronGolem.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\MagmaCube.cpp"> + <ClCompile Include="..\src\Mobs\MagmaCube.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Monster.cpp"> + <ClCompile Include="..\src\Mobs\Monster.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Mooshroom.cpp"> + <ClCompile Include="..\src\Mobs\Mooshroom.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\PassiveAggressiveMonster.cpp"> + <ClCompile Include="..\src\Mobs\PassiveAggressiveMonster.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\PassiveMonster.cpp"> + <ClCompile Include="..\src\Mobs\PassiveMonster.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Pig.cpp"> + <ClCompile Include="..\src\Mobs\Pig.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Sheep.cpp"> + <ClCompile Include="..\src\Mobs\Sheep.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Skeleton.cpp"> + <ClCompile Include="..\src\Mobs\Skeleton.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Slime.cpp"> + <ClCompile Include="..\src\Mobs\Slime.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\SnowGolem.cpp"> + <ClCompile Include="..\src\Mobs\SnowGolem.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Spider.cpp"> + <ClCompile Include="..\src\Mobs\Spider.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Squid.cpp"> + <ClCompile Include="..\src\Mobs\Squid.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Villager.cpp"> + <ClCompile Include="..\src\Mobs\Villager.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Witch.cpp"> + <ClCompile Include="..\src\Mobs\Witch.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Wither.cpp"> + <ClCompile Include="..\src\Mobs\Wither.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Wolf.cpp"> + <ClCompile Include="..\src\Mobs\Wolf.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\Zombie.cpp"> + <ClCompile Include="..\src\Mobs\Zombie.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Mobs\ZombiePigman.cpp"> + <ClCompile Include="..\src\Mobs\ZombiePigman.cpp"> <Filter>Source Files\Mobs</Filter> </ClCompile> - <ClCompile Include="..\source\Entities\Boat.cpp"> + <ClCompile Include="..\src\Entities\Boat.cpp"> <Filter>Source Files\Entities</Filter> </ClCompile> - <ClCompile Include="..\source\Entities\Entity.cpp"> + <ClCompile Include="..\src\Entities\Entity.cpp"> <Filter>Source Files\Entities</Filter> </ClCompile> - <ClCompile Include="..\source\Entities\FallingBlock.cpp"> + <ClCompile Include="..\src\Entities\FallingBlock.cpp"> <Filter>Source Files\Entities</Filter> </ClCompile> - <ClCompile Include="..\source\Entities\Minecart.cpp"> + <ClCompile Include="..\src\Entities\Minecart.cpp"> <Filter>Source Files\Entities</Filter> </ClCompile> - <ClCompile Include="..\source\Entities\Pawn.cpp"> + <ClCompile Include="..\src\Entities\Pawn.cpp"> <Filter>Source Files\Entities</Filter> </ClCompile> - <ClCompile Include="..\source\Entities\Pickup.cpp"> + <ClCompile Include="..\src\Entities\Pickup.cpp"> <Filter>Source Files\Entities</Filter> </ClCompile> - <ClCompile Include="..\source\Entities\Player.cpp"> + <ClCompile Include="..\src\Entities\Player.cpp"> <Filter>Source Files\Entities</Filter> </ClCompile> - <ClCompile Include="..\source\Entities\ProjectileEntity.cpp"> + <ClCompile Include="..\src\Entities\ProjectileEntity.cpp"> <Filter>Source Files\Entities</Filter> </ClCompile> - <ClCompile Include="..\source\Entities\TNTEntity.cpp"> + <ClCompile Include="..\src\Entities\TNTEntity.cpp"> <Filter>Source Files\Entities</Filter> </ClCompile> - <ClCompile Include="..\source\UI\SlotArea.cpp"> + <ClCompile Include="..\src\UI\SlotArea.cpp"> <Filter>Source Files\UI</Filter> </ClCompile> - <ClCompile Include="..\source\UI\Window.cpp"> + <ClCompile Include="..\src\UI\Window.cpp"> <Filter>Source Files\UI</Filter> </ClCompile> - <ClCompile Include="..\source\Simulator\DelayedFluidSimulator.cpp"> + <ClCompile Include="..\src\Simulator\DelayedFluidSimulator.cpp"> <Filter>Source Files\Simulator</Filter> </ClCompile> - <ClCompile Include="..\source\Simulator\FireSimulator.cpp"> + <ClCompile Include="..\src\Simulator\FireSimulator.cpp"> <Filter>Source Files\Simulator</Filter> </ClCompile> - <ClCompile Include="..\source\Simulator\FloodyFluidSimulator.cpp"> + <ClCompile Include="..\src\Simulator\FloodyFluidSimulator.cpp"> <Filter>Source Files\Simulator</Filter> </ClCompile> - <ClCompile Include="..\source\Simulator\FluidSimulator.cpp"> + <ClCompile Include="..\src\Simulator\FluidSimulator.cpp"> <Filter>Source Files\Simulator</Filter> </ClCompile> - <ClCompile Include="..\source\Simulator\RedstoneSimulator.cpp"> + <ClCompile Include="..\src\Simulator\RedstoneSimulator.cpp"> <Filter>Source Files\Simulator</Filter> </ClCompile> - <ClCompile Include="..\source\Simulator\SandSimulator.cpp"> + <ClCompile Include="..\src\Simulator\SandSimulator.cpp"> <Filter>Source Files\Simulator</Filter> </ClCompile> - <ClCompile Include="..\source\Simulator\Simulator.cpp"> + <ClCompile Include="..\src\Simulator\Simulator.cpp"> <Filter>Source Files\Simulator</Filter> </ClCompile> - <ClCompile Include="..\source\Simulator\SimulatorManager.cpp"> + <ClCompile Include="..\src\Simulator\SimulatorManager.cpp"> <Filter>Source Files\Simulator</Filter> </ClCompile> - <ClCompile Include="..\source\Simulator\VaporizeFluidSimulator.cpp"> + <ClCompile Include="..\src\Simulator\VaporizeFluidSimulator.cpp"> <Filter>Source Files\Simulator</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\BlockingTCPLink.cpp"> + <ClCompile Include="..\src\OSSupport\BlockingTCPLink.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\CriticalSection.cpp"> + <ClCompile Include="..\src\OSSupport\CriticalSection.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\Event.cpp"> + <ClCompile Include="..\src\OSSupport\Event.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\File.cpp"> + <ClCompile Include="..\src\OSSupport\File.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\GZipFile.cpp"> + <ClCompile Include="..\src\OSSupport\GZipFile.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\IsThread.cpp"> + <ClCompile Include="..\src\OSSupport\IsThread.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\ListenThread.cpp"> + <ClCompile Include="..\src\OSSupport\ListenThread.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\Semaphore.cpp"> + <ClCompile Include="..\src\OSSupport\Semaphore.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\Sleep.cpp"> + <ClCompile Include="..\src\OSSupport\Sleep.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\Socket.cpp"> + <ClCompile Include="..\src\OSSupport\Socket.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\SocketThreads.cpp"> + <ClCompile Include="..\src\OSSupport\SocketThreads.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\Thread.cpp"> + <ClCompile Include="..\src\OSSupport\Thread.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> - <ClCompile Include="..\source\OSSupport\Timer.cpp"> + <ClCompile Include="..\src\OSSupport\Timer.cpp"> <Filter>Source Files\OSSupport</Filter> </ClCompile> <ClCompile Include="..\Android\jni\app-android.cpp"> @@ -1450,205 +1450,208 @@ <ClCompile Include="..\Android\jni\ToJava.cpp"> <Filter>Source Files\OSSupport\Android Specific</Filter> </ClCompile> - <ClCompile Include="..\source\Bindings.cpp"> + <ClCompile Include="..\src\Bindings.cpp"> <Filter>Source Files\Bindings</Filter> </ClCompile> - <ClCompile Include="..\source\LuaState.cpp"> + <ClCompile Include="..\src\LuaState.cpp"> <Filter>Source Files\Bindings</Filter> </ClCompile> - <ClCompile Include="..\source\LuaWindow.cpp"> + <ClCompile Include="..\src\LuaWindow.cpp"> <Filter>Source Files\Bindings</Filter> </ClCompile> - <ClCompile Include="..\source\ManualBindings.cpp"> + <ClCompile Include="..\src\ManualBindings.cpp"> <Filter>Source Files\Bindings</Filter> </ClCompile> - <ClCompile Include="..\source\Plugin.cpp"> + <ClCompile Include="..\src\Plugin.cpp"> <Filter>Source Files\Bindings</Filter> </ClCompile> - <ClCompile Include="..\source\PluginLua.cpp"> + <ClCompile Include="..\src\PluginLua.cpp"> <Filter>Source Files\Bindings</Filter> </ClCompile> - <ClCompile Include="..\source\PluginManager.cpp"> + <ClCompile Include="..\src\PluginManager.cpp"> <Filter>Source Files\Bindings</Filter> </ClCompile> - <ClCompile Include="..\source\WebPlugin.cpp"> + <ClCompile Include="..\src\WebPlugin.cpp"> <Filter>Source Files\Bindings</Filter> </ClCompile> - <ClCompile Include="..\iniFile\iniFile.cpp"> + <ClCompile Include="..\lib\inifile\iniFile.cpp"> <Filter>Source Files\External</Filter> </ClCompile> - <ClCompile Include="..\source\md5\md5.cpp"> + <ClCompile Include="..\lib\md5\md5.cpp"> <Filter>Source Files\External</Filter> </ClCompile> - <ClCompile Include="..\source\WorldStorage\FastNBT.cpp"> + <ClCompile Include="..\src\WorldStorage\FastNBT.cpp"> <Filter>Source Files\WorldStorage</Filter> </ClCompile> - <ClCompile Include="..\source\WorldStorage\NBTChunkSerializer.cpp"> + <ClCompile Include="..\src\WorldStorage\NBTChunkSerializer.cpp"> <Filter>Source Files\WorldStorage</Filter> </ClCompile> - <ClCompile Include="..\source\WorldStorage\WorldStorage.cpp"> + <ClCompile Include="..\src\WorldStorage\WorldStorage.cpp"> <Filter>Source Files\WorldStorage</Filter> </ClCompile> - <ClCompile Include="..\source\WorldStorage\WSSAnvil.cpp"> + <ClCompile Include="..\src\WorldStorage\WSSAnvil.cpp"> <Filter>Source Files\WorldStorage</Filter> </ClCompile> - <ClCompile Include="..\source\WorldStorage\WSSCompact.cpp"> + <ClCompile Include="..\src\WorldStorage\WSSCompact.cpp"> <Filter>Source Files\WorldStorage</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\BioGen.cpp"> + <ClCompile Include="..\src\Generating\BioGen.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\Caves.cpp"> + <ClCompile Include="..\src\Generating\Caves.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\ChunkDesc.cpp"> + <ClCompile Include="..\src\Generating\ChunkDesc.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\ChunkGenerator.cpp"> + <ClCompile Include="..\src\Generating\ChunkGenerator.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\CompoGen.cpp"> + <ClCompile Include="..\src\Generating\CompoGen.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\ComposableGenerator.cpp"> + <ClCompile Include="..\src\Generating\ComposableGenerator.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\DistortedHeightmap.cpp"> + <ClCompile Include="..\src\Generating\DistortedHeightmap.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\EndGen.cpp"> + <ClCompile Include="..\src\Generating\EndGen.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\FinishGen.cpp"> + <ClCompile Include="..\src\Generating\FinishGen.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\HeiGen.cpp"> + <ClCompile Include="..\src\Generating\HeiGen.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\MineShafts.cpp"> + <ClCompile Include="..\src\Generating\MineShafts.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\Noise3DGenerator.cpp"> + <ClCompile Include="..\src\Generating\Noise3DGenerator.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\Ravines.cpp"> + <ClCompile Include="..\src\Generating\Ravines.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\StructGen.cpp"> + <ClCompile Include="..\src\Generating\StructGen.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Generating\Trees.cpp"> + <ClCompile Include="..\src\Generating\Trees.cpp"> <Filter>Source Files\Generating</Filter> </ClCompile> - <ClCompile Include="..\source\Blocks\BlockBed.cpp"> + <ClCompile Include="..\src\Blocks\BlockBed.cpp"> <Filter>Source Files\Blocks</Filter> </ClCompile> - <ClCompile Include="..\source\Blocks\BlockButton.cpp"> + <ClCompile Include="..\src\Blocks\BlockButton.cpp"> <Filter>Source Files\Blocks</Filter> </ClCompile> - <ClCompile Include="..\source\Blocks\BlockComparator.cpp"> + <ClCompile Include="..\src\Blocks\BlockComparator.cpp"> <Filter>Source Files\Blocks</Filter> </ClCompile> - <ClCompile Include="..\source\blocks\BlockDoor.cpp"> + <ClCompile Include="..\src\blocks\BlockDoor.cpp"> <Filter>Source Files\Blocks</Filter> </ClCompile> - <ClCompile Include="..\source\blocks\BlockHandler.cpp"> + <ClCompile Include="..\src\blocks\BlockHandler.cpp"> <Filter>Source Files\Blocks</Filter> </ClCompile> - <ClCompile Include="..\source\Blocks\BlockLever.cpp"> + <ClCompile Include="..\src\Blocks\BlockLever.cpp"> <Filter>Source Files\Blocks</Filter> </ClCompile> - <ClCompile Include="..\source\blocks\BlockPiston.cpp"> + <ClCompile Include="..\src\blocks\BlockPiston.cpp"> <Filter>Source Files\Blocks</Filter> </ClCompile> - <ClCompile Include="..\source\blocks\BlockRedstone.cpp"> + <ClCompile Include="..\src\blocks\BlockRedstone.cpp"> <Filter>Source Files\Blocks</Filter> </ClCompile> - <ClCompile Include="..\source\blocks\BlockRedstoneRepeater.cpp"> + <ClCompile Include="..\src\blocks\BlockRedstoneRepeater.cpp"> <Filter>Source Files\Blocks</Filter> </ClCompile> - <ClCompile Include="..\source\items\ItemHandler.cpp"> + <ClCompile Include="..\src\items\ItemHandler.cpp"> <Filter>Source Files\Items</Filter> </ClCompile> - <ClCompile Include="..\source\Protocol\ChunkDataSerializer.cpp"> + <ClCompile Include="..\src\Protocol\ChunkDataSerializer.cpp"> <Filter>Source Files\Protocol</Filter> </ClCompile> - <ClCompile Include="..\source\Protocol\Protocol125.cpp"> + <ClCompile Include="..\src\Protocol\Protocol125.cpp"> <Filter>Source Files\Protocol</Filter> </ClCompile> - <ClCompile Include="..\source\Protocol\Protocol132.cpp"> + <ClCompile Include="..\src\Protocol\Protocol132.cpp"> <Filter>Source Files\Protocol</Filter> </ClCompile> - <ClCompile Include="..\source\Protocol\Protocol14x.cpp"> + <ClCompile Include="..\src\Protocol\Protocol14x.cpp"> <Filter>Source Files\Protocol</Filter> </ClCompile> - <ClCompile Include="..\source\Protocol\Protocol15x.cpp"> + <ClCompile Include="..\src\Protocol\Protocol15x.cpp"> <Filter>Source Files\Protocol</Filter> </ClCompile> - <ClCompile Include="..\source\Protocol\Protocol16x.cpp"> + <ClCompile Include="..\src\Protocol\Protocol16x.cpp"> <Filter>Source Files\Protocol</Filter> </ClCompile> - <ClCompile Include="..\source\Protocol\Protocol17x.cpp"> + <ClCompile Include="..\src\Protocol\Protocol17x.cpp"> <Filter>Source Files\Protocol</Filter> </ClCompile> - <ClCompile Include="..\source\Protocol\ProtocolRecognizer.cpp"> + <ClCompile Include="..\src\Protocol\ProtocolRecognizer.cpp"> <Filter>Source Files\Protocol</Filter> </ClCompile> - <ClCompile Include="..\source\sqlite\lsqlite3.c"> + <ClCompile Include="..\lib\sqlite\lsqlite3.c"> <Filter>Source Files\SQLite</Filter> </ClCompile> - <ClCompile Include="..\source\sqlite\sqlite3.c"> + <ClCompile Include="..\lib\sqlite\sqlite3.c"> <Filter>Source Files\SQLite</Filter> </ClCompile> - <ClCompile Include="..\source\LuaExpat\lxplib.c"> + <ClCompile Include="..\lib\luaexpat\lxplib.c"> <Filter>Source Files\LuaExpat</Filter> </ClCompile> - <ClCompile Include="..\source\BlockEntities\ChestEntity.cpp"> + <ClCompile Include="..\src\BlockEntities\BlockEntity.cpp"> <Filter>Source Files\BlockEntities</Filter> </ClCompile> - <ClCompile Include="..\source\BlockEntities\DispenserEntity.cpp"> + <ClCompile Include="..\src\BlockEntities\ChestEntity.cpp"> <Filter>Source Files\BlockEntities</Filter> </ClCompile> - <ClCompile Include="..\source\BlockEntities\DropperEntity.cpp"> + <ClCompile Include="..\src\BlockEntities\DispenserEntity.cpp"> <Filter>Source Files\BlockEntities</Filter> </ClCompile> - <ClCompile Include="..\source\BlockEntities\DropSpenserEntity.cpp"> + <ClCompile Include="..\src\BlockEntities\DropperEntity.cpp"> <Filter>Source Files\BlockEntities</Filter> </ClCompile> - <ClCompile Include="..\source\BlockEntities\FurnaceEntity.cpp"> + <ClCompile Include="..\src\BlockEntities\DropSpenserEntity.cpp"> <Filter>Source Files\BlockEntities</Filter> </ClCompile> - <ClCompile Include="..\source\BlockEntities\HopperEntity.cpp"> + <ClCompile Include="..\src\BlockEntities\FurnaceEntity.cpp"> <Filter>Source Files\BlockEntities</Filter> </ClCompile> - <ClCompile Include="..\source\BlockEntities\JukeboxEntity.cpp"> + <ClCompile Include="..\src\BlockEntities\HopperEntity.cpp"> <Filter>Source Files\BlockEntities</Filter> </ClCompile> - <ClCompile Include="..\source\BlockEntities\NoteEntity.cpp"> + <ClCompile Include="..\src\BlockEntities\JukeboxEntity.cpp"> <Filter>Source Files\BlockEntities</Filter> </ClCompile> - <ClCompile Include="..\source\BlockEntities\SignEntity.cpp"> + <ClCompile Include="..\src\BlockEntities\NoteEntity.cpp"> <Filter>Source Files\BlockEntities</Filter> </ClCompile> - <ClCompile Include="..\source\HTTPServer\EnvelopeParser.cpp"> + <ClCompile Include="..\src\BlockEntities\SignEntity.cpp"> + <Filter>Source Files\BlockEntities</Filter> + </ClCompile> + <ClCompile Include="..\src\HTTPServer\EnvelopeParser.cpp"> <Filter>Source Files\HTTPServer</Filter> </ClCompile> - <ClCompile Include="..\source\HTTPServer\HTTPConnection.cpp"> + <ClCompile Include="..\src\HTTPServer\HTTPConnection.cpp"> <Filter>Source Files\HTTPServer</Filter> </ClCompile> - <ClCompile Include="..\source\HTTPServer\HTTPFormParser.cpp"> + <ClCompile Include="..\src\HTTPServer\HTTPFormParser.cpp"> <Filter>Source Files\HTTPServer</Filter> </ClCompile> - <ClCompile Include="..\source\HTTPServer\HTTPMessage.cpp"> + <ClCompile Include="..\src\HTTPServer\HTTPMessage.cpp"> <Filter>Source Files\HTTPServer</Filter> </ClCompile> - <ClCompile Include="..\source\HTTPServer\HTTPServer.cpp"> + <ClCompile Include="..\src\HTTPServer\HTTPServer.cpp"> <Filter>Source Files\HTTPServer</Filter> </ClCompile> - <ClCompile Include="..\source\HTTPServer\MultipartParser.cpp"> + <ClCompile Include="..\src\HTTPServer\MultipartParser.cpp"> <Filter>Source Files\HTTPServer</Filter> </ClCompile> - <ClCompile Include="..\source\HTTPServer\NameValueParser.cpp"> + <ClCompile Include="..\src\HTTPServer\NameValueParser.cpp"> <Filter>Source Files\HTTPServer</Filter> </ClCompile> </ItemGroup> @@ -1656,7 +1659,7 @@ <Text Include="..\MCServer\API.txt"> <Filter>Source Files\Bindings</Filter> </Text> - <Text Include="..\source\sqlite\urls.txt"> + <Text Include="..\lib\sqlite\urls.txt"> <Filter>Source Files\SQLite</Filter> </Text> <Text Include="..\MCServer\crafting.txt"> @@ -1676,7 +1679,7 @@ <CustomBuild Include="..\Android\jni\ToJava.h"> <Filter>Source Files\OSSupport\Android Specific</Filter> </CustomBuild> - <CustomBuild Include="..\source\AllToLua.pkg"> + <CustomBuild Include="..\src\AllToLua.pkg"> <Filter>Source Files\Bindings</Filter> </CustomBuild> </ItemGroup> diff --git a/VC2013/ToLua.vcxproj b/VC2013/ToLua.vcxproj index cd032d3b3..c798af657 100644 --- a/VC2013/ToLua.vcxproj +++ b/VC2013/ToLua.vcxproj @@ -84,7 +84,7 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>../tolua++-1.0.93/include;../lua-5.1.4/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>../lib/tolua++/include;../lib/lua/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -98,7 +98,7 @@ <ClCompile> <Optimization>MaxSpeed</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalIncludeDirectories>../tolua++-1.0.93/include;../lua-5.1.4/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>../lib/tolua++/include;../lib/lua/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> @@ -111,7 +111,7 @@ <ClCompile> <Optimization>MaxSpeed</Optimization> <IntrinsicFunctions>true</IntrinsicFunctions> - <AdditionalIncludeDirectories>../tolua++-1.0.93/include;../lua-5.1.4/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>../lib/tolua++/include;../lib/lua/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> <FunctionLevelLinking>true</FunctionLevelLinking> @@ -123,7 +123,7 @@ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug profiled|Win32'"> <ClCompile> <Optimization>Disabled</Optimization> - <AdditionalIncludeDirectories>../tolua++-1.0.93/include;../lua-5.1.4/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <AdditionalIncludeDirectories>../lib/tolua++/include;../lib/lua/src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <MinimalRebuild>true</MinimalRebuild> <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> @@ -134,15 +134,15 @@ </ClCompile> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\tolua++-1.0.93\src\bin\tolua.c" /> - <ClCompile Include="..\tolua++-1.0.93\src\lib\tolua_event.c" /> - <ClCompile Include="..\tolua++-1.0.93\src\lib\tolua_is.c" /> - <ClCompile Include="..\tolua++-1.0.93\src\lib\tolua_map.c" /> - <ClCompile Include="..\tolua++-1.0.93\src\lib\tolua_push.c" /> - <ClCompile Include="..\tolua++-1.0.93\src\lib\tolua_to.c" /> + <ClCompile Include="..\lib\tolua++\src\bin\tolua.c" /> + <ClCompile Include="..\lib\tolua++\src\lib\tolua_event.c" /> + <ClCompile Include="..\lib\tolua++\src\lib\tolua_is.c" /> + <ClCompile Include="..\lib\tolua++\src\lib\tolua_map.c" /> + <ClCompile Include="..\lib\tolua++\src\lib\tolua_push.c" /> + <ClCompile Include="..\lib\tolua++\src\lib\tolua_to.c" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\tolua++-1.0.93\src\lib\tolua_event.h" /> + <ClInclude Include="..\lib\tolua++\src\lib\tolua_event.h" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/VC2013/ToLua.vcxproj.filters b/VC2013/ToLua.vcxproj.filters index 719b59c0d..5d104d7d0 100644 --- a/VC2013/ToLua.vcxproj.filters +++ b/VC2013/ToLua.vcxproj.filters @@ -7,27 +7,27 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\tolua++-1.0.93\src\bin\tolua.c"> + <ClCompile Include="..\lib\tolua++\src\bin\tolua.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\tolua++-1.0.93\src\lib\tolua_event.c"> + <ClCompile Include="..\lib\tolua++\src\lib\tolua_event.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\tolua++-1.0.93\src\lib\tolua_is.c"> + <ClCompile Include="..\lib\tolua++\src\lib\tolua_is.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\tolua++-1.0.93\src\lib\tolua_map.c"> + <ClCompile Include="..\lib\tolua++\src\lib\tolua_map.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\tolua++-1.0.93\src\lib\tolua_push.c"> + <ClCompile Include="..\lib\tolua++\src\lib\tolua_push.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\tolua++-1.0.93\src\lib\tolua_to.c"> + <ClCompile Include="..\lib\tolua++\src\lib\tolua_to.c"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\tolua++-1.0.93\src\lib\tolua_event.h"> + <ClInclude Include="..\lib\tolua++\src\lib\tolua_event.h"> <Filter>Source Files</Filter> </ClInclude> </ItemGroup> diff --git a/VC2013/expat.vcxproj b/VC2013/expat.vcxproj index 3049b972a..388bf6158 100644 --- a/VC2013/expat.vcxproj +++ b/VC2013/expat.vcxproj @@ -73,26 +73,26 @@ </ClCompile> </ItemDefinitionGroup> <ItemGroup> - <ClInclude Include="..\expat\ascii.h" /> - <ClInclude Include="..\expat\asciitab.h" /> - <ClInclude Include="..\expat\expat.h" /> - <ClInclude Include="..\expat\expat_external.h" /> - <ClInclude Include="..\expat\iasciitab.h" /> - <ClInclude Include="..\expat\internal.h" /> - <ClInclude Include="..\expat\latin1tab.h" /> - <ClInclude Include="..\expat\nametab.h" /> - <ClInclude Include="..\expat\utf8tab.h" /> - <ClInclude Include="..\expat\winconfig.h" /> - <ClInclude Include="..\expat\xmlrole.h" /> - <ClInclude Include="..\expat\xmltok.h" /> - <ClInclude Include="..\expat\xmltok_impl.h" /> + <ClInclude Include="..\lib\expat\ascii.h" /> + <ClInclude Include="..\lib\expat\asciitab.h" /> + <ClInclude Include="..\lib\expat\expat.h" /> + <ClInclude Include="..\lib\expat\expat_external.h" /> + <ClInclude Include="..\lib\expat\iasciitab.h" /> + <ClInclude Include="..\lib\expat\internal.h" /> + <ClInclude Include="..\lib\expat\latin1tab.h" /> + <ClInclude Include="..\lib\expat\nametab.h" /> + <ClInclude Include="..\lib\expat\utf8tab.h" /> + <ClInclude Include="..\lib\expat\winconfig.h" /> + <ClInclude Include="..\lib\expat\xmlrole.h" /> + <ClInclude Include="..\lib\expat\xmltok.h" /> + <ClInclude Include="..\lib\expat\xmltok_impl.h" /> </ItemGroup> <ItemGroup> - <ClCompile Include="..\expat\xmlparse.c" /> - <ClCompile Include="..\expat\xmlrole.c" /> - <ClCompile Include="..\expat\xmltok.c" /> - <ClCompile Include="..\expat\xmltok_impl.c" /> - <ClCompile Include="..\expat\xmltok_ns.c" /> + <ClCompile Include="..\lib\expat\xmlparse.c" /> + <ClCompile Include="..\lib\expat\xmlrole.c" /> + <ClCompile Include="..\lib\expat\xmltok.c" /> + <ClCompile Include="..\lib\expat\xmltok_impl.c" /> + <ClCompile Include="..\lib\expat\xmltok_ns.c" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/VC2013/expat.vcxproj.filters b/VC2013/expat.vcxproj.filters index 34cf0b3b6..4cb4220c9 100644 --- a/VC2013/expat.vcxproj.filters +++ b/VC2013/expat.vcxproj.filters @@ -7,60 +7,60 @@ </Filter> </ItemGroup> <ItemGroup> - <ClInclude Include="..\expat\ascii.h"> + <ClInclude Include="..\lib\expat\ascii.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\expat\asciitab.h"> + <ClInclude Include="..\lib\expat\asciitab.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\expat\expat.h"> + <ClInclude Include="..\lib\expat\expat.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\expat\expat_external.h"> + <ClInclude Include="..\lib\expat\expat_external.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\expat\iasciitab.h"> + <ClInclude Include="..\lib\expat\iasciitab.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\expat\internal.h"> + <ClInclude Include="..\lib\expat\internal.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\expat\latin1tab.h"> + <ClInclude Include="..\lib\expat\latin1tab.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\expat\nametab.h"> + <ClInclude Include="..\lib\expat\nametab.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\expat\utf8tab.h"> + <ClInclude Include="..\lib\expat\utf8tab.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\expat\winconfig.h"> + <ClInclude Include="..\lib\expat\winconfig.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\expat\xmlrole.h"> + <ClInclude Include="..\lib\expat\xmlrole.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\expat\xmltok.h"> + <ClInclude Include="..\lib\expat\xmltok.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\expat\xmltok_impl.h"> + <ClInclude Include="..\lib\expat\xmltok_impl.h"> <Filter>Source Files</Filter> </ClInclude> </ItemGroup> <ItemGroup> - <ClCompile Include="..\expat\xmlparse.c"> + <ClCompile Include="..\lib\expat\xmlparse.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\expat\xmlrole.c"> + <ClCompile Include="..\lib\expat\xmlrole.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\expat\xmltok.c"> + <ClCompile Include="..\lib\expat\xmltok.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\expat\xmltok_impl.c"> + <ClCompile Include="..\lib\expat\xmltok_impl.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\expat\xmltok_ns.c"> + <ClCompile Include="..\lib\expat\xmltok_ns.c"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> diff --git a/VC2013/zlib.vcxproj b/VC2013/zlib.vcxproj index d00064bf2..3aeacf329 100644 --- a/VC2013/zlib.vcxproj +++ b/VC2013/zlib.vcxproj @@ -134,34 +134,34 @@ </ClCompile> </ItemDefinitionGroup> <ItemGroup> - <ClCompile Include="..\zlib-1.2.7\adler32.c" /> - <ClCompile Include="..\zlib-1.2.7\compress.c" /> - <ClCompile Include="..\zlib-1.2.7\crc32.c" /> - <ClCompile Include="..\zlib-1.2.7\deflate.c" /> - <ClCompile Include="..\zlib-1.2.7\gzclose.c" /> - <ClCompile Include="..\zlib-1.2.7\gzlib.c" /> - <ClCompile Include="..\zlib-1.2.7\gzread.c" /> - <ClCompile Include="..\zlib-1.2.7\gzwrite.c" /> - <ClCompile Include="..\zlib-1.2.7\infback.c" /> - <ClCompile Include="..\zlib-1.2.7\inffast.c" /> - <ClCompile Include="..\zlib-1.2.7\inflate.c" /> - <ClCompile Include="..\zlib-1.2.7\inftrees.c" /> - <ClCompile Include="..\zlib-1.2.7\trees.c" /> - <ClCompile Include="..\zlib-1.2.7\uncompr.c" /> - <ClCompile Include="..\zlib-1.2.7\zutil.c" /> + <ClCompile Include="..\lib\zlib\adler32.c" /> + <ClCompile Include="..\lib\zlib\compress.c" /> + <ClCompile Include="..\lib\zlib\crc32.c" /> + <ClCompile Include="..\lib\zlib\deflate.c" /> + <ClCompile Include="..\lib\zlib\gzclose.c" /> + <ClCompile Include="..\lib\zlib\gzlib.c" /> + <ClCompile Include="..\lib\zlib\gzread.c" /> + <ClCompile Include="..\lib\zlib\gzwrite.c" /> + <ClCompile Include="..\lib\zlib\infback.c" /> + <ClCompile Include="..\lib\zlib\inffast.c" /> + <ClCompile Include="..\lib\zlib\inflate.c" /> + <ClCompile Include="..\lib\zlib\inftrees.c" /> + <ClCompile Include="..\lib\zlib\trees.c" /> + <ClCompile Include="..\lib\zlib\uncompr.c" /> + <ClCompile Include="..\lib\zlib\zutil.c" /> </ItemGroup> <ItemGroup> - <ClInclude Include="..\zlib-1.2.7\crc32.h" /> - <ClInclude Include="..\zlib-1.2.7\deflate.h" /> - <ClInclude Include="..\zlib-1.2.7\gzguts.h" /> - <ClInclude Include="..\zlib-1.2.7\inffast.h" /> - <ClInclude Include="..\zlib-1.2.7\inffixed.h" /> - <ClInclude Include="..\zlib-1.2.7\inflate.h" /> - <ClInclude Include="..\zlib-1.2.7\inftrees.h" /> - <ClInclude Include="..\zlib-1.2.7\trees.h" /> - <ClInclude Include="..\zlib-1.2.7\zconf.h" /> - <ClInclude Include="..\zlib-1.2.7\zlib.h" /> - <ClInclude Include="..\zlib-1.2.7\zutil.h" /> + <ClInclude Include="..\lib\zlib\crc32.h" /> + <ClInclude Include="..\lib\zlib\deflate.h" /> + <ClInclude Include="..\lib\zlib\gzguts.h" /> + <ClInclude Include="..\lib\zlib\inffast.h" /> + <ClInclude Include="..\lib\zlib\inffixed.h" /> + <ClInclude Include="..\lib\zlib\inflate.h" /> + <ClInclude Include="..\lib\zlib\inftrees.h" /> + <ClInclude Include="..\lib\zlib\trees.h" /> + <ClInclude Include="..\lib\zlib\zconf.h" /> + <ClInclude Include="..\lib\zlib\zlib.h" /> + <ClInclude Include="..\lib\zlib\zutil.h" /> </ItemGroup> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <ImportGroup Label="ExtensionTargets"> diff --git a/VC2013/zlib.vcxproj.filters b/VC2013/zlib.vcxproj.filters index 73223e924..192806a9f 100644 --- a/VC2013/zlib.vcxproj.filters +++ b/VC2013/zlib.vcxproj.filters @@ -7,84 +7,84 @@ </Filter> </ItemGroup> <ItemGroup> - <ClCompile Include="..\zlib-1.2.7\adler32.c"> + <ClCompile Include="..\lib\zlib\adler32.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\compress.c"> + <ClCompile Include="..\lib\zlib\compress.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\crc32.c"> + <ClCompile Include="..\lib\zlib\crc32.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\deflate.c"> + <ClCompile Include="..\lib\zlib\deflate.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\gzclose.c"> + <ClCompile Include="..\lib\zlib\gzclose.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\gzlib.c"> + <ClCompile Include="..\lib\zlib\gzlib.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\gzread.c"> + <ClCompile Include="..\lib\zlib\gzread.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\gzwrite.c"> + <ClCompile Include="..\lib\zlib\gzwrite.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\infback.c"> + <ClCompile Include="..\lib\zlib\infback.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\inffast.c"> + <ClCompile Include="..\lib\zlib\inffast.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\inflate.c"> + <ClCompile Include="..\lib\zlib\inflate.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\inftrees.c"> + <ClCompile Include="..\lib\zlib\inftrees.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\trees.c"> + <ClCompile Include="..\lib\zlib\trees.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\uncompr.c"> + <ClCompile Include="..\lib\zlib\uncompr.c"> <Filter>Source Files</Filter> </ClCompile> - <ClCompile Include="..\zlib-1.2.7\zutil.c"> + <ClCompile Include="..\lib\zlib\zutil.c"> <Filter>Source Files</Filter> </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="..\zlib-1.2.7\crc32.h"> + <ClInclude Include="..\lib\zlib\crc32.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\zlib-1.2.7\deflate.h"> + <ClInclude Include="..\lib\zlib\deflate.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\zlib-1.2.7\gzguts.h"> + <ClInclude Include="..\lib\zlib\gzguts.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\zlib-1.2.7\inffast.h"> + <ClInclude Include="..\lib\zlib\inffast.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\zlib-1.2.7\inffixed.h"> + <ClInclude Include="..\lib\zlib\inffixed.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\zlib-1.2.7\inflate.h"> + <ClInclude Include="..\lib\zlib\inflate.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\zlib-1.2.7\inftrees.h"> + <ClInclude Include="..\lib\zlib\inftrees.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\zlib-1.2.7\trees.h"> + <ClInclude Include="..\lib\zlib\trees.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\zlib-1.2.7\zconf.h"> + <ClInclude Include="..\lib\zlib\zconf.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\zlib-1.2.7\zlib.h"> + <ClInclude Include="..\lib\zlib\zlib.h"> <Filter>Source Files</Filter> </ClInclude> - <ClInclude Include="..\zlib-1.2.7\zutil.h"> + <ClInclude Include="..\lib\zlib\zutil.h"> <Filter>Source Files</Filter> </ClInclude> </ItemGroup> diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp b/jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp deleted file mode 100644 index 7c94e612e..000000000 --- a/jsoncpp-src-0.5.0/src/lib_json/json_reader.cpp +++ /dev/null @@ -1,885 +0,0 @@ -#include <json/reader.h> -#include <json/value.h> -#include <utility> -#include <cstdio> -#include <cassert> -#include <cstring> -#include <iostream> -#include <stdexcept> - -#if _MSC_VER >= 1400 // VC++ 8.0 -#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated. -#endif - -namespace Json { - -// Implementation of class Features -// //////////////////////////////// - -Features::Features() - : allowComments_( true ) - , strictRoot_( false ) -{ -} - - -Features -Features::all() -{ - return Features(); -} - - -Features -Features::strictMode() -{ - Features features; - features.allowComments_ = false; - features.strictRoot_ = true; - return features; -} - -// Implementation of class Reader -// //////////////////////////////// - - -static inline bool -in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4 ) -{ - return c == c1 || c == c2 || c == c3 || c == c4; -} - -static inline bool -in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4, Reader::Char c5 ) -{ - return c == c1 || c == c2 || c == c3 || c == c4 || c == c5; -} - - -static bool -containsNewLine( Reader::Location begin, - Reader::Location end ) -{ - for ( ;begin < end; ++begin ) - if ( *begin == '\n' || *begin == '\r' ) - return true; - return false; -} - -static std::string codePointToUTF8(unsigned int cp) -{ - std::string result; - - // based on description from http://en.wikipedia.org/wiki/UTF-8 - - if (cp <= 0x7f) - { - result.resize(1); - result[0] = static_cast<char>(cp); - } - else if (cp <= 0x7FF) - { - result.resize(2); - result[1] = static_cast<char>(0x80 | (0x3f & cp)); - result[0] = static_cast<char>(0xC0 | (0x1f & (cp >> 6))); - } - else if (cp <= 0xFFFF) - { - result.resize(3); - result[2] = static_cast<char>(0x80 | (0x3f & cp)); - result[1] = 0x80 | static_cast<char>((0x3f & (cp >> 6))); - result[0] = 0xE0 | static_cast<char>((0xf & (cp >> 12))); - } - else if (cp <= 0x10FFFF) - { - result.resize(4); - result[3] = static_cast<char>(0x80 | (0x3f & cp)); - result[2] = static_cast<char>(0x80 | (0x3f & (cp >> 6))); - result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 12))); - result[0] = static_cast<char>(0xF0 | (0x7 & (cp >> 18))); - } - - return result; -} - - -// Class Reader -// ////////////////////////////////////////////////////////////////// - -Reader::Reader() - : features_( Features::all() ) -{ -} - - -Reader::Reader( const Features &features ) - : features_( features ) -{ -} - - -bool -Reader::parse( const std::string &document, - Value &root, - bool collectComments ) -{ - document_ = document; - const char *begin = document_.c_str(); - const char *end = begin + document_.length(); - return parse( begin, end, root, collectComments ); -} - - -bool -Reader::parse( std::istream& sin, - Value &root, - bool collectComments ) -{ - //std::istream_iterator<char> begin(sin); - //std::istream_iterator<char> end; - // Those would allow streamed input from a file, if parse() were a - // template function. - - // Since std::string is reference-counted, this at least does not - // create an extra copy. - std::string doc; - std::getline(sin, doc, (char)EOF); - return parse( doc, root, collectComments ); -} - -bool -Reader::parse( const char *beginDoc, const char *endDoc, - Value &root, - bool collectComments ) -{ - if ( !features_.allowComments_ ) - { - collectComments = false; - } - - begin_ = beginDoc; - end_ = endDoc; - collectComments_ = collectComments; - current_ = begin_; - lastValueEnd_ = 0; - lastValue_ = 0; - commentsBefore_ = ""; - errors_.clear(); - while ( !nodes_.empty() ) - nodes_.pop(); - nodes_.push( &root ); - - bool successful = readValue(); - Token token; - skipCommentTokens( token ); - if ( collectComments_ && !commentsBefore_.empty() ) - root.setComment( commentsBefore_, commentAfter ); - if ( features_.strictRoot_ ) - { - if ( !root.isArray() && !root.isObject() ) - { - // Set error location to start of doc, ideally should be first token found in doc - token.type_ = tokenError; - token.start_ = beginDoc; - token.end_ = endDoc; - addError( "A valid JSON document must be either an array or an object value.", - token ); - return false; - } - } - return successful; -} - - -bool -Reader::readValue() -{ - Token token; - skipCommentTokens( token ); - bool successful = true; - - if ( collectComments_ && !commentsBefore_.empty() ) - { - currentValue().setComment( commentsBefore_, commentBefore ); - commentsBefore_ = ""; - } - - - switch ( token.type_ ) - { - case tokenObjectBegin: - successful = readObject( token ); - break; - case tokenArrayBegin: - successful = readArray( token ); - break; - case tokenNumber: - successful = decodeNumber( token ); - break; - case tokenString: - successful = decodeString( token ); - break; - case tokenTrue: - currentValue() = true; - break; - case tokenFalse: - currentValue() = false; - break; - case tokenNull: - currentValue() = Value(); - break; - default: - return addError( "Syntax error: value, object or array expected.", token ); - } - - if ( collectComments_ ) - { - lastValueEnd_ = current_; - lastValue_ = ¤tValue(); - } - - return successful; -} - - -void -Reader::skipCommentTokens( Token &token ) -{ - if ( features_.allowComments_ ) - { - do - { - readToken( token ); - } - while ( token.type_ == tokenComment ); - } - else - { - readToken( token ); - } -} - - -bool -Reader::expectToken( TokenType type, Token &token, const char *message ) -{ - readToken( token ); - if ( token.type_ != type ) - return addError( message, token ); - return true; -} - - -bool -Reader::readToken( Token &token ) -{ - skipSpaces(); - token.start_ = current_; - Char c = getNextChar(); - bool ok = true; - switch ( c ) - { - case '{': - token.type_ = tokenObjectBegin; - break; - case '}': - token.type_ = tokenObjectEnd; - break; - case '[': - token.type_ = tokenArrayBegin; - break; - case ']': - token.type_ = tokenArrayEnd; - break; - case '"': - token.type_ = tokenString; - ok = readString(); - break; - case '/': - token.type_ = tokenComment; - ok = readComment(); - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - case '-': - token.type_ = tokenNumber; - readNumber(); - break; - case 't': - token.type_ = tokenTrue; - ok = match( "rue", 3 ); - break; - case 'f': - token.type_ = tokenFalse; - ok = match( "alse", 4 ); - break; - case 'n': - token.type_ = tokenNull; - ok = match( "ull", 3 ); - break; - case ',': - token.type_ = tokenArraySeparator; - break; - case ':': - token.type_ = tokenMemberSeparator; - break; - case 0: - token.type_ = tokenEndOfStream; - break; - default: - ok = false; - break; - } - if ( !ok ) - token.type_ = tokenError; - token.end_ = current_; - return true; -} - - -void -Reader::skipSpaces() -{ - while ( current_ != end_ ) - { - Char c = *current_; - if ( c == ' ' || c == '\t' || c == '\r' || c == '\n' ) - ++current_; - else - break; - } -} - - -bool -Reader::match( Location pattern, - int patternLength ) -{ - if ( end_ - current_ < patternLength ) - return false; - int index = patternLength; - while ( index-- ) - if ( current_[index] != pattern[index] ) - return false; - current_ += patternLength; - return true; -} - - -bool -Reader::readComment() -{ - Location commentBegin = current_ - 1; - Char c = getNextChar(); - bool successful = false; - if ( c == '*' ) - successful = readCStyleComment(); - else if ( c == '/' ) - successful = readCppStyleComment(); - if ( !successful ) - return false; - - if ( collectComments_ ) - { - CommentPlacement placement = commentBefore; - if ( lastValueEnd_ && !containsNewLine( lastValueEnd_, commentBegin ) ) - { - if ( c != '*' || !containsNewLine( commentBegin, current_ ) ) - placement = commentAfterOnSameLine; - } - - addComment( commentBegin, current_, placement ); - } - return true; -} - - -void -Reader::addComment( Location begin, - Location end, - CommentPlacement placement ) -{ - assert( collectComments_ ); - if ( placement == commentAfterOnSameLine ) - { - assert( lastValue_ != 0 ); - lastValue_->setComment( std::string( begin, end ), placement ); - } - else - { - if ( !commentsBefore_.empty() ) - commentsBefore_ += "\n"; - commentsBefore_ += std::string( begin, end ); - } -} - - -bool -Reader::readCStyleComment() -{ - while ( current_ != end_ ) - { - Char c = getNextChar(); - if ( c == '*' && *current_ == '/' ) - break; - } - return getNextChar() == '/'; -} - - -bool -Reader::readCppStyleComment() -{ - while ( current_ != end_ ) - { - Char c = getNextChar(); - if ( c == '\r' || c == '\n' ) - break; - } - return true; -} - - -void -Reader::readNumber() -{ - while ( current_ != end_ ) - { - if ( !(*current_ >= '0' && *current_ <= '9') && - !in( *current_, '.', 'e', 'E', '+', '-' ) ) - break; - ++current_; - } -} - -bool -Reader::readString() -{ - Char c = 0; - while ( current_ != end_ ) - { - c = getNextChar(); - if ( c == '\\' ) - getNextChar(); - else if ( c == '"' ) - break; - } - return c == '"'; -} - - -bool -Reader::readObject( Token &tokenStart ) -{ - Token tokenName; - std::string name; - currentValue() = Value( objectValue ); - while ( readToken( tokenName ) ) - { - bool initialTokenOk = true; - while ( tokenName.type_ == tokenComment && initialTokenOk ) - initialTokenOk = readToken( tokenName ); - if ( !initialTokenOk ) - break; - if ( tokenName.type_ == tokenObjectEnd && name.empty() ) // empty object - return true; - if ( tokenName.type_ != tokenString ) - break; - - name = ""; - if ( !decodeString( tokenName, name ) ) - return recoverFromError( tokenObjectEnd ); - - Token colon; - if ( !readToken( colon ) || colon.type_ != tokenMemberSeparator ) - { - return addErrorAndRecover( "Missing ':' after object member name", - colon, - tokenObjectEnd ); - } - Value &value = currentValue()[ name ]; - nodes_.push( &value ); - bool ok = readValue(); - nodes_.pop(); - if ( !ok ) // error already set - return recoverFromError( tokenObjectEnd ); - - Token comma; - if ( !readToken( comma ) - || ( comma.type_ != tokenObjectEnd && - comma.type_ != tokenArraySeparator && - comma.type_ != tokenComment ) ) - { - return addErrorAndRecover( "Missing ',' or '}' in object declaration", - comma, - tokenObjectEnd ); - } - bool finalizeTokenOk = true; - while ( comma.type_ == tokenComment && - finalizeTokenOk ) - finalizeTokenOk = readToken( comma ); - if ( comma.type_ == tokenObjectEnd ) - return true; - } - return addErrorAndRecover( "Missing '}' or object member name", - tokenName, - tokenObjectEnd ); -} - - -bool -Reader::readArray( Token &tokenStart ) -{ - currentValue() = Value( arrayValue ); - skipSpaces(); - if ( *current_ == ']' ) // empty array - { - Token endArray; - readToken( endArray ); - return true; - } - int index = 0; - while ( true ) - { - Value &value = currentValue()[ index++ ]; - nodes_.push( &value ); - bool ok = readValue(); - nodes_.pop(); - if ( !ok ) // error already set - return recoverFromError( tokenArrayEnd ); - - Token token; - // Accept Comment after last item in the array. - ok = readToken( token ); - while ( token.type_ == tokenComment && ok ) - { - ok = readToken( token ); - } - bool badTokenType = ( token.type_ == tokenArraySeparator && - token.type_ == tokenArrayEnd ); - if ( !ok || badTokenType ) - { - return addErrorAndRecover( "Missing ',' or ']' in array declaration", - token, - tokenArrayEnd ); - } - if ( token.type_ == tokenArrayEnd ) - break; - } - return true; -} - - -bool -Reader::decodeNumber( Token &token ) -{ - bool isDouble = false; - for ( Location inspect = token.start_; inspect != token.end_; ++inspect ) - { - isDouble = isDouble - || in( *inspect, '.', 'e', 'E', '+' ) - || ( *inspect == '-' && inspect != token.start_ ); - } - if ( isDouble ) - return decodeDouble( token ); - Location current = token.start_; - bool isNegative = *current == '-'; - if ( isNegative ) - ++current; - Value::UInt threshold = (isNegative ? Value::UInt(-Value::minInt) - : Value::maxUInt) / 10; - Value::UInt value = 0; - while ( current < token.end_ ) - { - Char c = *current++; - if ( c < '0' || c > '9' ) - return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token ); - if ( value >= threshold ) - return decodeDouble( token ); - value = value * 10 + Value::UInt(c - '0'); - } - if ( isNegative ) - currentValue() = -Value::Int( value ); - else if ( value <= Value::UInt(Value::maxInt) ) - currentValue() = Value::Int( value ); - else - currentValue() = value; - return true; -} - - -bool -Reader::decodeDouble( Token &token ) -{ - double value = 0; - const int bufferSize = 32; - int count; - int length = int(token.end_ - token.start_); - if ( length <= bufferSize ) - { - Char buffer[bufferSize]; - memcpy( buffer, token.start_, length ); - buffer[length] = 0; - count = sscanf( buffer, "%lf", &value ); - } - else - { - std::string buffer( token.start_, token.end_ ); - count = sscanf( buffer.c_str(), "%lf", &value ); - } - - if ( count != 1 ) - return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token ); - currentValue() = value; - return true; -} - - -bool -Reader::decodeString( Token &token ) -{ - std::string decoded; - if ( !decodeString( token, decoded ) ) - return false; - currentValue() = decoded; - return true; -} - - -bool -Reader::decodeString( Token &token, std::string &decoded ) -{ - decoded.reserve( token.end_ - token.start_ - 2 ); - Location current = token.start_ + 1; // skip '"' - Location end = token.end_ - 1; // do not include '"' - while ( current != end ) - { - Char c = *current++; - if ( c == '"' ) - break; - else if ( c == '\\' ) - { - if ( current == end ) - return addError( "Empty escape sequence in string", token, current ); - Char escape = *current++; - switch ( escape ) - { - case '"': decoded += '"'; break; - case '/': decoded += '/'; break; - case '\\': decoded += '\\'; break; - case 'b': decoded += '\b'; break; - case 'f': decoded += '\f'; break; - case 'n': decoded += '\n'; break; - case 'r': decoded += '\r'; break; - case 't': decoded += '\t'; break; - case 'u': - { - unsigned int unicode; - if ( !decodeUnicodeCodePoint( token, current, end, unicode ) ) - return false; - decoded += codePointToUTF8(unicode); - } - break; - default: - return addError( "Bad escape sequence in string", token, current ); - } - } - else - { - decoded += c; - } - } - return true; -} - -bool -Reader::decodeUnicodeCodePoint( Token &token, - Location ¤t, - Location end, - unsigned int &unicode ) -{ - - if ( !decodeUnicodeEscapeSequence( token, current, end, unicode ) ) - return false; - if (unicode >= 0xD800 && unicode <= 0xDBFF) - { - // surrogate pairs - if (end - current < 6) - return addError( "additional six characters expected to parse unicode surrogate pair.", token, current ); - unsigned int surrogatePair; - if (*(current++) == '\\' && *(current++)== 'u') - { - if (decodeUnicodeEscapeSequence( token, current, end, surrogatePair )) - { - unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF); - } - else - return false; - } - else - return addError( "expecting another \\u token to begin the second half of a unicode surrogate pair", token, current ); - } - return true; -} - -bool -Reader::decodeUnicodeEscapeSequence( Token &token, - Location ¤t, - Location end, - unsigned int &unicode ) -{ - if ( end - current < 4 ) - return addError( "Bad unicode escape sequence in string: four digits expected.", token, current ); - unicode = 0; - for ( int index =0; index < 4; ++index ) - { - Char c = *current++; - unicode *= 16; - if ( c >= '0' && c <= '9' ) - unicode += c - '0'; - else if ( c >= 'a' && c <= 'f' ) - unicode += c - 'a' + 10; - else if ( c >= 'A' && c <= 'F' ) - unicode += c - 'A' + 10; - else - return addError( "Bad unicode escape sequence in string: hexadecimal digit expected.", token, current ); - } - return true; -} - - -bool -Reader::addError( const std::string &message, - Token &token, - Location extra ) -{ - ErrorInfo info; - info.token_ = token; - info.message_ = message; - info.extra_ = extra; - errors_.push_back( info ); - return false; -} - - -bool -Reader::recoverFromError( TokenType skipUntilToken ) -{ - int errorCount = int(errors_.size()); - Token skip; - while ( true ) - { - if ( !readToken(skip) ) - errors_.resize( errorCount ); // discard errors caused by recovery - if ( skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream ) - break; - } - errors_.resize( errorCount ); - return false; -} - - -bool -Reader::addErrorAndRecover( const std::string &message, - Token &token, - TokenType skipUntilToken ) -{ - addError( message, token ); - return recoverFromError( skipUntilToken ); -} - - -Value & -Reader::currentValue() -{ - return *(nodes_.top()); -} - - -Reader::Char -Reader::getNextChar() -{ - if ( current_ == end_ ) - return 0; - return *current_++; -} - - -void -Reader::getLocationLineAndColumn( Location location, - int &line, - int &column ) const -{ - Location current = begin_; - Location lastLineStart = current; - line = 0; - while ( current < location && current != end_ ) - { - Char c = *current++; - if ( c == '\r' ) - { - if ( *current == '\n' ) - ++current; - lastLineStart = current; - ++line; - } - else if ( c == '\n' ) - { - lastLineStart = current; - ++line; - } - } - // column & line start at 1 - column = int(location - lastLineStart) + 1; - ++line; -} - - -std::string -Reader::getLocationLineAndColumn( Location location ) const -{ - int line, column; - getLocationLineAndColumn( location, line, column ); - char buffer[18+16+16+1]; - sprintf( buffer, "Line %d, Column %d", line, column ); - return buffer; -} - - -std::string -Reader::getFormatedErrorMessages() const -{ - std::string formattedMessage; - for ( Errors::const_iterator itError = errors_.begin(); - itError != errors_.end(); - ++itError ) - { - const ErrorInfo &error = *itError; - formattedMessage += "* " + getLocationLineAndColumn( error.token_.start_ ) + "\n"; - formattedMessage += " " + error.message_ + "\n"; - if ( error.extra_ ) - formattedMessage += "See " + getLocationLineAndColumn( error.extra_ ) + " for detail.\n"; - } - return formattedMessage; -} - -#define JSON_ASSERT( condition ) assert( condition ); -std::istream& operator>>( std::istream &sin, Value &root ) -{ - Json::Reader reader; - bool ok = reader.parse(sin, root, true); - JSON_ASSERT( ok ); - //if (!ok) throw std::runtime_error(reader.getFormatedErrorMessages()); - return sin; -} - - -} // namespace Json diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_value.cpp b/jsoncpp-src-0.5.0/src/lib_json/json_value.cpp deleted file mode 100644 index 89271cd00..000000000 --- a/jsoncpp-src-0.5.0/src/lib_json/json_value.cpp +++ /dev/null @@ -1,1727 +0,0 @@ -#include <iostream> -#include <json/value.h> -#include <json/writer.h> -#include <utility> -#include <stdexcept> -#include <cstring> -#include <cassert> -#ifdef JSON_USE_CPPTL -# include <cpptl/conststring.h> -#endif -#include <cstddef> // size_t -#ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR -# include "json_batchallocator.h" -#endif // #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR - -#define JSON_ASSERT_UNREACHABLE assert( false ) -#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw -#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) throw std::runtime_error( message ); - -namespace Json { - -const Value Value::null; -const Int Value::minInt = Int( ~(UInt(-1)/2) ); -const Int Value::maxInt = Int( UInt(-1)/2 ); -const UInt Value::maxUInt = UInt(-1); - -// A "safe" implementation of strdup. Allow null pointer to be passed. -// Also avoid warning on msvc80. -// -//inline char *safeStringDup( const char *czstring ) -//{ -// if ( czstring ) -// { -// const size_t length = (unsigned int)( strlen(czstring) + 1 ); -// char *newString = static_cast<char *>( malloc( length ) ); -// memcpy( newString, czstring, length ); -// return newString; -// } -// return 0; -//} -// -//inline char *safeStringDup( const std::string &str ) -//{ -// if ( !str.empty() ) -// { -// const size_t length = str.length(); -// char *newString = static_cast<char *>( malloc( length + 1 ) ); -// memcpy( newString, str.c_str(), length ); -// newString[length] = 0; -// return newString; -// } -// return 0; -//} - -ValueAllocator::~ValueAllocator() -{ -} - -class DefaultValueAllocator : public ValueAllocator -{ -public: - virtual ~DefaultValueAllocator() - { - } - - virtual char *makeMemberName( const char *memberName ) - { - return duplicateStringValue( memberName ); - } - - virtual void releaseMemberName( char *memberName ) - { - releaseStringValue( memberName ); - } - - virtual char *duplicateStringValue( const char *value, - unsigned int length = unknown ) - { - //@todo invesgate this old optimization - //if ( !value || value[0] == 0 ) - // return 0; - - if ( length == unknown ) - length = (unsigned int)strlen(value); - char *newString = static_cast<char *>( malloc( length + 1 ) ); - memcpy( newString, value, length ); - newString[length] = 0; - return newString; - } - - virtual void releaseStringValue( char *value ) - { - if ( value ) - free( value ); - } -}; - -static ValueAllocator *&valueAllocator() -{ - static DefaultValueAllocator defaultAllocator; - static ValueAllocator *valueAllocator = &defaultAllocator; - return valueAllocator; -} - -static struct DummyValueAllocatorInitializer { - DummyValueAllocatorInitializer() - { - valueAllocator(); // ensure valueAllocator() statics are initialized before main(). - } -} dummyValueAllocatorInitializer; - - - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ValueInternals... -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -#ifdef JSON_VALUE_USE_INTERNAL_MAP -# include "json_internalarray.inl" -# include "json_internalmap.inl" -#endif // JSON_VALUE_USE_INTERNAL_MAP - -# include "json_valueiterator.inl" - - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class Value::CommentInfo -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - - -Value::CommentInfo::CommentInfo() - : comment_( 0 ) -{ -} - -Value::CommentInfo::~CommentInfo() -{ - if ( comment_ ) - valueAllocator()->releaseStringValue( comment_ ); -} - - -void -Value::CommentInfo::setComment( const char *text ) -{ - if ( comment_ ) - valueAllocator()->releaseStringValue( comment_ ); - JSON_ASSERT( text ); - //JSON_ASSERT_MESSAGE( text[0]=='\0' || text[0]=='/', "Comments must start with /"); - JSON_ASSERT( text[0]=='\0' || text[0]=='/' ); - // It seems that /**/ style comments are acceptable as well. - comment_ = valueAllocator()->duplicateStringValue( text ); -} - - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class Value::CZString -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -# ifndef JSON_VALUE_USE_INTERNAL_MAP - -// Notes: index_ indicates if the string was allocated when -// a string is stored. - -Value::CZString::CZString( int index ) - : cstr_( 0 ) - , index_( index ) -{ -} - -Value::CZString::CZString( const char *cstr, DuplicationPolicy allocate ) - : cstr_( allocate == duplicate ? valueAllocator()->makeMemberName(cstr) - : cstr ) - , index_( allocate ) -{ -} - -Value::CZString::CZString( const CZString &other ) -: cstr_( other.index_ != noDuplication && other.cstr_ != 0 - ? valueAllocator()->makeMemberName( other.cstr_ ) - : other.cstr_ ) - , index_( other.cstr_ ? (other.index_ == noDuplication ? noDuplication : duplicate) - : other.index_ ) -{ -} - -Value::CZString::~CZString() -{ - if ( cstr_ && index_ == duplicate ) - valueAllocator()->releaseMemberName( const_cast<char *>( cstr_ ) ); -} - -void -Value::CZString::swap( CZString &other ) -{ - std::swap( cstr_, other.cstr_ ); - std::swap( index_, other.index_ ); -} - -Value::CZString & -Value::CZString::operator =( const CZString &other ) -{ - CZString temp( other ); - swap( temp ); - return *this; -} - -bool -Value::CZString::operator<( const CZString &other ) const -{ - if ( cstr_ ) - return strcmp( cstr_, other.cstr_ ) < 0; - return index_ < other.index_; -} - -bool -Value::CZString::operator==( const CZString &other ) const -{ - if ( cstr_ ) - return strcmp( cstr_, other.cstr_ ) == 0; - return index_ == other.index_; -} - - -int -Value::CZString::index() const -{ - return index_; -} - - -const char * -Value::CZString::c_str() const -{ - return cstr_; -} - -bool -Value::CZString::isStaticString() const -{ - return index_ == noDuplication; -} - -#endif // ifndef JSON_VALUE_USE_INTERNAL_MAP - - -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// class Value::Value -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// -// ////////////////////////////////////////////////////////////////// - -/*! \internal Default constructor initialization must be equivalent to: - * memset( this, 0, sizeof(Value) ) - * This optimization is used in ValueInternalMap fast allocator. - */ -Value::Value( ValueType type ) - : type_( type ) - , allocated_( 0 ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - switch ( type ) - { - case nullValue: - break; - case intValue: - case uintValue: - value_.int_ = 0; - break; - case realValue: - value_.real_ = 0.0; - break; - case stringValue: - value_.string_ = 0; - break; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - case objectValue: - value_.map_ = new ObjectValues(); - break; -#else - case arrayValue: - value_.array_ = arrayAllocator()->newArray(); - break; - case objectValue: - value_.map_ = mapAllocator()->newMap(); - break; -#endif - case booleanValue: - value_.bool_ = false; - break; - default: - JSON_ASSERT_UNREACHABLE; - } -} - - -Value::Value( Int value ) - : type_( intValue ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.int_ = value; -} - - -Value::Value( UInt value ) - : type_( uintValue ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.uint_ = value; -} - -Value::Value( double value ) - : type_( realValue ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.real_ = value; -} - -Value::Value( const char *value ) - : type_( stringValue ) - , allocated_( true ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.string_ = valueAllocator()->duplicateStringValue( value ); -} - - -Value::Value( const char *beginValue, - const char *endValue ) - : type_( stringValue ) - , allocated_( true ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.string_ = valueAllocator()->duplicateStringValue( beginValue, - UInt(endValue - beginValue) ); -} - - -Value::Value( const std::string &value ) - : type_( stringValue ) - , allocated_( true ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.string_ = valueAllocator()->duplicateStringValue( value.c_str(), - (unsigned int)value.length() ); - -} - -Value::Value( const StaticString &value ) - : type_( stringValue ) - , allocated_( false ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.string_ = const_cast<char *>( value.c_str() ); -} - - -# ifdef JSON_USE_CPPTL -Value::Value( const CppTL::ConstString &value ) - : type_( stringValue ) - , allocated_( true ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.string_ = valueAllocator()->duplicateStringValue( value, value.length() ); -} -# endif - -Value::Value( bool value ) - : type_( booleanValue ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - value_.bool_ = value; -} - - -Value::Value( const Value &other ) - : type_( other.type_ ) - , comments_( 0 ) -# ifdef JSON_VALUE_USE_INTERNAL_MAP - , itemIsUsed_( 0 ) -#endif -{ - switch ( type_ ) - { - case nullValue: - case intValue: - case uintValue: - case realValue: - case booleanValue: - value_ = other.value_; - break; - case stringValue: - if ( other.value_.string_ ) - { - value_.string_ = valueAllocator()->duplicateStringValue( other.value_.string_ ); - allocated_ = true; - } - else - value_.string_ = 0; - break; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - case objectValue: - value_.map_ = new ObjectValues( *other.value_.map_ ); - break; -#else - case arrayValue: - value_.array_ = arrayAllocator()->newArrayCopy( *other.value_.array_ ); - break; - case objectValue: - value_.map_ = mapAllocator()->newMapCopy( *other.value_.map_ ); - break; -#endif - default: - JSON_ASSERT_UNREACHABLE; - } - if ( other.comments_ ) - { - comments_ = new CommentInfo[numberOfCommentPlacement]; - for ( int comment =0; comment < numberOfCommentPlacement; ++comment ) - { - const CommentInfo &otherComment = other.comments_[comment]; - if ( otherComment.comment_ ) - comments_[comment].setComment( otherComment.comment_ ); - } - } -} - - -Value::~Value() -{ - switch ( type_ ) - { - case nullValue: - case intValue: - case uintValue: - case realValue: - case booleanValue: - break; - case stringValue: - if ( allocated_ ) - valueAllocator()->releaseStringValue( value_.string_ ); - break; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - case objectValue: - delete value_.map_; - break; -#else - case arrayValue: - arrayAllocator()->destructArray( value_.array_ ); - break; - case objectValue: - mapAllocator()->destructMap( value_.map_ ); - break; -#endif - default: - JSON_ASSERT_UNREACHABLE; - } - - if ( comments_ ) - delete[] comments_; -} - -Value & -Value::operator=( const Value &other ) -{ - Value temp( other ); - swap( temp ); - return *this; -} - -void -Value::swap( Value &other ) -{ - ValueType temp = type_; - type_ = other.type_; - other.type_ = temp; - std::swap( value_, other.value_ ); - int temp2 = allocated_; - allocated_ = other.allocated_; - other.allocated_ = temp2; -} - -ValueType -Value::type() const -{ - return type_; -} - - -int -Value::compare( const Value &other ) -{ - /* - int typeDelta = other.type_ - type_; - switch ( type_ ) - { - case nullValue: - - return other.type_ == type_; - case intValue: - if ( other.type_.isNumeric() - case uintValue: - case realValue: - case booleanValue: - break; - case stringValue, - break; - case arrayValue: - delete value_.array_; - break; - case objectValue: - delete value_.map_; - default: - JSON_ASSERT_UNREACHABLE; - } - */ - return 0; // unreachable -} - -bool -Value::operator <( const Value &other ) const -{ - int typeDelta = type_ - other.type_; - if ( typeDelta ) - return typeDelta < 0 ? true : false; - switch ( type_ ) - { - case nullValue: - return false; - case intValue: - return value_.int_ < other.value_.int_; - case uintValue: - return value_.uint_ < other.value_.uint_; - case realValue: - return value_.real_ < other.value_.real_; - case booleanValue: - return value_.bool_ < other.value_.bool_; - case stringValue: - return ( value_.string_ == 0 && other.value_.string_ ) - || ( other.value_.string_ - && value_.string_ - && strcmp( value_.string_, other.value_.string_ ) < 0 ); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - case objectValue: - { - int delta = int( value_.map_->size() - other.value_.map_->size() ); - if ( delta ) - return delta < 0; - return (*value_.map_) < (*other.value_.map_); - } -#else - case arrayValue: - return value_.array_->compare( *(other.value_.array_) ) < 0; - case objectValue: - return value_.map_->compare( *(other.value_.map_) ) < 0; -#endif - default: - JSON_ASSERT_UNREACHABLE; - } - return 0; // unreachable -} - -bool -Value::operator <=( const Value &other ) const -{ - return !(other > *this); -} - -bool -Value::operator >=( const Value &other ) const -{ - return !(*this < other); -} - -bool -Value::operator >( const Value &other ) const -{ - return other < *this; -} - -bool -Value::operator ==( const Value &other ) const -{ - //if ( type_ != other.type_ ) - // GCC 2.95.3 says: - // attempt to take address of bit-field structure member `Json::Value::type_' - // Beats me, but a temp solves the problem. - int temp = other.type_; - if ( type_ != temp ) - return false; - switch ( type_ ) - { - case nullValue: - return true; - case intValue: - return value_.int_ == other.value_.int_; - case uintValue: - return value_.uint_ == other.value_.uint_; - case realValue: - return value_.real_ == other.value_.real_; - case booleanValue: - return value_.bool_ == other.value_.bool_; - case stringValue: - return ( value_.string_ == other.value_.string_ ) - || ( other.value_.string_ - && value_.string_ - && strcmp( value_.string_, other.value_.string_ ) == 0 ); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - case objectValue: - return value_.map_->size() == other.value_.map_->size() - && (*value_.map_) == (*other.value_.map_); -#else - case arrayValue: - return value_.array_->compare( *(other.value_.array_) ) == 0; - case objectValue: - return value_.map_->compare( *(other.value_.map_) ) == 0; -#endif - default: - JSON_ASSERT_UNREACHABLE; - } - return 0; // unreachable -} - -bool -Value::operator !=( const Value &other ) const -{ - return !( *this == other ); -} - -const char * -Value::asCString() const -{ - JSON_ASSERT( type_ == stringValue ); - return value_.string_; -} - - -std::string -Value::asString() const -{ - switch ( type_ ) - { - case nullValue: - return ""; - case stringValue: - return value_.string_ ? value_.string_ : ""; - case booleanValue: - return value_.bool_ ? "true" : "false"; - case intValue: - case uintValue: - case realValue: - case arrayValue: - case objectValue: - //JSON_ASSERT_MESSAGE( false, "Type is not convertible to string" ); - JSON_ASSERT( false ); - default: - JSON_ASSERT_UNREACHABLE; - } - return ""; // unreachable -} - -# ifdef JSON_USE_CPPTL -CppTL::ConstString -Value::asConstString() const -{ - return CppTL::ConstString( asString().c_str() ); -} -# endif - -Value::Int -Value::asInt() const -{ - switch ( type_ ) - { - case nullValue: - return 0; - case intValue: - return value_.int_; - case uintValue: - //JSON_ASSERT_MESSAGE( value_.uint_ < (unsigned)maxInt, "integer out of signed integer range" ); - JSON_ASSERT( value_.uint_ < (unsigned)maxInt ); - return value_.uint_; - case realValue: - //JSON_ASSERT_MESSAGE( value_.real_ >= minInt && value_.real_ <= maxInt, "Real out of signed integer range" ); - JSON_ASSERT( value_.real_ >= minInt && value_.real_ <= maxInt ); - return Int( value_.real_ ); - case booleanValue: - return value_.bool_ ? 1 : 0; - case stringValue: - case arrayValue: - case objectValue: - //JSON_ASSERT_MESSAGE( false, "Type is not convertible to int" ); - JSON_ASSERT( false ); - default: - JSON_ASSERT_UNREACHABLE; - } - return 0; // unreachable; -} - -Value::UInt -Value::asUInt() const -{ - switch ( type_ ) - { - case nullValue: - return 0; - case intValue: - //JSON_ASSERT_MESSAGE( value_.int_ >= 0, "Negative integer can not be converted to unsigned integer" ); - JSON_ASSERT( value_.int_ >= 0 ); - return value_.int_; - case uintValue: - return value_.uint_; - case realValue: - //JSON_ASSERT_MESSAGE( value_.real_ >= 0 && value_.real_ <= maxUInt, "Real out of unsigned integer range" ); - JSON_ASSERT( value_.real_ >= 0 && value_.real_ <= maxUInt ); - return UInt( value_.real_ ); - case booleanValue: - return value_.bool_ ? 1 : 0; - case stringValue: - case arrayValue: - case objectValue: - //JSON_ASSERT_MESSAGE( false, "Type is not convertible to uint" ); - JSON_ASSERT( false ); - default: - JSON_ASSERT_UNREACHABLE; - } - return 0; // unreachable; -} - -double -Value::asDouble() const -{ - switch ( type_ ) - { - case nullValue: - return 0.0; - case intValue: - return value_.int_; - case uintValue: - return value_.uint_; - case realValue: - return value_.real_; - case booleanValue: - return value_.bool_ ? 1.0 : 0.0; - case stringValue: - case arrayValue: - case objectValue: - //JSON_ASSERT_MESSAGE( false, "Type is not convertible to double" ); - JSON_ASSERT( false ); - default: - JSON_ASSERT_UNREACHABLE; - } - return 0; // unreachable; -} - -bool -Value::asBool() const -{ - switch ( type_ ) - { - case nullValue: - return false; - case intValue: - case uintValue: - return value_.int_ != 0; - case realValue: - return value_.real_ != 0.0; - case booleanValue: - return value_.bool_; - case stringValue: - return value_.string_ && value_.string_[0] != 0; - case arrayValue: - case objectValue: - return value_.map_->size() != 0; - default: - JSON_ASSERT_UNREACHABLE; - } - return false; // unreachable; -} - - -bool -Value::isConvertibleTo( ValueType other ) const -{ - switch ( type_ ) - { - case nullValue: - return true; - case intValue: - return ( other == nullValue && value_.int_ == 0 ) - || other == intValue - || ( other == uintValue && value_.int_ >= 0 ) - || other == realValue - || other == stringValue - || other == booleanValue; - case uintValue: - return ( other == nullValue && value_.uint_ == 0 ) - || ( other == intValue && value_.uint_ <= (unsigned)maxInt ) - || other == uintValue - || other == realValue - || other == stringValue - || other == booleanValue; - case realValue: - return ( other == nullValue && value_.real_ == 0.0 ) - || ( other == intValue && value_.real_ >= minInt && value_.real_ <= maxInt ) - || ( other == uintValue && value_.real_ >= 0 && value_.real_ <= maxUInt ) - || other == realValue - || other == stringValue - || other == booleanValue; - case booleanValue: - return ( other == nullValue && value_.bool_ == false ) - || other == intValue - || other == uintValue - || other == realValue - || other == stringValue - || other == booleanValue; - case stringValue: - return other == stringValue - || ( other == nullValue && (!value_.string_ || value_.string_[0] == 0) ); - case arrayValue: - return other == arrayValue - || ( other == nullValue && value_.map_->size() == 0 ); - case objectValue: - return other == objectValue - || ( other == nullValue && value_.map_->size() == 0 ); - default: - JSON_ASSERT_UNREACHABLE; - } - return false; // unreachable; -} - - -/// Number of values in array or object -Value::UInt -Value::size() const -{ - switch ( type_ ) - { - case nullValue: - case intValue: - case uintValue: - case realValue: - case booleanValue: - case stringValue: - return 0; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: // size of the array is highest index + 1 - if ( !value_.map_->empty() ) - { - ObjectValues::const_iterator itLast = value_.map_->end(); - --itLast; - return (*itLast).first.index()+1; - } - return 0; - case objectValue: - return Int( value_.map_->size() ); -#else - case arrayValue: - return Int( value_.array_->size() ); - case objectValue: - return Int( value_.map_->size() ); -#endif - default: - JSON_ASSERT_UNREACHABLE; - } - return 0; // unreachable; -} - - -bool -Value::empty() const -{ - if ( isNull() || isArray() || isObject() ) - return size() == 0u; - else - return false; -} - - -bool -Value::operator!() const -{ - return isNull(); -} - - -void -Value::clear() -{ - JSON_ASSERT( type_ == nullValue || type_ == arrayValue || type_ == objectValue ); - - switch ( type_ ) - { -#ifndef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - case objectValue: - value_.map_->clear(); - break; -#else - case arrayValue: - value_.array_->clear(); - break; - case objectValue: - value_.map_->clear(); - break; -#endif - default: - break; - } -} - -void -Value::resize( UInt newSize ) -{ - JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); - if ( type_ == nullValue ) - *this = Value( arrayValue ); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - UInt oldSize = size(); - if ( newSize == 0 ) - clear(); - else if ( newSize > oldSize ) - (*this)[ newSize - 1 ]; - else - { - for ( UInt index = newSize; index < oldSize; ++index ) - value_.map_->erase( index ); - assert( size() == newSize ); - } -#else - value_.array_->resize( newSize ); -#endif -} - - -Value & -Value::operator[]( UInt index ) -{ - JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); - if ( type_ == nullValue ) - *this = Value( arrayValue ); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - CZString key( index ); - ObjectValues::iterator it = value_.map_->lower_bound( key ); - if ( it != value_.map_->end() && (*it).first == key ) - return (*it).second; - - ObjectValues::value_type defaultValue( key, null ); - it = value_.map_->insert( it, defaultValue ); - return (*it).second; -#else - return value_.array_->resolveReference( index ); -#endif -} - - -const Value & -Value::operator[]( UInt index ) const -{ - JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); - if ( type_ == nullValue ) - return null; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - CZString key( index ); - ObjectValues::const_iterator it = value_.map_->find( key ); - if ( it == value_.map_->end() ) - return null; - return (*it).second; -#else - Value *value = value_.array_->find( index ); - return value ? *value : null; -#endif -} - - -Value & -Value::operator[]( const char *key ) -{ - return resolveReference( key, false ); -} - - -Value & -Value::resolveReference( const char *key, - bool isStatic ) -{ - JSON_ASSERT( type_ == nullValue || type_ == objectValue ); - if ( type_ == nullValue ) - *this = Value( objectValue ); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - CZString actualKey( key, isStatic ? CZString::noDuplication - : CZString::duplicateOnCopy ); - ObjectValues::iterator it = value_.map_->lower_bound( actualKey ); - if ( it != value_.map_->end() && (*it).first == actualKey ) - return (*it).second; - - ObjectValues::value_type defaultValue( actualKey, null ); - it = value_.map_->insert( it, defaultValue ); - Value &value = (*it).second; - return value; -#else - return value_.map_->resolveReference( key, isStatic ); -#endif -} - - -Value -Value::get( UInt index, - const Value &defaultValue ) const -{ - const Value *value = &((*this)[index]); - return value == &null ? defaultValue : *value; -} - - -bool -Value::isValidIndex( UInt index ) const -{ - return index < size(); -} - - - -const Value & -Value::operator[]( const char *key ) const -{ - JSON_ASSERT( type_ == nullValue || type_ == objectValue ); - if ( type_ == nullValue ) - return null; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - CZString actualKey( key, CZString::noDuplication ); - ObjectValues::const_iterator it = value_.map_->find( actualKey ); - if ( it == value_.map_->end() ) - return null; - return (*it).second; -#else - const Value *value = value_.map_->find( key ); - return value ? *value : null; -#endif -} - - -Value & -Value::operator[]( const std::string &key ) -{ - return (*this)[ key.c_str() ]; -} - - -const Value & -Value::operator[]( const std::string &key ) const -{ - return (*this)[ key.c_str() ]; -} - -Value & -Value::operator[]( const StaticString &key ) -{ - return resolveReference( key, true ); -} - - -# ifdef JSON_USE_CPPTL -Value & -Value::operator[]( const CppTL::ConstString &key ) -{ - return (*this)[ key.c_str() ]; -} - - -const Value & -Value::operator[]( const CppTL::ConstString &key ) const -{ - return (*this)[ key.c_str() ]; -} -# endif - - -Value & -Value::append( const Value &value ) -{ - return (*this)[size()] = value; -} - - -Value -Value::get( const char *key, - const Value &defaultValue ) const -{ - const Value *value = &((*this)[key]); - return value == &null ? defaultValue : *value; -} - - -Value -Value::get( const std::string &key, - const Value &defaultValue ) const -{ - return get( key.c_str(), defaultValue ); -} - -Value -Value::removeMember( const char* key ) -{ - JSON_ASSERT( type_ == nullValue || type_ == objectValue ); - if ( type_ == nullValue ) - return null; -#ifndef JSON_VALUE_USE_INTERNAL_MAP - CZString actualKey( key, CZString::noDuplication ); - ObjectValues::iterator it = value_.map_->find( actualKey ); - if ( it == value_.map_->end() ) - return null; - Value old(it->second); - value_.map_->erase(it); - return old; -#else - Value *value = value_.map_->find( key ); - if (value){ - Value old(*value); - value_.map_.remove( key ); - return old; - } else { - return null; - } -#endif -} - -Value -Value::removeMember( const std::string &key ) -{ - return removeMember( key.c_str() ); -} - -# ifdef JSON_USE_CPPTL -Value -Value::get( const CppTL::ConstString &key, - const Value &defaultValue ) const -{ - return get( key.c_str(), defaultValue ); -} -# endif - -bool -Value::isMember( const char *key ) const -{ - const Value *value = &((*this)[key]); - return value != &null; -} - - -bool -Value::isMember( const std::string &key ) const -{ - return isMember( key.c_str() ); -} - - -# ifdef JSON_USE_CPPTL -bool -Value::isMember( const CppTL::ConstString &key ) const -{ - return isMember( key.c_str() ); -} -#endif - -Value::Members -Value::getMemberNames() const -{ - JSON_ASSERT( type_ == nullValue || type_ == objectValue ); - if ( type_ == nullValue ) - return Value::Members(); - Members members; - members.reserve( value_.map_->size() ); -#ifndef JSON_VALUE_USE_INTERNAL_MAP - ObjectValues::const_iterator it = value_.map_->begin(); - ObjectValues::const_iterator itEnd = value_.map_->end(); - for ( ; it != itEnd; ++it ) - members.push_back( std::string( (*it).first.c_str() ) ); -#else - ValueInternalMap::IteratorState it; - ValueInternalMap::IteratorState itEnd; - value_.map_->makeBeginIterator( it ); - value_.map_->makeEndIterator( itEnd ); - for ( ; !ValueInternalMap::equals( it, itEnd ); ValueInternalMap::increment(it) ) - members.push_back( std::string( ValueInternalMap::key( it ) ) ); -#endif - return members; -} -// -//# ifdef JSON_USE_CPPTL -//EnumMemberNames -//Value::enumMemberNames() const -//{ -// if ( type_ == objectValue ) -// { -// return CppTL::Enum::any( CppTL::Enum::transform( -// CppTL::Enum::keys( *(value_.map_), CppTL::Type<const CZString &>() ), -// MemberNamesTransform() ) ); -// } -// return EnumMemberNames(); -//} -// -// -//EnumValues -//Value::enumValues() const -//{ -// if ( type_ == objectValue || type_ == arrayValue ) -// return CppTL::Enum::anyValues( *(value_.map_), -// CppTL::Type<const Value &>() ); -// return EnumValues(); -//} -// -//# endif - - -bool -Value::isNull() const -{ - return type_ == nullValue; -} - - -bool -Value::isBool() const -{ - return type_ == booleanValue; -} - - -bool -Value::isInt() const -{ - return type_ == intValue; -} - - -bool -Value::isUInt() const -{ - return type_ == uintValue; -} - - -bool -Value::isIntegral() const -{ - return type_ == intValue - || type_ == uintValue - || type_ == booleanValue; -} - - -bool -Value::isDouble() const -{ - return type_ == realValue; -} - - -bool -Value::isNumeric() const -{ - return isIntegral() || isDouble(); -} - - -bool -Value::isString() const -{ - return type_ == stringValue; -} - - -bool -Value::isArray() const -{ - return type_ == nullValue || type_ == arrayValue; -} - - -bool -Value::isObject() const -{ - return type_ == nullValue || type_ == objectValue; -} - - -void -Value::setComment( const char *comment, - CommentPlacement placement ) -{ - if ( !comments_ ) - comments_ = new CommentInfo[numberOfCommentPlacement]; - comments_[placement].setComment( comment ); -} - - -void -Value::setComment( const std::string &comment, - CommentPlacement placement ) -{ - setComment( comment.c_str(), placement ); -} - - -bool -Value::hasComment( CommentPlacement placement ) const -{ - return comments_ != 0 && comments_[placement].comment_ != 0; -} - -std::string -Value::getComment( CommentPlacement placement ) const -{ - if ( hasComment(placement) ) - return comments_[placement].comment_; - return ""; -} - - -std::string -Value::toStyledString() const -{ - StyledWriter writer; - return writer.write( *this ); -} - - -Value::const_iterator -Value::begin() const -{ - switch ( type_ ) - { -#ifdef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - if ( value_.array_ ) - { - ValueInternalArray::IteratorState it; - value_.array_->makeBeginIterator( it ); - return const_iterator( it ); - } - break; - case objectValue: - if ( value_.map_ ) - { - ValueInternalMap::IteratorState it; - value_.map_->makeBeginIterator( it ); - return const_iterator( it ); - } - break; -#else - case arrayValue: - case objectValue: - if ( value_.map_ ) - return const_iterator( value_.map_->begin() ); - break; -#endif - default: - break; - } - return const_iterator(); -} - -Value::const_iterator -Value::end() const -{ - switch ( type_ ) - { -#ifdef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - if ( value_.array_ ) - { - ValueInternalArray::IteratorState it; - value_.array_->makeEndIterator( it ); - return const_iterator( it ); - } - break; - case objectValue: - if ( value_.map_ ) - { - ValueInternalMap::IteratorState it; - value_.map_->makeEndIterator( it ); - return const_iterator( it ); - } - break; -#else - case arrayValue: - case objectValue: - if ( value_.map_ ) - return const_iterator( value_.map_->end() ); - break; -#endif - default: - break; - } - return const_iterator(); -} - - -Value::iterator -Value::begin() -{ - switch ( type_ ) - { -#ifdef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - if ( value_.array_ ) - { - ValueInternalArray::IteratorState it; - value_.array_->makeBeginIterator( it ); - return iterator( it ); - } - break; - case objectValue: - if ( value_.map_ ) - { - ValueInternalMap::IteratorState it; - value_.map_->makeBeginIterator( it ); - return iterator( it ); - } - break; -#else - case arrayValue: - case objectValue: - if ( value_.map_ ) - return iterator( value_.map_->begin() ); - break; -#endif - default: - break; - } - return iterator(); -} - -Value::iterator -Value::end() -{ - switch ( type_ ) - { -#ifdef JSON_VALUE_USE_INTERNAL_MAP - case arrayValue: - if ( value_.array_ ) - { - ValueInternalArray::IteratorState it; - value_.array_->makeEndIterator( it ); - return iterator( it ); - } - break; - case objectValue: - if ( value_.map_ ) - { - ValueInternalMap::IteratorState it; - value_.map_->makeEndIterator( it ); - return iterator( it ); - } - break; -#else - case arrayValue: - case objectValue: - if ( value_.map_ ) - return iterator( value_.map_->end() ); - break; -#endif - default: - break; - } - return iterator(); -} - - -// class PathArgument -// ////////////////////////////////////////////////////////////////// - -PathArgument::PathArgument() - : kind_( kindNone ) -{ -} - - -PathArgument::PathArgument( Value::UInt index ) - : index_( index ) - , kind_( kindIndex ) -{ -} - - -PathArgument::PathArgument( const char *key ) - : key_( key ) - , kind_( kindKey ) -{ -} - - -PathArgument::PathArgument( const std::string &key ) - : key_( key.c_str() ) - , kind_( kindKey ) -{ -} - -// class Path -// ////////////////////////////////////////////////////////////////// - -Path::Path( const std::string &path, - const PathArgument &a1, - const PathArgument &a2, - const PathArgument &a3, - const PathArgument &a4, - const PathArgument &a5 ) -{ - InArgs in; - in.push_back( &a1 ); - in.push_back( &a2 ); - in.push_back( &a3 ); - in.push_back( &a4 ); - in.push_back( &a5 ); - makePath( path, in ); -} - - -void -Path::makePath( const std::string &path, - const InArgs &in ) -{ - const char *current = path.c_str(); - const char *end = current + path.length(); - InArgs::const_iterator itInArg = in.begin(); - while ( current != end ) - { - if ( *current == '[' ) - { - ++current; - if ( *current == '%' ) - addPathInArg( path, in, itInArg, PathArgument::kindIndex ); - else - { - Value::UInt index = 0; - for ( ; current != end && *current >= '0' && *current <= '9'; ++current ) - index = index * 10 + Value::UInt(*current - '0'); - args_.push_back( index ); - } - if ( current == end || *current++ != ']' ) - invalidPath( path, int(current - path.c_str()) ); - } - else if ( *current == '%' ) - { - addPathInArg( path, in, itInArg, PathArgument::kindKey ); - ++current; - } - else if ( *current == '.' ) - { - ++current; - } - else - { - const char *beginName = current; - while ( current != end && !strchr( "[.", *current ) ) - ++current; - args_.push_back( std::string( beginName, current ) ); - } - } -} - - -void -Path::addPathInArg( const std::string &path, - const InArgs &in, - InArgs::const_iterator &itInArg, - PathArgument::Kind kind ) -{ - if ( itInArg == in.end() ) - { - // Error: missing argument %d - } - else if ( (*itInArg)->kind_ != kind ) - { - // Error: bad argument type - } - else - { - args_.push_back( **itInArg ); - } -} - - -void -Path::invalidPath( const std::string &path, - int location ) -{ - // Error: invalid path. -} - - -const Value & -Path::resolve( const Value &root ) const -{ - const Value *node = &root; - for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) - { - const PathArgument &arg = *it; - if ( arg.kind_ == PathArgument::kindIndex ) - { - if ( !node->isArray() || node->isValidIndex( arg.index_ ) ) - { - // Error: unable to resolve path (array value expected at position... - } - node = &((*node)[arg.index_]); - } - else if ( arg.kind_ == PathArgument::kindKey ) - { - if ( !node->isObject() ) - { - // Error: unable to resolve path (object value expected at position...) - } - node = &((*node)[arg.key_]); - if ( node == &Value::null ) - { - // Error: unable to resolve path (object has no member named '' at position...) - } - } - } - return *node; -} - - -Value -Path::resolve( const Value &root, - const Value &defaultValue ) const -{ - const Value *node = &root; - for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) - { - const PathArgument &arg = *it; - if ( arg.kind_ == PathArgument::kindIndex ) - { - if ( !node->isArray() || node->isValidIndex( arg.index_ ) ) - return defaultValue; - node = &((*node)[arg.index_]); - } - else if ( arg.kind_ == PathArgument::kindKey ) - { - if ( !node->isObject() ) - return defaultValue; - node = &((*node)[arg.key_]); - if ( node == &Value::null ) - return defaultValue; - } - } - return *node; -} - - -Value & -Path::make( Value &root ) const -{ - Value *node = &root; - for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) - { - const PathArgument &arg = *it; - if ( arg.kind_ == PathArgument::kindIndex ) - { - if ( !node->isArray() ) - { - // Error: node is not an array at position ... - } - node = &((*node)[arg.index_]); - } - else if ( arg.kind_ == PathArgument::kindKey ) - { - if ( !node->isObject() ) - { - // Error: node is not an object at position... - } - node = &((*node)[arg.key_]); - } - } - return *node; -} - - -} // namespace Json diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_writer.cpp b/jsoncpp-src-0.5.0/src/lib_json/json_writer.cpp deleted file mode 100644 index cdf4188f2..000000000 --- a/jsoncpp-src-0.5.0/src/lib_json/json_writer.cpp +++ /dev/null @@ -1,829 +0,0 @@ -#include <json/writer.h> -#include <utility> -#include <assert.h> -#include <stdio.h> -#include <string.h> -#include <iostream> -#include <sstream> -#include <iomanip> - -#if _MSC_VER >= 1400 // VC++ 8.0 -#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated. -#endif - -namespace Json { - -static bool isControlCharacter(char ch) -{ - return ch > 0 && ch <= 0x1F; -} - -static bool containsControlCharacter( const char* str ) -{ - while ( *str ) - { - if ( isControlCharacter( *(str++) ) ) - return true; - } - return false; -} -static void uintToString( unsigned int value, - char *¤t ) -{ - *--current = 0; - do - { - *--current = (value % 10) + '0'; - value /= 10; - } - while ( value != 0 ); -} - -std::string valueToString( Int value ) -{ - char buffer[32]; - char *current = buffer + sizeof(buffer); - bool isNegative = value < 0; - if ( isNegative ) - value = -value; - uintToString( UInt(value), current ); - if ( isNegative ) - *--current = '-'; - assert( current >= buffer ); - return current; -} - - -std::string valueToString( UInt value ) -{ - char buffer[32]; - char *current = buffer + sizeof(buffer); - uintToString( value, current ); - assert( current >= buffer ); - return current; -} - -std::string valueToString( double value ) -{ - char buffer[32]; -#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with visual studio 2005 to avoid warning. - sprintf_s(buffer, sizeof(buffer), "%#.16g", value); -#else - sprintf(buffer, "%#.16g", value); -#endif - char* ch = buffer + strlen(buffer) - 1; - if (*ch != '0') return buffer; // nothing to truncate, so save time - while(ch > buffer && *ch == '0'){ - --ch; - } - char* last_nonzero = ch; - while(ch >= buffer){ - switch(*ch){ - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - --ch; - continue; - case '.': - // Truncate zeroes to save bytes in output, but keep one. - *(last_nonzero+2) = '\0'; - return buffer; - default: - return buffer; - } - } - return buffer; -} - - -std::string valueToString( bool value ) -{ - return value ? "true" : "false"; -} - -std::string valueToQuotedString( const char *value ) -{ - // Not sure how to handle unicode... - if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value )) - return std::string("\"") + value + "\""; - // We have to walk value and escape any special characters. - // Appending to std::string is not efficient, but this should be rare. - // (Note: forward slashes are *not* rare, but I am not escaping them.) - unsigned maxsize = strlen(value)*2 + 3; // allescaped+quotes+NULL - std::string result; - result.reserve(maxsize); // to avoid lots of mallocs - result += "\""; - for (const char* c=value; *c != 0; ++c) - { - switch(*c) - { - case '\"': - result += "\\\""; - break; - case '\\': - result += "\\\\"; - break; - case '\b': - result += "\\b"; - break; - case '\f': - result += "\\f"; - break; - case '\n': - result += "\\n"; - break; - case '\r': - result += "\\r"; - break; - case '\t': - result += "\\t"; - break; - //case '/': - // Even though \/ is considered a legal escape in JSON, a bare - // slash is also legal, so I see no reason to escape it. - // (I hope I am not misunderstanding something. - // blep notes: actually escaping \/ may be useful in javascript to avoid </ - // sequence. - // Should add a flag to allow this compatibility mode and prevent this - // sequence from occurring. - default: - if ( isControlCharacter( *c ) ) - { - std::ostringstream oss; - oss << "\\u" << std::hex << std::uppercase << std::setfill('0') << std::setw(4) << static_cast<int>(*c); - result += oss.str(); - } - else - { - result += *c; - } - break; - } - } - result += "\""; - return result; -} - -// Class Writer -// ////////////////////////////////////////////////////////////////// -Writer::~Writer() -{ -} - - -// Class FastWriter -// ////////////////////////////////////////////////////////////////// - -FastWriter::FastWriter() - : yamlCompatiblityEnabled_( false ) -{ -} - - -void -FastWriter::enableYAMLCompatibility() -{ - yamlCompatiblityEnabled_ = true; -} - - -std::string -FastWriter::write( const Value &root ) -{ - document_ = ""; - writeValue( root ); - document_ += "\n"; - return document_; -} - - -void -FastWriter::writeValue( const Value &value ) -{ - switch ( value.type() ) - { - case nullValue: - document_ += "null"; - break; - case intValue: - document_ += valueToString( value.asInt() ); - break; - case uintValue: - document_ += valueToString( value.asUInt() ); - break; - case realValue: - document_ += valueToString( value.asDouble() ); - break; - case stringValue: - document_ += valueToQuotedString( value.asCString() ); - break; - case booleanValue: - document_ += valueToString( value.asBool() ); - break; - case arrayValue: - { - document_ += "["; - int size = value.size(); - for ( int index =0; index < size; ++index ) - { - if ( index > 0 ) - document_ += ","; - writeValue( value[index] ); - } - document_ += "]"; - } - break; - case objectValue: - { - Value::Members members( value.getMemberNames() ); - document_ += "{"; - for ( Value::Members::iterator it = members.begin(); - it != members.end(); - ++it ) - { - const std::string &name = *it; - if ( it != members.begin() ) - document_ += ","; - document_ += valueToQuotedString( name.c_str() ); - document_ += yamlCompatiblityEnabled_ ? ": " - : ":"; - writeValue( value[name] ); - } - document_ += "}"; - } - break; - } -} - - -// Class StyledWriter -// ////////////////////////////////////////////////////////////////// - -StyledWriter::StyledWriter() - : rightMargin_( 74 ) - , indentSize_( 3 ) -{ -} - - -std::string -StyledWriter::write( const Value &root ) -{ - document_ = ""; - addChildValues_ = false; - indentString_ = ""; - writeCommentBeforeValue( root ); - writeValue( root ); - writeCommentAfterValueOnSameLine( root ); - document_ += "\n"; - return document_; -} - - -void -StyledWriter::writeValue( const Value &value ) -{ - switch ( value.type() ) - { - case nullValue: - pushValue( "null" ); - break; - case intValue: - pushValue( valueToString( value.asInt() ) ); - break; - case uintValue: - pushValue( valueToString( value.asUInt() ) ); - break; - case realValue: - pushValue( valueToString( value.asDouble() ) ); - break; - case stringValue: - pushValue( valueToQuotedString( value.asCString() ) ); - break; - case booleanValue: - pushValue( valueToString( value.asBool() ) ); - break; - case arrayValue: - writeArrayValue( value); - break; - case objectValue: - { - Value::Members members( value.getMemberNames() ); - if ( members.empty() ) - pushValue( "{}" ); - else - { - writeWithIndent( "{" ); - indent(); - Value::Members::iterator it = members.begin(); - while ( true ) - { - const std::string &name = *it; - const Value &childValue = value[name]; - writeCommentBeforeValue( childValue ); - writeWithIndent( valueToQuotedString( name.c_str() ) ); - document_ += " : "; - writeValue( childValue ); - if ( ++it == members.end() ) - { - writeCommentAfterValueOnSameLine( childValue ); - break; - } - document_ += ","; - writeCommentAfterValueOnSameLine( childValue ); - } - unindent(); - writeWithIndent( "}" ); - } - } - break; - } -} - - -void -StyledWriter::writeArrayValue( const Value &value ) -{ - unsigned size = value.size(); - if ( size == 0 ) - pushValue( "[]" ); - else - { - bool isArrayMultiLine = isMultineArray( value ); - if ( isArrayMultiLine ) - { - writeWithIndent( "[" ); - indent(); - bool hasChildValue = !childValues_.empty(); - unsigned index =0; - while ( true ) - { - const Value &childValue = value[index]; - writeCommentBeforeValue( childValue ); - if ( hasChildValue ) - writeWithIndent( childValues_[index] ); - else - { - writeIndent(); - writeValue( childValue ); - } - if ( ++index == size ) - { - writeCommentAfterValueOnSameLine( childValue ); - break; - } - document_ += ","; - writeCommentAfterValueOnSameLine( childValue ); - } - unindent(); - writeWithIndent( "]" ); - } - else // output on a single line - { - assert( childValues_.size() == size ); - document_ += "[ "; - for ( unsigned index =0; index < size; ++index ) - { - if ( index > 0 ) - document_ += ", "; - document_ += childValues_[index]; - } - document_ += " ]"; - } - } -} - - -bool -StyledWriter::isMultineArray( const Value &value ) -{ - int size = value.size(); - bool isMultiLine = size*3 >= rightMargin_ ; - childValues_.clear(); - for ( int index =0; index < size && !isMultiLine; ++index ) - { - const Value &childValue = value[index]; - isMultiLine = isMultiLine || - ( (childValue.isArray() || childValue.isObject()) && - childValue.size() > 0 ); - } - if ( !isMultiLine ) // check if line length > max line length - { - childValues_.reserve( size ); - addChildValues_ = true; - int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]' - for ( int index =0; index < size && !isMultiLine; ++index ) - { - writeValue( value[index] ); - lineLength += int( childValues_[index].length() ); - isMultiLine = isMultiLine && hasCommentForValue( value[index] ); - } - addChildValues_ = false; - isMultiLine = isMultiLine || lineLength >= rightMargin_; - } - return isMultiLine; -} - - -void -StyledWriter::pushValue( const std::string &value ) -{ - if ( addChildValues_ ) - childValues_.push_back( value ); - else - document_ += value; -} - - -void -StyledWriter::writeIndent() -{ - if ( !document_.empty() ) - { - char last = document_[document_.length()-1]; - if ( last == ' ' ) // already indented - return; - if ( last != '\n' ) // Comments may add new-line - document_ += '\n'; - } - document_ += indentString_; -} - - -void -StyledWriter::writeWithIndent( const std::string &value ) -{ - writeIndent(); - document_ += value; -} - - -void -StyledWriter::indent() -{ - indentString_ += std::string( indentSize_, ' ' ); -} - - -void -StyledWriter::unindent() -{ - assert( int(indentString_.size()) >= indentSize_ ); - indentString_.resize( indentString_.size() - indentSize_ ); -} - - -void -StyledWriter::writeCommentBeforeValue( const Value &root ) -{ - if ( !root.hasComment( commentBefore ) ) - return; - document_ += normalizeEOL( root.getComment( commentBefore ) ); - document_ += "\n"; -} - - -void -StyledWriter::writeCommentAfterValueOnSameLine( const Value &root ) -{ - if ( root.hasComment( commentAfterOnSameLine ) ) - document_ += " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) ); - - if ( root.hasComment( commentAfter ) ) - { - document_ += "\n"; - document_ += normalizeEOL( root.getComment( commentAfter ) ); - document_ += "\n"; - } -} - - -bool -StyledWriter::hasCommentForValue( const Value &value ) -{ - return value.hasComment( commentBefore ) - || value.hasComment( commentAfterOnSameLine ) - || value.hasComment( commentAfter ); -} - - -std::string -StyledWriter::normalizeEOL( const std::string &text ) -{ - std::string normalized; - normalized.reserve( text.length() ); - const char *begin = text.c_str(); - const char *end = begin + text.length(); - const char *current = begin; - while ( current != end ) - { - char c = *current++; - if ( c == '\r' ) // mac or dos EOL - { - if ( *current == '\n' ) // convert dos EOL - ++current; - normalized += '\n'; - } - else // handle unix EOL & other char - normalized += c; - } - return normalized; -} - - -// Class StyledStreamWriter -// ////////////////////////////////////////////////////////////////// - -StyledStreamWriter::StyledStreamWriter( std::string indentation ) - : document_(NULL) - , rightMargin_( 74 ) - , indentation_( indentation ) -{ -} - - -void -StyledStreamWriter::write( std::ostream &out, const Value &root ) -{ - document_ = &out; - addChildValues_ = false; - indentString_ = ""; - writeCommentBeforeValue( root ); - writeValue( root ); - writeCommentAfterValueOnSameLine( root ); - *document_ << "\n"; - document_ = NULL; // Forget the stream, for safety. -} - - -void -StyledStreamWriter::writeValue( const Value &value ) -{ - switch ( value.type() ) - { - case nullValue: - pushValue( "null" ); - break; - case intValue: - pushValue( valueToString( value.asInt() ) ); - break; - case uintValue: - pushValue( valueToString( value.asUInt() ) ); - break; - case realValue: - pushValue( valueToString( value.asDouble() ) ); - break; - case stringValue: - pushValue( valueToQuotedString( value.asCString() ) ); - break; - case booleanValue: - pushValue( valueToString( value.asBool() ) ); - break; - case arrayValue: - writeArrayValue( value); - break; - case objectValue: - { - Value::Members members( value.getMemberNames() ); - if ( members.empty() ) - pushValue( "{}" ); - else - { - writeWithIndent( "{" ); - indent(); - Value::Members::iterator it = members.begin(); - while ( true ) - { - const std::string &name = *it; - const Value &childValue = value[name]; - writeCommentBeforeValue( childValue ); - writeWithIndent( valueToQuotedString( name.c_str() ) ); - *document_ << " : "; - writeValue( childValue ); - if ( ++it == members.end() ) - { - writeCommentAfterValueOnSameLine( childValue ); - break; - } - *document_ << ","; - writeCommentAfterValueOnSameLine( childValue ); - } - unindent(); - writeWithIndent( "}" ); - } - } - break; - } -} - - -void -StyledStreamWriter::writeArrayValue( const Value &value ) -{ - unsigned size = value.size(); - if ( size == 0 ) - pushValue( "[]" ); - else - { - bool isArrayMultiLine = isMultineArray( value ); - if ( isArrayMultiLine ) - { - writeWithIndent( "[" ); - indent(); - bool hasChildValue = !childValues_.empty(); - unsigned index =0; - while ( true ) - { - const Value &childValue = value[index]; - writeCommentBeforeValue( childValue ); - if ( hasChildValue ) - writeWithIndent( childValues_[index] ); - else - { - writeIndent(); - writeValue( childValue ); - } - if ( ++index == size ) - { - writeCommentAfterValueOnSameLine( childValue ); - break; - } - *document_ << ","; - writeCommentAfterValueOnSameLine( childValue ); - } - unindent(); - writeWithIndent( "]" ); - } - else // output on a single line - { - assert( childValues_.size() == size ); - *document_ << "[ "; - for ( unsigned index =0; index < size; ++index ) - { - if ( index > 0 ) - *document_ << ", "; - *document_ << childValues_[index]; - } - *document_ << " ]"; - } - } -} - - -bool -StyledStreamWriter::isMultineArray( const Value &value ) -{ - int size = value.size(); - bool isMultiLine = size*3 >= rightMargin_ ; - childValues_.clear(); - for ( int index =0; index < size && !isMultiLine; ++index ) - { - const Value &childValue = value[index]; - isMultiLine = isMultiLine || - ( (childValue.isArray() || childValue.isObject()) && - childValue.size() > 0 ); - } - if ( !isMultiLine ) // check if line length > max line length - { - childValues_.reserve( size ); - addChildValues_ = true; - int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]' - for ( int index =0; index < size && !isMultiLine; ++index ) - { - writeValue( value[index] ); - lineLength += int( childValues_[index].length() ); - isMultiLine = isMultiLine && hasCommentForValue( value[index] ); - } - addChildValues_ = false; - isMultiLine = isMultiLine || lineLength >= rightMargin_; - } - return isMultiLine; -} - - -void -StyledStreamWriter::pushValue( const std::string &value ) -{ - if ( addChildValues_ ) - childValues_.push_back( value ); - else - *document_ << value; -} - - -void -StyledStreamWriter::writeIndent() -{ - /* - Some comments in this method would have been nice. ;-) - - if ( !document_.empty() ) - { - char last = document_[document_.length()-1]; - if ( last == ' ' ) // already indented - return; - if ( last != '\n' ) // Comments may add new-line - *document_ << '\n'; - } - */ - *document_ << '\n' << indentString_; -} - - -void -StyledStreamWriter::writeWithIndent( const std::string &value ) -{ - writeIndent(); - *document_ << value; -} - - -void -StyledStreamWriter::indent() -{ - indentString_ += indentation_; -} - - -void -StyledStreamWriter::unindent() -{ - assert( indentString_.size() >= indentation_.size() ); - indentString_.resize( indentString_.size() - indentation_.size() ); -} - - -void -StyledStreamWriter::writeCommentBeforeValue( const Value &root ) -{ - if ( !root.hasComment( commentBefore ) ) - return; - *document_ << normalizeEOL( root.getComment( commentBefore ) ); - *document_ << "\n"; -} - - -void -StyledStreamWriter::writeCommentAfterValueOnSameLine( const Value &root ) -{ - if ( root.hasComment( commentAfterOnSameLine ) ) - *document_ << " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) ); - - if ( root.hasComment( commentAfter ) ) - { - *document_ << "\n"; - *document_ << normalizeEOL( root.getComment( commentAfter ) ); - *document_ << "\n"; - } -} - - -bool -StyledStreamWriter::hasCommentForValue( const Value &value ) -{ - return value.hasComment( commentBefore ) - || value.hasComment( commentAfterOnSameLine ) - || value.hasComment( commentAfter ); -} - - -std::string -StyledStreamWriter::normalizeEOL( const std::string &text ) -{ - std::string normalized; - normalized.reserve( text.length() ); - const char *begin = text.c_str(); - const char *end = begin + text.length(); - const char *current = begin; - while ( current != end ) - { - char c = *current++; - if ( c == '\r' ) // mac or dos EOL - { - if ( *current == '\n' ) // convert dos EOL - ++current; - normalized += '\n'; - } - else // handle unix EOL & other char - normalized += c; - } - return normalized; -} - - -std::ostream& operator<<( std::ostream &sout, const Value &root ) -{ - Json::StyledStreamWriter writer; - writer.write(sout, root); - return sout; -} - - -} // namespace Json diff --git a/CryptoPP/Doxyfile b/lib/cryptopp/Doxyfile index c221fdf56..c221fdf56 100644 --- a/CryptoPP/Doxyfile +++ b/lib/cryptopp/Doxyfile diff --git a/CryptoPP/License.txt b/lib/cryptopp/License.txt index c5d3f34b1..c5d3f34b1 100644 --- a/CryptoPP/License.txt +++ b/lib/cryptopp/License.txt diff --git a/CryptoPP/Readme.txt b/lib/cryptopp/Readme.txt index 5f3b4525d..5f3b4525d 100644 --- a/CryptoPP/Readme.txt +++ b/lib/cryptopp/Readme.txt diff --git a/CryptoPP/adler32.cpp b/lib/cryptopp/adler32.cpp index 0d52c0838..0d52c0838 100644 --- a/CryptoPP/adler32.cpp +++ b/lib/cryptopp/adler32.cpp diff --git a/CryptoPP/adler32.h b/lib/cryptopp/adler32.h index 0ed803da9..0ed803da9 100644 --- a/CryptoPP/adler32.h +++ b/lib/cryptopp/adler32.h diff --git a/CryptoPP/aes.h b/lib/cryptopp/aes.h index 008754256..008754256 100644 --- a/CryptoPP/aes.h +++ b/lib/cryptopp/aes.h diff --git a/CryptoPP/algebra.cpp b/lib/cryptopp/algebra.cpp index 958e63701..958e63701 100644 --- a/CryptoPP/algebra.cpp +++ b/lib/cryptopp/algebra.cpp diff --git a/CryptoPP/algebra.h b/lib/cryptopp/algebra.h index 13038bd80..13038bd80 100644 --- a/CryptoPP/algebra.h +++ b/lib/cryptopp/algebra.h diff --git a/CryptoPP/algparam.cpp b/lib/cryptopp/algparam.cpp index a70d5dd95..a70d5dd95 100644 --- a/CryptoPP/algparam.cpp +++ b/lib/cryptopp/algparam.cpp diff --git a/CryptoPP/algparam.h b/lib/cryptopp/algparam.h index ea5129c22..ea5129c22 100644 --- a/CryptoPP/algparam.h +++ b/lib/cryptopp/algparam.h diff --git a/CryptoPP/argnames.h b/lib/cryptopp/argnames.h index e96172521..e96172521 100644 --- a/CryptoPP/argnames.h +++ b/lib/cryptopp/argnames.h diff --git a/CryptoPP/asn.cpp b/lib/cryptopp/asn.cpp index 8ae1ad65a..8ae1ad65a 100644 --- a/CryptoPP/asn.cpp +++ b/lib/cryptopp/asn.cpp diff --git a/CryptoPP/asn.h b/lib/cryptopp/asn.h index c35126bc3..c35126bc3 100644 --- a/CryptoPP/asn.h +++ b/lib/cryptopp/asn.h diff --git a/CryptoPP/authenc.cpp b/lib/cryptopp/authenc.cpp index f93662efb..f93662efb 100644 --- a/CryptoPP/authenc.cpp +++ b/lib/cryptopp/authenc.cpp diff --git a/CryptoPP/authenc.h b/lib/cryptopp/authenc.h index 5bb2a51c8..5bb2a51c8 100644 --- a/CryptoPP/authenc.h +++ b/lib/cryptopp/authenc.h diff --git a/CryptoPP/base32.cpp b/lib/cryptopp/base32.cpp index 0568f0729..0568f0729 100644 --- a/CryptoPP/base32.cpp +++ b/lib/cryptopp/base32.cpp diff --git a/CryptoPP/base32.h b/lib/cryptopp/base32.h index cb1e1af8d..cb1e1af8d 100644 --- a/CryptoPP/base32.h +++ b/lib/cryptopp/base32.h diff --git a/CryptoPP/base64.cpp b/lib/cryptopp/base64.cpp index 7571f2b8c..7571f2b8c 100644 --- a/CryptoPP/base64.cpp +++ b/lib/cryptopp/base64.cpp diff --git a/CryptoPP/base64.h b/lib/cryptopp/base64.h index 5a9e184b2..5a9e184b2 100644 --- a/CryptoPP/base64.h +++ b/lib/cryptopp/base64.h diff --git a/CryptoPP/basecode.cpp b/lib/cryptopp/basecode.cpp index 0c98b2271..0c98b2271 100644 --- a/CryptoPP/basecode.cpp +++ b/lib/cryptopp/basecode.cpp diff --git a/CryptoPP/basecode.h b/lib/cryptopp/basecode.h index cc44c4342..cc44c4342 100644 --- a/CryptoPP/basecode.h +++ b/lib/cryptopp/basecode.h diff --git a/CryptoPP/cbcmac.cpp b/lib/cryptopp/cbcmac.cpp index 6b0e8858e..6b0e8858e 100644 --- a/CryptoPP/cbcmac.cpp +++ b/lib/cryptopp/cbcmac.cpp diff --git a/CryptoPP/cbcmac.h b/lib/cryptopp/cbcmac.h index 4675dcb3d..4675dcb3d 100644 --- a/CryptoPP/cbcmac.h +++ b/lib/cryptopp/cbcmac.h diff --git a/CryptoPP/ccm.cpp b/lib/cryptopp/ccm.cpp index 030828ad8..030828ad8 100644 --- a/CryptoPP/ccm.cpp +++ b/lib/cryptopp/ccm.cpp diff --git a/CryptoPP/ccm.h b/lib/cryptopp/ccm.h index b1e5f00b9..b1e5f00b9 100644 --- a/CryptoPP/ccm.h +++ b/lib/cryptopp/ccm.h diff --git a/CryptoPP/channels.cpp b/lib/cryptopp/channels.cpp index 7359f54f7..7359f54f7 100644 --- a/CryptoPP/channels.cpp +++ b/lib/cryptopp/channels.cpp diff --git a/CryptoPP/channels.h b/lib/cryptopp/channels.h index 837415615..837415615 100644 --- a/CryptoPP/channels.h +++ b/lib/cryptopp/channels.h diff --git a/CryptoPP/cmac.cpp b/lib/cryptopp/cmac.cpp index a31d5f8b0..a31d5f8b0 100644 --- a/CryptoPP/cmac.cpp +++ b/lib/cryptopp/cmac.cpp diff --git a/CryptoPP/cmac.h b/lib/cryptopp/cmac.h index d8a1b391d..d8a1b391d 100644 --- a/CryptoPP/cmac.h +++ b/lib/cryptopp/cmac.h diff --git a/CryptoPP/config.h b/lib/cryptopp/config.h index edbfd00ef..edbfd00ef 100644 --- a/CryptoPP/config.h +++ b/lib/cryptopp/config.h diff --git a/CryptoPP/cpu.cpp b/lib/cryptopp/cpu.cpp index 3610a7c8e..3610a7c8e 100644 --- a/CryptoPP/cpu.cpp +++ b/lib/cryptopp/cpu.cpp diff --git a/CryptoPP/cpu.h b/lib/cryptopp/cpu.h index 65029d338..65029d338 100644 --- a/CryptoPP/cpu.h +++ b/lib/cryptopp/cpu.h diff --git a/CryptoPP/crc.cpp b/lib/cryptopp/crc.cpp index 10c25c257..10c25c257 100644 --- a/CryptoPP/crc.cpp +++ b/lib/cryptopp/crc.cpp diff --git a/CryptoPP/crc.h b/lib/cryptopp/crc.h index f75ea384c..f75ea384c 100644 --- a/CryptoPP/crc.h +++ b/lib/cryptopp/crc.h diff --git a/CryptoPP/cryptlib.cpp b/lib/cryptopp/cryptlib.cpp index df138ddb0..df138ddb0 100644 --- a/CryptoPP/cryptlib.cpp +++ b/lib/cryptopp/cryptlib.cpp diff --git a/CryptoPP/cryptlib.h b/lib/cryptopp/cryptlib.h index 406872232..406872232 100644 --- a/CryptoPP/cryptlib.h +++ b/lib/cryptopp/cryptlib.h diff --git a/CryptoPP/default.cpp b/lib/cryptopp/default.cpp index 72940784d..72940784d 100644 --- a/CryptoPP/default.cpp +++ b/lib/cryptopp/default.cpp diff --git a/CryptoPP/default.h b/lib/cryptopp/default.h index fb5364152..fb5364152 100644 --- a/CryptoPP/default.h +++ b/lib/cryptopp/default.h diff --git a/CryptoPP/des.cpp b/lib/cryptopp/des.cpp index a6e0c514d..a6e0c514d 100644 --- a/CryptoPP/des.cpp +++ b/lib/cryptopp/des.cpp diff --git a/CryptoPP/des.h b/lib/cryptopp/des.h index 62f628824..62f628824 100644 --- a/CryptoPP/des.h +++ b/lib/cryptopp/des.h diff --git a/CryptoPP/dessp.cpp b/lib/cryptopp/dessp.cpp index 49ed1d26d..49ed1d26d 100644 --- a/CryptoPP/dessp.cpp +++ b/lib/cryptopp/dessp.cpp diff --git a/CryptoPP/dh.cpp b/lib/cryptopp/dh.cpp index 22097a051..22097a051 100644 --- a/CryptoPP/dh.cpp +++ b/lib/cryptopp/dh.cpp diff --git a/CryptoPP/dh.h b/lib/cryptopp/dh.h index 10e8d142e..10e8d142e 100644 --- a/CryptoPP/dh.h +++ b/lib/cryptopp/dh.h diff --git a/CryptoPP/dh2.cpp b/lib/cryptopp/dh2.cpp index 98175ee28..98175ee28 100644 --- a/CryptoPP/dh2.cpp +++ b/lib/cryptopp/dh2.cpp diff --git a/CryptoPP/dh2.h b/lib/cryptopp/dh2.h index af9d342d6..af9d342d6 100644 --- a/CryptoPP/dh2.h +++ b/lib/cryptopp/dh2.h diff --git a/CryptoPP/dll.cpp b/lib/cryptopp/dll.cpp index 2b4ef7ade..2b4ef7ade 100644 --- a/CryptoPP/dll.cpp +++ b/lib/cryptopp/dll.cpp diff --git a/CryptoPP/dll.h b/lib/cryptopp/dll.h index 50775e98b..50775e98b 100644 --- a/CryptoPP/dll.h +++ b/lib/cryptopp/dll.h diff --git a/CryptoPP/dmac.h b/lib/cryptopp/dmac.h index 80b54ac2f..80b54ac2f 100644 --- a/CryptoPP/dmac.h +++ b/lib/cryptopp/dmac.h diff --git a/CryptoPP/dsa.cpp b/lib/cryptopp/dsa.cpp index 5aace4857..5aace4857 100644 --- a/CryptoPP/dsa.cpp +++ b/lib/cryptopp/dsa.cpp diff --git a/CryptoPP/dsa.h b/lib/cryptopp/dsa.h index 6ae03877c..6ae03877c 100644 --- a/CryptoPP/dsa.h +++ b/lib/cryptopp/dsa.h diff --git a/CryptoPP/eax.cpp b/lib/cryptopp/eax.cpp index 2728c9bcd..2728c9bcd 100644 --- a/CryptoPP/eax.cpp +++ b/lib/cryptopp/eax.cpp diff --git a/CryptoPP/eax.h b/lib/cryptopp/eax.h index e48ee92b5..e48ee92b5 100644 --- a/CryptoPP/eax.h +++ b/lib/cryptopp/eax.h diff --git a/CryptoPP/ec2n.cpp b/lib/cryptopp/ec2n.cpp index b513b2cb8..b513b2cb8 100644 --- a/CryptoPP/ec2n.cpp +++ b/lib/cryptopp/ec2n.cpp diff --git a/CryptoPP/ec2n.h b/lib/cryptopp/ec2n.h index ae4007cd6..ae4007cd6 100644 --- a/CryptoPP/ec2n.h +++ b/lib/cryptopp/ec2n.h diff --git a/CryptoPP/eccrypto.cpp b/lib/cryptopp/eccrypto.cpp index 922104c4d..922104c4d 100644 --- a/CryptoPP/eccrypto.cpp +++ b/lib/cryptopp/eccrypto.cpp diff --git a/CryptoPP/eccrypto.h b/lib/cryptopp/eccrypto.h index 3530455a3..3530455a3 100644 --- a/CryptoPP/eccrypto.h +++ b/lib/cryptopp/eccrypto.h diff --git a/CryptoPP/ecp.cpp b/lib/cryptopp/ecp.cpp index 55a7cc15b..55a7cc15b 100644 --- a/CryptoPP/ecp.cpp +++ b/lib/cryptopp/ecp.cpp diff --git a/CryptoPP/ecp.h b/lib/cryptopp/ecp.h index d946be63a..d946be63a 100644 --- a/CryptoPP/ecp.h +++ b/lib/cryptopp/ecp.h diff --git a/CryptoPP/elgamal.cpp b/lib/cryptopp/elgamal.cpp index b58fe7c06..b58fe7c06 100644 --- a/CryptoPP/elgamal.cpp +++ b/lib/cryptopp/elgamal.cpp diff --git a/CryptoPP/elgamal.h b/lib/cryptopp/elgamal.h index 9afc30eee..9afc30eee 100644 --- a/CryptoPP/elgamal.h +++ b/lib/cryptopp/elgamal.h diff --git a/CryptoPP/emsa2.cpp b/lib/cryptopp/emsa2.cpp index 3dbb7e8c0..3dbb7e8c0 100644 --- a/CryptoPP/emsa2.cpp +++ b/lib/cryptopp/emsa2.cpp diff --git a/CryptoPP/emsa2.h b/lib/cryptopp/emsa2.h index 49109e6db..49109e6db 100644 --- a/CryptoPP/emsa2.h +++ b/lib/cryptopp/emsa2.h diff --git a/CryptoPP/eprecomp.cpp b/lib/cryptopp/eprecomp.cpp index a061cf6cd..a061cf6cd 100644 --- a/CryptoPP/eprecomp.cpp +++ b/lib/cryptopp/eprecomp.cpp diff --git a/CryptoPP/eprecomp.h b/lib/cryptopp/eprecomp.h index 1f3256766..1f3256766 100644 --- a/CryptoPP/eprecomp.h +++ b/lib/cryptopp/eprecomp.h diff --git a/CryptoPP/esign.cpp b/lib/cryptopp/esign.cpp index 8b42c1fa4..8b42c1fa4 100644 --- a/CryptoPP/esign.cpp +++ b/lib/cryptopp/esign.cpp diff --git a/CryptoPP/esign.h b/lib/cryptopp/esign.h index 8eecbc5a1..8eecbc5a1 100644 --- a/CryptoPP/esign.h +++ b/lib/cryptopp/esign.h diff --git a/CryptoPP/factory.h b/lib/cryptopp/factory.h index 5b65db3da..5b65db3da 100644 --- a/CryptoPP/factory.h +++ b/lib/cryptopp/factory.h diff --git a/CryptoPP/files.cpp b/lib/cryptopp/files.cpp index 453b56248..453b56248 100644 --- a/CryptoPP/files.cpp +++ b/lib/cryptopp/files.cpp diff --git a/CryptoPP/files.h b/lib/cryptopp/files.h index a47e856bf..a47e856bf 100644 --- a/CryptoPP/files.h +++ b/lib/cryptopp/files.h diff --git a/CryptoPP/filters.cpp b/lib/cryptopp/filters.cpp index 083dfd361..083dfd361 100644 --- a/CryptoPP/filters.cpp +++ b/lib/cryptopp/filters.cpp diff --git a/CryptoPP/filters.h b/lib/cryptopp/filters.h index c72a4ece3..c72a4ece3 100644 --- a/CryptoPP/filters.h +++ b/lib/cryptopp/filters.h diff --git a/CryptoPP/fips140.cpp b/lib/cryptopp/fips140.cpp index 1fcf59014..1fcf59014 100644 --- a/CryptoPP/fips140.cpp +++ b/lib/cryptopp/fips140.cpp diff --git a/CryptoPP/fips140.h b/lib/cryptopp/fips140.h index a3e538613..a3e538613 100644 --- a/CryptoPP/fips140.h +++ b/lib/cryptopp/fips140.h diff --git a/CryptoPP/fltrimpl.h b/lib/cryptopp/fltrimpl.h index 4087d7d9f..4087d7d9f 100644 --- a/CryptoPP/fltrimpl.h +++ b/lib/cryptopp/fltrimpl.h diff --git a/CryptoPP/gcm.cpp b/lib/cryptopp/gcm.cpp index 2304f96d8..2304f96d8 100644 --- a/CryptoPP/gcm.cpp +++ b/lib/cryptopp/gcm.cpp diff --git a/CryptoPP/gcm.h b/lib/cryptopp/gcm.h index 272a51c9c..272a51c9c 100644 --- a/CryptoPP/gcm.h +++ b/lib/cryptopp/gcm.h diff --git a/CryptoPP/gf256.cpp b/lib/cryptopp/gf256.cpp index 72026d1e1..72026d1e1 100644 --- a/CryptoPP/gf256.cpp +++ b/lib/cryptopp/gf256.cpp diff --git a/CryptoPP/gf256.h b/lib/cryptopp/gf256.h index e0ea74826..e0ea74826 100644 --- a/CryptoPP/gf256.h +++ b/lib/cryptopp/gf256.h diff --git a/CryptoPP/gf2_32.cpp b/lib/cryptopp/gf2_32.cpp index ae4874a40..ae4874a40 100644 --- a/CryptoPP/gf2_32.cpp +++ b/lib/cryptopp/gf2_32.cpp diff --git a/CryptoPP/gf2_32.h b/lib/cryptopp/gf2_32.h index 31713f4c0..31713f4c0 100644 --- a/CryptoPP/gf2_32.h +++ b/lib/cryptopp/gf2_32.h diff --git a/CryptoPP/gf2n.cpp b/lib/cryptopp/gf2n.cpp index bcc56071a..bcc56071a 100644 --- a/CryptoPP/gf2n.cpp +++ b/lib/cryptopp/gf2n.cpp diff --git a/CryptoPP/gf2n.h b/lib/cryptopp/gf2n.h index 67ade641e..67ade641e 100644 --- a/CryptoPP/gf2n.h +++ b/lib/cryptopp/gf2n.h diff --git a/CryptoPP/gfpcrypt.cpp b/lib/cryptopp/gfpcrypt.cpp index e293fc598..e293fc598 100644 --- a/CryptoPP/gfpcrypt.cpp +++ b/lib/cryptopp/gfpcrypt.cpp diff --git a/CryptoPP/gfpcrypt.h b/lib/cryptopp/gfpcrypt.h index 7af993fb3..7af993fb3 100644 --- a/CryptoPP/gfpcrypt.h +++ b/lib/cryptopp/gfpcrypt.h diff --git a/CryptoPP/gzip.h b/lib/cryptopp/gzip.h index f3148ad71..f3148ad71 100644 --- a/CryptoPP/gzip.h +++ b/lib/cryptopp/gzip.h diff --git a/CryptoPP/hex.cpp b/lib/cryptopp/hex.cpp index 5731df550..5731df550 100644 --- a/CryptoPP/hex.cpp +++ b/lib/cryptopp/hex.cpp diff --git a/CryptoPP/hex.h b/lib/cryptopp/hex.h index 006914c5a..006914c5a 100644 --- a/CryptoPP/hex.h +++ b/lib/cryptopp/hex.h diff --git a/CryptoPP/hmac.cpp b/lib/cryptopp/hmac.cpp index d4a649c08..d4a649c08 100644 --- a/CryptoPP/hmac.cpp +++ b/lib/cryptopp/hmac.cpp diff --git a/CryptoPP/hmac.h b/lib/cryptopp/hmac.h index 62db5ef33..62db5ef33 100644 --- a/CryptoPP/hmac.h +++ b/lib/cryptopp/hmac.h diff --git a/CryptoPP/hrtimer.cpp b/lib/cryptopp/hrtimer.cpp index 6871a15dc..6871a15dc 100644 --- a/CryptoPP/hrtimer.cpp +++ b/lib/cryptopp/hrtimer.cpp diff --git a/CryptoPP/hrtimer.h b/lib/cryptopp/hrtimer.h index 858dbd226..858dbd226 100644 --- a/CryptoPP/hrtimer.h +++ b/lib/cryptopp/hrtimer.h diff --git a/CryptoPP/integer.cpp b/lib/cryptopp/integer.cpp index f07cce873..f07cce873 100644 --- a/CryptoPP/integer.cpp +++ b/lib/cryptopp/integer.cpp diff --git a/CryptoPP/integer.h b/lib/cryptopp/integer.h index 6d844fa57..6d844fa57 100644 --- a/CryptoPP/integer.h +++ b/lib/cryptopp/integer.h diff --git a/CryptoPP/iterhash.cpp b/lib/cryptopp/iterhash.cpp index 1e31e9fb3..1e31e9fb3 100644 --- a/CryptoPP/iterhash.cpp +++ b/lib/cryptopp/iterhash.cpp diff --git a/CryptoPP/iterhash.h b/lib/cryptopp/iterhash.h index cce9e8211..cce9e8211 100644 --- a/CryptoPP/iterhash.h +++ b/lib/cryptopp/iterhash.h diff --git a/CryptoPP/lubyrack.h b/lib/cryptopp/lubyrack.h index e8fd2f748..e8fd2f748 100644 --- a/CryptoPP/lubyrack.h +++ b/lib/cryptopp/lubyrack.h diff --git a/CryptoPP/luc.cpp b/lib/cryptopp/luc.cpp index 43cd2ed21..43cd2ed21 100644 --- a/CryptoPP/luc.cpp +++ b/lib/cryptopp/luc.cpp diff --git a/CryptoPP/luc.h b/lib/cryptopp/luc.h index 730776d57..730776d57 100644 --- a/CryptoPP/luc.h +++ b/lib/cryptopp/luc.h diff --git a/CryptoPP/md2.cpp b/lib/cryptopp/md2.cpp index 41f714b59..41f714b59 100644 --- a/CryptoPP/md2.cpp +++ b/lib/cryptopp/md2.cpp diff --git a/CryptoPP/md2.h b/lib/cryptopp/md2.h index b0837c882..b0837c882 100644 --- a/CryptoPP/md2.h +++ b/lib/cryptopp/md2.h diff --git a/CryptoPP/md4.cpp b/lib/cryptopp/md4.cpp index 9ed639cb9..9ed639cb9 100644 --- a/CryptoPP/md4.cpp +++ b/lib/cryptopp/md4.cpp diff --git a/CryptoPP/md4.h b/lib/cryptopp/md4.h index 53387003c..53387003c 100644 --- a/CryptoPP/md4.h +++ b/lib/cryptopp/md4.h diff --git a/CryptoPP/md5.cpp b/lib/cryptopp/md5.cpp index a52297816..a52297816 100644 --- a/CryptoPP/md5.cpp +++ b/lib/cryptopp/md5.cpp diff --git a/CryptoPP/md5.h b/lib/cryptopp/md5.h index 73ec5326c..73ec5326c 100644 --- a/CryptoPP/md5.h +++ b/lib/cryptopp/md5.h diff --git a/CryptoPP/mdc.h b/lib/cryptopp/mdc.h index cc90cdc45..cc90cdc45 100644 --- a/CryptoPP/mdc.h +++ b/lib/cryptopp/mdc.h diff --git a/CryptoPP/misc.cpp b/lib/cryptopp/misc.cpp index 93760e3a3..93760e3a3 100644 --- a/CryptoPP/misc.cpp +++ b/lib/cryptopp/misc.cpp diff --git a/CryptoPP/misc.h b/lib/cryptopp/misc.h index 2b326dd60..2b326dd60 100644 --- a/CryptoPP/misc.h +++ b/lib/cryptopp/misc.h diff --git a/CryptoPP/modarith.h b/lib/cryptopp/modarith.h index c0368e3fb..c0368e3fb 100644 --- a/CryptoPP/modarith.h +++ b/lib/cryptopp/modarith.h diff --git a/CryptoPP/modes.cpp b/lib/cryptopp/modes.cpp index 46332284b..46332284b 100644 --- a/CryptoPP/modes.cpp +++ b/lib/cryptopp/modes.cpp diff --git a/CryptoPP/modes.h b/lib/cryptopp/modes.h index c0c30c476..c0c30c476 100644 --- a/CryptoPP/modes.h +++ b/lib/cryptopp/modes.h diff --git a/CryptoPP/modexppc.h b/lib/cryptopp/modexppc.h index fbe701279..fbe701279 100644 --- a/CryptoPP/modexppc.h +++ b/lib/cryptopp/modexppc.h diff --git a/CryptoPP/mqueue.cpp b/lib/cryptopp/mqueue.cpp index 1d645d83d..1d645d83d 100644 --- a/CryptoPP/mqueue.cpp +++ b/lib/cryptopp/mqueue.cpp diff --git a/CryptoPP/mqueue.h b/lib/cryptopp/mqueue.h index efa57a7cf..efa57a7cf 100644 --- a/CryptoPP/mqueue.h +++ b/lib/cryptopp/mqueue.h diff --git a/CryptoPP/mqv.cpp b/lib/cryptopp/mqv.cpp index c427561b2..c427561b2 100644 --- a/CryptoPP/mqv.cpp +++ b/lib/cryptopp/mqv.cpp diff --git a/CryptoPP/mqv.h b/lib/cryptopp/mqv.h index 2683817b0..2683817b0 100644 --- a/CryptoPP/mqv.h +++ b/lib/cryptopp/mqv.h diff --git a/CryptoPP/nbtheory.cpp b/lib/cryptopp/nbtheory.cpp index 3fdea4e69..3fdea4e69 100644 --- a/CryptoPP/nbtheory.cpp +++ b/lib/cryptopp/nbtheory.cpp diff --git a/CryptoPP/nbtheory.h b/lib/cryptopp/nbtheory.h index 636479269..636479269 100644 --- a/CryptoPP/nbtheory.h +++ b/lib/cryptopp/nbtheory.h diff --git a/CryptoPP/network.cpp b/lib/cryptopp/network.cpp index 9b7198d16..9b7198d16 100644 --- a/CryptoPP/network.cpp +++ b/lib/cryptopp/network.cpp diff --git a/CryptoPP/network.h b/lib/cryptopp/network.h index 96cd4567e..96cd4567e 100644 --- a/CryptoPP/network.h +++ b/lib/cryptopp/network.h diff --git a/CryptoPP/nr.h b/lib/cryptopp/nr.h index c398e3550..c398e3550 100644 --- a/CryptoPP/nr.h +++ b/lib/cryptopp/nr.h diff --git a/CryptoPP/oaep.cpp b/lib/cryptopp/oaep.cpp index 1d474be52..1d474be52 100644 --- a/CryptoPP/oaep.cpp +++ b/lib/cryptopp/oaep.cpp diff --git a/CryptoPP/oaep.h b/lib/cryptopp/oaep.h index 4bf6b0d83..4bf6b0d83 100644 --- a/CryptoPP/oaep.h +++ b/lib/cryptopp/oaep.h diff --git a/CryptoPP/oids.h b/lib/cryptopp/oids.h index 8b1030150..8b1030150 100644 --- a/CryptoPP/oids.h +++ b/lib/cryptopp/oids.h diff --git a/CryptoPP/osrng.cpp b/lib/cryptopp/osrng.cpp index 76e486b4e..76e486b4e 100644 --- a/CryptoPP/osrng.cpp +++ b/lib/cryptopp/osrng.cpp diff --git a/CryptoPP/osrng.h b/lib/cryptopp/osrng.h index ae07d057b..ae07d057b 100644 --- a/CryptoPP/osrng.h +++ b/lib/cryptopp/osrng.h diff --git a/CryptoPP/pch.cpp b/lib/cryptopp/pch.cpp index 1d9f38c57..1d9f38c57 100644 --- a/CryptoPP/pch.cpp +++ b/lib/cryptopp/pch.cpp diff --git a/CryptoPP/pch.h b/lib/cryptopp/pch.h index 418c39076..418c39076 100644 --- a/CryptoPP/pch.h +++ b/lib/cryptopp/pch.h diff --git a/CryptoPP/pkcspad.cpp b/lib/cryptopp/pkcspad.cpp index e1f1d1e23..e1f1d1e23 100644 --- a/CryptoPP/pkcspad.cpp +++ b/lib/cryptopp/pkcspad.cpp diff --git a/CryptoPP/pkcspad.h b/lib/cryptopp/pkcspad.h index 6371c7698..6371c7698 100644 --- a/CryptoPP/pkcspad.h +++ b/lib/cryptopp/pkcspad.h diff --git a/CryptoPP/polynomi.cpp b/lib/cryptopp/polynomi.cpp index 734cae926..734cae926 100644 --- a/CryptoPP/polynomi.cpp +++ b/lib/cryptopp/polynomi.cpp diff --git a/CryptoPP/polynomi.h b/lib/cryptopp/polynomi.h index cddadaeaf..cddadaeaf 100644 --- a/CryptoPP/polynomi.h +++ b/lib/cryptopp/polynomi.h diff --git a/CryptoPP/pssr.cpp b/lib/cryptopp/pssr.cpp index ccbe4ee27..ccbe4ee27 100644 --- a/CryptoPP/pssr.cpp +++ b/lib/cryptopp/pssr.cpp diff --git a/CryptoPP/pssr.h b/lib/cryptopp/pssr.h index 6ec6936e5..6ec6936e5 100644 --- a/CryptoPP/pssr.h +++ b/lib/cryptopp/pssr.h diff --git a/CryptoPP/pubkey.cpp b/lib/cryptopp/pubkey.cpp index 1159e5343..1159e5343 100644 --- a/CryptoPP/pubkey.cpp +++ b/lib/cryptopp/pubkey.cpp diff --git a/CryptoPP/pubkey.h b/lib/cryptopp/pubkey.h index 3a3f3bcde..3a3f3bcde 100644 --- a/CryptoPP/pubkey.h +++ b/lib/cryptopp/pubkey.h diff --git a/CryptoPP/pwdbased.h b/lib/cryptopp/pwdbased.h index f755724b1..f755724b1 100644 --- a/CryptoPP/pwdbased.h +++ b/lib/cryptopp/pwdbased.h diff --git a/CryptoPP/queue.cpp b/lib/cryptopp/queue.cpp index ff2f0d316..ff2f0d316 100644 --- a/CryptoPP/queue.cpp +++ b/lib/cryptopp/queue.cpp diff --git a/CryptoPP/queue.h b/lib/cryptopp/queue.h index ab89dbdf1..ab89dbdf1 100644 --- a/CryptoPP/queue.h +++ b/lib/cryptopp/queue.h diff --git a/CryptoPP/rabin.cpp b/lib/cryptopp/rabin.cpp index d496333b5..d496333b5 100644 --- a/CryptoPP/rabin.cpp +++ b/lib/cryptopp/rabin.cpp diff --git a/CryptoPP/rabin.h b/lib/cryptopp/rabin.h index 1c9bcbb49..1c9bcbb49 100644 --- a/CryptoPP/rabin.h +++ b/lib/cryptopp/rabin.h diff --git a/CryptoPP/randpool.cpp b/lib/cryptopp/randpool.cpp index a063c8996..a063c8996 100644 --- a/CryptoPP/randpool.cpp +++ b/lib/cryptopp/randpool.cpp diff --git a/CryptoPP/randpool.h b/lib/cryptopp/randpool.h index c25bc9bb1..c25bc9bb1 100644 --- a/CryptoPP/randpool.h +++ b/lib/cryptopp/randpool.h diff --git a/CryptoPP/rdtables.cpp b/lib/cryptopp/rdtables.cpp index 493793252..493793252 100644 --- a/CryptoPP/rdtables.cpp +++ b/lib/cryptopp/rdtables.cpp diff --git a/CryptoPP/resource.h b/lib/cryptopp/resource.h index 861e22ba3..861e22ba3 100644 --- a/CryptoPP/resource.h +++ b/lib/cryptopp/resource.h diff --git a/CryptoPP/rijndael.cpp b/lib/cryptopp/rijndael.cpp index c185032cf..c185032cf 100644 --- a/CryptoPP/rijndael.cpp +++ b/lib/cryptopp/rijndael.cpp diff --git a/CryptoPP/rijndael.h b/lib/cryptopp/rijndael.h index 64c784b07..64c784b07 100644 --- a/CryptoPP/rijndael.h +++ b/lib/cryptopp/rijndael.h diff --git a/CryptoPP/rng.cpp b/lib/cryptopp/rng.cpp index 9866cd831..9866cd831 100644 --- a/CryptoPP/rng.cpp +++ b/lib/cryptopp/rng.cpp diff --git a/CryptoPP/rng.h b/lib/cryptopp/rng.h index 2439dee69..2439dee69 100644 --- a/CryptoPP/rng.h +++ b/lib/cryptopp/rng.h diff --git a/CryptoPP/rsa.cpp b/lib/cryptopp/rsa.cpp index 59449c40e..59449c40e 100644 --- a/CryptoPP/rsa.cpp +++ b/lib/cryptopp/rsa.cpp diff --git a/CryptoPP/rsa.h b/lib/cryptopp/rsa.h index 6a8b18525..6a8b18525 100644 --- a/CryptoPP/rsa.h +++ b/lib/cryptopp/rsa.h diff --git a/CryptoPP/rw.cpp b/lib/cryptopp/rw.cpp index cdd9f2d22..cdd9f2d22 100644 --- a/CryptoPP/rw.cpp +++ b/lib/cryptopp/rw.cpp diff --git a/CryptoPP/rw.h b/lib/cryptopp/rw.h index 6820251e8..6820251e8 100644 --- a/CryptoPP/rw.h +++ b/lib/cryptopp/rw.h diff --git a/CryptoPP/safer.cpp b/lib/cryptopp/safer.cpp index d46ca6417..d46ca6417 100644 --- a/CryptoPP/safer.cpp +++ b/lib/cryptopp/safer.cpp diff --git a/CryptoPP/safer.h b/lib/cryptopp/safer.h index f9a3c9e1f..f9a3c9e1f 100644 --- a/CryptoPP/safer.h +++ b/lib/cryptopp/safer.h diff --git a/CryptoPP/seal.cpp b/lib/cryptopp/seal.cpp index f49b52203..f49b52203 100644 --- a/CryptoPP/seal.cpp +++ b/lib/cryptopp/seal.cpp diff --git a/CryptoPP/seal.h b/lib/cryptopp/seal.h index e14ae1caf..e14ae1caf 100644 --- a/CryptoPP/seal.h +++ b/lib/cryptopp/seal.h diff --git a/CryptoPP/secblock.h b/lib/cryptopp/secblock.h index 40cce3341..40cce3341 100644 --- a/CryptoPP/secblock.h +++ b/lib/cryptopp/secblock.h diff --git a/CryptoPP/seckey.h b/lib/cryptopp/seckey.h index 35046a61b..35046a61b 100644 --- a/CryptoPP/seckey.h +++ b/lib/cryptopp/seckey.h diff --git a/CryptoPP/seed.cpp b/lib/cryptopp/seed.cpp index 101902dce..101902dce 100644 --- a/CryptoPP/seed.cpp +++ b/lib/cryptopp/seed.cpp diff --git a/CryptoPP/seed.h b/lib/cryptopp/seed.h index 871284de7..871284de7 100644 --- a/CryptoPP/seed.h +++ b/lib/cryptopp/seed.h diff --git a/CryptoPP/sha.cpp b/lib/cryptopp/sha.cpp index df947ad16..df947ad16 100644 --- a/CryptoPP/sha.cpp +++ b/lib/cryptopp/sha.cpp diff --git a/CryptoPP/sha.h b/lib/cryptopp/sha.h index 679081e8f..679081e8f 100644 --- a/CryptoPP/sha.h +++ b/lib/cryptopp/sha.h diff --git a/CryptoPP/shacal2.cpp b/lib/cryptopp/shacal2.cpp index b0360e404..b0360e404 100644 --- a/CryptoPP/shacal2.cpp +++ b/lib/cryptopp/shacal2.cpp diff --git a/CryptoPP/shacal2.h b/lib/cryptopp/shacal2.h index 66c987fd7..66c987fd7 100644 --- a/CryptoPP/shacal2.h +++ b/lib/cryptopp/shacal2.h diff --git a/CryptoPP/simple.cpp b/lib/cryptopp/simple.cpp index 96f256b40..96f256b40 100644 --- a/CryptoPP/simple.cpp +++ b/lib/cryptopp/simple.cpp diff --git a/CryptoPP/simple.h b/lib/cryptopp/simple.h index 35fd65ae4..35fd65ae4 100644 --- a/CryptoPP/simple.h +++ b/lib/cryptopp/simple.h diff --git a/CryptoPP/smartptr.h b/lib/cryptopp/smartptr.h index a0a727edc..a0a727edc 100644 --- a/CryptoPP/smartptr.h +++ b/lib/cryptopp/smartptr.h diff --git a/CryptoPP/socketft.cpp b/lib/cryptopp/socketft.cpp index 6c5a8ff9d..6c5a8ff9d 100644 --- a/CryptoPP/socketft.cpp +++ b/lib/cryptopp/socketft.cpp diff --git a/CryptoPP/socketft.h b/lib/cryptopp/socketft.h index e414aa68f..e414aa68f 100644 --- a/CryptoPP/socketft.h +++ b/lib/cryptopp/socketft.h diff --git a/CryptoPP/square.cpp b/lib/cryptopp/square.cpp index 00e6bddbe..00e6bddbe 100644 --- a/CryptoPP/square.cpp +++ b/lib/cryptopp/square.cpp diff --git a/CryptoPP/square.h b/lib/cryptopp/square.h index d7e23c284..d7e23c284 100644 --- a/CryptoPP/square.h +++ b/lib/cryptopp/square.h diff --git a/CryptoPP/squaretb.cpp b/lib/cryptopp/squaretb.cpp index bc3bee7df..bc3bee7df 100644 --- a/CryptoPP/squaretb.cpp +++ b/lib/cryptopp/squaretb.cpp diff --git a/CryptoPP/stdcpp.h b/lib/cryptopp/stdcpp.h index 6511c4fa2..6511c4fa2 100644 --- a/CryptoPP/stdcpp.h +++ b/lib/cryptopp/stdcpp.h diff --git a/CryptoPP/strciphr.cpp b/lib/cryptopp/strciphr.cpp index 53e007376..53e007376 100644 --- a/CryptoPP/strciphr.cpp +++ b/lib/cryptopp/strciphr.cpp diff --git a/CryptoPP/strciphr.h b/lib/cryptopp/strciphr.h index d1d11a17b..d1d11a17b 100644 --- a/CryptoPP/strciphr.h +++ b/lib/cryptopp/strciphr.h diff --git a/CryptoPP/tea.cpp b/lib/cryptopp/tea.cpp index b1fb6f140..b1fb6f140 100644 --- a/CryptoPP/tea.cpp +++ b/lib/cryptopp/tea.cpp diff --git a/CryptoPP/tea.h b/lib/cryptopp/tea.h index d8ddded86..d8ddded86 100644 --- a/CryptoPP/tea.h +++ b/lib/cryptopp/tea.h diff --git a/CryptoPP/tiger.cpp b/lib/cryptopp/tiger.cpp index c6c05caed..c6c05caed 100644 --- a/CryptoPP/tiger.cpp +++ b/lib/cryptopp/tiger.cpp diff --git a/CryptoPP/tiger.h b/lib/cryptopp/tiger.h index 5f6e941ac..5f6e941ac 100644 --- a/CryptoPP/tiger.h +++ b/lib/cryptopp/tiger.h diff --git a/CryptoPP/tigertab.cpp b/lib/cryptopp/tigertab.cpp index 5c1595b5b..5c1595b5b 100644 --- a/CryptoPP/tigertab.cpp +++ b/lib/cryptopp/tigertab.cpp diff --git a/CryptoPP/trdlocal.cpp b/lib/cryptopp/trdlocal.cpp index 6d6b822c0..6d6b822c0 100644 --- a/CryptoPP/trdlocal.cpp +++ b/lib/cryptopp/trdlocal.cpp diff --git a/CryptoPP/trdlocal.h b/lib/cryptopp/trdlocal.h index 92d244a0a..92d244a0a 100644 --- a/CryptoPP/trdlocal.h +++ b/lib/cryptopp/trdlocal.h diff --git a/CryptoPP/trunhash.h b/lib/cryptopp/trunhash.h index c1c4e9b64..c1c4e9b64 100644 --- a/CryptoPP/trunhash.h +++ b/lib/cryptopp/trunhash.h diff --git a/CryptoPP/ttmac.cpp b/lib/cryptopp/ttmac.cpp index d4ff38104..d4ff38104 100644 --- a/CryptoPP/ttmac.cpp +++ b/lib/cryptopp/ttmac.cpp diff --git a/CryptoPP/ttmac.h b/lib/cryptopp/ttmac.h index b4bf86e26..b4bf86e26 100644 --- a/CryptoPP/ttmac.h +++ b/lib/cryptopp/ttmac.h diff --git a/CryptoPP/validate.h b/lib/cryptopp/validate.h index 0ab23cba3..0ab23cba3 100644 --- a/CryptoPP/validate.h +++ b/lib/cryptopp/validate.h diff --git a/CryptoPP/vmac.cpp b/lib/cryptopp/vmac.cpp index 6b490f904..6b490f904 100644 --- a/CryptoPP/vmac.cpp +++ b/lib/cryptopp/vmac.cpp diff --git a/CryptoPP/vmac.h b/lib/cryptopp/vmac.h index 07240173c..07240173c 100644 --- a/CryptoPP/vmac.h +++ b/lib/cryptopp/vmac.h diff --git a/CryptoPP/wait.cpp b/lib/cryptopp/wait.cpp index 198785838..198785838 100644 --- a/CryptoPP/wait.cpp +++ b/lib/cryptopp/wait.cpp diff --git a/CryptoPP/wait.h b/lib/cryptopp/wait.h index 045afbc18..045afbc18 100644 --- a/CryptoPP/wait.h +++ b/lib/cryptopp/wait.h diff --git a/CryptoPP/winpipes.cpp b/lib/cryptopp/winpipes.cpp index 1c2e047b0..1c2e047b0 100644 --- a/CryptoPP/winpipes.cpp +++ b/lib/cryptopp/winpipes.cpp diff --git a/CryptoPP/winpipes.h b/lib/cryptopp/winpipes.h index 07225f9f1..07225f9f1 100644 --- a/CryptoPP/winpipes.h +++ b/lib/cryptopp/winpipes.h diff --git a/CryptoPP/words.h b/lib/cryptopp/words.h index d5fda71da..d5fda71da 100644 --- a/CryptoPP/words.h +++ b/lib/cryptopp/words.h diff --git a/expat/ascii.h b/lib/expat/ascii.h index d10530b09..d10530b09 100644 --- a/expat/ascii.h +++ b/lib/expat/ascii.h diff --git a/expat/asciitab.h b/lib/expat/asciitab.h index 79a15c28c..79a15c28c 100644 --- a/expat/asciitab.h +++ b/lib/expat/asciitab.h diff --git a/expat/expat.h b/lib/expat/expat.h index 20a8278f7..20a8278f7 100644 --- a/expat/expat.h +++ b/lib/expat/expat.h diff --git a/expat/expat_external.h b/lib/expat/expat_external.h index 2c03284ea..2c03284ea 100644 --- a/expat/expat_external.h +++ b/lib/expat/expat_external.h diff --git a/expat/iasciitab.h b/lib/expat/iasciitab.h index 24a1d5ccc..24a1d5ccc 100644 --- a/expat/iasciitab.h +++ b/lib/expat/iasciitab.h diff --git a/expat/internal.h b/lib/expat/internal.h index dd5454831..dd5454831 100644 --- a/expat/internal.h +++ b/lib/expat/internal.h diff --git a/expat/latin1tab.h b/lib/expat/latin1tab.h index 53c25d76b..53c25d76b 100644 --- a/expat/latin1tab.h +++ b/lib/expat/latin1tab.h diff --git a/expat/nametab.h b/lib/expat/nametab.h index b05e62c77..b05e62c77 100644 --- a/expat/nametab.h +++ b/lib/expat/nametab.h diff --git a/expat/utf8tab.h b/lib/expat/utf8tab.h index 7bb3e7760..7bb3e7760 100644 --- a/expat/utf8tab.h +++ b/lib/expat/utf8tab.h diff --git a/expat/winconfig.h b/lib/expat/winconfig.h index c1b791d62..c1b791d62 100644 --- a/expat/winconfig.h +++ b/lib/expat/winconfig.h diff --git a/expat/xmlparse.c b/lib/expat/xmlparse.c index 115b42127..115b42127 100644 --- a/expat/xmlparse.c +++ b/lib/expat/xmlparse.c diff --git a/expat/xmlrole.c b/lib/expat/xmlrole.c index 55cba6429..55cba6429 100644 --- a/expat/xmlrole.c +++ b/lib/expat/xmlrole.c diff --git a/expat/xmlrole.h b/lib/expat/xmlrole.h index 4dd9f06f9..4dd9f06f9 100644 --- a/expat/xmlrole.h +++ b/lib/expat/xmlrole.h diff --git a/expat/xmltok.c b/lib/expat/xmltok.c index c23b348eb..c23b348eb 100644 --- a/expat/xmltok.c +++ b/lib/expat/xmltok.c diff --git a/expat/xmltok.h b/lib/expat/xmltok.h index ca867aa6b..ca867aa6b 100644 --- a/expat/xmltok.h +++ b/lib/expat/xmltok.h diff --git a/expat/xmltok_impl.c b/lib/expat/xmltok_impl.c index 5fa578a43..5fa578a43 100644 --- a/expat/xmltok_impl.c +++ b/lib/expat/xmltok_impl.c diff --git a/expat/xmltok_impl.h b/lib/expat/xmltok_impl.h index da0ea60a6..da0ea60a6 100644 --- a/expat/xmltok_impl.h +++ b/lib/expat/xmltok_impl.h diff --git a/expat/xmltok_ns.c b/lib/expat/xmltok_ns.c index 5afdfbe5c..5afdfbe5c 100644 --- a/expat/xmltok_ns.c +++ b/lib/expat/xmltok_ns.c diff --git a/iniFile/iniFile.cpp b/lib/inifile/iniFile.cpp index da523e783..da523e783 100644 --- a/iniFile/iniFile.cpp +++ b/lib/inifile/iniFile.cpp diff --git a/iniFile/iniFile.h b/lib/inifile/iniFile.h index 83d961fc6..83d961fc6 100644 --- a/iniFile/iniFile.h +++ b/lib/inifile/iniFile.h diff --git a/jsoncpp-src-0.5.0/include/json/autolink.h b/lib/jsoncpp/include/json/autolink.h index 37c9258ed..37c9258ed 100644 --- a/jsoncpp-src-0.5.0/include/json/autolink.h +++ b/lib/jsoncpp/include/json/autolink.h diff --git a/jsoncpp-src-0.5.0/include/json/config.h b/lib/jsoncpp/include/json/config.h index 5d334cbc5..5d334cbc5 100644 --- a/jsoncpp-src-0.5.0/include/json/config.h +++ b/lib/jsoncpp/include/json/config.h diff --git a/jsoncpp-src-0.5.0/include/json/features.h b/lib/jsoncpp/include/json/features.h index 5a9adec11..5a9adec11 100644 --- a/jsoncpp-src-0.5.0/include/json/features.h +++ b/lib/jsoncpp/include/json/features.h diff --git a/jsoncpp-src-0.5.0/include/json/forwards.h b/lib/jsoncpp/include/json/forwards.h index d0ce8300c..d0ce8300c 100644 --- a/jsoncpp-src-0.5.0/include/json/forwards.h +++ b/lib/jsoncpp/include/json/forwards.h diff --git a/jsoncpp-src-0.5.0/include/json/json.h b/lib/jsoncpp/include/json/json.h index c71ed65ab..c71ed65ab 100644 --- a/jsoncpp-src-0.5.0/include/json/json.h +++ b/lib/jsoncpp/include/json/json.h diff --git a/jsoncpp-src-0.5.0/include/json/reader.h b/lib/jsoncpp/include/json/reader.h index ee1d6a244..ee1d6a244 100644 --- a/jsoncpp-src-0.5.0/include/json/reader.h +++ b/lib/jsoncpp/include/json/reader.h diff --git a/jsoncpp-src-0.5.0/include/json/value.h b/lib/jsoncpp/include/json/value.h index 58bfd88e7..58bfd88e7 100644 --- a/jsoncpp-src-0.5.0/include/json/value.h +++ b/lib/jsoncpp/include/json/value.h diff --git a/jsoncpp-src-0.5.0/include/json/writer.h b/lib/jsoncpp/include/json/writer.h index 5f4b83be4..5f4b83be4 100644 --- a/jsoncpp-src-0.5.0/include/json/writer.h +++ b/lib/jsoncpp/include/json/writer.h diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_batchallocator.h b/lib/jsoncpp/src/lib_json/json_batchallocator.h index 87ea5ed80..87ea5ed80 100644 --- a/jsoncpp-src-0.5.0/src/lib_json/json_batchallocator.h +++ b/lib/jsoncpp/src/lib_json/json_batchallocator.h diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_internalarray.inl b/lib/jsoncpp/src/lib_json/json_internalarray.inl index 9b985d258..9b985d258 100644 --- a/jsoncpp-src-0.5.0/src/lib_json/json_internalarray.inl +++ b/lib/jsoncpp/src/lib_json/json_internalarray.inl diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_internalmap.inl b/lib/jsoncpp/src/lib_json/json_internalmap.inl index 19771488d..19771488d 100644 --- a/jsoncpp-src-0.5.0/src/lib_json/json_internalmap.inl +++ b/lib/jsoncpp/src/lib_json/json_internalmap.inl diff --git a/lib/jsoncpp/src/lib_json/json_reader.cpp b/lib/jsoncpp/src/lib_json/json_reader.cpp new file mode 100644 index 000000000..e9d6b88d2 --- /dev/null +++ b/lib/jsoncpp/src/lib_json/json_reader.cpp @@ -0,0 +1,885 @@ +#include "../../include/json/reader.h" +#include "../../include/json/value.h" +#include <utility> +#include <cstdio> +#include <cassert> +#include <cstring> +#include <iostream> +#include <stdexcept> + +#if _MSC_VER >= 1400 // VC++ 8.0 +#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated. +#endif + +namespace Json { + +// Implementation of class Features +// //////////////////////////////// + +Features::Features() + : allowComments_( true ) + , strictRoot_( false ) +{ +} + + +Features +Features::all() +{ + return Features(); +} + + +Features +Features::strictMode() +{ + Features features; + features.allowComments_ = false; + features.strictRoot_ = true; + return features; +} + +// Implementation of class Reader +// //////////////////////////////// + + +static inline bool +in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4 ) +{ + return c == c1 || c == c2 || c == c3 || c == c4; +} + +static inline bool +in( Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4, Reader::Char c5 ) +{ + return c == c1 || c == c2 || c == c3 || c == c4 || c == c5; +} + + +static bool +containsNewLine( Reader::Location begin, + Reader::Location end ) +{ + for ( ;begin < end; ++begin ) + if ( *begin == '\n' || *begin == '\r' ) + return true; + return false; +} + +static std::string codePointToUTF8(unsigned int cp) +{ + std::string result; + + // based on description from http://en.wikipedia.org/wiki/UTF-8 + + if (cp <= 0x7f) + { + result.resize(1); + result[0] = static_cast<char>(cp); + } + else if (cp <= 0x7FF) + { + result.resize(2); + result[1] = static_cast<char>(0x80 | (0x3f & cp)); + result[0] = static_cast<char>(0xC0 | (0x1f & (cp >> 6))); + } + else if (cp <= 0xFFFF) + { + result.resize(3); + result[2] = static_cast<char>(0x80 | (0x3f & cp)); + result[1] = 0x80 | static_cast<char>((0x3f & (cp >> 6))); + result[0] = 0xE0 | static_cast<char>((0xf & (cp >> 12))); + } + else if (cp <= 0x10FFFF) + { + result.resize(4); + result[3] = static_cast<char>(0x80 | (0x3f & cp)); + result[2] = static_cast<char>(0x80 | (0x3f & (cp >> 6))); + result[1] = static_cast<char>(0x80 | (0x3f & (cp >> 12))); + result[0] = static_cast<char>(0xF0 | (0x7 & (cp >> 18))); + } + + return result; +} + + +// Class Reader +// ////////////////////////////////////////////////////////////////// + +Reader::Reader() + : features_( Features::all() ) +{ +} + + +Reader::Reader( const Features &features ) + : features_( features ) +{ +} + + +bool +Reader::parse( const std::string &document, + Value &root, + bool collectComments ) +{ + document_ = document; + const char *begin = document_.c_str(); + const char *end = begin + document_.length(); + return parse( begin, end, root, collectComments ); +} + + +bool +Reader::parse( std::istream& sin, + Value &root, + bool collectComments ) +{ + //std::istream_iterator<char> begin(sin); + //std::istream_iterator<char> end; + // Those would allow streamed input from a file, if parse() were a + // template function. + + // Since std::string is reference-counted, this at least does not + // create an extra copy. + std::string doc; + std::getline(sin, doc, (char)EOF); + return parse( doc, root, collectComments ); +} + +bool +Reader::parse( const char *beginDoc, const char *endDoc, + Value &root, + bool collectComments ) +{ + if ( !features_.allowComments_ ) + { + collectComments = false; + } + + begin_ = beginDoc; + end_ = endDoc; + collectComments_ = collectComments; + current_ = begin_; + lastValueEnd_ = 0; + lastValue_ = 0; + commentsBefore_ = ""; + errors_.clear(); + while ( !nodes_.empty() ) + nodes_.pop(); + nodes_.push( &root ); + + bool successful = readValue(); + Token token; + skipCommentTokens( token ); + if ( collectComments_ && !commentsBefore_.empty() ) + root.setComment( commentsBefore_, commentAfter ); + if ( features_.strictRoot_ ) + { + if ( !root.isArray() && !root.isObject() ) + { + // Set error location to start of doc, ideally should be first token found in doc + token.type_ = tokenError; + token.start_ = beginDoc; + token.end_ = endDoc; + addError( "A valid JSON document must be either an array or an object value.", + token ); + return false; + } + } + return successful; +} + + +bool +Reader::readValue() +{ + Token token; + skipCommentTokens( token ); + bool successful = true; + + if ( collectComments_ && !commentsBefore_.empty() ) + { + currentValue().setComment( commentsBefore_, commentBefore ); + commentsBefore_ = ""; + } + + + switch ( token.type_ ) + { + case tokenObjectBegin: + successful = readObject( token ); + break; + case tokenArrayBegin: + successful = readArray( token ); + break; + case tokenNumber: + successful = decodeNumber( token ); + break; + case tokenString: + successful = decodeString( token ); + break; + case tokenTrue: + currentValue() = true; + break; + case tokenFalse: + currentValue() = false; + break; + case tokenNull: + currentValue() = Value(); + break; + default: + return addError( "Syntax error: value, object or array expected.", token ); + } + + if ( collectComments_ ) + { + lastValueEnd_ = current_; + lastValue_ = ¤tValue(); + } + + return successful; +} + + +void +Reader::skipCommentTokens( Token &token ) +{ + if ( features_.allowComments_ ) + { + do + { + readToken( token ); + } + while ( token.type_ == tokenComment ); + } + else + { + readToken( token ); + } +} + + +bool +Reader::expectToken( TokenType type, Token &token, const char *message ) +{ + readToken( token ); + if ( token.type_ != type ) + return addError( message, token ); + return true; +} + + +bool +Reader::readToken( Token &token ) +{ + skipSpaces(); + token.start_ = current_; + Char c = getNextChar(); + bool ok = true; + switch ( c ) + { + case '{': + token.type_ = tokenObjectBegin; + break; + case '}': + token.type_ = tokenObjectEnd; + break; + case '[': + token.type_ = tokenArrayBegin; + break; + case ']': + token.type_ = tokenArrayEnd; + break; + case '"': + token.type_ = tokenString; + ok = readString(); + break; + case '/': + token.type_ = tokenComment; + ok = readComment(); + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + case '-': + token.type_ = tokenNumber; + readNumber(); + break; + case 't': + token.type_ = tokenTrue; + ok = match( "rue", 3 ); + break; + case 'f': + token.type_ = tokenFalse; + ok = match( "alse", 4 ); + break; + case 'n': + token.type_ = tokenNull; + ok = match( "ull", 3 ); + break; + case ',': + token.type_ = tokenArraySeparator; + break; + case ':': + token.type_ = tokenMemberSeparator; + break; + case 0: + token.type_ = tokenEndOfStream; + break; + default: + ok = false; + break; + } + if ( !ok ) + token.type_ = tokenError; + token.end_ = current_; + return true; +} + + +void +Reader::skipSpaces() +{ + while ( current_ != end_ ) + { + Char c = *current_; + if ( c == ' ' || c == '\t' || c == '\r' || c == '\n' ) + ++current_; + else + break; + } +} + + +bool +Reader::match( Location pattern, + int patternLength ) +{ + if ( end_ - current_ < patternLength ) + return false; + int index = patternLength; + while ( index-- ) + if ( current_[index] != pattern[index] ) + return false; + current_ += patternLength; + return true; +} + + +bool +Reader::readComment() +{ + Location commentBegin = current_ - 1; + Char c = getNextChar(); + bool successful = false; + if ( c == '*' ) + successful = readCStyleComment(); + else if ( c == '/' ) + successful = readCppStyleComment(); + if ( !successful ) + return false; + + if ( collectComments_ ) + { + CommentPlacement placement = commentBefore; + if ( lastValueEnd_ && !containsNewLine( lastValueEnd_, commentBegin ) ) + { + if ( c != '*' || !containsNewLine( commentBegin, current_ ) ) + placement = commentAfterOnSameLine; + } + + addComment( commentBegin, current_, placement ); + } + return true; +} + + +void +Reader::addComment( Location begin, + Location end, + CommentPlacement placement ) +{ + assert( collectComments_ ); + if ( placement == commentAfterOnSameLine ) + { + assert( lastValue_ != 0 ); + lastValue_->setComment( std::string( begin, end ), placement ); + } + else + { + if ( !commentsBefore_.empty() ) + commentsBefore_ += "\n"; + commentsBefore_ += std::string( begin, end ); + } +} + + +bool +Reader::readCStyleComment() +{ + while ( current_ != end_ ) + { + Char c = getNextChar(); + if ( c == '*' && *current_ == '/' ) + break; + } + return getNextChar() == '/'; +} + + +bool +Reader::readCppStyleComment() +{ + while ( current_ != end_ ) + { + Char c = getNextChar(); + if ( c == '\r' || c == '\n' ) + break; + } + return true; +} + + +void +Reader::readNumber() +{ + while ( current_ != end_ ) + { + if ( !(*current_ >= '0' && *current_ <= '9') && + !in( *current_, '.', 'e', 'E', '+', '-' ) ) + break; + ++current_; + } +} + +bool +Reader::readString() +{ + Char c = 0; + while ( current_ != end_ ) + { + c = getNextChar(); + if ( c == '\\' ) + getNextChar(); + else if ( c == '"' ) + break; + } + return c == '"'; +} + + +bool +Reader::readObject( Token &tokenStart ) +{ + Token tokenName; + std::string name; + currentValue() = Value( objectValue ); + while ( readToken( tokenName ) ) + { + bool initialTokenOk = true; + while ( tokenName.type_ == tokenComment && initialTokenOk ) + initialTokenOk = readToken( tokenName ); + if ( !initialTokenOk ) + break; + if ( tokenName.type_ == tokenObjectEnd && name.empty() ) // empty object + return true; + if ( tokenName.type_ != tokenString ) + break; + + name = ""; + if ( !decodeString( tokenName, name ) ) + return recoverFromError( tokenObjectEnd ); + + Token colon; + if ( !readToken( colon ) || colon.type_ != tokenMemberSeparator ) + { + return addErrorAndRecover( "Missing ':' after object member name", + colon, + tokenObjectEnd ); + } + Value &value = currentValue()[ name ]; + nodes_.push( &value ); + bool ok = readValue(); + nodes_.pop(); + if ( !ok ) // error already set + return recoverFromError( tokenObjectEnd ); + + Token comma; + if ( !readToken( comma ) + || ( comma.type_ != tokenObjectEnd && + comma.type_ != tokenArraySeparator && + comma.type_ != tokenComment ) ) + { + return addErrorAndRecover( "Missing ',' or '}' in object declaration", + comma, + tokenObjectEnd ); + } + bool finalizeTokenOk = true; + while ( comma.type_ == tokenComment && + finalizeTokenOk ) + finalizeTokenOk = readToken( comma ); + if ( comma.type_ == tokenObjectEnd ) + return true; + } + return addErrorAndRecover( "Missing '}' or object member name", + tokenName, + tokenObjectEnd ); +} + + +bool +Reader::readArray( Token &tokenStart ) +{ + currentValue() = Value( arrayValue ); + skipSpaces(); + if ( *current_ == ']' ) // empty array + { + Token endArray; + readToken( endArray ); + return true; + } + int index = 0; + while ( true ) + { + Value &value = currentValue()[ index++ ]; + nodes_.push( &value ); + bool ok = readValue(); + nodes_.pop(); + if ( !ok ) // error already set + return recoverFromError( tokenArrayEnd ); + + Token token; + // Accept Comment after last item in the array. + ok = readToken( token ); + while ( token.type_ == tokenComment && ok ) + { + ok = readToken( token ); + } + bool badTokenType = ( token.type_ == tokenArraySeparator && + token.type_ == tokenArrayEnd ); + if ( !ok || badTokenType ) + { + return addErrorAndRecover( "Missing ',' or ']' in array declaration", + token, + tokenArrayEnd ); + } + if ( token.type_ == tokenArrayEnd ) + break; + } + return true; +} + + +bool +Reader::decodeNumber( Token &token ) +{ + bool isDouble = false; + for ( Location inspect = token.start_; inspect != token.end_; ++inspect ) + { + isDouble = isDouble + || in( *inspect, '.', 'e', 'E', '+' ) + || ( *inspect == '-' && inspect != token.start_ ); + } + if ( isDouble ) + return decodeDouble( token ); + Location current = token.start_; + bool isNegative = *current == '-'; + if ( isNegative ) + ++current; + Value::UInt threshold = (isNegative ? Value::UInt(-Value::minInt) + : Value::maxUInt) / 10; + Value::UInt value = 0; + while ( current < token.end_ ) + { + Char c = *current++; + if ( c < '0' || c > '9' ) + return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token ); + if ( value >= threshold ) + return decodeDouble( token ); + value = value * 10 + Value::UInt(c - '0'); + } + if ( isNegative ) + currentValue() = -Value::Int( value ); + else if ( value <= Value::UInt(Value::maxInt) ) + currentValue() = Value::Int( value ); + else + currentValue() = value; + return true; +} + + +bool +Reader::decodeDouble( Token &token ) +{ + double value = 0; + const int bufferSize = 32; + int count; + int length = int(token.end_ - token.start_); + if ( length <= bufferSize ) + { + Char buffer[bufferSize]; + memcpy( buffer, token.start_, length ); + buffer[length] = 0; + count = sscanf( buffer, "%lf", &value ); + } + else + { + std::string buffer( token.start_, token.end_ ); + count = sscanf( buffer.c_str(), "%lf", &value ); + } + + if ( count != 1 ) + return addError( "'" + std::string( token.start_, token.end_ ) + "' is not a number.", token ); + currentValue() = value; + return true; +} + + +bool +Reader::decodeString( Token &token ) +{ + std::string decoded; + if ( !decodeString( token, decoded ) ) + return false; + currentValue() = decoded; + return true; +} + + +bool +Reader::decodeString( Token &token, std::string &decoded ) +{ + decoded.reserve( token.end_ - token.start_ - 2 ); + Location current = token.start_ + 1; // skip '"' + Location end = token.end_ - 1; // do not include '"' + while ( current != end ) + { + Char c = *current++; + if ( c == '"' ) + break; + else if ( c == '\\' ) + { + if ( current == end ) + return addError( "Empty escape sequence in string", token, current ); + Char escape = *current++; + switch ( escape ) + { + case '"': decoded += '"'; break; + case '/': decoded += '/'; break; + case '\\': decoded += '\\'; break; + case 'b': decoded += '\b'; break; + case 'f': decoded += '\f'; break; + case 'n': decoded += '\n'; break; + case 'r': decoded += '\r'; break; + case 't': decoded += '\t'; break; + case 'u': + { + unsigned int unicode; + if ( !decodeUnicodeCodePoint( token, current, end, unicode ) ) + return false; + decoded += codePointToUTF8(unicode); + } + break; + default: + return addError( "Bad escape sequence in string", token, current ); + } + } + else + { + decoded += c; + } + } + return true; +} + +bool +Reader::decodeUnicodeCodePoint( Token &token, + Location ¤t, + Location end, + unsigned int &unicode ) +{ + + if ( !decodeUnicodeEscapeSequence( token, current, end, unicode ) ) + return false; + if (unicode >= 0xD800 && unicode <= 0xDBFF) + { + // surrogate pairs + if (end - current < 6) + return addError( "additional six characters expected to parse unicode surrogate pair.", token, current ); + unsigned int surrogatePair; + if (*(current++) == '\\' && *(current++)== 'u') + { + if (decodeUnicodeEscapeSequence( token, current, end, surrogatePair )) + { + unicode = 0x10000 + ((unicode & 0x3FF) << 10) + (surrogatePair & 0x3FF); + } + else + return false; + } + else + return addError( "expecting another \\u token to begin the second half of a unicode surrogate pair", token, current ); + } + return true; +} + +bool +Reader::decodeUnicodeEscapeSequence( Token &token, + Location ¤t, + Location end, + unsigned int &unicode ) +{ + if ( end - current < 4 ) + return addError( "Bad unicode escape sequence in string: four digits expected.", token, current ); + unicode = 0; + for ( int index =0; index < 4; ++index ) + { + Char c = *current++; + unicode *= 16; + if ( c >= '0' && c <= '9' ) + unicode += c - '0'; + else if ( c >= 'a' && c <= 'f' ) + unicode += c - 'a' + 10; + else if ( c >= 'A' && c <= 'F' ) + unicode += c - 'A' + 10; + else + return addError( "Bad unicode escape sequence in string: hexadecimal digit expected.", token, current ); + } + return true; +} + + +bool +Reader::addError( const std::string &message, + Token &token, + Location extra ) +{ + ErrorInfo info; + info.token_ = token; + info.message_ = message; + info.extra_ = extra; + errors_.push_back( info ); + return false; +} + + +bool +Reader::recoverFromError( TokenType skipUntilToken ) +{ + int errorCount = int(errors_.size()); + Token skip; + while ( true ) + { + if ( !readToken(skip) ) + errors_.resize( errorCount ); // discard errors caused by recovery + if ( skip.type_ == skipUntilToken || skip.type_ == tokenEndOfStream ) + break; + } + errors_.resize( errorCount ); + return false; +} + + +bool +Reader::addErrorAndRecover( const std::string &message, + Token &token, + TokenType skipUntilToken ) +{ + addError( message, token ); + return recoverFromError( skipUntilToken ); +} + + +Value & +Reader::currentValue() +{ + return *(nodes_.top()); +} + + +Reader::Char +Reader::getNextChar() +{ + if ( current_ == end_ ) + return 0; + return *current_++; +} + + +void +Reader::getLocationLineAndColumn( Location location, + int &line, + int &column ) const +{ + Location current = begin_; + Location lastLineStart = current; + line = 0; + while ( current < location && current != end_ ) + { + Char c = *current++; + if ( c == '\r' ) + { + if ( *current == '\n' ) + ++current; + lastLineStart = current; + ++line; + } + else if ( c == '\n' ) + { + lastLineStart = current; + ++line; + } + } + // column & line start at 1 + column = int(location - lastLineStart) + 1; + ++line; +} + + +std::string +Reader::getLocationLineAndColumn( Location location ) const +{ + int line, column; + getLocationLineAndColumn( location, line, column ); + char buffer[18+16+16+1]; + sprintf( buffer, "Line %d, Column %d", line, column ); + return buffer; +} + + +std::string +Reader::getFormatedErrorMessages() const +{ + std::string formattedMessage; + for ( Errors::const_iterator itError = errors_.begin(); + itError != errors_.end(); + ++itError ) + { + const ErrorInfo &error = *itError; + formattedMessage += "* " + getLocationLineAndColumn( error.token_.start_ ) + "\n"; + formattedMessage += " " + error.message_ + "\n"; + if ( error.extra_ ) + formattedMessage += "See " + getLocationLineAndColumn( error.extra_ ) + " for detail.\n"; + } + return formattedMessage; +} + +#define JSON_ASSERT( condition ) assert( condition ); +std::istream& operator>>( std::istream &sin, Value &root ) +{ + Json::Reader reader; + bool ok = reader.parse(sin, root, true); + JSON_ASSERT( ok ); + //if (!ok) throw std::runtime_error(reader.getFormatedErrorMessages()); + return sin; +} + + +} // namespace Json diff --git a/lib/jsoncpp/src/lib_json/json_value.cpp b/lib/jsoncpp/src/lib_json/json_value.cpp new file mode 100644 index 000000000..ea033c400 --- /dev/null +++ b/lib/jsoncpp/src/lib_json/json_value.cpp @@ -0,0 +1,1727 @@ +#include <iostream> +#include "../../include/json/json.h" +#include "../../include/json/writer.h" +#include <utility> +#include <stdexcept> +#include <cstring> +#include <cassert> +#ifdef JSON_USE_CPPTL +# include <cpptl/conststring.h> +#endif +#include <cstddef> // size_t +#ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR +# include "json_batchallocator.h" +#endif // #ifndef JSON_USE_SIMPLE_INTERNAL_ALLOCATOR + +#define JSON_ASSERT_UNREACHABLE assert( false ) +#define JSON_ASSERT( condition ) assert( condition ); // @todo <= change this into an exception throw +#define JSON_ASSERT_MESSAGE( condition, message ) if (!( condition )) throw std::runtime_error( message ); + +namespace Json { + +const Value Value::null; +const Int Value::minInt = Int( ~(UInt(-1)/2) ); +const Int Value::maxInt = Int( UInt(-1)/2 ); +const UInt Value::maxUInt = UInt(-1); + +// A "safe" implementation of strdup. Allow null pointer to be passed. +// Also avoid warning on msvc80. +// +//inline char *safeStringDup( const char *czstring ) +//{ +// if ( czstring ) +// { +// const size_t length = (unsigned int)( strlen(czstring) + 1 ); +// char *newString = static_cast<char *>( malloc( length ) ); +// memcpy( newString, czstring, length ); +// return newString; +// } +// return 0; +//} +// +//inline char *safeStringDup( const std::string &str ) +//{ +// if ( !str.empty() ) +// { +// const size_t length = str.length(); +// char *newString = static_cast<char *>( malloc( length + 1 ) ); +// memcpy( newString, str.c_str(), length ); +// newString[length] = 0; +// return newString; +// } +// return 0; +//} + +ValueAllocator::~ValueAllocator() +{ +} + +class DefaultValueAllocator : public ValueAllocator +{ +public: + virtual ~DefaultValueAllocator() + { + } + + virtual char *makeMemberName( const char *memberName ) + { + return duplicateStringValue( memberName ); + } + + virtual void releaseMemberName( char *memberName ) + { + releaseStringValue( memberName ); + } + + virtual char *duplicateStringValue( const char *value, + unsigned int length = unknown ) + { + //@todo invesgate this old optimization + //if ( !value || value[0] == 0 ) + // return 0; + + if ( length == unknown ) + length = (unsigned int)strlen(value); + char *newString = static_cast<char *>( malloc( length + 1 ) ); + memcpy( newString, value, length ); + newString[length] = 0; + return newString; + } + + virtual void releaseStringValue( char *value ) + { + if ( value ) + free( value ); + } +}; + +static ValueAllocator *&valueAllocator() +{ + static DefaultValueAllocator defaultAllocator; + static ValueAllocator *valueAllocator = &defaultAllocator; + return valueAllocator; +} + +static struct DummyValueAllocatorInitializer { + DummyValueAllocatorInitializer() + { + valueAllocator(); // ensure valueAllocator() statics are initialized before main(). + } +} dummyValueAllocatorInitializer; + + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ValueInternals... +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +#ifdef JSON_VALUE_USE_INTERNAL_MAP +# include "json_internalarray.inl" +# include "json_internalmap.inl" +#endif // JSON_VALUE_USE_INTERNAL_MAP + +# include "json_valueiterator.inl" + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::CommentInfo +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + + +Value::CommentInfo::CommentInfo() + : comment_( 0 ) +{ +} + +Value::CommentInfo::~CommentInfo() +{ + if ( comment_ ) + valueAllocator()->releaseStringValue( comment_ ); +} + + +void +Value::CommentInfo::setComment( const char *text ) +{ + if ( comment_ ) + valueAllocator()->releaseStringValue( comment_ ); + JSON_ASSERT( text ); + //JSON_ASSERT_MESSAGE( text[0]=='\0' || text[0]=='/', "Comments must start with /"); + JSON_ASSERT( text[0]=='\0' || text[0]=='/' ); + // It seems that /**/ style comments are acceptable as well. + comment_ = valueAllocator()->duplicateStringValue( text ); +} + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::CZString +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +# ifndef JSON_VALUE_USE_INTERNAL_MAP + +// Notes: index_ indicates if the string was allocated when +// a string is stored. + +Value::CZString::CZString( int index ) + : cstr_( 0 ) + , index_( index ) +{ +} + +Value::CZString::CZString( const char *cstr, DuplicationPolicy allocate ) + : cstr_( allocate == duplicate ? valueAllocator()->makeMemberName(cstr) + : cstr ) + , index_( allocate ) +{ +} + +Value::CZString::CZString( const CZString &other ) +: cstr_( other.index_ != noDuplication && other.cstr_ != 0 + ? valueAllocator()->makeMemberName( other.cstr_ ) + : other.cstr_ ) + , index_( other.cstr_ ? (other.index_ == noDuplication ? noDuplication : duplicate) + : other.index_ ) +{ +} + +Value::CZString::~CZString() +{ + if ( cstr_ && index_ == duplicate ) + valueAllocator()->releaseMemberName( const_cast<char *>( cstr_ ) ); +} + +void +Value::CZString::swap( CZString &other ) +{ + std::swap( cstr_, other.cstr_ ); + std::swap( index_, other.index_ ); +} + +Value::CZString & +Value::CZString::operator =( const CZString &other ) +{ + CZString temp( other ); + swap( temp ); + return *this; +} + +bool +Value::CZString::operator<( const CZString &other ) const +{ + if ( cstr_ ) + return strcmp( cstr_, other.cstr_ ) < 0; + return index_ < other.index_; +} + +bool +Value::CZString::operator==( const CZString &other ) const +{ + if ( cstr_ ) + return strcmp( cstr_, other.cstr_ ) == 0; + return index_ == other.index_; +} + + +int +Value::CZString::index() const +{ + return index_; +} + + +const char * +Value::CZString::c_str() const +{ + return cstr_; +} + +bool +Value::CZString::isStaticString() const +{ + return index_ == noDuplication; +} + +#endif // ifndef JSON_VALUE_USE_INTERNAL_MAP + + +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// class Value::Value +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// +// ////////////////////////////////////////////////////////////////// + +/*! \internal Default constructor initialization must be equivalent to: + * memset( this, 0, sizeof(Value) ) + * This optimization is used in ValueInternalMap fast allocator. + */ +Value::Value( ValueType type ) + : type_( type ) + , allocated_( 0 ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + switch ( type ) + { + case nullValue: + break; + case intValue: + case uintValue: + value_.int_ = 0; + break; + case realValue: + value_.real_ = 0.0; + break; + case stringValue: + value_.string_ = 0; + break; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + value_.map_ = new ObjectValues(); + break; +#else + case arrayValue: + value_.array_ = arrayAllocator()->newArray(); + break; + case objectValue: + value_.map_ = mapAllocator()->newMap(); + break; +#endif + case booleanValue: + value_.bool_ = false; + break; + default: + JSON_ASSERT_UNREACHABLE; + } +} + + +Value::Value( Int value ) + : type_( intValue ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.int_ = value; +} + + +Value::Value( UInt value ) + : type_( uintValue ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.uint_ = value; +} + +Value::Value( double value ) + : type_( realValue ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.real_ = value; +} + +Value::Value( const char *value ) + : type_( stringValue ) + , allocated_( true ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.string_ = valueAllocator()->duplicateStringValue( value ); +} + + +Value::Value( const char *beginValue, + const char *endValue ) + : type_( stringValue ) + , allocated_( true ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.string_ = valueAllocator()->duplicateStringValue( beginValue, + UInt(endValue - beginValue) ); +} + + +Value::Value( const std::string &value ) + : type_( stringValue ) + , allocated_( true ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.string_ = valueAllocator()->duplicateStringValue( value.c_str(), + (unsigned int)value.length() ); + +} + +Value::Value( const StaticString &value ) + : type_( stringValue ) + , allocated_( false ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.string_ = const_cast<char *>( value.c_str() ); +} + + +# ifdef JSON_USE_CPPTL +Value::Value( const CppTL::ConstString &value ) + : type_( stringValue ) + , allocated_( true ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.string_ = valueAllocator()->duplicateStringValue( value, value.length() ); +} +# endif + +Value::Value( bool value ) + : type_( booleanValue ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + value_.bool_ = value; +} + + +Value::Value( const Value &other ) + : type_( other.type_ ) + , comments_( 0 ) +# ifdef JSON_VALUE_USE_INTERNAL_MAP + , itemIsUsed_( 0 ) +#endif +{ + switch ( type_ ) + { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + value_ = other.value_; + break; + case stringValue: + if ( other.value_.string_ ) + { + value_.string_ = valueAllocator()->duplicateStringValue( other.value_.string_ ); + allocated_ = true; + } + else + value_.string_ = 0; + break; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + value_.map_ = new ObjectValues( *other.value_.map_ ); + break; +#else + case arrayValue: + value_.array_ = arrayAllocator()->newArrayCopy( *other.value_.array_ ); + break; + case objectValue: + value_.map_ = mapAllocator()->newMapCopy( *other.value_.map_ ); + break; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + if ( other.comments_ ) + { + comments_ = new CommentInfo[numberOfCommentPlacement]; + for ( int comment =0; comment < numberOfCommentPlacement; ++comment ) + { + const CommentInfo &otherComment = other.comments_[comment]; + if ( otherComment.comment_ ) + comments_[comment].setComment( otherComment.comment_ ); + } + } +} + + +Value::~Value() +{ + switch ( type_ ) + { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + break; + case stringValue: + if ( allocated_ ) + valueAllocator()->releaseStringValue( value_.string_ ); + break; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + delete value_.map_; + break; +#else + case arrayValue: + arrayAllocator()->destructArray( value_.array_ ); + break; + case objectValue: + mapAllocator()->destructMap( value_.map_ ); + break; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + + if ( comments_ ) + delete[] comments_; +} + +Value & +Value::operator=( const Value &other ) +{ + Value temp( other ); + swap( temp ); + return *this; +} + +void +Value::swap( Value &other ) +{ + ValueType temp = type_; + type_ = other.type_; + other.type_ = temp; + std::swap( value_, other.value_ ); + int temp2 = allocated_; + allocated_ = other.allocated_; + other.allocated_ = temp2; +} + +ValueType +Value::type() const +{ + return type_; +} + + +int +Value::compare( const Value &other ) +{ + /* + int typeDelta = other.type_ - type_; + switch ( type_ ) + { + case nullValue: + + return other.type_ == type_; + case intValue: + if ( other.type_.isNumeric() + case uintValue: + case realValue: + case booleanValue: + break; + case stringValue, + break; + case arrayValue: + delete value_.array_; + break; + case objectValue: + delete value_.map_; + default: + JSON_ASSERT_UNREACHABLE; + } + */ + return 0; // unreachable +} + +bool +Value::operator <( const Value &other ) const +{ + int typeDelta = type_ - other.type_; + if ( typeDelta ) + return typeDelta < 0 ? true : false; + switch ( type_ ) + { + case nullValue: + return false; + case intValue: + return value_.int_ < other.value_.int_; + case uintValue: + return value_.uint_ < other.value_.uint_; + case realValue: + return value_.real_ < other.value_.real_; + case booleanValue: + return value_.bool_ < other.value_.bool_; + case stringValue: + return ( value_.string_ == 0 && other.value_.string_ ) + || ( other.value_.string_ + && value_.string_ + && strcmp( value_.string_, other.value_.string_ ) < 0 ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + { + int delta = int( value_.map_->size() - other.value_.map_->size() ); + if ( delta ) + return delta < 0; + return (*value_.map_) < (*other.value_.map_); + } +#else + case arrayValue: + return value_.array_->compare( *(other.value_.array_) ) < 0; + case objectValue: + return value_.map_->compare( *(other.value_.map_) ) < 0; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + return 0; // unreachable +} + +bool +Value::operator <=( const Value &other ) const +{ + return !(other > *this); +} + +bool +Value::operator >=( const Value &other ) const +{ + return !(*this < other); +} + +bool +Value::operator >( const Value &other ) const +{ + return other < *this; +} + +bool +Value::operator ==( const Value &other ) const +{ + //if ( type_ != other.type_ ) + // GCC 2.95.3 says: + // attempt to take address of bit-field structure member `Json::Value::type_' + // Beats me, but a temp solves the problem. + int temp = other.type_; + if ( type_ != temp ) + return false; + switch ( type_ ) + { + case nullValue: + return true; + case intValue: + return value_.int_ == other.value_.int_; + case uintValue: + return value_.uint_ == other.value_.uint_; + case realValue: + return value_.real_ == other.value_.real_; + case booleanValue: + return value_.bool_ == other.value_.bool_; + case stringValue: + return ( value_.string_ == other.value_.string_ ) + || ( other.value_.string_ + && value_.string_ + && strcmp( value_.string_, other.value_.string_ ) == 0 ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + return value_.map_->size() == other.value_.map_->size() + && (*value_.map_) == (*other.value_.map_); +#else + case arrayValue: + return value_.array_->compare( *(other.value_.array_) ) == 0; + case objectValue: + return value_.map_->compare( *(other.value_.map_) ) == 0; +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + return 0; // unreachable +} + +bool +Value::operator !=( const Value &other ) const +{ + return !( *this == other ); +} + +const char * +Value::asCString() const +{ + JSON_ASSERT( type_ == stringValue ); + return value_.string_; +} + + +std::string +Value::asString() const +{ + switch ( type_ ) + { + case nullValue: + return ""; + case stringValue: + return value_.string_ ? value_.string_ : ""; + case booleanValue: + return value_.bool_ ? "true" : "false"; + case intValue: + case uintValue: + case realValue: + case arrayValue: + case objectValue: + //JSON_ASSERT_MESSAGE( false, "Type is not convertible to string" ); + JSON_ASSERT( false ); + default: + JSON_ASSERT_UNREACHABLE; + } + return ""; // unreachable +} + +# ifdef JSON_USE_CPPTL +CppTL::ConstString +Value::asConstString() const +{ + return CppTL::ConstString( asString().c_str() ); +} +# endif + +Value::Int +Value::asInt() const +{ + switch ( type_ ) + { + case nullValue: + return 0; + case intValue: + return value_.int_; + case uintValue: + //JSON_ASSERT_MESSAGE( value_.uint_ < (unsigned)maxInt, "integer out of signed integer range" ); + JSON_ASSERT( value_.uint_ < (unsigned)maxInt ); + return value_.uint_; + case realValue: + //JSON_ASSERT_MESSAGE( value_.real_ >= minInt && value_.real_ <= maxInt, "Real out of signed integer range" ); + JSON_ASSERT( value_.real_ >= minInt && value_.real_ <= maxInt ); + return Int( value_.real_ ); + case booleanValue: + return value_.bool_ ? 1 : 0; + case stringValue: + case arrayValue: + case objectValue: + //JSON_ASSERT_MESSAGE( false, "Type is not convertible to int" ); + JSON_ASSERT( false ); + default: + JSON_ASSERT_UNREACHABLE; + } + return 0; // unreachable; +} + +Value::UInt +Value::asUInt() const +{ + switch ( type_ ) + { + case nullValue: + return 0; + case intValue: + //JSON_ASSERT_MESSAGE( value_.int_ >= 0, "Negative integer can not be converted to unsigned integer" ); + JSON_ASSERT( value_.int_ >= 0 ); + return value_.int_; + case uintValue: + return value_.uint_; + case realValue: + //JSON_ASSERT_MESSAGE( value_.real_ >= 0 && value_.real_ <= maxUInt, "Real out of unsigned integer range" ); + JSON_ASSERT( value_.real_ >= 0 && value_.real_ <= maxUInt ); + return UInt( value_.real_ ); + case booleanValue: + return value_.bool_ ? 1 : 0; + case stringValue: + case arrayValue: + case objectValue: + //JSON_ASSERT_MESSAGE( false, "Type is not convertible to uint" ); + JSON_ASSERT( false ); + default: + JSON_ASSERT_UNREACHABLE; + } + return 0; // unreachable; +} + +double +Value::asDouble() const +{ + switch ( type_ ) + { + case nullValue: + return 0.0; + case intValue: + return value_.int_; + case uintValue: + return value_.uint_; + case realValue: + return value_.real_; + case booleanValue: + return value_.bool_ ? 1.0 : 0.0; + case stringValue: + case arrayValue: + case objectValue: + //JSON_ASSERT_MESSAGE( false, "Type is not convertible to double" ); + JSON_ASSERT( false ); + default: + JSON_ASSERT_UNREACHABLE; + } + return 0; // unreachable; +} + +bool +Value::asBool() const +{ + switch ( type_ ) + { + case nullValue: + return false; + case intValue: + case uintValue: + return value_.int_ != 0; + case realValue: + return value_.real_ != 0.0; + case booleanValue: + return value_.bool_; + case stringValue: + return value_.string_ && value_.string_[0] != 0; + case arrayValue: + case objectValue: + return value_.map_->size() != 0; + default: + JSON_ASSERT_UNREACHABLE; + } + return false; // unreachable; +} + + +bool +Value::isConvertibleTo( ValueType other ) const +{ + switch ( type_ ) + { + case nullValue: + return true; + case intValue: + return ( other == nullValue && value_.int_ == 0 ) + || other == intValue + || ( other == uintValue && value_.int_ >= 0 ) + || other == realValue + || other == stringValue + || other == booleanValue; + case uintValue: + return ( other == nullValue && value_.uint_ == 0 ) + || ( other == intValue && value_.uint_ <= (unsigned)maxInt ) + || other == uintValue + || other == realValue + || other == stringValue + || other == booleanValue; + case realValue: + return ( other == nullValue && value_.real_ == 0.0 ) + || ( other == intValue && value_.real_ >= minInt && value_.real_ <= maxInt ) + || ( other == uintValue && value_.real_ >= 0 && value_.real_ <= maxUInt ) + || other == realValue + || other == stringValue + || other == booleanValue; + case booleanValue: + return ( other == nullValue && value_.bool_ == false ) + || other == intValue + || other == uintValue + || other == realValue + || other == stringValue + || other == booleanValue; + case stringValue: + return other == stringValue + || ( other == nullValue && (!value_.string_ || value_.string_[0] == 0) ); + case arrayValue: + return other == arrayValue + || ( other == nullValue && value_.map_->size() == 0 ); + case objectValue: + return other == objectValue + || ( other == nullValue && value_.map_->size() == 0 ); + default: + JSON_ASSERT_UNREACHABLE; + } + return false; // unreachable; +} + + +/// Number of values in array or object +Value::UInt +Value::size() const +{ + switch ( type_ ) + { + case nullValue: + case intValue: + case uintValue: + case realValue: + case booleanValue: + case stringValue: + return 0; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: // size of the array is highest index + 1 + if ( !value_.map_->empty() ) + { + ObjectValues::const_iterator itLast = value_.map_->end(); + --itLast; + return (*itLast).first.index()+1; + } + return 0; + case objectValue: + return Int( value_.map_->size() ); +#else + case arrayValue: + return Int( value_.array_->size() ); + case objectValue: + return Int( value_.map_->size() ); +#endif + default: + JSON_ASSERT_UNREACHABLE; + } + return 0; // unreachable; +} + + +bool +Value::empty() const +{ + if ( isNull() || isArray() || isObject() ) + return size() == 0u; + else + return false; +} + + +bool +Value::operator!() const +{ + return isNull(); +} + + +void +Value::clear() +{ + JSON_ASSERT( type_ == nullValue || type_ == arrayValue || type_ == objectValue ); + + switch ( type_ ) + { +#ifndef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + case objectValue: + value_.map_->clear(); + break; +#else + case arrayValue: + value_.array_->clear(); + break; + case objectValue: + value_.map_->clear(); + break; +#endif + default: + break; + } +} + +void +Value::resize( UInt newSize ) +{ + JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); + if ( type_ == nullValue ) + *this = Value( arrayValue ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + UInt oldSize = size(); + if ( newSize == 0 ) + clear(); + else if ( newSize > oldSize ) + (*this)[ newSize - 1 ]; + else + { + for ( UInt index = newSize; index < oldSize; ++index ) + value_.map_->erase( index ); + assert( size() == newSize ); + } +#else + value_.array_->resize( newSize ); +#endif +} + + +Value & +Value::operator[]( UInt index ) +{ + JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); + if ( type_ == nullValue ) + *this = Value( arrayValue ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString key( index ); + ObjectValues::iterator it = value_.map_->lower_bound( key ); + if ( it != value_.map_->end() && (*it).first == key ) + return (*it).second; + + ObjectValues::value_type defaultValue( key, null ); + it = value_.map_->insert( it, defaultValue ); + return (*it).second; +#else + return value_.array_->resolveReference( index ); +#endif +} + + +const Value & +Value::operator[]( UInt index ) const +{ + JSON_ASSERT( type_ == nullValue || type_ == arrayValue ); + if ( type_ == nullValue ) + return null; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString key( index ); + ObjectValues::const_iterator it = value_.map_->find( key ); + if ( it == value_.map_->end() ) + return null; + return (*it).second; +#else + Value *value = value_.array_->find( index ); + return value ? *value : null; +#endif +} + + +Value & +Value::operator[]( const char *key ) +{ + return resolveReference( key, false ); +} + + +Value & +Value::resolveReference( const char *key, + bool isStatic ) +{ + JSON_ASSERT( type_ == nullValue || type_ == objectValue ); + if ( type_ == nullValue ) + *this = Value( objectValue ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString actualKey( key, isStatic ? CZString::noDuplication + : CZString::duplicateOnCopy ); + ObjectValues::iterator it = value_.map_->lower_bound( actualKey ); + if ( it != value_.map_->end() && (*it).first == actualKey ) + return (*it).second; + + ObjectValues::value_type defaultValue( actualKey, null ); + it = value_.map_->insert( it, defaultValue ); + Value &value = (*it).second; + return value; +#else + return value_.map_->resolveReference( key, isStatic ); +#endif +} + + +Value +Value::get( UInt index, + const Value &defaultValue ) const +{ + const Value *value = &((*this)[index]); + return value == &null ? defaultValue : *value; +} + + +bool +Value::isValidIndex( UInt index ) const +{ + return index < size(); +} + + + +const Value & +Value::operator[]( const char *key ) const +{ + JSON_ASSERT( type_ == nullValue || type_ == objectValue ); + if ( type_ == nullValue ) + return null; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString actualKey( key, CZString::noDuplication ); + ObjectValues::const_iterator it = value_.map_->find( actualKey ); + if ( it == value_.map_->end() ) + return null; + return (*it).second; +#else + const Value *value = value_.map_->find( key ); + return value ? *value : null; +#endif +} + + +Value & +Value::operator[]( const std::string &key ) +{ + return (*this)[ key.c_str() ]; +} + + +const Value & +Value::operator[]( const std::string &key ) const +{ + return (*this)[ key.c_str() ]; +} + +Value & +Value::operator[]( const StaticString &key ) +{ + return resolveReference( key, true ); +} + + +# ifdef JSON_USE_CPPTL +Value & +Value::operator[]( const CppTL::ConstString &key ) +{ + return (*this)[ key.c_str() ]; +} + + +const Value & +Value::operator[]( const CppTL::ConstString &key ) const +{ + return (*this)[ key.c_str() ]; +} +# endif + + +Value & +Value::append( const Value &value ) +{ + return (*this)[size()] = value; +} + + +Value +Value::get( const char *key, + const Value &defaultValue ) const +{ + const Value *value = &((*this)[key]); + return value == &null ? defaultValue : *value; +} + + +Value +Value::get( const std::string &key, + const Value &defaultValue ) const +{ + return get( key.c_str(), defaultValue ); +} + +Value +Value::removeMember( const char* key ) +{ + JSON_ASSERT( type_ == nullValue || type_ == objectValue ); + if ( type_ == nullValue ) + return null; +#ifndef JSON_VALUE_USE_INTERNAL_MAP + CZString actualKey( key, CZString::noDuplication ); + ObjectValues::iterator it = value_.map_->find( actualKey ); + if ( it == value_.map_->end() ) + return null; + Value old(it->second); + value_.map_->erase(it); + return old; +#else + Value *value = value_.map_->find( key ); + if (value){ + Value old(*value); + value_.map_.remove( key ); + return old; + } else { + return null; + } +#endif +} + +Value +Value::removeMember( const std::string &key ) +{ + return removeMember( key.c_str() ); +} + +# ifdef JSON_USE_CPPTL +Value +Value::get( const CppTL::ConstString &key, + const Value &defaultValue ) const +{ + return get( key.c_str(), defaultValue ); +} +# endif + +bool +Value::isMember( const char *key ) const +{ + const Value *value = &((*this)[key]); + return value != &null; +} + + +bool +Value::isMember( const std::string &key ) const +{ + return isMember( key.c_str() ); +} + + +# ifdef JSON_USE_CPPTL +bool +Value::isMember( const CppTL::ConstString &key ) const +{ + return isMember( key.c_str() ); +} +#endif + +Value::Members +Value::getMemberNames() const +{ + JSON_ASSERT( type_ == nullValue || type_ == objectValue ); + if ( type_ == nullValue ) + return Value::Members(); + Members members; + members.reserve( value_.map_->size() ); +#ifndef JSON_VALUE_USE_INTERNAL_MAP + ObjectValues::const_iterator it = value_.map_->begin(); + ObjectValues::const_iterator itEnd = value_.map_->end(); + for ( ; it != itEnd; ++it ) + members.push_back( std::string( (*it).first.c_str() ) ); +#else + ValueInternalMap::IteratorState it; + ValueInternalMap::IteratorState itEnd; + value_.map_->makeBeginIterator( it ); + value_.map_->makeEndIterator( itEnd ); + for ( ; !ValueInternalMap::equals( it, itEnd ); ValueInternalMap::increment(it) ) + members.push_back( std::string( ValueInternalMap::key( it ) ) ); +#endif + return members; +} +// +//# ifdef JSON_USE_CPPTL +//EnumMemberNames +//Value::enumMemberNames() const +//{ +// if ( type_ == objectValue ) +// { +// return CppTL::Enum::any( CppTL::Enum::transform( +// CppTL::Enum::keys( *(value_.map_), CppTL::Type<const CZString &>() ), +// MemberNamesTransform() ) ); +// } +// return EnumMemberNames(); +//} +// +// +//EnumValues +//Value::enumValues() const +//{ +// if ( type_ == objectValue || type_ == arrayValue ) +// return CppTL::Enum::anyValues( *(value_.map_), +// CppTL::Type<const Value &>() ); +// return EnumValues(); +//} +// +//# endif + + +bool +Value::isNull() const +{ + return type_ == nullValue; +} + + +bool +Value::isBool() const +{ + return type_ == booleanValue; +} + + +bool +Value::isInt() const +{ + return type_ == intValue; +} + + +bool +Value::isUInt() const +{ + return type_ == uintValue; +} + + +bool +Value::isIntegral() const +{ + return type_ == intValue + || type_ == uintValue + || type_ == booleanValue; +} + + +bool +Value::isDouble() const +{ + return type_ == realValue; +} + + +bool +Value::isNumeric() const +{ + return isIntegral() || isDouble(); +} + + +bool +Value::isString() const +{ + return type_ == stringValue; +} + + +bool +Value::isArray() const +{ + return type_ == nullValue || type_ == arrayValue; +} + + +bool +Value::isObject() const +{ + return type_ == nullValue || type_ == objectValue; +} + + +void +Value::setComment( const char *comment, + CommentPlacement placement ) +{ + if ( !comments_ ) + comments_ = new CommentInfo[numberOfCommentPlacement]; + comments_[placement].setComment( comment ); +} + + +void +Value::setComment( const std::string &comment, + CommentPlacement placement ) +{ + setComment( comment.c_str(), placement ); +} + + +bool +Value::hasComment( CommentPlacement placement ) const +{ + return comments_ != 0 && comments_[placement].comment_ != 0; +} + +std::string +Value::getComment( CommentPlacement placement ) const +{ + if ( hasComment(placement) ) + return comments_[placement].comment_; + return ""; +} + + +std::string +Value::toStyledString() const +{ + StyledWriter writer; + return writer.write( *this ); +} + + +Value::const_iterator +Value::begin() const +{ + switch ( type_ ) + { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if ( value_.array_ ) + { + ValueInternalArray::IteratorState it; + value_.array_->makeBeginIterator( it ); + return const_iterator( it ); + } + break; + case objectValue: + if ( value_.map_ ) + { + ValueInternalMap::IteratorState it; + value_.map_->makeBeginIterator( it ); + return const_iterator( it ); + } + break; +#else + case arrayValue: + case objectValue: + if ( value_.map_ ) + return const_iterator( value_.map_->begin() ); + break; +#endif + default: + break; + } + return const_iterator(); +} + +Value::const_iterator +Value::end() const +{ + switch ( type_ ) + { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if ( value_.array_ ) + { + ValueInternalArray::IteratorState it; + value_.array_->makeEndIterator( it ); + return const_iterator( it ); + } + break; + case objectValue: + if ( value_.map_ ) + { + ValueInternalMap::IteratorState it; + value_.map_->makeEndIterator( it ); + return const_iterator( it ); + } + break; +#else + case arrayValue: + case objectValue: + if ( value_.map_ ) + return const_iterator( value_.map_->end() ); + break; +#endif + default: + break; + } + return const_iterator(); +} + + +Value::iterator +Value::begin() +{ + switch ( type_ ) + { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if ( value_.array_ ) + { + ValueInternalArray::IteratorState it; + value_.array_->makeBeginIterator( it ); + return iterator( it ); + } + break; + case objectValue: + if ( value_.map_ ) + { + ValueInternalMap::IteratorState it; + value_.map_->makeBeginIterator( it ); + return iterator( it ); + } + break; +#else + case arrayValue: + case objectValue: + if ( value_.map_ ) + return iterator( value_.map_->begin() ); + break; +#endif + default: + break; + } + return iterator(); +} + +Value::iterator +Value::end() +{ + switch ( type_ ) + { +#ifdef JSON_VALUE_USE_INTERNAL_MAP + case arrayValue: + if ( value_.array_ ) + { + ValueInternalArray::IteratorState it; + value_.array_->makeEndIterator( it ); + return iterator( it ); + } + break; + case objectValue: + if ( value_.map_ ) + { + ValueInternalMap::IteratorState it; + value_.map_->makeEndIterator( it ); + return iterator( it ); + } + break; +#else + case arrayValue: + case objectValue: + if ( value_.map_ ) + return iterator( value_.map_->end() ); + break; +#endif + default: + break; + } + return iterator(); +} + + +// class PathArgument +// ////////////////////////////////////////////////////////////////// + +PathArgument::PathArgument() + : kind_( kindNone ) +{ +} + + +PathArgument::PathArgument( Value::UInt index ) + : index_( index ) + , kind_( kindIndex ) +{ +} + + +PathArgument::PathArgument( const char *key ) + : key_( key ) + , kind_( kindKey ) +{ +} + + +PathArgument::PathArgument( const std::string &key ) + : key_( key.c_str() ) + , kind_( kindKey ) +{ +} + +// class Path +// ////////////////////////////////////////////////////////////////// + +Path::Path( const std::string &path, + const PathArgument &a1, + const PathArgument &a2, + const PathArgument &a3, + const PathArgument &a4, + const PathArgument &a5 ) +{ + InArgs in; + in.push_back( &a1 ); + in.push_back( &a2 ); + in.push_back( &a3 ); + in.push_back( &a4 ); + in.push_back( &a5 ); + makePath( path, in ); +} + + +void +Path::makePath( const std::string &path, + const InArgs &in ) +{ + const char *current = path.c_str(); + const char *end = current + path.length(); + InArgs::const_iterator itInArg = in.begin(); + while ( current != end ) + { + if ( *current == '[' ) + { + ++current; + if ( *current == '%' ) + addPathInArg( path, in, itInArg, PathArgument::kindIndex ); + else + { + Value::UInt index = 0; + for ( ; current != end && *current >= '0' && *current <= '9'; ++current ) + index = index * 10 + Value::UInt(*current - '0'); + args_.push_back( index ); + } + if ( current == end || *current++ != ']' ) + invalidPath( path, int(current - path.c_str()) ); + } + else if ( *current == '%' ) + { + addPathInArg( path, in, itInArg, PathArgument::kindKey ); + ++current; + } + else if ( *current == '.' ) + { + ++current; + } + else + { + const char *beginName = current; + while ( current != end && !strchr( "[.", *current ) ) + ++current; + args_.push_back( std::string( beginName, current ) ); + } + } +} + + +void +Path::addPathInArg( const std::string &path, + const InArgs &in, + InArgs::const_iterator &itInArg, + PathArgument::Kind kind ) +{ + if ( itInArg == in.end() ) + { + // Error: missing argument %d + } + else if ( (*itInArg)->kind_ != kind ) + { + // Error: bad argument type + } + else + { + args_.push_back( **itInArg ); + } +} + + +void +Path::invalidPath( const std::string &path, + int location ) +{ + // Error: invalid path. +} + + +const Value & +Path::resolve( const Value &root ) const +{ + const Value *node = &root; + for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) + { + const PathArgument &arg = *it; + if ( arg.kind_ == PathArgument::kindIndex ) + { + if ( !node->isArray() || node->isValidIndex( arg.index_ ) ) + { + // Error: unable to resolve path (array value expected at position... + } + node = &((*node)[arg.index_]); + } + else if ( arg.kind_ == PathArgument::kindKey ) + { + if ( !node->isObject() ) + { + // Error: unable to resolve path (object value expected at position...) + } + node = &((*node)[arg.key_]); + if ( node == &Value::null ) + { + // Error: unable to resolve path (object has no member named '' at position...) + } + } + } + return *node; +} + + +Value +Path::resolve( const Value &root, + const Value &defaultValue ) const +{ + const Value *node = &root; + for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) + { + const PathArgument &arg = *it; + if ( arg.kind_ == PathArgument::kindIndex ) + { + if ( !node->isArray() || node->isValidIndex( arg.index_ ) ) + return defaultValue; + node = &((*node)[arg.index_]); + } + else if ( arg.kind_ == PathArgument::kindKey ) + { + if ( !node->isObject() ) + return defaultValue; + node = &((*node)[arg.key_]); + if ( node == &Value::null ) + return defaultValue; + } + } + return *node; +} + + +Value & +Path::make( Value &root ) const +{ + Value *node = &root; + for ( Args::const_iterator it = args_.begin(); it != args_.end(); ++it ) + { + const PathArgument &arg = *it; + if ( arg.kind_ == PathArgument::kindIndex ) + { + if ( !node->isArray() ) + { + // Error: node is not an array at position ... + } + node = &((*node)[arg.index_]); + } + else if ( arg.kind_ == PathArgument::kindKey ) + { + if ( !node->isObject() ) + { + // Error: node is not an object at position... + } + node = &((*node)[arg.key_]); + } + } + return *node; +} + + +} // namespace Json diff --git a/jsoncpp-src-0.5.0/src/lib_json/json_valueiterator.inl b/lib/jsoncpp/src/lib_json/json_valueiterator.inl index 736e260ea..736e260ea 100644 --- a/jsoncpp-src-0.5.0/src/lib_json/json_valueiterator.inl +++ b/lib/jsoncpp/src/lib_json/json_valueiterator.inl diff --git a/lib/jsoncpp/src/lib_json/json_writer.cpp b/lib/jsoncpp/src/lib_json/json_writer.cpp new file mode 100644 index 000000000..eff3fabeb --- /dev/null +++ b/lib/jsoncpp/src/lib_json/json_writer.cpp @@ -0,0 +1,829 @@ +#include "../../include/json/writer.h" +#include <utility> +#include <assert.h> +#include <stdio.h> +#include <string.h> +#include <iostream> +#include <sstream> +#include <iomanip> + +#if _MSC_VER >= 1400 // VC++ 8.0 +#pragma warning( disable : 4996 ) // disable warning about strdup being deprecated. +#endif + +namespace Json { + +static bool isControlCharacter(char ch) +{ + return ch > 0 && ch <= 0x1F; +} + +static bool containsControlCharacter( const char* str ) +{ + while ( *str ) + { + if ( isControlCharacter( *(str++) ) ) + return true; + } + return false; +} +static void uintToString( unsigned int value, + char *¤t ) +{ + *--current = 0; + do + { + *--current = (value % 10) + '0'; + value /= 10; + } + while ( value != 0 ); +} + +std::string valueToString( Int value ) +{ + char buffer[32]; + char *current = buffer + sizeof(buffer); + bool isNegative = value < 0; + if ( isNegative ) + value = -value; + uintToString( UInt(value), current ); + if ( isNegative ) + *--current = '-'; + assert( current >= buffer ); + return current; +} + + +std::string valueToString( UInt value ) +{ + char buffer[32]; + char *current = buffer + sizeof(buffer); + uintToString( value, current ); + assert( current >= buffer ); + return current; +} + +std::string valueToString( double value ) +{ + char buffer[32]; +#if defined(_MSC_VER) && defined(__STDC_SECURE_LIB__) // Use secure version with visual studio 2005 to avoid warning. + sprintf_s(buffer, sizeof(buffer), "%#.16g", value); +#else + sprintf(buffer, "%#.16g", value); +#endif + char* ch = buffer + strlen(buffer) - 1; + if (*ch != '0') return buffer; // nothing to truncate, so save time + while(ch > buffer && *ch == '0'){ + --ch; + } + char* last_nonzero = ch; + while(ch >= buffer){ + switch(*ch){ + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + --ch; + continue; + case '.': + // Truncate zeroes to save bytes in output, but keep one. + *(last_nonzero+2) = '\0'; + return buffer; + default: + return buffer; + } + } + return buffer; +} + + +std::string valueToString( bool value ) +{ + return value ? "true" : "false"; +} + +std::string valueToQuotedString( const char *value ) +{ + // Not sure how to handle unicode... + if (strpbrk(value, "\"\\\b\f\n\r\t") == NULL && !containsControlCharacter( value )) + return std::string("\"") + value + "\""; + // We have to walk value and escape any special characters. + // Appending to std::string is not efficient, but this should be rare. + // (Note: forward slashes are *not* rare, but I am not escaping them.) + unsigned maxsize = strlen(value)*2 + 3; // allescaped+quotes+NULL + std::string result; + result.reserve(maxsize); // to avoid lots of mallocs + result += "\""; + for (const char* c=value; *c != 0; ++c) + { + switch(*c) + { + case '\"': + result += "\\\""; + break; + case '\\': + result += "\\\\"; + break; + case '\b': + result += "\\b"; + break; + case '\f': + result += "\\f"; + break; + case '\n': + result += "\\n"; + break; + case '\r': + result += "\\r"; + break; + case '\t': + result += "\\t"; + break; + //case '/': + // Even though \/ is considered a legal escape in JSON, a bare + // slash is also legal, so I see no reason to escape it. + // (I hope I am not misunderstanding something. + // blep notes: actually escaping \/ may be useful in javascript to avoid </ + // sequence. + // Should add a flag to allow this compatibility mode and prevent this + // sequence from occurring. + default: + if ( isControlCharacter( *c ) ) + { + std::ostringstream oss; + oss << "\\u" << std::hex << std::uppercase << std::setfill('0') << std::setw(4) << static_cast<int>(*c); + result += oss.str(); + } + else + { + result += *c; + } + break; + } + } + result += "\""; + return result; +} + +// Class Writer +// ////////////////////////////////////////////////////////////////// +Writer::~Writer() +{ +} + + +// Class FastWriter +// ////////////////////////////////////////////////////////////////// + +FastWriter::FastWriter() + : yamlCompatiblityEnabled_( false ) +{ +} + + +void +FastWriter::enableYAMLCompatibility() +{ + yamlCompatiblityEnabled_ = true; +} + + +std::string +FastWriter::write( const Value &root ) +{ + document_ = ""; + writeValue( root ); + document_ += "\n"; + return document_; +} + + +void +FastWriter::writeValue( const Value &value ) +{ + switch ( value.type() ) + { + case nullValue: + document_ += "null"; + break; + case intValue: + document_ += valueToString( value.asInt() ); + break; + case uintValue: + document_ += valueToString( value.asUInt() ); + break; + case realValue: + document_ += valueToString( value.asDouble() ); + break; + case stringValue: + document_ += valueToQuotedString( value.asCString() ); + break; + case booleanValue: + document_ += valueToString( value.asBool() ); + break; + case arrayValue: + { + document_ += "["; + int size = value.size(); + for ( int index =0; index < size; ++index ) + { + if ( index > 0 ) + document_ += ","; + writeValue( value[index] ); + } + document_ += "]"; + } + break; + case objectValue: + { + Value::Members members( value.getMemberNames() ); + document_ += "{"; + for ( Value::Members::iterator it = members.begin(); + it != members.end(); + ++it ) + { + const std::string &name = *it; + if ( it != members.begin() ) + document_ += ","; + document_ += valueToQuotedString( name.c_str() ); + document_ += yamlCompatiblityEnabled_ ? ": " + : ":"; + writeValue( value[name] ); + } + document_ += "}"; + } + break; + } +} + + +// Class StyledWriter +// ////////////////////////////////////////////////////////////////// + +StyledWriter::StyledWriter() + : rightMargin_( 74 ) + , indentSize_( 3 ) +{ +} + + +std::string +StyledWriter::write( const Value &root ) +{ + document_ = ""; + addChildValues_ = false; + indentString_ = ""; + writeCommentBeforeValue( root ); + writeValue( root ); + writeCommentAfterValueOnSameLine( root ); + document_ += "\n"; + return document_; +} + + +void +StyledWriter::writeValue( const Value &value ) +{ + switch ( value.type() ) + { + case nullValue: + pushValue( "null" ); + break; + case intValue: + pushValue( valueToString( value.asInt() ) ); + break; + case uintValue: + pushValue( valueToString( value.asUInt() ) ); + break; + case realValue: + pushValue( valueToString( value.asDouble() ) ); + break; + case stringValue: + pushValue( valueToQuotedString( value.asCString() ) ); + break; + case booleanValue: + pushValue( valueToString( value.asBool() ) ); + break; + case arrayValue: + writeArrayValue( value); + break; + case objectValue: + { + Value::Members members( value.getMemberNames() ); + if ( members.empty() ) + pushValue( "{}" ); + else + { + writeWithIndent( "{" ); + indent(); + Value::Members::iterator it = members.begin(); + while ( true ) + { + const std::string &name = *it; + const Value &childValue = value[name]; + writeCommentBeforeValue( childValue ); + writeWithIndent( valueToQuotedString( name.c_str() ) ); + document_ += " : "; + writeValue( childValue ); + if ( ++it == members.end() ) + { + writeCommentAfterValueOnSameLine( childValue ); + break; + } + document_ += ","; + writeCommentAfterValueOnSameLine( childValue ); + } + unindent(); + writeWithIndent( "}" ); + } + } + break; + } +} + + +void +StyledWriter::writeArrayValue( const Value &value ) +{ + unsigned size = value.size(); + if ( size == 0 ) + pushValue( "[]" ); + else + { + bool isArrayMultiLine = isMultineArray( value ); + if ( isArrayMultiLine ) + { + writeWithIndent( "[" ); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index =0; + while ( true ) + { + const Value &childValue = value[index]; + writeCommentBeforeValue( childValue ); + if ( hasChildValue ) + writeWithIndent( childValues_[index] ); + else + { + writeIndent(); + writeValue( childValue ); + } + if ( ++index == size ) + { + writeCommentAfterValueOnSameLine( childValue ); + break; + } + document_ += ","; + writeCommentAfterValueOnSameLine( childValue ); + } + unindent(); + writeWithIndent( "]" ); + } + else // output on a single line + { + assert( childValues_.size() == size ); + document_ += "[ "; + for ( unsigned index =0; index < size; ++index ) + { + if ( index > 0 ) + document_ += ", "; + document_ += childValues_[index]; + } + document_ += " ]"; + } + } +} + + +bool +StyledWriter::isMultineArray( const Value &value ) +{ + int size = value.size(); + bool isMultiLine = size*3 >= rightMargin_ ; + childValues_.clear(); + for ( int index =0; index < size && !isMultiLine; ++index ) + { + const Value &childValue = value[index]; + isMultiLine = isMultiLine || + ( (childValue.isArray() || childValue.isObject()) && + childValue.size() > 0 ); + } + if ( !isMultiLine ) // check if line length > max line length + { + childValues_.reserve( size ); + addChildValues_ = true; + int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]' + for ( int index =0; index < size && !isMultiLine; ++index ) + { + writeValue( value[index] ); + lineLength += int( childValues_[index].length() ); + isMultiLine = isMultiLine && hasCommentForValue( value[index] ); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + + +void +StyledWriter::pushValue( const std::string &value ) +{ + if ( addChildValues_ ) + childValues_.push_back( value ); + else + document_ += value; +} + + +void +StyledWriter::writeIndent() +{ + if ( !document_.empty() ) + { + char last = document_[document_.length()-1]; + if ( last == ' ' ) // already indented + return; + if ( last != '\n' ) // Comments may add new-line + document_ += '\n'; + } + document_ += indentString_; +} + + +void +StyledWriter::writeWithIndent( const std::string &value ) +{ + writeIndent(); + document_ += value; +} + + +void +StyledWriter::indent() +{ + indentString_ += std::string( indentSize_, ' ' ); +} + + +void +StyledWriter::unindent() +{ + assert( int(indentString_.size()) >= indentSize_ ); + indentString_.resize( indentString_.size() - indentSize_ ); +} + + +void +StyledWriter::writeCommentBeforeValue( const Value &root ) +{ + if ( !root.hasComment( commentBefore ) ) + return; + document_ += normalizeEOL( root.getComment( commentBefore ) ); + document_ += "\n"; +} + + +void +StyledWriter::writeCommentAfterValueOnSameLine( const Value &root ) +{ + if ( root.hasComment( commentAfterOnSameLine ) ) + document_ += " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) ); + + if ( root.hasComment( commentAfter ) ) + { + document_ += "\n"; + document_ += normalizeEOL( root.getComment( commentAfter ) ); + document_ += "\n"; + } +} + + +bool +StyledWriter::hasCommentForValue( const Value &value ) +{ + return value.hasComment( commentBefore ) + || value.hasComment( commentAfterOnSameLine ) + || value.hasComment( commentAfter ); +} + + +std::string +StyledWriter::normalizeEOL( const std::string &text ) +{ + std::string normalized; + normalized.reserve( text.length() ); + const char *begin = text.c_str(); + const char *end = begin + text.length(); + const char *current = begin; + while ( current != end ) + { + char c = *current++; + if ( c == '\r' ) // mac or dos EOL + { + if ( *current == '\n' ) // convert dos EOL + ++current; + normalized += '\n'; + } + else // handle unix EOL & other char + normalized += c; + } + return normalized; +} + + +// Class StyledStreamWriter +// ////////////////////////////////////////////////////////////////// + +StyledStreamWriter::StyledStreamWriter( std::string indentation ) + : document_(NULL) + , rightMargin_( 74 ) + , indentation_( indentation ) +{ +} + + +void +StyledStreamWriter::write( std::ostream &out, const Value &root ) +{ + document_ = &out; + addChildValues_ = false; + indentString_ = ""; + writeCommentBeforeValue( root ); + writeValue( root ); + writeCommentAfterValueOnSameLine( root ); + *document_ << "\n"; + document_ = NULL; // Forget the stream, for safety. +} + + +void +StyledStreamWriter::writeValue( const Value &value ) +{ + switch ( value.type() ) + { + case nullValue: + pushValue( "null" ); + break; + case intValue: + pushValue( valueToString( value.asInt() ) ); + break; + case uintValue: + pushValue( valueToString( value.asUInt() ) ); + break; + case realValue: + pushValue( valueToString( value.asDouble() ) ); + break; + case stringValue: + pushValue( valueToQuotedString( value.asCString() ) ); + break; + case booleanValue: + pushValue( valueToString( value.asBool() ) ); + break; + case arrayValue: + writeArrayValue( value); + break; + case objectValue: + { + Value::Members members( value.getMemberNames() ); + if ( members.empty() ) + pushValue( "{}" ); + else + { + writeWithIndent( "{" ); + indent(); + Value::Members::iterator it = members.begin(); + while ( true ) + { + const std::string &name = *it; + const Value &childValue = value[name]; + writeCommentBeforeValue( childValue ); + writeWithIndent( valueToQuotedString( name.c_str() ) ); + *document_ << " : "; + writeValue( childValue ); + if ( ++it == members.end() ) + { + writeCommentAfterValueOnSameLine( childValue ); + break; + } + *document_ << ","; + writeCommentAfterValueOnSameLine( childValue ); + } + unindent(); + writeWithIndent( "}" ); + } + } + break; + } +} + + +void +StyledStreamWriter::writeArrayValue( const Value &value ) +{ + unsigned size = value.size(); + if ( size == 0 ) + pushValue( "[]" ); + else + { + bool isArrayMultiLine = isMultineArray( value ); + if ( isArrayMultiLine ) + { + writeWithIndent( "[" ); + indent(); + bool hasChildValue = !childValues_.empty(); + unsigned index =0; + while ( true ) + { + const Value &childValue = value[index]; + writeCommentBeforeValue( childValue ); + if ( hasChildValue ) + writeWithIndent( childValues_[index] ); + else + { + writeIndent(); + writeValue( childValue ); + } + if ( ++index == size ) + { + writeCommentAfterValueOnSameLine( childValue ); + break; + } + *document_ << ","; + writeCommentAfterValueOnSameLine( childValue ); + } + unindent(); + writeWithIndent( "]" ); + } + else // output on a single line + { + assert( childValues_.size() == size ); + *document_ << "[ "; + for ( unsigned index =0; index < size; ++index ) + { + if ( index > 0 ) + *document_ << ", "; + *document_ << childValues_[index]; + } + *document_ << " ]"; + } + } +} + + +bool +StyledStreamWriter::isMultineArray( const Value &value ) +{ + int size = value.size(); + bool isMultiLine = size*3 >= rightMargin_ ; + childValues_.clear(); + for ( int index =0; index < size && !isMultiLine; ++index ) + { + const Value &childValue = value[index]; + isMultiLine = isMultiLine || + ( (childValue.isArray() || childValue.isObject()) && + childValue.size() > 0 ); + } + if ( !isMultiLine ) // check if line length > max line length + { + childValues_.reserve( size ); + addChildValues_ = true; + int lineLength = 4 + (size-1)*2; // '[ ' + ', '*n + ' ]' + for ( int index =0; index < size && !isMultiLine; ++index ) + { + writeValue( value[index] ); + lineLength += int( childValues_[index].length() ); + isMultiLine = isMultiLine && hasCommentForValue( value[index] ); + } + addChildValues_ = false; + isMultiLine = isMultiLine || lineLength >= rightMargin_; + } + return isMultiLine; +} + + +void +StyledStreamWriter::pushValue( const std::string &value ) +{ + if ( addChildValues_ ) + childValues_.push_back( value ); + else + *document_ << value; +} + + +void +StyledStreamWriter::writeIndent() +{ + /* + Some comments in this method would have been nice. ;-) + + if ( !document_.empty() ) + { + char last = document_[document_.length()-1]; + if ( last == ' ' ) // already indented + return; + if ( last != '\n' ) // Comments may add new-line + *document_ << '\n'; + } + */ + *document_ << '\n' << indentString_; +} + + +void +StyledStreamWriter::writeWithIndent( const std::string &value ) +{ + writeIndent(); + *document_ << value; +} + + +void +StyledStreamWriter::indent() +{ + indentString_ += indentation_; +} + + +void +StyledStreamWriter::unindent() +{ + assert( indentString_.size() >= indentation_.size() ); + indentString_.resize( indentString_.size() - indentation_.size() ); +} + + +void +StyledStreamWriter::writeCommentBeforeValue( const Value &root ) +{ + if ( !root.hasComment( commentBefore ) ) + return; + *document_ << normalizeEOL( root.getComment( commentBefore ) ); + *document_ << "\n"; +} + + +void +StyledStreamWriter::writeCommentAfterValueOnSameLine( const Value &root ) +{ + if ( root.hasComment( commentAfterOnSameLine ) ) + *document_ << " " + normalizeEOL( root.getComment( commentAfterOnSameLine ) ); + + if ( root.hasComment( commentAfter ) ) + { + *document_ << "\n"; + *document_ << normalizeEOL( root.getComment( commentAfter ) ); + *document_ << "\n"; + } +} + + +bool +StyledStreamWriter::hasCommentForValue( const Value &value ) +{ + return value.hasComment( commentBefore ) + || value.hasComment( commentAfterOnSameLine ) + || value.hasComment( commentAfter ); +} + + +std::string +StyledStreamWriter::normalizeEOL( const std::string &text ) +{ + std::string normalized; + normalized.reserve( text.length() ); + const char *begin = text.c_str(); + const char *end = begin + text.length(); + const char *current = begin; + while ( current != end ) + { + char c = *current++; + if ( c == '\r' ) // mac or dos EOL + { + if ( *current == '\n' ) // convert dos EOL + ++current; + normalized += '\n'; + } + else // handle unix EOL & other char + normalized += c; + } + return normalized; +} + + +std::ostream& operator<<( std::ostream &sout, const Value &root ) +{ + Json::StyledStreamWriter writer; + writer.write(sout, root); + return sout; +} + + +} // namespace Json diff --git a/jsoncpp-src-0.5.0/src/lib_json/sconscript b/lib/jsoncpp/src/lib_json/sconscript index f6520d185..f6520d185 100644 --- a/jsoncpp-src-0.5.0/src/lib_json/sconscript +++ b/lib/jsoncpp/src/lib_json/sconscript diff --git a/lua-5.1.4/COPYRIGHT b/lib/lua/COPYRIGHT index 3a53e741e..3a53e741e 100644 --- a/lua-5.1.4/COPYRIGHT +++ b/lib/lua/COPYRIGHT diff --git a/lua-5.1.4/HISTORY b/lib/lua/HISTORY index ce0c95bc6..ce0c95bc6 100644 --- a/lua-5.1.4/HISTORY +++ b/lib/lua/HISTORY diff --git a/lua-5.1.4/INSTALL b/lib/lua/INSTALL index 17eb8aee8..17eb8aee8 100644 --- a/lua-5.1.4/INSTALL +++ b/lib/lua/INSTALL diff --git a/lua-5.1.4/Makefile b/lib/lua/Makefile index 6e78f66fa..6e78f66fa 100644 --- a/lua-5.1.4/Makefile +++ b/lib/lua/Makefile diff --git a/lua-5.1.4/README b/lib/lua/README index 11b4dff70..11b4dff70 100644 --- a/lua-5.1.4/README +++ b/lib/lua/README diff --git a/lua-5.1.4/src/Makefile b/lib/lua/src/Makefile index e4a3cd610..e4a3cd610 100644 --- a/lua-5.1.4/src/Makefile +++ b/lib/lua/src/Makefile diff --git a/lua-5.1.4/src/lapi.c b/lib/lua/src/lapi.c index 5d5145d2e..5d5145d2e 100644 --- a/lua-5.1.4/src/lapi.c +++ b/lib/lua/src/lapi.c diff --git a/lua-5.1.4/src/lapi.h b/lib/lua/src/lapi.h index 2c3fab244..2c3fab244 100644 --- a/lua-5.1.4/src/lapi.h +++ b/lib/lua/src/lapi.h diff --git a/lua-5.1.4/src/lauxlib.c b/lib/lua/src/lauxlib.c index 10f14e2c0..10f14e2c0 100644 --- a/lua-5.1.4/src/lauxlib.c +++ b/lib/lua/src/lauxlib.c diff --git a/lua-5.1.4/src/lauxlib.h b/lib/lua/src/lauxlib.h index 34258235d..34258235d 100644 --- a/lua-5.1.4/src/lauxlib.h +++ b/lib/lua/src/lauxlib.h diff --git a/lua-5.1.4/src/lbaselib.c b/lib/lua/src/lbaselib.c index 2a4c079d3..2a4c079d3 100644 --- a/lua-5.1.4/src/lbaselib.c +++ b/lib/lua/src/lbaselib.c diff --git a/lua-5.1.4/src/lcode.c b/lib/lua/src/lcode.c index cff626b7f..cff626b7f 100644 --- a/lua-5.1.4/src/lcode.c +++ b/lib/lua/src/lcode.c diff --git a/lua-5.1.4/src/lcode.h b/lib/lua/src/lcode.h index b941c6072..b941c6072 100644 --- a/lua-5.1.4/src/lcode.h +++ b/lib/lua/src/lcode.h diff --git a/lua-5.1.4/src/ldblib.c b/lib/lua/src/ldblib.c index 67de1222a..67de1222a 100644 --- a/lua-5.1.4/src/ldblib.c +++ b/lib/lua/src/ldblib.c diff --git a/lua-5.1.4/src/ldebug.c b/lib/lua/src/ldebug.c index 50ad3d380..50ad3d380 100644 --- a/lua-5.1.4/src/ldebug.c +++ b/lib/lua/src/ldebug.c diff --git a/lua-5.1.4/src/ldebug.h b/lib/lua/src/ldebug.h index ba28a9724..ba28a9724 100644 --- a/lua-5.1.4/src/ldebug.h +++ b/lib/lua/src/ldebug.h diff --git a/lua-5.1.4/src/ldo.c b/lib/lua/src/ldo.c index 8de05f728..8de05f728 100644 --- a/lua-5.1.4/src/ldo.c +++ b/lib/lua/src/ldo.c diff --git a/lua-5.1.4/src/ldo.h b/lib/lua/src/ldo.h index 98fddac59..98fddac59 100644 --- a/lua-5.1.4/src/ldo.h +++ b/lib/lua/src/ldo.h diff --git a/lua-5.1.4/src/ldump.c b/lib/lua/src/ldump.c index c9d3d4870..c9d3d4870 100644 --- a/lua-5.1.4/src/ldump.c +++ b/lib/lua/src/ldump.c diff --git a/lua-5.1.4/src/lfunc.c b/lib/lua/src/lfunc.c index 813e88f58..813e88f58 100644 --- a/lua-5.1.4/src/lfunc.c +++ b/lib/lua/src/lfunc.c diff --git a/lua-5.1.4/src/lfunc.h b/lib/lua/src/lfunc.h index a68cf5151..a68cf5151 100644 --- a/lua-5.1.4/src/lfunc.h +++ b/lib/lua/src/lfunc.h diff --git a/lua-5.1.4/src/lgc.c b/lib/lua/src/lgc.c index d9e0b7829..d9e0b7829 100644 --- a/lua-5.1.4/src/lgc.c +++ b/lib/lua/src/lgc.c diff --git a/lua-5.1.4/src/lgc.h b/lib/lua/src/lgc.h index 5a8dc605b..5a8dc605b 100644 --- a/lua-5.1.4/src/lgc.h +++ b/lib/lua/src/lgc.h diff --git a/lua-5.1.4/src/linit.c b/lib/lua/src/linit.c index c1f90dfab..c1f90dfab 100644 --- a/lua-5.1.4/src/linit.c +++ b/lib/lua/src/linit.c diff --git a/lua-5.1.4/src/liolib.c b/lib/lua/src/liolib.c index e79ed1cb2..e79ed1cb2 100644 --- a/lua-5.1.4/src/liolib.c +++ b/lib/lua/src/liolib.c diff --git a/lua-5.1.4/src/llex.c b/lib/lua/src/llex.c index 02849fa8f..02849fa8f 100644 --- a/lua-5.1.4/src/llex.c +++ b/lib/lua/src/llex.c diff --git a/lua-5.1.4/src/llex.h b/lib/lua/src/llex.h index a9201cee4..a9201cee4 100644 --- a/lua-5.1.4/src/llex.h +++ b/lib/lua/src/llex.h diff --git a/lua-5.1.4/src/llimits.h b/lib/lua/src/llimits.h index ca8dcb722..ca8dcb722 100644 --- a/lua-5.1.4/src/llimits.h +++ b/lib/lua/src/llimits.h diff --git a/lua-5.1.4/src/lmathlib.c b/lib/lua/src/lmathlib.c index 441fbf736..441fbf736 100644 --- a/lua-5.1.4/src/lmathlib.c +++ b/lib/lua/src/lmathlib.c diff --git a/lua-5.1.4/src/lmem.c b/lib/lua/src/lmem.c index ae7d8c965..ae7d8c965 100644 --- a/lua-5.1.4/src/lmem.c +++ b/lib/lua/src/lmem.c diff --git a/lua-5.1.4/src/lmem.h b/lib/lua/src/lmem.h index 7c2dcb322..7c2dcb322 100644 --- a/lua-5.1.4/src/lmem.h +++ b/lib/lua/src/lmem.h diff --git a/lua-5.1.4/src/loadlib.c b/lib/lua/src/loadlib.c index 0d401eba1..0d401eba1 100644 --- a/lua-5.1.4/src/loadlib.c +++ b/lib/lua/src/loadlib.c diff --git a/lua-5.1.4/src/lobject.c b/lib/lua/src/lobject.c index 4ff50732a..4ff50732a 100644 --- a/lua-5.1.4/src/lobject.c +++ b/lib/lua/src/lobject.c diff --git a/lua-5.1.4/src/lobject.h b/lib/lua/src/lobject.h index f1e447ef3..f1e447ef3 100644 --- a/lua-5.1.4/src/lobject.h +++ b/lib/lua/src/lobject.h diff --git a/lua-5.1.4/src/lopcodes.c b/lib/lua/src/lopcodes.c index 4cc745230..4cc745230 100644 --- a/lua-5.1.4/src/lopcodes.c +++ b/lib/lua/src/lopcodes.c diff --git a/lua-5.1.4/src/lopcodes.h b/lib/lua/src/lopcodes.h index 41224d6ee..41224d6ee 100644 --- a/lua-5.1.4/src/lopcodes.h +++ b/lib/lua/src/lopcodes.h diff --git a/lua-5.1.4/src/loslib.c b/lib/lua/src/loslib.c index da06a572a..da06a572a 100644 --- a/lua-5.1.4/src/loslib.c +++ b/lib/lua/src/loslib.c diff --git a/lua-5.1.4/src/lparser.c b/lib/lua/src/lparser.c index 1e2a9a88b..1e2a9a88b 100644 --- a/lua-5.1.4/src/lparser.c +++ b/lib/lua/src/lparser.c diff --git a/lua-5.1.4/src/lparser.h b/lib/lua/src/lparser.h index 18836afd1..18836afd1 100644 --- a/lua-5.1.4/src/lparser.h +++ b/lib/lua/src/lparser.h diff --git a/lua-5.1.4/src/lstate.c b/lib/lua/src/lstate.c index 4313b83a0..4313b83a0 100644 --- a/lua-5.1.4/src/lstate.c +++ b/lib/lua/src/lstate.c diff --git a/lua-5.1.4/src/lstate.h b/lib/lua/src/lstate.h index 3bc575b6b..3bc575b6b 100644 --- a/lua-5.1.4/src/lstate.h +++ b/lib/lua/src/lstate.h diff --git a/lua-5.1.4/src/lstring.c b/lib/lua/src/lstring.c index 49113151c..49113151c 100644 --- a/lua-5.1.4/src/lstring.c +++ b/lib/lua/src/lstring.c diff --git a/lua-5.1.4/src/lstring.h b/lib/lua/src/lstring.h index 73a2ff8b3..73a2ff8b3 100644 --- a/lua-5.1.4/src/lstring.h +++ b/lib/lua/src/lstring.h diff --git a/lua-5.1.4/src/lstrlib.c b/lib/lua/src/lstrlib.c index 1b4763d4e..1b4763d4e 100644 --- a/lua-5.1.4/src/lstrlib.c +++ b/lib/lua/src/lstrlib.c diff --git a/lua-5.1.4/src/ltable.c b/lib/lua/src/ltable.c index ec84f4fab..ec84f4fab 100644 --- a/lua-5.1.4/src/ltable.c +++ b/lib/lua/src/ltable.c diff --git a/lua-5.1.4/src/ltable.h b/lib/lua/src/ltable.h index f5b9d5ead..f5b9d5ead 100644 --- a/lua-5.1.4/src/ltable.h +++ b/lib/lua/src/ltable.h diff --git a/lua-5.1.4/src/ltablib.c b/lib/lua/src/ltablib.c index b6d9cb4ac..b6d9cb4ac 100644 --- a/lua-5.1.4/src/ltablib.c +++ b/lib/lua/src/ltablib.c diff --git a/lua-5.1.4/src/ltm.c b/lib/lua/src/ltm.c index c27f0f6fa..c27f0f6fa 100644 --- a/lua-5.1.4/src/ltm.c +++ b/lib/lua/src/ltm.c diff --git a/lua-5.1.4/src/ltm.h b/lib/lua/src/ltm.h index 64343b781..64343b781 100644 --- a/lua-5.1.4/src/ltm.h +++ b/lib/lua/src/ltm.h diff --git a/lua-5.1.4/src/lua.c b/lib/lua/src/lua.c index 3a4660932..3a4660932 100644 --- a/lua-5.1.4/src/lua.c +++ b/lib/lua/src/lua.c diff --git a/lua-5.1.4/src/lua.h b/lib/lua/src/lua.h index 1f8513667..1f8513667 100644 --- a/lua-5.1.4/src/lua.h +++ b/lib/lua/src/lua.h diff --git a/lua-5.1.4/src/luac.c b/lib/lua/src/luac.c index 487715433..487715433 100644 --- a/lua-5.1.4/src/luac.c +++ b/lib/lua/src/luac.c diff --git a/lua-5.1.4/src/luaconf.h b/lib/lua/src/luaconf.h index e2cb26163..e2cb26163 100644 --- a/lua-5.1.4/src/luaconf.h +++ b/lib/lua/src/luaconf.h diff --git a/lua-5.1.4/src/lualib.h b/lib/lua/src/lualib.h index 469417f67..469417f67 100644 --- a/lua-5.1.4/src/lualib.h +++ b/lib/lua/src/lualib.h diff --git a/lua-5.1.4/src/lundump.c b/lib/lua/src/lundump.c index 8010a4579..8010a4579 100644 --- a/lua-5.1.4/src/lundump.c +++ b/lib/lua/src/lundump.c diff --git a/lua-5.1.4/src/lundump.h b/lib/lua/src/lundump.h index c80189dbf..c80189dbf 100644 --- a/lua-5.1.4/src/lundump.h +++ b/lib/lua/src/lundump.h diff --git a/lua-5.1.4/src/lvm.c b/lib/lua/src/lvm.c index ee3256ab9..ee3256ab9 100644 --- a/lua-5.1.4/src/lvm.c +++ b/lib/lua/src/lvm.c diff --git a/lua-5.1.4/src/lvm.h b/lib/lua/src/lvm.h index bfe4f5678..bfe4f5678 100644 --- a/lua-5.1.4/src/lvm.h +++ b/lib/lua/src/lvm.h diff --git a/lua-5.1.4/src/lzio.c b/lib/lua/src/lzio.c index 293edd59b..293edd59b 100644 --- a/lua-5.1.4/src/lzio.c +++ b/lib/lua/src/lzio.c diff --git a/lua-5.1.4/src/lzio.h b/lib/lua/src/lzio.h index 51d695d8c..51d695d8c 100644 --- a/lua-5.1.4/src/lzio.h +++ b/lib/lua/src/lzio.h diff --git a/lua-5.1.4/src/print.c b/lib/lua/src/print.c index e240cfc3c..e240cfc3c 100644 --- a/lua-5.1.4/src/print.c +++ b/lib/lua/src/print.c diff --git a/lib/luaexpat/lxplib.c b/lib/luaexpat/lxplib.c new file mode 100644 index 000000000..1a36104a8 --- /dev/null +++ b/lib/luaexpat/lxplib.c @@ -0,0 +1,599 @@ +/* +** $Id: lxplib.c,v 1.16 2007/06/05 20:03:12 carregal Exp $ +** LuaExpat: Lua bind for Expat library +** See Copyright Notice in license.html +*/ + + +#include <assert.h> +#include <stdlib.h> +#include <string.h> + +#include "expat/expat.h" + +#include "lua/src/lua.h" +#include "lua/src/lauxlib.h" + + +#include "lxplib.h" + + +#if !defined(lua_pushliteral) +#define lua_pushliteral(L, s) \ + lua_pushstring(L, "" s, (sizeof(s)/sizeof(char))-1) +#endif + + +enum XPState { + XPSpre, /* parser just initialized */ + XPSok, /* state while parsing */ + XPSfinished, /* state after finished parsing */ + XPSerror, + XPSstring /* state while reading a string */ +}; + +struct lxp_userdata { + lua_State *L; + XML_Parser parser; /* associated expat parser */ + int tableref; /* table with callbacks for this parser */ + enum XPState state; + luaL_Buffer *b; /* to concatenate sequences of cdata pieces */ +}; + +typedef struct lxp_userdata lxp_userdata; + + +static int reporterror (lxp_userdata *xpu) { + lua_State *L = xpu->L; + XML_Parser p = xpu->parser; + lua_pushnil(L); + lua_pushstring(L, XML_ErrorString(XML_GetErrorCode(p))); + lua_pushnumber(L, XML_GetCurrentLineNumber(p)); + lua_pushnumber(L, XML_GetCurrentColumnNumber(p) + 1); + lua_pushnumber(L, XML_GetCurrentByteIndex(p) + 1); + return 5; +} + + +static lxp_userdata *createlxp (lua_State *L) { + lxp_userdata *xpu = (lxp_userdata *)lua_newuserdata(L, sizeof(lxp_userdata)); + xpu->tableref = LUA_REFNIL; /* in case of errors... */ + xpu->parser = NULL; + xpu->L = NULL; + xpu->state = XPSpre; + luaL_getmetatable(L, ParserType); + lua_setmetatable(L, -2); + return xpu; +} + + +static void lxpclose (lua_State *L, lxp_userdata *xpu) { + luaL_unref(L, LUA_REGISTRYINDEX, xpu->tableref); + xpu->tableref = LUA_REFNIL; + if (xpu->parser) + XML_ParserFree(xpu->parser); + xpu->parser = NULL; +} + + + + +/* +** Auxiliary function to call a Lua handle +*/ +static void docall (lxp_userdata *xpu, int nargs, int nres) { + lua_State *L = xpu->L; + assert(xpu->state == XPSok); + if (lua_pcall(L, nargs + 1, nres, 0) != 0) { + xpu->state = XPSerror; + luaL_unref(L, LUA_REGISTRYINDEX, xpu->tableref); + xpu->tableref = luaL_ref(L, LUA_REGISTRYINDEX); /* error message */ + } +} + + +/* +** Check whether there is pending Cdata, and call its handle if necessary +*/ +static void dischargestring (lxp_userdata *xpu) { + assert(xpu->state == XPSstring); + xpu->state = XPSok; + luaL_pushresult(xpu->b); + docall(xpu, 1, 0); +} + + +/* +** Check whether there is a Lua handle for a given event: If so, +** put it on the stack (to be called later), and also push `self' +*/ +static int getHandle (lxp_userdata *xpu, const char *handle) { + lua_State *L = xpu->L; + if (xpu->state == XPSstring) dischargestring(xpu); + if (xpu->state == XPSerror) + return 0; /* some error happened before; skip all handles */ + lua_pushstring(L, handle); + lua_gettable(L, 3); + if (lua_toboolean(L, -1) == 0) { + lua_pop(L, 1); + return 0; + } + if (!lua_isfunction(L, -1)) { + luaL_error(L, "lxp `%s' callback is not a function", handle); + } + lua_pushvalue(L, 1); /* first argument in every call (self) */ + return 1; +} + + + +/* +** {====================================================== +** Handles +** ======================================================= +*/ + + +static void f_StartCdata (void *ud) { + lxp_userdata *xpu = (lxp_userdata *)ud; + if (getHandle(xpu, StartCdataKey) == 0) return; /* no handle */ + docall(xpu, 0, 0); +} + + +static void f_EndCdataKey (void *ud) { + lxp_userdata *xpu = (lxp_userdata *)ud; + if (getHandle(xpu, EndCdataKey) == 0) return; /* no handle */ + docall(xpu, 0, 0); +} + + +static void f_CharData (void *ud, const char *s, int len) { + lxp_userdata *xpu = (lxp_userdata *)ud; + if (xpu->state == XPSok) { + if (getHandle(xpu, CharDataKey) == 0) return; /* no handle */ + xpu->state = XPSstring; + luaL_buffinit(xpu->L, xpu->b); + } + if (xpu->state == XPSstring) + luaL_addlstring(xpu->b, s, len); +} + + +static void f_Comment (void *ud, const char *data) { + lxp_userdata *xpu = (lxp_userdata *)ud; + if (getHandle(xpu, CommentKey) == 0) return; /* no handle */ + lua_pushstring(xpu->L, data); + docall(xpu, 1, 0); +} + + +static void f_Default (void *ud, const char *data, int len) { + lxp_userdata *xpu = (lxp_userdata *)ud; + if (getHandle(xpu, DefaultKey) == 0) return; /* no handle */ + lua_pushlstring(xpu->L, data, len); + docall(xpu, 1, 0); +} + + +static void f_DefaultExpand (void *ud, const char *data, int len) { + lxp_userdata *xpu = (lxp_userdata *)ud; + if (getHandle(xpu, DefaultExpandKey) == 0) return; /* no handle */ + lua_pushlstring(xpu->L, data, len); + docall(xpu, 1, 0); +} + + +static void f_StartElement (void *ud, const char *name, const char **attrs) { + lxp_userdata *xpu = (lxp_userdata *)ud; + lua_State *L = xpu->L; + int lastspec = XML_GetSpecifiedAttributeCount(xpu->parser) / 2; + int i = 1; + if (getHandle(xpu, StartElementKey) == 0) return; /* no handle */ + lua_pushstring(L, name); + lua_newtable(L); + while (*attrs) { + if (i <= lastspec) { + lua_pushnumber(L, i++); + lua_pushstring(L, *attrs); + lua_settable(L, -3); + } + lua_pushstring(L, *attrs++); + lua_pushstring(L, *attrs++); + lua_settable(L, -3); + } + docall(xpu, 2, 0); /* call function with self, name, and attributes */ +} + + +static void f_EndElement (void *ud, const char *name) { + lxp_userdata *xpu = (lxp_userdata *)ud; + if (getHandle(xpu, EndElementKey) == 0) return; /* no handle */ + lua_pushstring(xpu->L, name); + docall(xpu, 1, 0); +} + + +static int f_ExternaEntity (XML_Parser p, const char *context, + const char *base, + const char *systemId, + const char *publicId) { + lxp_userdata *xpu = (lxp_userdata *)XML_GetUserData(p); + lua_State *L = xpu->L; + lxp_userdata *child; + int status; + if (getHandle(xpu, ExternalEntityKey) == 0) return 1; /* no handle */ + child = createlxp(L); + child->parser = XML_ExternalEntityParserCreate(p, context, NULL); + if (!child->parser) + luaL_error(L, "XML_ParserCreate failed"); + lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); /*lua_getref(L, xpu->tableref); */ /* child uses the same table of its father */ + child->tableref = luaL_ref(L, LUA_REGISTRYINDEX); + lua_pushstring(L, base); + lua_pushstring(L, systemId); + lua_pushstring(L, publicId); + docall(xpu, 4, 1); + status = lua_toboolean(L, -1); + lua_pop(L, 1); + lxpclose(L, child); + return status; +} + + +static void f_StartNamespaceDecl (void *ud, const char *prefix, + const char *uri) { + lxp_userdata *xpu = (lxp_userdata *)ud; + lua_State *L = xpu->L; + if (getHandle(xpu, StartNamespaceDeclKey) == 0) return; /* no handle */ + lua_pushstring(L, prefix); + lua_pushstring(L, uri); + docall(xpu, 2, 0); +} + + +static void f_EndNamespaceDecl (void *ud, const char *prefix) { + lxp_userdata *xpu = (lxp_userdata *)ud; + if (getHandle(xpu, EndNamespaceDeclKey) == 0) return; /* no handle */ + lua_pushstring(xpu->L, prefix); + docall(xpu, 1, 0); +} + + +static void f_NotationDecl (void *ud, const char *notationName, + const char *base, + const char *systemId, + const char *publicId) { + lxp_userdata *xpu = (lxp_userdata *)ud; + lua_State *L = xpu->L; + if (getHandle(xpu, NotationDeclKey) == 0) return; /* no handle */ + lua_pushstring(L, notationName); + lua_pushstring(L, base); + lua_pushstring(L, systemId); + lua_pushstring(L, publicId); + docall(xpu, 4, 0); +} + + +static int f_NotStandalone (void *ud) { + int status; + lxp_userdata *xpu = (lxp_userdata *)ud; + lua_State *L = xpu->L; + if (getHandle(xpu, NotStandaloneKey) == 0) return 1; /* no handle */ + docall(xpu, 0, 1); + status = lua_toboolean(L, -1); + lua_pop(L, 1); + return status; +} + + +static void f_ProcessingInstruction (void *ud, const char *target, + const char *data) { + lxp_userdata *xpu = (lxp_userdata *)ud; + lua_State *L = xpu->L; + if (getHandle(xpu, ProcessingInstructionKey) == 0) return; /* no handle */ + lua_pushstring(L, target); + lua_pushstring(L, data); + docall(xpu, 2, 0); +} + + +static void f_UnparsedEntityDecl (void *ud, const char *entityName, + const char *base, + const char *systemId, + const char *publicId, + const char *notationName) { + lxp_userdata *xpu = (lxp_userdata *)ud; + lua_State *L = xpu->L; + if (getHandle(xpu, UnparsedEntityDeclKey) == 0) return; /* no handle */ + lua_pushstring(L, entityName); + lua_pushstring(L, base); + lua_pushstring(L, systemId); + lua_pushstring(L, publicId); + lua_pushstring(L, notationName); + docall(xpu, 5, 0); +} + +static void f_StartDoctypeDecl (void *ud, const XML_Char *doctypeName, + const XML_Char *sysid, + const XML_Char *pubid, + int has_internal_subset) { + lxp_userdata *xpu = (lxp_userdata *)ud; + if (getHandle(xpu, StartDoctypeDeclKey) == 0) return; /* no handle */ + lua_pushstring(xpu->L, doctypeName); + lua_pushstring(xpu->L, sysid); + lua_pushstring(xpu->L, pubid); + lua_pushboolean(xpu->L, has_internal_subset); + docall(xpu, 4, 0); +} + +/* }====================================================== */ + + + +static int hasfield (lua_State *L, const char *fname) { + int res; + lua_pushstring(L, fname); + lua_gettable(L, 1); + res = !lua_isnil(L, -1); + lua_pop(L, 1); + return res; +} + + +static void checkcallbacks (lua_State *L) { + static const char *const validkeys[] = { + "StartCdataSection", "EndCdataSection", "CharacterData", "Comment", + "Default", "DefaultExpand", "StartElement", "EndElement", + "ExternalEntityRef", "StartNamespaceDecl", "EndNamespaceDecl", + "NotationDecl", "NotStandalone", "ProcessingInstruction", + "UnparsedEntityDecl", "StartDoctypeDecl", NULL}; + if (hasfield(L, "_nonstrict")) return; + lua_pushnil(L); + while (lua_next(L, 1)) { + lua_pop(L, 1); /* remove value */ +#if ! defined (LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 + if (lua_type(L, -1) != LUA_TSTRING || + luaL_findstring(lua_tostring(L, -1), validkeys) < 0) + luaL_error(L, "invalid key `%s' in callback table", lua_tostring(L, -1)); +#else + luaL_checkoption(L, -1, NULL, validkeys); +#endif + } +} + + +static int lxp_make_parser (lua_State *L) { + XML_Parser p; + char sep = *luaL_optstring(L, 2, ""); + lxp_userdata *xpu = createlxp(L); + p = xpu->parser = (sep == '\0') ? XML_ParserCreate(NULL) : + XML_ParserCreateNS(NULL, sep); + if (!p) + luaL_error(L, "XML_ParserCreate failed"); + luaL_checktype(L, 1, LUA_TTABLE); + checkcallbacks(L); + lua_pushvalue(L, 1); + xpu->tableref = luaL_ref(L, LUA_REGISTRYINDEX); + XML_SetUserData(p, xpu); + if (hasfield(L, StartCdataKey) || hasfield(L, EndCdataKey)) + XML_SetCdataSectionHandler(p, f_StartCdata, f_EndCdataKey); + if (hasfield(L, CharDataKey)) + XML_SetCharacterDataHandler(p, f_CharData); + if (hasfield(L, CommentKey)) + XML_SetCommentHandler(p, f_Comment); + if (hasfield(L, DefaultKey)) + XML_SetDefaultHandler(p, f_Default); + if (hasfield(L, DefaultExpandKey)) + XML_SetDefaultHandlerExpand(p, f_DefaultExpand); + if (hasfield(L, StartElementKey) || hasfield(L, EndElementKey)) + XML_SetElementHandler(p, f_StartElement, f_EndElement); + if (hasfield(L, ExternalEntityKey)) + XML_SetExternalEntityRefHandler(p, f_ExternaEntity); + if (hasfield(L, StartNamespaceDeclKey) || hasfield(L, EndNamespaceDeclKey)) + XML_SetNamespaceDeclHandler(p, f_StartNamespaceDecl, f_EndNamespaceDecl); + if (hasfield(L, NotationDeclKey)) + XML_SetNotationDeclHandler(p, f_NotationDecl); + if (hasfield(L, NotStandaloneKey)) + XML_SetNotStandaloneHandler(p, f_NotStandalone); + if (hasfield(L, ProcessingInstructionKey)) + XML_SetProcessingInstructionHandler(p, f_ProcessingInstruction); + if (hasfield(L, UnparsedEntityDeclKey)) + XML_SetUnparsedEntityDeclHandler(p, f_UnparsedEntityDecl); + if (hasfield(L, StartDoctypeDeclKey)) + XML_SetStartDoctypeDeclHandler(p, f_StartDoctypeDecl); + return 1; +} + + +static lxp_userdata *checkparser (lua_State *L, int idx) { + lxp_userdata *xpu = (lxp_userdata *)luaL_checkudata(L, idx, ParserType); + luaL_argcheck(L, xpu, idx, "expat parser expected"); + luaL_argcheck(L, xpu->parser, idx, "parser is closed"); + return xpu; +} + + +static int parser_gc (lua_State *L) { + lxp_userdata *xpu = (lxp_userdata *)luaL_checkudata(L, 1, ParserType); + luaL_argcheck(L, xpu, 1, "expat parser expected"); + lxpclose(L, xpu); + return 0; +} + + +static int setbase (lua_State *L) { + lxp_userdata *xpu = checkparser(L, 1); + if (XML_SetBase(xpu->parser, luaL_checkstring(L, 2)) == 0) + luaL_error(L, "no memory to store base"); + return 0; +} + + +static int getbase (lua_State *L) { + lxp_userdata *xpu = checkparser(L, 1); + lua_pushstring(L, XML_GetBase(xpu->parser)); + return 1; +} + + +static int getcallbacks (lua_State *L) { + lxp_userdata *xpu = checkparser(L, 1); + lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); + return 1; +} + + +static int parse_aux (lua_State *L, lxp_userdata *xpu, const char *s, + size_t len) { + luaL_Buffer b; + int status; + xpu->L = L; + xpu->state = XPSok; + xpu->b = &b; + lua_settop(L, 2); + lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); /*lua_getref(L, xpu->tableref);*/ /* to be used by handlers */ + status = XML_Parse(xpu->parser, s, (int)len, s == NULL); + if (xpu->state == XPSstring) dischargestring(xpu); + if (xpu->state == XPSerror) { /* callback error? */ + lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); /* get original msg. */ + lua_error(L); + } + if (s == NULL) xpu->state = XPSfinished; + if (status) { + lua_pushboolean(L, 1); + return 1; + } + else { /* error */ + return reporterror(xpu); + } +} + + +static int lxp_parse (lua_State *L) { + lxp_userdata *xpu = checkparser(L, 1); + size_t len; + const char *s = luaL_optlstring(L, 2, NULL, &len); + if (xpu->state == XPSfinished && s != NULL) { + lua_pushnil(L); + lua_pushliteral(L, "cannot parse - document is finished"); + return 2; + } + return parse_aux(L, xpu, s, len); +} + + +static int lxp_close (lua_State *L) { + int status = 1; + lxp_userdata *xpu = (lxp_userdata *)luaL_checkudata(L, 1, ParserType); + luaL_argcheck(L, xpu, 1, "expat parser expected"); + if (xpu->state != XPSfinished) + status = parse_aux(L, xpu, NULL, 0); + lxpclose(L, xpu); + if (status > 1) luaL_error(L, "error closing parser: %s", + lua_tostring(L, -status+1)); + return 0; +} + + +static int lxp_pos (lua_State *L) { + lxp_userdata *xpu = checkparser(L, 1); + XML_Parser p = xpu->parser; + lua_pushnumber(L, XML_GetCurrentLineNumber(p)); + lua_pushnumber(L, XML_GetCurrentColumnNumber(p) + 1); + lua_pushnumber(L, XML_GetCurrentByteIndex(p) + 1); + return 3; +} + + +static int lxp_setencoding (lua_State *L) { + lxp_userdata *xpu = checkparser(L, 1); + const char *encoding = luaL_checkstring(L, 2); + luaL_argcheck(L, xpu->state == XPSpre, 1, "invalid parser state"); + XML_SetEncoding(xpu->parser, encoding); + return 0; +} + +static int lxp_stop (lua_State *L) { + lxp_userdata *xpu = checkparser(L, 1); + lua_pushboolean(L, XML_StopParser(xpu->parser, XML_FALSE) == XML_STATUS_OK); + return 1; +} + +#if !defined LUA_VERSION_NUM +/* Lua 5.0 */ +#define luaL_Reg luaL_reg +#endif + +static const struct luaL_Reg lxp_meths[] = { + {"parse", lxp_parse}, + {"close", lxp_close}, + {"__gc", parser_gc}, + {"pos", lxp_pos}, + {"setencoding", lxp_setencoding}, + {"getcallbacks", getcallbacks}, + {"getbase", getbase}, + {"setbase", setbase}, + {"stop", lxp_stop}, + {NULL, NULL} +}; + +static const struct luaL_Reg lxp_funcs[] = { + {"new", lxp_make_parser}, + {NULL, NULL} +}; + + +/* +** Assumes the table is on top of the stack. +*/ +static void set_info (lua_State *L) { + lua_pushliteral (L, "_COPYRIGHT"); + lua_pushliteral (L, "Copyright (C) 2003-2012 Kepler Project"); + lua_settable (L, -3); + lua_pushliteral (L, "_DESCRIPTION"); + lua_pushliteral (L, "LuaExpat is a SAX XML parser based on the Expat library"); + lua_settable (L, -3); + lua_pushliteral (L, "_VERSION"); + lua_pushliteral (L, "LuaExpat 1.3.0"); + lua_settable (L, -3); +} + + +#if !defined LUA_VERSION_NUM || LUA_VERSION_NUM==501 +/* +** Adapted from Lua 5.2.0 +*/ +static void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { + luaL_checkstack(L, nup, "too many upvalues"); + for (; l->name != NULL; l++) { /* fill the table with given functions */ + int i; + for (i = 0; i < nup; i++) /* copy upvalues to the top */ + lua_pushvalue(L, -nup); + lua_pushstring(L, l->name); + lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ + lua_settable(L, -(nup + 3)); + } + lua_pop(L, nup); /* remove upvalues */ +} +#endif + + +int luaopen_lxp (lua_State *L) { + luaL_newmetatable(L, ParserType); + + lua_pushliteral(L, "__index"); + lua_pushvalue(L, -2); + lua_rawset(L, -3); + + luaL_setfuncs (L, lxp_meths, 0); + lua_pop (L, 1); /* remove metatable */ + + // _X 2013_04_09: Modified to allow embedding + luaL_openlib (L, "lxp", lxp_funcs, 0); + /* + lua_newtable (L); + luaL_setfuncs (L, lxp_funcs, 0); + */ + set_info (L); + return 1; +} diff --git a/source/LuaExpat/lxplib.h b/lib/luaexpat/lxplib.h index 9c0be4f78..9c0be4f78 100644 --- a/source/LuaExpat/lxplib.h +++ b/lib/luaexpat/lxplib.h diff --git a/source/md5/md5.cpp b/lib/md5/md5.cpp index eae0fc3f2..eae0fc3f2 100644 --- a/source/md5/md5.cpp +++ b/lib/md5/md5.cpp diff --git a/source/md5/md5.h b/lib/md5/md5.h index ad5ad5384..ad5ad5384 100644 --- a/source/md5/md5.h +++ b/lib/md5/md5.h diff --git a/lib/sqlite/lsqlite3.c b/lib/sqlite/lsqlite3.c new file mode 100644 index 000000000..cf2c62597 --- /dev/null +++ b/lib/sqlite/lsqlite3.c @@ -0,0 +1,2175 @@ +/************************************************************************ +* lsqlite3 * +* Copyright (C) 2002-2013 Tiago Dionizio, Doug Currie * +* All rights reserved. * +* Author : Tiago Dionizio <tiago.dionizio@ist.utl.pt> * +* Author : Doug Currie <doug.currie@alum.mit.edu> * +* Library : lsqlite3 - a SQLite 3 database binding for Lua 5 * +* * +* 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. * +************************************************************************/ +// Slightly modified by _Xoft to compile in MSVC + + + + +// 2013_04_07 _X: Added the following #define-s so that MSVC doesn't complain about non-secure stuff: +#define _CRT_SECURE_NO_WARNINGS +#ifdef __cplusplus +extern "C" { +#endif // __cplusplus + + + + +#include <stdlib.h> +#include <string.h> +#include <assert.h> + +#define LUA_LIB +#include "lua/src/lua.h" +#include "lua/src/lauxlib.h" + +#if LUA_VERSION_NUM > 501 +// +// Lua 5.2 +// +#define lua_strlen lua_rawlen +// luaL_typerror always used with arg at ndx == NULL +#define luaL_typerror(L,ndx,str) luaL_error(L,"bad argument %d (%s expected, got nil)",ndx,str) +// luaL_register used once, so below expansion is OK for this case +#define luaL_register(L,name,reg) lua_newtable(L);luaL_setfuncs(L,reg,0) +// luaL_openlib always used with name == NULL +#define luaL_openlib(L,name,reg,nup) luaL_setfuncs(L,reg,nup) +#endif + +#include "sqlite3.h" + +/* compile time features */ +#if !defined(SQLITE_OMIT_PROGRESS_CALLBACK) + #define SQLITE_OMIT_PROGRESS_CALLBACK 0 +#endif +#if !defined(LSQLITE_OMIT_UPDATE_HOOK) + #define LSQLITE_OMIT_UPDATE_HOOK 0 +#endif + +typedef struct sdb sdb; +typedef struct sdb_vm sdb_vm; +typedef struct sdb_func sdb_func; + +/* to use as C user data so i know what function sqlite is calling */ +struct sdb_func { + /* references to associated lua values */ + int fn_step; + int fn_finalize; + int udata; + + sdb *db; + char aggregate; + + sdb_func *next; +}; + +/* information about database */ +struct sdb { + /* associated lua state */ + lua_State *L; + /* sqlite database handle */ + sqlite3 *db; + + /* sql functions stack usage */ + sdb_func *func; /* top SQL function being called */ + + /* references */ + int busy_cb; /* busy callback */ + int busy_udata; + + int progress_cb; /* progress handler */ + int progress_udata; + + int trace_cb; /* trace callback */ + int trace_udata; + +#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK + + int update_hook_cb; /* update_hook callback */ + int update_hook_udata; + + int commit_hook_cb; /* commit_hook callback */ + int commit_hook_udata; + + int rollback_hook_cb; /* rollback_hook callback */ + int rollback_hook_udata; + +#endif +}; + +static const char *sqlite_meta = ":sqlite3"; +static const char *sqlite_vm_meta = ":sqlite3:vm"; +static const char *sqlite_ctx_meta = ":sqlite3:ctx"; +static int sqlite_ctx_meta_ref; + +/* +** ======================================================= +** Database Virtual Machine Operations +** ======================================================= +*/ + +static void vm_push_column(lua_State *L, sqlite3_stmt *vm, int idx) { + switch (sqlite3_column_type(vm, idx)) { + case SQLITE_INTEGER: + { + sqlite_int64 i64 = sqlite3_column_int64(vm, idx); + lua_Number n = (lua_Number)i64; + if (n == i64) + lua_pushnumber(L, n); + else + lua_pushlstring(L, (const char*)sqlite3_column_text(vm, idx), sqlite3_column_bytes(vm, idx)); + } + break; + case SQLITE_FLOAT: + lua_pushnumber(L, sqlite3_column_double(vm, idx)); + break; + case SQLITE_TEXT: + lua_pushlstring(L, (const char*)sqlite3_column_text(vm, idx), sqlite3_column_bytes(vm, idx)); + break; + case SQLITE_BLOB: + lua_pushlstring(L, sqlite3_column_blob(vm, idx), sqlite3_column_bytes(vm, idx)); + break; + case SQLITE_NULL: + lua_pushnil(L); + break; + default: + lua_pushnil(L); + break; + } +} + +/* virtual machine information */ +struct sdb_vm { + sdb *db; /* associated database handle */ + sqlite3_stmt *vm; /* virtual machine */ + + /* sqlite3_step info */ + int columns; /* number of columns in result */ + char has_values; /* true when step succeeds */ + + char temp; /* temporary vm used in db:rows */ +}; + +/* called with sql text on the lua stack */ +static sdb_vm *newvm(lua_State *L, sdb *db) { + sdb_vm *svm = (sdb_vm*)lua_newuserdata(L, sizeof(sdb_vm)); + + luaL_getmetatable(L, sqlite_vm_meta); + lua_setmetatable(L, -2); /* set metatable */ + + svm->db = db; + svm->columns = 0; + svm->has_values = 0; + svm->vm = NULL; + svm->temp = 0; + + /* add an entry on the database table: svm -> sql text */ + lua_pushlightuserdata(L, db); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushlightuserdata(L, svm); + lua_pushvalue(L, -4); /* the sql text */ + lua_rawset(L, -3); + lua_pop(L, 1); + + return svm; +} + +static int cleanupvm(lua_State *L, sdb_vm *svm) { + /* remove entry in database table - no harm if not present in the table */ + lua_pushlightuserdata(L, svm->db); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushlightuserdata(L, svm); + lua_pushnil(L); + lua_rawset(L, -3); + lua_pop(L, 1); + + svm->columns = 0; + svm->has_values = 0; + + if (!svm->vm) return 0; + + lua_pushnumber(L, sqlite3_finalize(svm->vm)); + svm->vm = NULL; + return 1; +} + +static int stepvm(lua_State *L, sdb_vm *svm) { + int result; + int loop_limit = 3; + while ( loop_limit-- ) { + result = sqlite3_step(svm->vm); + if ( result==SQLITE_ERROR ) { + result = sqlite3_reset (svm->vm); + } + if ( result==SQLITE_SCHEMA ) { + sqlite3_stmt *vn; + const char *sql; + /* recover sql text */ + lua_pushlightuserdata(L, svm->db); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushlightuserdata(L, svm); + lua_rawget(L, -2); /* sql text */ + sql = luaL_checkstring(L, -1); + /* re-prepare */ + result = sqlite3_prepare(svm->db->db, sql, -1, &vn, NULL); + if (result != SQLITE_OK) break; + sqlite3_transfer_bindings(svm->vm, vn); + sqlite3_finalize(svm->vm); + svm->vm = vn; + lua_pop(L,2); + } else { + break; + } + } + return result; +} + +static sdb_vm *lsqlite_getvm(lua_State *L, int index) { + sdb_vm *svm = (sdb_vm*)luaL_checkudata(L, index, sqlite_vm_meta); + if (svm == NULL) luaL_argerror(L, index, "bad sqlite virtual machine"); + return svm; +} + +static sdb_vm *lsqlite_checkvm(lua_State *L, int index) { + sdb_vm *svm = lsqlite_getvm(L, index); + if (svm->vm == NULL) luaL_argerror(L, index, "attempt to use closed sqlite virtual machine"); + return svm; +} + +static int dbvm_isopen(lua_State *L) { + sdb_vm *svm = lsqlite_getvm(L, 1); + lua_pushboolean(L, svm->vm != NULL ? 1 : 0); + return 1; +} + +static int dbvm_tostring(lua_State *L) { + char buff[39]; + sdb_vm *svm = lsqlite_getvm(L, 1); + if (svm->vm == NULL) + strcpy(buff, "closed"); + else + sprintf(buff, "%p", svm); + lua_pushfstring(L, "sqlite virtual machine (%s)", buff); + return 1; +} + +static int dbvm_gc(lua_State *L) { + sdb_vm *svm = lsqlite_getvm(L, 1); + if (svm->vm != NULL) /* ignore closed vms */ + cleanupvm(L, svm); + return 0; +} + +static int dbvm_step(lua_State *L) { + int result; + sdb_vm *svm = lsqlite_checkvm(L, 1); + + result = stepvm(L, svm); + svm->has_values = result == SQLITE_ROW ? 1 : 0; + svm->columns = sqlite3_data_count(svm->vm); + + lua_pushnumber(L, result); + return 1; +} + +static int dbvm_finalize(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + return cleanupvm(L, svm); +} + +static int dbvm_reset(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_reset(svm->vm); + lua_pushnumber(L, sqlite3_errcode(svm->db->db)); + return 1; +} + +static void dbvm_check_contents(lua_State *L, sdb_vm *svm) { + if (!svm->has_values) { + luaL_error(L, "misuse of function"); + } +} + +static void dbvm_check_index(lua_State *L, sdb_vm *svm, int index) { + if (index < 0 || index >= svm->columns) { + luaL_error(L, "index out of range [0..%d]", svm->columns - 1); + } +} + +static void dbvm_check_bind_index(lua_State *L, sdb_vm *svm, int index) { + if (index < 1 || index > sqlite3_bind_parameter_count(svm->vm)) { + luaL_error(L, "bind index out of range [1..%d]", sqlite3_bind_parameter_count(svm->vm)); + } +} + +/* +** ======================================================= +** Virtual Machine - generic info +** ======================================================= +*/ +static int dbvm_columns(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + lua_pushnumber(L, sqlite3_column_count(svm->vm)); + return 1; +} + +/* +** ======================================================= +** Virtual Machine - getters +** ======================================================= +*/ + +static int dbvm_get_value(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + int index = luaL_checkint(L, 2); + dbvm_check_contents(L, svm); + dbvm_check_index(L, svm, index); + vm_push_column(L, svm->vm, index); + return 1; +} + +static int dbvm_get_name(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + int index = (int)luaL_checknumber(L, 2); + dbvm_check_index(L, svm, index); + lua_pushstring(L, sqlite3_column_name(svm->vm, index)); + return 1; +} + +static int dbvm_get_type(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + int index = (int)luaL_checknumber(L, 2); + dbvm_check_index(L, svm, index); + lua_pushstring(L, sqlite3_column_decltype(svm->vm, index)); + return 1; +} + +static int dbvm_get_values(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_stmt *vm = svm->vm; + int columns = svm->columns; + int n; + dbvm_check_contents(L, svm); + + lua_newtable(L); + for (n = 0; n < columns;) { + vm_push_column(L, vm, n++); + lua_rawseti(L, -2, n); + } + return 1; +} + +static int dbvm_get_names(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_stmt *vm = svm->vm; + int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */ + int n; + + lua_newtable(L); + for (n = 0; n < columns;) { + lua_pushstring(L, sqlite3_column_name(vm, n++)); + lua_rawseti(L, -2, n); + } + return 1; +} + +static int dbvm_get_types(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_stmt *vm = svm->vm; + int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */ + int n; + + lua_newtable(L); + for (n = 0; n < columns;) { + lua_pushstring(L, sqlite3_column_decltype(vm, n++)); + lua_rawseti(L, -2, n); + } + return 1; +} + +static int dbvm_get_uvalues(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_stmt *vm = svm->vm; + int columns = svm->columns; + int n; + dbvm_check_contents(L, svm); + + lua_checkstack(L, columns); + for (n = 0; n < columns; ++n) + vm_push_column(L, vm, n); + return columns; +} + +static int dbvm_get_unames(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_stmt *vm = svm->vm; + int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */ + int n; + + lua_checkstack(L, columns); + for (n = 0; n < columns; ++n) + lua_pushstring(L, sqlite3_column_name(vm, n)); + return columns; +} + +static int dbvm_get_utypes(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_stmt *vm = svm->vm; + int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */ + int n; + + lua_checkstack(L, columns); + for (n = 0; n < columns; ++n) + lua_pushstring(L, sqlite3_column_decltype(vm, n)); + return columns; +} + +static int dbvm_get_named_values(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_stmt *vm = svm->vm; + int columns = svm->columns; + int n; + dbvm_check_contents(L, svm); + + lua_newtable(L); + for (n = 0; n < columns; ++n) { + lua_pushstring(L, sqlite3_column_name(vm, n)); + vm_push_column(L, vm, n); + lua_rawset(L, -3); + } + return 1; +} + +static int dbvm_get_named_types(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_stmt *vm = svm->vm; + int columns = sqlite3_column_count(vm); + int n; + + lua_newtable(L); + for (n = 0; n < columns; ++n) { + lua_pushstring(L, sqlite3_column_name(vm, n)); + lua_pushstring(L, sqlite3_column_decltype(vm, n)); + lua_rawset(L, -3); + } + return 1; +} + +/* +** ======================================================= +** Virtual Machine - Bind +** ======================================================= +*/ + +static int dbvm_bind_index(lua_State *L, sqlite3_stmt *vm, int index, int lindex) { + switch (lua_type(L, lindex)) { + case LUA_TSTRING: + return sqlite3_bind_text(vm, index, lua_tostring(L, lindex), lua_strlen(L, lindex), SQLITE_TRANSIENT); + case LUA_TNUMBER: + return sqlite3_bind_double(vm, index, lua_tonumber(L, lindex)); + case LUA_TBOOLEAN: + return sqlite3_bind_int(vm, index, lua_toboolean(L, lindex) ? 1 : 0); + case LUA_TNONE: + case LUA_TNIL: + return sqlite3_bind_null(vm, index); + default: + luaL_error(L, "index (%d) - invalid data type for bind (%s)", index, lua_typename(L, lua_type(L, lindex))); + return SQLITE_MISUSE; /*!*/ + } +} + + +static int dbvm_bind_parameter_count(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + lua_pushnumber(L, sqlite3_bind_parameter_count(svm->vm)); + return 1; +} + +static int dbvm_bind_parameter_name(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + int index = (int)luaL_checknumber(L, 2); + dbvm_check_bind_index(L, svm, index); + lua_pushstring(L, sqlite3_bind_parameter_name(svm->vm, index)); + return 1; +} + +static int dbvm_bind(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_stmt *vm = svm->vm; + int index = luaL_checkint(L, 2); + int result; + + dbvm_check_bind_index(L, svm, index); + result = dbvm_bind_index(L, vm, index, 3); + + lua_pushnumber(L, result); + return 1; +} + +static int dbvm_bind_blob(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + int index = luaL_checkint(L, 2); + const char *value = luaL_checkstring(L, 3); + int len = lua_strlen(L, 3); + + lua_pushnumber(L, sqlite3_bind_blob(svm->vm, index, value, len, SQLITE_TRANSIENT)); + return 1; +} + +static int dbvm_bind_values(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_stmt *vm = svm->vm; + int top = lua_gettop(L); + int result, n; + + if (top - 1 != sqlite3_bind_parameter_count(vm)) + luaL_error(L, + "incorrect number of parameters to bind (%d given, %d to bind)", + top - 1, + sqlite3_bind_parameter_count(vm) + ); + + for (n = 2; n <= top; ++n) { + if ((result = dbvm_bind_index(L, vm, n - 1, n)) != SQLITE_OK) { + lua_pushnumber(L, result); + return 1; + } + } + + lua_pushnumber(L, SQLITE_OK); + return 1; +} + +static int dbvm_bind_names(lua_State *L) { + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_stmt *vm = svm->vm; + int count = sqlite3_bind_parameter_count(vm); + const char *name; + int result, n; + luaL_checktype(L, 2, LUA_TTABLE); + + for (n = 1; n <= count; ++n) { + name = sqlite3_bind_parameter_name(vm, n); + if (name && (name[0] == ':' || name[0] == '$')) { + lua_pushstring(L, ++name); + lua_gettable(L, 2); + result = dbvm_bind_index(L, vm, n, -1); + lua_pop(L, 1); + } + else { + lua_pushnumber(L, n); + lua_gettable(L, 2); + result = dbvm_bind_index(L, vm, n, -1); + lua_pop(L, 1); + } + + if (result != SQLITE_OK) { + lua_pushnumber(L, result); + return 1; + } + } + + lua_pushnumber(L, SQLITE_OK); + return 1; +} + +/* +** ======================================================= +** Database (internal management) +** ======================================================= +*/ + +/* +** When creating database handles, always creates a `closed' database handle +** before opening the actual database; so, if there is a memory error, the +** database is not left opened. +** +** Creates a new 'table' and leaves it in the stack +*/ +static sdb *newdb (lua_State *L) { + sdb *db = (sdb*)lua_newuserdata(L, sizeof(sdb)); + db->L = L; + db->db = NULL; /* database handle is currently `closed' */ + db->func = NULL; + + db->busy_cb = + db->busy_udata = + db->progress_cb = + db->progress_udata = + db->trace_cb = + db->trace_udata = +#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK + db->update_hook_cb = + db->update_hook_udata = + db->commit_hook_cb = + db->commit_hook_udata = + db->rollback_hook_cb = + db->rollback_hook_udata = +#endif + LUA_NOREF; + + luaL_getmetatable(L, sqlite_meta); + lua_setmetatable(L, -2); /* set metatable */ + + /* to keep track of 'open' virtual machines */ + lua_pushlightuserdata(L, db); + lua_newtable(L); + lua_rawset(L, LUA_REGISTRYINDEX); + + return db; +} + +static int cleanupdb(lua_State *L, sdb *db) { + sdb_func *func; + sdb_func *func_next; + int top; + int result; + + /* free associated virtual machines */ + lua_pushlightuserdata(L, db); + lua_rawget(L, LUA_REGISTRYINDEX); + + /* close all used handles */ + top = lua_gettop(L); + lua_pushnil(L); + while (lua_next(L, -2)) { + sdb_vm *svm = lua_touserdata(L, -2); /* key: vm; val: sql text */ + cleanupvm(L, svm); + + lua_settop(L, top); + lua_pushnil(L); + } + + lua_pop(L, 1); /* pop vm table */ + + /* remove entry in lua registry table */ + lua_pushlightuserdata(L, db); + lua_pushnil(L); + lua_rawset(L, LUA_REGISTRYINDEX); + + /* 'free' all references */ + luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata); + luaL_unref(L, LUA_REGISTRYINDEX, db->progress_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->progress_udata); + luaL_unref(L, LUA_REGISTRYINDEX, db->trace_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->trace_udata); +#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK + luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_udata); + luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_udata); + luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_udata); +#endif + + /* close database */ + result = sqlite3_close(db->db); + db->db = NULL; + + /* free associated memory with created functions */ + func = db->func; + while (func) { + func_next = func->next; + luaL_unref(L, LUA_REGISTRYINDEX, func->fn_step); + luaL_unref(L, LUA_REGISTRYINDEX, func->fn_finalize); + luaL_unref(L, LUA_REGISTRYINDEX, func->udata); + free(func); + func = func_next; + } + db->func = NULL; + return result; +} + +static sdb *lsqlite_getdb(lua_State *L, int index) { + sdb *db = (sdb*)luaL_checkudata(L, index, sqlite_meta); + if (db == NULL) luaL_typerror(L, index, "sqlite database"); + return db; +} + +static sdb *lsqlite_checkdb(lua_State *L, int index) { + sdb *db = lsqlite_getdb(L, index); + if (db->db == NULL) luaL_argerror(L, index, "attempt to use closed sqlite database"); + return db; +} + + +/* +** ======================================================= +** User Defined Functions - Context Methods +** ======================================================= +*/ +typedef struct { + sqlite3_context *ctx; + int ud; +} lcontext; + +static lcontext *lsqlite_make_context(lua_State *L) { + lcontext *ctx = (lcontext*)lua_newuserdata(L, sizeof(lcontext)); + lua_rawgeti(L, LUA_REGISTRYINDEX, sqlite_ctx_meta_ref); + lua_setmetatable(L, -2); + ctx->ctx = NULL; + ctx->ud = LUA_NOREF; + return ctx; +} + +static lcontext *lsqlite_getcontext(lua_State *L, int index) { + lcontext *ctx = (lcontext*)luaL_checkudata(L, index, sqlite_ctx_meta); + if (ctx == NULL) luaL_typerror(L, index, "sqlite context"); + return ctx; +} + +static lcontext *lsqlite_checkcontext(lua_State *L, int index) { + lcontext *ctx = lsqlite_getcontext(L, index); + if (ctx->ctx == NULL) luaL_argerror(L, index, "invalid sqlite context"); + return ctx; +} + +static int lcontext_tostring(lua_State *L) { + char buff[39]; + lcontext *ctx = lsqlite_getcontext(L, 1); + if (ctx->ctx == NULL) + strcpy(buff, "closed"); + else + sprintf(buff, "%p", ctx->ctx); + lua_pushfstring(L, "sqlite function context (%s)", buff); + return 1; +} + +static void lcontext_check_aggregate(lua_State *L, lcontext *ctx) { + sdb_func *func = (sdb_func*)sqlite3_user_data(ctx->ctx); + if (!func->aggregate) { + luaL_error(L, "attempt to call aggregate method from scalar function"); + } +} + +static int lcontext_user_data(lua_State *L) { + lcontext *ctx = lsqlite_checkcontext(L, 1); + sdb_func *func = (sdb_func*)sqlite3_user_data(ctx->ctx); + lua_rawgeti(L, LUA_REGISTRYINDEX, func->udata); + return 1; +} + +static int lcontext_get_aggregate_context(lua_State *L) { + lcontext *ctx = lsqlite_checkcontext(L, 1); + lcontext_check_aggregate(L, ctx); + lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->ud); + return 1; +} + +static int lcontext_set_aggregate_context(lua_State *L) { + lcontext *ctx = lsqlite_checkcontext(L, 1); + lcontext_check_aggregate(L, ctx); + lua_settop(L, 2); + luaL_unref(L, LUA_REGISTRYINDEX, ctx->ud); + ctx->ud = luaL_ref(L, LUA_REGISTRYINDEX); + return 0; +} + +static int lcontext_aggregate_count(lua_State *L) { + lcontext *ctx = lsqlite_checkcontext(L, 1); + lcontext_check_aggregate(L, ctx); + lua_pushnumber(L, sqlite3_aggregate_count(ctx->ctx)); + return 1; +} + +#if 0 +void *sqlite3_get_auxdata(sqlite3_context*, int); +void sqlite3_set_auxdata(sqlite3_context*, int, void*, void (*)(void*)); +#endif + +static int lcontext_result(lua_State *L) { + lcontext *ctx = lsqlite_checkcontext(L, 1); + switch (lua_type(L, 2)) { + case LUA_TNUMBER: + sqlite3_result_double(ctx->ctx, luaL_checknumber(L, 2)); + break; + case LUA_TSTRING: + sqlite3_result_text(ctx->ctx, luaL_checkstring(L, 2), lua_strlen(L, 2), SQLITE_TRANSIENT); + break; + case LUA_TNIL: + case LUA_TNONE: + sqlite3_result_null(ctx->ctx); + break; + default: + luaL_error(L, "invalid result type %s", lua_typename(L, 2)); + break; + } + + return 0; +} + +static int lcontext_result_blob(lua_State *L) { + lcontext *ctx = lsqlite_checkcontext(L, 1); + const char *blob = luaL_checkstring(L, 2); + int size = lua_strlen(L, 2); + sqlite3_result_blob(ctx->ctx, (const void*)blob, size, SQLITE_TRANSIENT); + return 0; +} + +static int lcontext_result_double(lua_State *L) { + lcontext *ctx = lsqlite_checkcontext(L, 1); + double d = luaL_checknumber(L, 2); + sqlite3_result_double(ctx->ctx, d); + return 0; +} + +static int lcontext_result_error(lua_State *L) { + lcontext *ctx = lsqlite_checkcontext(L, 1); + const char *err = luaL_checkstring(L, 2); + int size = lua_strlen(L, 2); + sqlite3_result_error(ctx->ctx, err, size); + return 0; +} + +static int lcontext_result_int(lua_State *L) { + lcontext *ctx = lsqlite_checkcontext(L, 1); + int i = luaL_checkint(L, 2); + sqlite3_result_int(ctx->ctx, i); + return 0; +} + +static int lcontext_result_null(lua_State *L) { + lcontext *ctx = lsqlite_checkcontext(L, 1); + sqlite3_result_null(ctx->ctx); + return 0; +} + +static int lcontext_result_text(lua_State *L) { + lcontext *ctx = lsqlite_checkcontext(L, 1); + const char *text = luaL_checkstring(L, 2); + int size = lua_strlen(L, 2); + sqlite3_result_text(ctx->ctx, text, size, SQLITE_TRANSIENT); + return 0; +} + +/* +** ======================================================= +** Database Methods +** ======================================================= +*/ + +static int db_isopen(lua_State *L) { + sdb *db = lsqlite_getdb(L, 1); + lua_pushboolean(L, db->db != NULL ? 1 : 0); + return 1; +} + +static int db_last_insert_rowid(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + /* conversion warning: int64 -> luaNumber */ + sqlite_int64 rowid = sqlite3_last_insert_rowid(db->db); + lua_Number n = (lua_Number)rowid; + if (n == rowid) + lua_pushnumber(L, n); + else + lua_pushfstring(L, "%ll", rowid); + return 1; +} + +static int db_changes(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + lua_pushnumber(L, sqlite3_changes(db->db)); + return 1; +} + +static int db_total_changes(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + lua_pushnumber(L, sqlite3_total_changes(db->db)); + return 1; +} + +static int db_errcode(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + lua_pushnumber(L, sqlite3_errcode(db->db)); + return 1; +} + +static int db_errmsg(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + lua_pushstring(L, sqlite3_errmsg(db->db)); + return 1; +} + +static int db_interrupt(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + sqlite3_interrupt(db->db); + return 0; +} + +/* +** Registering SQL functions: +*/ + +static void db_push_value(lua_State *L, sqlite3_value *value) { + switch (sqlite3_value_type(value)) { + case SQLITE_TEXT: + lua_pushlstring(L, (const char*)sqlite3_value_text(value), sqlite3_value_bytes(value)); + break; + + case SQLITE_INTEGER: + { + sqlite_int64 i64 = sqlite3_value_int64(value); + lua_Number n = (lua_Number)i64; + if (n == i64) + lua_pushnumber(L, n); + else + lua_pushlstring(L, (const char*)sqlite3_value_text(value), sqlite3_value_bytes(value)); + } + break; + + case SQLITE_FLOAT: + lua_pushnumber(L, sqlite3_value_double(value)); + break; + + case SQLITE_BLOB: + lua_pushlstring(L, sqlite3_value_blob(value), sqlite3_value_bytes(value)); + break; + + case SQLITE_NULL: + lua_pushnil(L); + break; + + default: + /* things done properly (SQLite + Lua SQLite) + ** this should never happen */ + lua_pushnil(L); + break; + } +} + +/* +** callback functions used when calling registered sql functions +*/ + +/* scalar function to be called +** callback params: context, values... */ +static void db_sql_normal_function(sqlite3_context *context, int argc, sqlite3_value **argv) { + sdb_func *func = (sdb_func*)sqlite3_user_data(context); + lua_State *L = func->db->L; + int n; + lcontext *ctx; + + int top = lua_gettop(L); + + /* ensure there is enough space in the stack */ + lua_checkstack(L, argc + 3); + + lua_rawgeti(L, LUA_REGISTRYINDEX, func->fn_step); /* function to call */ + + if (!func->aggregate) { + ctx = lsqlite_make_context(L); /* push context - used to set results */ + } + else { + /* reuse context userdata value */ + void *p = sqlite3_aggregate_context(context, 1); + /* i think it is OK to use assume that using a light user data + ** as an entry on LUA REGISTRY table will be unique */ + lua_pushlightuserdata(L, p); + lua_rawget(L, LUA_REGISTRYINDEX); /* context table */ + + if (lua_isnil(L, -1)) { /* not yet created? */ + lua_pop(L, 1); + ctx = lsqlite_make_context(L); + lua_pushlightuserdata(L, p); + lua_pushvalue(L, -2); + lua_rawset(L, LUA_REGISTRYINDEX); + } + else + ctx = lsqlite_getcontext(L, -1); + } + + /* push params */ + for (n = 0; n < argc; ++n) { + db_push_value(L, argv[n]); + } + + /* set context */ + ctx->ctx = context; + + if (lua_pcall(L, argc + 1, 0, 0)) { + const char *errmsg = lua_tostring(L, -1); + int size = lua_strlen(L, -1); + sqlite3_result_error(context, errmsg, size); + } + + /* invalidate context */ + ctx->ctx = NULL; + + if (!func->aggregate) { + luaL_unref(L, LUA_REGISTRYINDEX, ctx->ud); + } + + lua_settop(L, top); +} + +static void db_sql_finalize_function(sqlite3_context *context) { + sdb_func *func = (sdb_func*)sqlite3_user_data(context); + lua_State *L = func->db->L; + void *p = sqlite3_aggregate_context(context, 1); /* minimal mem usage */ + lcontext *ctx; + int top = lua_gettop(L); + + lua_rawgeti(L, LUA_REGISTRYINDEX, func->fn_finalize); /* function to call */ + + /* i think it is OK to use assume that using a light user data + ** as an entry on LUA REGISTRY table will be unique */ + lua_pushlightuserdata(L, p); + lua_rawget(L, LUA_REGISTRYINDEX); /* context table */ + + if (lua_isnil(L, -1)) { /* not yet created? - shouldn't happen in finalize function */ + lua_pop(L, 1); + ctx = lsqlite_make_context(L); + lua_pushlightuserdata(L, p); + lua_pushvalue(L, -2); + lua_rawset(L, LUA_REGISTRYINDEX); + } + else + ctx = lsqlite_getcontext(L, -1); + + /* set context */ + ctx->ctx = context; + + if (lua_pcall(L, 1, 0, 0)) { + sqlite3_result_error(context, lua_tostring(L, -1), -1); + } + + /* invalidate context */ + ctx->ctx = NULL; + + /* cleanup context */ + luaL_unref(L, LUA_REGISTRYINDEX, ctx->ud); + /* remove it from registry */ + lua_pushlightuserdata(L, p); + lua_pushnil(L); + lua_rawset(L, LUA_REGISTRYINDEX); + + lua_settop(L, top); +} + +/* +** Register a normal function +** Params: db, function name, number arguments, [ callback | step, finalize], user data +** Returns: true on sucess +** +** Normal function: +** Params: context, params +** +** Aggregate function: +** Params of step: context, params +** Params of finalize: context +*/ +static int db_register_function(lua_State *L, int aggregate) { + sdb *db = lsqlite_checkdb(L, 1); + const char *name; + int args; + int result; + sdb_func *func; + + /* safety measure */ + if (aggregate) aggregate = 1; + + name = luaL_checkstring(L, 2); + args = luaL_checkint(L, 3); + luaL_checktype(L, 4, LUA_TFUNCTION); + if (aggregate) luaL_checktype(L, 5, LUA_TFUNCTION); + + /* maybe an alternative way to allocate memory should be used/avoided */ + func = (sdb_func*)malloc(sizeof(sdb_func)); + if (func == NULL) { + luaL_error(L, "out of memory"); + } + + result = sqlite3_create_function( + db->db, name, args, SQLITE_UTF8, func, + aggregate ? NULL : db_sql_normal_function, + aggregate ? db_sql_normal_function : NULL, + aggregate ? db_sql_finalize_function : NULL + ); + + if (result == SQLITE_OK) { + /* safety measures for userdata field to be present in the stack */ + lua_settop(L, 5 + aggregate); + + /* save registered function in db function list */ + func->db = db; + func->aggregate = aggregate; + func->next = db->func; + db->func = func; + + /* save the setp/normal function callback */ + lua_pushvalue(L, 4); + func->fn_step = luaL_ref(L, LUA_REGISTRYINDEX); + /* save user data */ + lua_pushvalue(L, 5+aggregate); + func->udata = luaL_ref(L, LUA_REGISTRYINDEX); + + if (aggregate) { + lua_pushvalue(L, 5); + func->fn_finalize = luaL_ref(L, LUA_REGISTRYINDEX); + } + else + func->fn_finalize = LUA_NOREF; + } + else { + /* free allocated memory */ + free(func); + } + + lua_pushboolean(L, result == SQLITE_OK ? 1 : 0); + return 1; +} + +static int db_create_function(lua_State *L) { + return db_register_function(L, 0); +} + +static int db_create_aggregate(lua_State *L) { + return db_register_function(L, 1); +} + +/* create_collation; contributed by Thomas Lauer +*/ + +typedef struct { + lua_State *L; + int ref; +} scc; + +static int collwrapper(scc *co,int l1,const void *p1, + int l2,const void *p2) { + int res=0; + lua_State *L=co->L; + lua_rawgeti(L,LUA_REGISTRYINDEX,co->ref); + lua_pushlstring(L,p1,l1); + lua_pushlstring(L,p2,l2); + if (lua_pcall(L,2,1,0)==0) res=(int)lua_tonumber(L,-1); + lua_pop(L,1); + return res; +} + +static void collfree(scc *co) { + if (co) { + luaL_unref(co->L,LUA_REGISTRYINDEX,co->ref); + free(co); + } +} + +static int db_create_collation(lua_State *L) { + sdb *db=lsqlite_checkdb(L,1); + const char *collname=luaL_checkstring(L,2); + scc *co=NULL; + int (*collfunc)(scc *,int,const void *,int,const void *)=NULL; + lua_settop(L,3); /* default args to nil, and exclude extras */ + if (lua_isfunction(L,3)) collfunc=collwrapper; + else if (!lua_isnil(L,3)) + luaL_error(L,"create_collation: function or nil expected"); + if (collfunc != NULL) { + co=(scc *)malloc(sizeof(scc)); /* userdata is a no-no as it + will be garbage-collected */ + if (co) { + co->L=L; + /* lua_settop(L,3) above means we don't need: lua_pushvalue(L,3); */ + co->ref=luaL_ref(L,LUA_REGISTRYINDEX); + } + else luaL_error(L,"create_collation: could not allocate callback"); + } + sqlite3_create_collation_v2(db->db, collname, SQLITE_UTF8, + (void *)co, + (int(*)(void*,int,const void*,int,const void*))collfunc, + (void(*)(void*))collfree); + return 0; +} + +/* +** trace callback: +** Params: database, callback function, userdata +** +** callback function: +** Params: userdata, sql +*/ +static void db_trace_callback(void *user, const char *sql) { + sdb *db = (sdb*)user; + lua_State *L = db->L; + int top = lua_gettop(L); + + /* setup lua callback call */ + lua_rawgeti(L, LUA_REGISTRYINDEX, db->trace_cb); /* get callback */ + lua_rawgeti(L, LUA_REGISTRYINDEX, db->trace_udata); /* get callback user data */ + lua_pushstring(L, sql); /* traced sql statement */ + + /* call lua function */ + lua_pcall(L, 2, 0, 0); + /* ignore any error generated by this function */ + + lua_settop(L, top); +} + +static int db_trace(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + + if (lua_gettop(L) < 2 || lua_isnil(L, 2)) { + luaL_unref(L, LUA_REGISTRYINDEX, db->trace_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->trace_udata); + + db->trace_cb = + db->trace_udata = LUA_NOREF; + + /* clear trace handler */ + sqlite3_trace(db->db, NULL, NULL); + } + else { + luaL_checktype(L, 2, LUA_TFUNCTION); + + /* make sure we have an userdata field (even if nil) */ + lua_settop(L, 3); + + luaL_unref(L, LUA_REGISTRYINDEX, db->trace_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->trace_udata); + + db->trace_udata = luaL_ref(L, LUA_REGISTRYINDEX); + db->trace_cb = luaL_ref(L, LUA_REGISTRYINDEX); + + /* set trace handler */ + sqlite3_trace(db->db, db_trace_callback, db); + } + + return 0; +} + +#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK + +/* +** update_hook callback: +** Params: database, callback function, userdata +** +** callback function: +** Params: userdata, {one of SQLITE_INSERT, SQLITE_DELETE, or SQLITE_UPDATE}, +** database name, table name (containing the affected row), rowid of the row +*/ +static void db_update_hook_callback(void *user, int op, char const *dbname, char const *tblname, sqlite3_int64 rowid) { + sdb *db = (sdb*)user; + lua_State *L = db->L; + int top = lua_gettop(L); + lua_Number n = (lua_Number)rowid; + + /* setup lua callback call */ + lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_cb); /* get callback */ + lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_udata); /* get callback user data */ + lua_pushnumber(L, (lua_Number )op); + lua_pushstring(L, dbname); /* update_hook database name */ + lua_pushstring(L, tblname); /* update_hook database name */ + if (n == rowid) + lua_pushnumber(L, n); + else + lua_pushfstring(L, "%ll", rowid); + + /* call lua function */ + lua_pcall(L, 5, 0, 0); + /* ignore any error generated by this function */ + + lua_settop(L, top); +} + +static int db_update_hook(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + + if (lua_gettop(L) < 2 || lua_isnil(L, 2)) { + luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_udata); + + db->update_hook_cb = + db->update_hook_udata = LUA_NOREF; + + /* clear update_hook handler */ + sqlite3_update_hook(db->db, NULL, NULL); + } + else { + luaL_checktype(L, 2, LUA_TFUNCTION); + + /* make sure we have an userdata field (even if nil) */ + lua_settop(L, 3); + + luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_udata); + + db->update_hook_udata = luaL_ref(L, LUA_REGISTRYINDEX); + db->update_hook_cb = luaL_ref(L, LUA_REGISTRYINDEX); + + /* set update_hook handler */ + sqlite3_update_hook(db->db, db_update_hook_callback, db); + } + + return 0; +} + +/* +** commit_hook callback: +** Params: database, callback function, userdata +** +** callback function: +** Params: userdata +** Returned value: Return false or nil to continue the COMMIT operation normally. +** return true (non false, non nil), then the COMMIT is converted into a ROLLBACK. +*/ +static int db_commit_hook_callback(void *user) { + sdb *db = (sdb*)user; + lua_State *L = db->L; + int top = lua_gettop(L); + int rollback = 0; + + /* setup lua callback call */ + lua_rawgeti(L, LUA_REGISTRYINDEX, db->commit_hook_cb); /* get callback */ + lua_rawgeti(L, LUA_REGISTRYINDEX, db->commit_hook_udata); /* get callback user data */ + + /* call lua function */ + if (!lua_pcall(L, 1, 1, 0)) + rollback = lua_toboolean(L, -1); /* use result if there was no error */ + + lua_settop(L, top); + return rollback; +} + +static int db_commit_hook(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + + if (lua_gettop(L) < 2 || lua_isnil(L, 2)) { + luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_udata); + + db->commit_hook_cb = + db->commit_hook_udata = LUA_NOREF; + + /* clear commit_hook handler */ + sqlite3_commit_hook(db->db, NULL, NULL); + } + else { + luaL_checktype(L, 2, LUA_TFUNCTION); + + /* make sure we have an userdata field (even if nil) */ + lua_settop(L, 3); + + luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_udata); + + db->commit_hook_udata = luaL_ref(L, LUA_REGISTRYINDEX); + db->commit_hook_cb = luaL_ref(L, LUA_REGISTRYINDEX); + + /* set commit_hook handler */ + sqlite3_commit_hook(db->db, db_commit_hook_callback, db); + } + + return 0; +} + +/* +** rollback hook callback: +** Params: database, callback function, userdata +** +** callback function: +** Params: userdata +*/ +static void db_rollback_hook_callback(void *user) { + sdb *db = (sdb*)user; + lua_State *L = db->L; + int top = lua_gettop(L); + + /* setup lua callback call */ + lua_rawgeti(L, LUA_REGISTRYINDEX, db->rollback_hook_cb); /* get callback */ + lua_rawgeti(L, LUA_REGISTRYINDEX, db->rollback_hook_udata); /* get callback user data */ + + /* call lua function */ + lua_pcall(L, 1, 0, 0); + /* ignore any error generated by this function */ + + lua_settop(L, top); +} + +static int db_rollback_hook(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + + if (lua_gettop(L) < 2 || lua_isnil(L, 2)) { + luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_udata); + + db->rollback_hook_cb = + db->rollback_hook_udata = LUA_NOREF; + + /* clear rollback_hook handler */ + sqlite3_rollback_hook(db->db, NULL, NULL); + } + else { + luaL_checktype(L, 2, LUA_TFUNCTION); + + /* make sure we have an userdata field (even if nil) */ + lua_settop(L, 3); + + luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_udata); + + db->rollback_hook_udata = luaL_ref(L, LUA_REGISTRYINDEX); + db->rollback_hook_cb = luaL_ref(L, LUA_REGISTRYINDEX); + + /* set rollback_hook handler */ + sqlite3_rollback_hook(db->db, db_rollback_hook_callback, db); + } + + return 0; +} + +#endif /* #if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK */ + +#if !defined(SQLITE_OMIT_PROGRESS_CALLBACK) || !SQLITE_OMIT_PROGRESS_CALLBACK + +/* +** progress handler: +** Params: database, number of opcodes, callback function, userdata +** +** callback function: +** Params: userdata +** returns: 0 to return immediatly and return SQLITE_ABORT, non-zero to continue +*/ +static int db_progress_callback(void *user) { + int result = 1; /* abort by default */ + sdb *db = (sdb*)user; + lua_State *L = db->L; + int top = lua_gettop(L); + + lua_rawgeti(L, LUA_REGISTRYINDEX, db->progress_cb); + lua_rawgeti(L, LUA_REGISTRYINDEX, db->progress_udata); + + /* call lua function */ + if (!lua_pcall(L, 1, 1, 0)) + result = lua_toboolean(L, -1); + + lua_settop(L, top); + return result; +} + +static int db_progress_handler(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + + if (lua_gettop(L) < 2 || lua_isnil(L, 2)) { + luaL_unref(L, LUA_REGISTRYINDEX, db->progress_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->progress_udata); + + db->progress_cb = + db->progress_udata = LUA_NOREF; + + /* clear busy handler */ + sqlite3_progress_handler(db->db, 0, NULL, NULL); + } + else { + int nop = luaL_checkint(L, 2); /* number of opcodes */ + luaL_checktype(L, 3, LUA_TFUNCTION); + + /* make sure we have an userdata field (even if nil) */ + lua_settop(L, 4); + + luaL_unref(L, LUA_REGISTRYINDEX, db->progress_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->progress_udata); + + db->progress_udata = luaL_ref(L, LUA_REGISTRYINDEX); + db->progress_cb = luaL_ref(L, LUA_REGISTRYINDEX); + + /* set progress callback */ + sqlite3_progress_handler(db->db, nop, db_progress_callback, db); + } + + return 0; +} + +#else /* #if !defined(SQLITE_OMIT_PROGRESS_CALLBACK) || !SQLITE_OMIT_PROGRESS_CALLBACK */ + +static int db_progress_handler(lua_State *L) { + lua_pushliteral(L, "progress callback support disabled at compile time"); + lua_error(L); + return 0; +} + +#endif /* #if !defined(SQLITE_OMIT_PROGRESS_CALLBACK) || !SQLITE_OMIT_PROGRESS_CALLBACK */ + +/* +** busy handler: +** Params: database, callback function, userdata +** +** callback function: +** Params: userdata, number of tries +** returns: 0 to return immediatly and return SQLITE_BUSY, non-zero to try again +*/ +static int db_busy_callback(void *user, int tries) { + int retry = 0; /* abort by default */ + sdb *db = (sdb*)user; + lua_State *L = db->L; + int top = lua_gettop(L); + + lua_rawgeti(L, LUA_REGISTRYINDEX, db->busy_cb); + lua_rawgeti(L, LUA_REGISTRYINDEX, db->busy_udata); + lua_pushnumber(L, tries); + + /* call lua function */ + if (!lua_pcall(L, 2, 1, 0)) + retry = lua_toboolean(L, -1); + + lua_settop(L, top); + return retry; +} + +static int db_busy_handler(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + + if (lua_gettop(L) < 2 || lua_isnil(L, 2)) { + luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata); + + db->busy_cb = + db->busy_udata = LUA_NOREF; + + /* clear busy handler */ + sqlite3_busy_handler(db->db, NULL, NULL); + } + else { + luaL_checktype(L, 2, LUA_TFUNCTION); + /* make sure we have an userdata field (even if nil) */ + lua_settop(L, 3); + + luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata); + + db->busy_udata = luaL_ref(L, LUA_REGISTRYINDEX); + db->busy_cb = luaL_ref(L, LUA_REGISTRYINDEX); + + /* set busy handler */ + sqlite3_busy_handler(db->db, db_busy_callback, db); + } + + return 0; +} + +static int db_busy_timeout(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + int timeout = luaL_checkint(L, 2); + sqlite3_busy_timeout(db->db, timeout); + + /* if there was a timeout callback registered, it is now + ** invalid/useless. free any references we may have */ + luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb); + luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata); + db->busy_cb = + db->busy_udata = LUA_NOREF; + + return 0; +} + +/* +** Params: db, sql, callback, user +** returns: code [, errmsg] +** +** Callback: +** Params: user, number of columns, values, names +** Returns: 0 to continue, other value will cause abort +*/ +static int db_exec_callback(void* user, int columns, char **data, char **names) { + int result = SQLITE_ABORT; /* abort by default */ + lua_State *L = (lua_State*)user; + int n; + + int top = lua_gettop(L); + + lua_pushvalue(L, 3); /* function to call */ + lua_pushvalue(L, 4); /* user data */ + lua_pushnumber(L, columns); /* total number of rows in result */ + + /* column values */ + lua_pushvalue(L, 6); + for (n = 0; n < columns;) { + lua_pushstring(L, data[n++]); + lua_rawseti(L, -2, n); + } + + /* columns names */ + lua_pushvalue(L, 5); + if (lua_isnil(L, -1)) { + lua_pop(L, 1); + lua_newtable(L); + lua_pushvalue(L, -1); + lua_replace(L, 5); + for (n = 0; n < columns;) { + lua_pushstring(L, names[n++]); + lua_rawseti(L, -2, n); + } + } + + /* call lua function */ + if (!lua_pcall(L, 4, 1, 0)) { + if (lua_isnumber(L, -1)) + result = (int)lua_tonumber(L, -1); + } + + lua_settop(L, top); + return result; +} + +static int db_exec(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + const char *sql = luaL_checkstring(L, 2); + int result; + + if (!lua_isnoneornil(L, 3)) { + /* stack: + ** 3: callback function + ** 4: userdata + ** 5: column names + ** 6: reusable column values + */ + luaL_checktype(L, 3, LUA_TFUNCTION); + lua_settop(L, 4); /* 'trap' userdata - nil extra parameters */ + lua_pushnil(L); /* column names not known at this point */ + lua_newtable(L); /* column values table */ + + result = sqlite3_exec(db->db, sql, db_exec_callback, L, NULL); + } + else { + /* no callbacks */ + result = sqlite3_exec(db->db, sql, NULL, NULL, NULL); + } + + lua_pushnumber(L, result); + return 1; +} + +/* +** Params: db, sql +** returns: code, compiled length or error message +*/ +static int db_prepare(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + const char *sql = luaL_checkstring(L, 2); + int sql_len = lua_strlen(L, 2); + const char *sqltail; + sdb_vm *svm; + lua_settop(L,2); /* sql is on top of stack for call to newvm */ + svm = newvm(L, db); + + if (sqlite3_prepare(db->db, sql, sql_len, &svm->vm, &sqltail) != SQLITE_OK) { + cleanupvm(L, svm); + + lua_pushnil(L); + lua_pushnumber(L, sqlite3_errcode(db->db)); + return 2; + } + + /* vm already in the stack */ + lua_pushstring(L, sqltail); + return 2; +} + +static int db_do_next_row(lua_State *L, int packed) { + int result; + sdb_vm *svm = lsqlite_checkvm(L, 1); + sqlite3_stmt *vm; + int columns; + int i; + + result = stepvm(L, svm); + vm = svm->vm; /* stepvm may change svm->vm if re-prepare is needed */ + svm->has_values = result == SQLITE_ROW ? 1 : 0; + svm->columns = columns = sqlite3_data_count(vm); + + if (result == SQLITE_ROW) { + if (packed) { + lua_newtable(L); + if (packed == 1) { + for (i = 0; i < columns;) { + vm_push_column(L, vm, i); + lua_rawseti(L, -2, ++i); + } + } + else { + for (i = 0; i < columns; ++i) { + lua_pushstring(L, sqlite3_column_name(vm, i)); + vm_push_column(L, vm, i); + lua_rawset(L, -3); + } + } + return 1; + } + else { + lua_checkstack(L, columns); + for (i = 0; i < columns; ++i) + vm_push_column(L, vm, i); + return svm->columns; + } + } + + if (svm->temp) { + /* finalize and check for errors */ + result = sqlite3_finalize(vm); + svm->vm = NULL; + cleanupvm(L, svm); + } + else if (result == SQLITE_DONE) { + result = sqlite3_reset(vm); + } + + if (result != SQLITE_OK) { + lua_pushstring(L, sqlite3_errmsg(svm->db->db)); + lua_error(L); + } + return 0; +} + +static int db_next_row(lua_State *L) { + return db_do_next_row(L, 0); +} + +static int db_next_packed_row(lua_State *L) { + return db_do_next_row(L, 1); +} + +static int db_next_named_row(lua_State *L) { + return db_do_next_row(L, 2); +} + +static int dbvm_do_rows(lua_State *L, int(*f)(lua_State *)) { + /* sdb_vm *svm = */ + lsqlite_checkvm(L, 1); + lua_pushvalue(L,1); + lua_pushcfunction(L, f); + lua_insert(L, -2); + return 2; +} + +static int dbvm_rows(lua_State *L) { + return dbvm_do_rows(L, db_next_packed_row); +} + +static int dbvm_nrows(lua_State *L) { + return dbvm_do_rows(L, db_next_named_row); +} + +static int dbvm_urows(lua_State *L) { + return dbvm_do_rows(L, db_next_row); +} + +static int db_do_rows(lua_State *L, int(*f)(lua_State *)) { + sdb *db = lsqlite_checkdb(L, 1); + const char *sql = luaL_checkstring(L, 2); + sdb_vm *svm; + lua_settop(L,2); /* sql is on top of stack for call to newvm */ + svm = newvm(L, db); + svm->temp = 1; + + if (sqlite3_prepare(db->db, sql, -1, &svm->vm, NULL) != SQLITE_OK) { + cleanupvm(L, svm); + + lua_pushstring(L, sqlite3_errmsg(svm->db->db)); + lua_error(L); + } + + lua_pushcfunction(L, f); + lua_insert(L, -2); + return 2; +} + +static int db_rows(lua_State *L) { + return db_do_rows(L, db_next_packed_row); +} + +static int db_nrows(lua_State *L) { + return db_do_rows(L, db_next_named_row); +} + +/* unpacked version of db:rows */ +static int db_urows(lua_State *L) { + return db_do_rows(L, db_next_row); +} + +static int db_tostring(lua_State *L) { + char buff[32]; + sdb *db = lsqlite_getdb(L, 1); + if (db->db == NULL) + strcpy(buff, "closed"); + else + sprintf(buff, "%p", lua_touserdata(L, 1)); + lua_pushfstring(L, "sqlite database (%s)", buff); + return 1; +} + +static int db_close(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + lua_pushnumber(L, cleanupdb(L, db)); + return 1; +} + +static int db_close_vm(lua_State *L) { + sdb *db = lsqlite_checkdb(L, 1); + /* cleanup temporary only tables? */ + int temp = lua_toboolean(L, 2); + + /* free associated virtual machines */ + lua_pushlightuserdata(L, db); + lua_rawget(L, LUA_REGISTRYINDEX); + + /* close all used handles */ + lua_pushnil(L); + while (lua_next(L, -2)) { + sdb_vm *svm = lua_touserdata(L, -2); /* key: vm; val: sql text */ + + if ((!temp || svm->temp) && svm->vm) + { + sqlite3_finalize(svm->vm); + svm->vm = NULL; + } + + /* leave key in the stack */ + lua_pop(L, 1); + } + return 0; +} + +static int db_gc(lua_State *L) { + sdb *db = lsqlite_getdb(L, 1); + if (db->db != NULL) /* ignore closed databases */ + cleanupdb(L, db); + return 0; +} + +/* +** ======================================================= +** General library functions +** ======================================================= +*/ + +static int lsqlite_version(lua_State *L) { + lua_pushstring(L, sqlite3_libversion()); + return 1; +} + +static int lsqlite_complete(lua_State *L) { + const char *sql = luaL_checkstring(L, 1); + lua_pushboolean(L, sqlite3_complete(sql)); + return 1; +} + +#ifndef WIN32 +static int lsqlite_temp_directory(lua_State *L) { + const char *oldtemp = sqlite3_temp_directory; + + if (!lua_isnone(L, 1)) { + const char *temp = luaL_optstring(L, 1, NULL); + if (sqlite3_temp_directory) { + sqlite3_free((char*)sqlite3_temp_directory); + } + if (temp) { + sqlite3_temp_directory = sqlite3_mprintf("%s", temp); + } + else { + sqlite3_temp_directory = NULL; + } + } + lua_pushstring(L, oldtemp); + return 1; +} +#endif + +static int lsqlite_do_open(lua_State *L, const char *filename) { + sdb *db = newdb(L); /* create and leave in stack */ + + if (sqlite3_open(filename, &db->db) == SQLITE_OK) { + /* database handle already in the stack - return it */ + return 1; + } + + /* failed to open database */ + lua_pushnil(L); /* push nil */ + lua_pushnumber(L, sqlite3_errcode(db->db)); + lua_pushstring(L, sqlite3_errmsg(db->db)); /* push error message */ + + /* clean things up */ + cleanupdb(L, db); + + /* return */ + return 3; +} + +static int lsqlite_open(lua_State *L) { + const char *filename = luaL_checkstring(L, 1); + return lsqlite_do_open(L, filename); +} + +static int lsqlite_open_memory(lua_State *L) { + return lsqlite_do_open(L, ":memory:"); +} + +static int lsqlite_newindex(lua_State *L) { + lua_pushliteral(L, "attempt to change readonly table"); + lua_error(L); + return 0; +} + +/* +** ======================================================= +** Register functions +** ======================================================= +*/ + +#define SC(s) { #s, SQLITE_ ## s }, +#define LSC(s) { #s, LSQLITE_ ## s }, + +static const struct { + const char* name; + int value; +} sqlite_constants[] = { + /* error codes */ + SC(OK) SC(ERROR) SC(INTERNAL) SC(PERM) + SC(ABORT) SC(BUSY) SC(LOCKED) SC(NOMEM) + SC(READONLY) SC(INTERRUPT) SC(IOERR) SC(CORRUPT) + SC(NOTFOUND) SC(FULL) SC(CANTOPEN) SC(PROTOCOL) + SC(EMPTY) SC(SCHEMA) SC(TOOBIG) SC(CONSTRAINT) + SC(MISMATCH) SC(MISUSE) SC(NOLFS) + SC(FORMAT) SC(NOTADB) + + /* sqlite_step specific return values */ + SC(RANGE) SC(ROW) SC(DONE) + + /* column types */ + SC(INTEGER) SC(FLOAT) SC(TEXT) SC(BLOB) + SC(NULL) + + /* Authorizer Action Codes */ + SC(CREATE_INDEX ) + SC(CREATE_TABLE ) + SC(CREATE_TEMP_INDEX ) + SC(CREATE_TEMP_TABLE ) + SC(CREATE_TEMP_TRIGGER) + SC(CREATE_TEMP_VIEW ) + SC(CREATE_TRIGGER ) + SC(CREATE_VIEW ) + SC(DELETE ) + SC(DROP_INDEX ) + SC(DROP_TABLE ) + SC(DROP_TEMP_INDEX ) + SC(DROP_TEMP_TABLE ) + SC(DROP_TEMP_TRIGGER ) + SC(DROP_TEMP_VIEW ) + SC(DROP_TRIGGER ) + SC(DROP_VIEW ) + SC(INSERT ) + SC(PRAGMA ) + SC(READ ) + SC(SELECT ) + SC(TRANSACTION ) + SC(UPDATE ) + SC(ATTACH ) + SC(DETACH ) + SC(ALTER_TABLE ) + SC(REINDEX ) + SC(ANALYZE ) + SC(CREATE_VTABLE ) + SC(DROP_VTABLE ) + SC(FUNCTION ) + SC(SAVEPOINT ) + + /* terminator */ + { NULL, 0 } +}; + +/* ======================================================= */ + +static const luaL_Reg dblib[] = { + {"isopen", db_isopen }, + {"last_insert_rowid", db_last_insert_rowid }, + {"changes", db_changes }, + {"total_changes", db_total_changes }, + {"errcode", db_errcode }, + {"error_code", db_errcode }, + {"errmsg", db_errmsg }, + {"error_message", db_errmsg }, + {"interrupt", db_interrupt }, + + {"create_function", db_create_function }, + {"create_aggregate", db_create_aggregate }, + {"create_collation", db_create_collation }, + + {"trace", db_trace }, + {"progress_handler", db_progress_handler }, + {"busy_timeout", db_busy_timeout }, + {"busy_handler", db_busy_handler }, +#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK + {"update_hook", db_update_hook }, + {"commit_hook", db_commit_hook }, + {"rollback_hook", db_rollback_hook }, +#endif + + {"prepare", db_prepare }, + {"rows", db_rows }, + {"urows", db_urows }, + {"nrows", db_nrows }, + + {"exec", db_exec }, + {"execute", db_exec }, + {"close", db_close }, + {"close_vm", db_close_vm }, + + {"__tostring", db_tostring }, + {"__gc", db_gc }, + + {NULL, NULL} +}; + +static const luaL_Reg vmlib[] = { + {"isopen", dbvm_isopen }, + + {"step", dbvm_step }, + {"reset", dbvm_reset }, + {"finalize", dbvm_finalize }, + + {"columns", dbvm_columns }, + + {"bind", dbvm_bind }, + {"bind_values", dbvm_bind_values }, + {"bind_names", dbvm_bind_names }, + {"bind_blob", dbvm_bind_blob }, + {"bind_parameter_count",dbvm_bind_parameter_count}, + {"bind_parameter_name", dbvm_bind_parameter_name}, + + {"get_value", dbvm_get_value }, + {"get_values", dbvm_get_values }, + {"get_name", dbvm_get_name }, + {"get_names", dbvm_get_names }, + {"get_type", dbvm_get_type }, + {"get_types", dbvm_get_types }, + {"get_uvalues", dbvm_get_uvalues }, + {"get_unames", dbvm_get_unames }, + {"get_utypes", dbvm_get_utypes }, + + {"get_named_values", dbvm_get_named_values }, + {"get_named_types", dbvm_get_named_types }, + + {"rows", dbvm_rows }, + {"urows", dbvm_urows }, + {"nrows", dbvm_nrows }, + + /* compatibility names (added by request) */ + {"idata", dbvm_get_values }, + {"inames", dbvm_get_names }, + {"itypes", dbvm_get_types }, + {"data", dbvm_get_named_values }, + {"type", dbvm_get_named_types }, + + {"__tostring", dbvm_tostring }, + {"__gc", dbvm_gc }, + + { NULL, NULL } +}; + +static const luaL_Reg ctxlib[] = { + {"user_data", lcontext_user_data }, + + {"get_aggregate_data", lcontext_get_aggregate_context }, + {"set_aggregate_data", lcontext_set_aggregate_context }, + {"aggregate_count", lcontext_aggregate_count }, + + {"result", lcontext_result }, + {"result_null", lcontext_result_null }, + {"result_number", lcontext_result_double }, + {"result_double", lcontext_result_double }, + {"result_int", lcontext_result_int }, + {"result_text", lcontext_result_text }, + {"result_blob", lcontext_result_blob }, + {"result_error", lcontext_result_error }, + + {"__tostring", lcontext_tostring }, + {NULL, NULL} +}; + +static const luaL_Reg sqlitelib[] = { + {"version", lsqlite_version }, + {"complete", lsqlite_complete }, +#ifndef WIN32 + {"temp_directory", lsqlite_temp_directory }, +#endif + {"open", lsqlite_open }, + {"open_memory", lsqlite_open_memory }, + + {"__newindex", lsqlite_newindex }, + {NULL, NULL} +}; + +static void create_meta(lua_State *L, const char *name, const luaL_Reg *lib) { + luaL_newmetatable(L, name); + lua_pushstring(L, "__index"); + lua_pushvalue(L, -2); /* push metatable */ + lua_rawset(L, -3); /* metatable.__index = metatable */ + + /* register metatable functions */ + luaL_openlib(L, NULL, lib, 0); + + /* remove metatable from stack */ + lua_pop(L, 1); +} + +LUALIB_API int luaopen_lsqlite3(lua_State *L) { + create_meta(L, sqlite_meta, dblib); + create_meta(L, sqlite_vm_meta, vmlib); + create_meta(L, sqlite_ctx_meta, ctxlib); + + luaL_getmetatable(L, sqlite_ctx_meta); + sqlite_ctx_meta_ref = luaL_ref(L, LUA_REGISTRYINDEX); + + /* register (local) sqlite metatable */ + luaL_register(L, "sqlite3", sqlitelib); + + { + int i = 0; + /* add constants to global table */ + while (sqlite_constants[i].name) { + lua_pushstring(L, sqlite_constants[i].name); + lua_pushnumber(L, sqlite_constants[i].value); + lua_rawset(L, -3); + ++i; + } + } + + /* set sqlite's metatable to itself - set as readonly (__newindex) */ + lua_pushvalue(L, -1); + lua_setmetatable(L, -2); + + return 1; +} + + + + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + + + + diff --git a/source/SQLite/sqlite3.c b/lib/sqlite/sqlite3.c index 37ee4ad38..37ee4ad38 100644 --- a/source/SQLite/sqlite3.c +++ b/lib/sqlite/sqlite3.c diff --git a/source/SQLite/sqlite3.h b/lib/sqlite/sqlite3.h index 1332eb162..1332eb162 100644 --- a/source/SQLite/sqlite3.h +++ b/lib/sqlite/sqlite3.h diff --git a/source/SQLite/urls.txt b/lib/sqlite/urls.txt index 131d70bbf..131d70bbf 100644 --- a/source/SQLite/urls.txt +++ b/lib/sqlite/urls.txt diff --git a/tolua++-1.0.93/COPYRIGHT b/lib/tolua++/COPYRIGHT index 9e99e0080..9e99e0080 100644 --- a/tolua++-1.0.93/COPYRIGHT +++ b/lib/tolua++/COPYRIGHT diff --git a/tolua++-1.0.93/INSTALL b/lib/tolua++/INSTALL index 5ee408f9e..5ee408f9e 100644 --- a/tolua++-1.0.93/INSTALL +++ b/lib/tolua++/INSTALL diff --git a/tolua++-1.0.93/Makefile b/lib/tolua++/Makefile index 92ded6c4e..92ded6c4e 100644 --- a/tolua++-1.0.93/Makefile +++ b/lib/tolua++/Makefile diff --git a/tolua++-1.0.93/README b/lib/tolua++/README index cee381fb3..cee381fb3 100644 --- a/tolua++-1.0.93/README +++ b/lib/tolua++/README diff --git a/tolua++-1.0.93/README-5.1 b/lib/tolua++/README-5.1 index f06f785e3..f06f785e3 100644 --- a/tolua++-1.0.93/README-5.1 +++ b/lib/tolua++/README-5.1 diff --git a/tolua++-1.0.93/SConstruct b/lib/tolua++/SConstruct index 5c1e7746e..5c1e7746e 100644 --- a/tolua++-1.0.93/SConstruct +++ b/lib/tolua++/SConstruct diff --git a/lib/tolua++/include/tolua++.h b/lib/tolua++/include/tolua++.h new file mode 100644 index 000000000..3ebd8d246 --- /dev/null +++ b/lib/tolua++/include/tolua++.h @@ -0,0 +1,186 @@ +/* tolua +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + + +#ifndef TOLUA_H +#define TOLUA_H + +#ifndef TOLUA_API +#define TOLUA_API extern +#endif + +#define TOLUA_VERSION "tolua++-1.0.92" + +#ifdef __cplusplus +extern "C" { +#endif + +#define tolua_pushcppstring(x,y) tolua_pushstring(x,y.c_str()) +#define tolua_iscppstring tolua_isstring + +#define tolua_iscppstringarray tolua_isstringarray +#define tolua_pushfieldcppstring(L,lo,idx,s) tolua_pushfieldstring(L, lo, idx, s.c_str()) + +#ifndef TEMPLATE_BIND + #define TEMPLATE_BIND(p) +#endif + +#define TOLUA_TEMPLATE_BIND(p) + +#define TOLUA_PROTECTED_DESTRUCTOR +#define TOLUA_PROPERTY_TYPE(p) + +typedef int lua_Object; + +#include "../../lua/src/lua.h" +#include "../../lua/src/lauxlib.h" + +struct tolua_Error +{ + int index; + int array; + const char* type; +}; +typedef struct tolua_Error tolua_Error; + +#define TOLUA_NOPEER LUA_REGISTRYINDEX /* for lua 5.1 */ + +TOLUA_API const char* tolua_typename (lua_State* L, int lo); +TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err); +TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err); +TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err); +TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err); +TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err); +TOLUA_API int tolua_isvaluearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isbooleanarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isnumberarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isstringarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_istablearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isuserdataarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isusertypearray + (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err); + +TOLUA_API void tolua_open (lua_State* L); + +TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size); +TOLUA_API int tolua_register_gc (lua_State* L, int lo); +TOLUA_API int tolua_default_collect (lua_State* tolua_S); + +TOLUA_API void tolua_usertype (lua_State* L, const char* type); +TOLUA_API void tolua_beginmodule (lua_State* L, const char* name); +TOLUA_API void tolua_endmodule (lua_State* L); +TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar); +TOLUA_API void tolua_class (lua_State* L, const char* name, const char* base); +TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col); +TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func); +TOLUA_API void tolua_constant (lua_State* L, const char* name, lua_Number value); +TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set); +TOLUA_API void tolua_array (lua_State* L,const char* name, lua_CFunction get, lua_CFunction set); + +/* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type); */ +/* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */ + +TOLUA_API void tolua_pushvalue (lua_State* L, int lo); +TOLUA_API void tolua_pushboolean (lua_State* L, int value); +TOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value); +TOLUA_API void tolua_pushstring (lua_State* L, const char* value); +TOLUA_API void tolua_pushuserdata (lua_State* L, void* value); +TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type); +TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type); +TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v); +TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v); +TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v); +TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v); +TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v); +TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type); +TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type); + +TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def); +TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def); +TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def); +TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def); +TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def); +TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def); +TOLUA_API lua_Number tolua_tofieldnumber (lua_State* L, int lo, int index, lua_Number def); +TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def); +TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def); +TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def); +TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def); +TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def); + +TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name); + +TOLUA_API int class_gc_event (lua_State* L); + +#ifdef __cplusplus +static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) { + + const char* s = tolua_tostring(L, narg, def); + return s?s:""; +}; + +static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) { + + const char* s = tolua_tofieldstring(L, lo, index, def); + return s?s:""; +}; + +#else +#define tolua_tocppstring tolua_tostring +#define tolua_tofieldcppstring tolua_tofieldstring +#endif + +TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index); + +#ifndef Mtolua_new +#define Mtolua_new(EXP) new EXP +#endif + +#ifndef Mtolua_delete +#define Mtolua_delete(EXP) delete EXP +#endif + +#ifndef Mtolua_new_dim +#define Mtolua_new_dim(EXP, len) new EXP[len] +#endif + +#ifndef Mtolua_delete_dim +#define Mtolua_delete_dim(EXP) delete [] EXP +#endif + +#ifndef tolua_outside +#define tolua_outside +#endif + +#ifndef tolua_owned +#define tolua_owned +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/tolua++-1.0.93/src/bin/SCsub b/lib/tolua++/src/bin/SCsub index 35ccd7a24..35ccd7a24 100644 --- a/tolua++-1.0.93/src/bin/SCsub +++ b/lib/tolua++/src/bin/SCsub diff --git a/tolua++-1.0.93/src/bin/lua/all.lua b/lib/tolua++/src/bin/lua/all.lua index 83f8a3cb9..83f8a3cb9 100644 --- a/tolua++-1.0.93/src/bin/lua/all.lua +++ b/lib/tolua++/src/bin/lua/all.lua diff --git a/tolua++-1.0.93/src/bin/lua/array.lua b/lib/tolua++/src/bin/lua/array.lua index f35aa98ce..f35aa98ce 100644 --- a/tolua++-1.0.93/src/bin/lua/array.lua +++ b/lib/tolua++/src/bin/lua/array.lua diff --git a/tolua++-1.0.93/src/bin/lua/basic.lua b/lib/tolua++/src/bin/lua/basic.lua index f651f1fe6..f651f1fe6 100644 --- a/tolua++-1.0.93/src/bin/lua/basic.lua +++ b/lib/tolua++/src/bin/lua/basic.lua diff --git a/tolua++-1.0.93/src/bin/lua/class.lua b/lib/tolua++/src/bin/lua/class.lua index 592705282..592705282 100644 --- a/tolua++-1.0.93/src/bin/lua/class.lua +++ b/lib/tolua++/src/bin/lua/class.lua diff --git a/tolua++-1.0.93/src/bin/lua/clean.lua b/lib/tolua++/src/bin/lua/clean.lua index fd5b7b635..fd5b7b635 100644 --- a/tolua++-1.0.93/src/bin/lua/clean.lua +++ b/lib/tolua++/src/bin/lua/clean.lua diff --git a/tolua++-1.0.93/src/bin/lua/code.lua b/lib/tolua++/src/bin/lua/code.lua index 5e19b6bbf..5e19b6bbf 100644 --- a/tolua++-1.0.93/src/bin/lua/code.lua +++ b/lib/tolua++/src/bin/lua/code.lua diff --git a/tolua++-1.0.93/src/bin/lua/compat-5.1.lua b/lib/tolua++/src/bin/lua/compat-5.1.lua index 7a2c60b69..7a2c60b69 100644 --- a/tolua++-1.0.93/src/bin/lua/compat-5.1.lua +++ b/lib/tolua++/src/bin/lua/compat-5.1.lua diff --git a/tolua++-1.0.93/src/bin/lua/compat.lua b/lib/tolua++/src/bin/lua/compat.lua index 45d6ae1ba..45d6ae1ba 100644 --- a/tolua++-1.0.93/src/bin/lua/compat.lua +++ b/lib/tolua++/src/bin/lua/compat.lua diff --git a/tolua++-1.0.93/src/bin/lua/container.lua b/lib/tolua++/src/bin/lua/container.lua index 2d11db7df..2d11db7df 100644 --- a/tolua++-1.0.93/src/bin/lua/container.lua +++ b/lib/tolua++/src/bin/lua/container.lua diff --git a/tolua++-1.0.93/src/bin/lua/custom.lua b/lib/tolua++/src/bin/lua/custom.lua index de5912fb3..de5912fb3 100644 --- a/tolua++-1.0.93/src/bin/lua/custom.lua +++ b/lib/tolua++/src/bin/lua/custom.lua diff --git a/tolua++-1.0.93/src/bin/lua/declaration.lua b/lib/tolua++/src/bin/lua/declaration.lua index 73bbe910e..73bbe910e 100644 --- a/tolua++-1.0.93/src/bin/lua/declaration.lua +++ b/lib/tolua++/src/bin/lua/declaration.lua diff --git a/tolua++-1.0.93/src/bin/lua/define.lua b/lib/tolua++/src/bin/lua/define.lua index 96a28d878..96a28d878 100644 --- a/tolua++-1.0.93/src/bin/lua/define.lua +++ b/lib/tolua++/src/bin/lua/define.lua diff --git a/tolua++-1.0.93/src/bin/lua/doit.lua b/lib/tolua++/src/bin/lua/doit.lua index 51dd0cf3c..51dd0cf3c 100644 --- a/tolua++-1.0.93/src/bin/lua/doit.lua +++ b/lib/tolua++/src/bin/lua/doit.lua diff --git a/tolua++-1.0.93/src/bin/lua/enumerate.lua b/lib/tolua++/src/bin/lua/enumerate.lua index 99fe74629..99fe74629 100644 --- a/tolua++-1.0.93/src/bin/lua/enumerate.lua +++ b/lib/tolua++/src/bin/lua/enumerate.lua diff --git a/tolua++-1.0.93/src/bin/lua/feature.lua b/lib/tolua++/src/bin/lua/feature.lua index 042b5d28e..042b5d28e 100644 --- a/tolua++-1.0.93/src/bin/lua/feature.lua +++ b/lib/tolua++/src/bin/lua/feature.lua diff --git a/tolua++-1.0.93/src/bin/lua/function.lua b/lib/tolua++/src/bin/lua/function.lua index 2358e9ff7..2358e9ff7 100644 --- a/tolua++-1.0.93/src/bin/lua/function.lua +++ b/lib/tolua++/src/bin/lua/function.lua diff --git a/tolua++-1.0.93/src/bin/lua/module.lua b/lib/tolua++/src/bin/lua/module.lua index 57dceb7d5..57dceb7d5 100644 --- a/tolua++-1.0.93/src/bin/lua/module.lua +++ b/lib/tolua++/src/bin/lua/module.lua diff --git a/tolua++-1.0.93/src/bin/lua/namespace.lua b/lib/tolua++/src/bin/lua/namespace.lua index 6ca80e6e3..6ca80e6e3 100644 --- a/tolua++-1.0.93/src/bin/lua/namespace.lua +++ b/lib/tolua++/src/bin/lua/namespace.lua diff --git a/tolua++-1.0.93/src/bin/lua/operator.lua b/lib/tolua++/src/bin/lua/operator.lua index 675027cd7..675027cd7 100644 --- a/tolua++-1.0.93/src/bin/lua/operator.lua +++ b/lib/tolua++/src/bin/lua/operator.lua diff --git a/tolua++-1.0.93/src/bin/lua/package.lua b/lib/tolua++/src/bin/lua/package.lua index eec136904..eec136904 100644 --- a/tolua++-1.0.93/src/bin/lua/package.lua +++ b/lib/tolua++/src/bin/lua/package.lua diff --git a/tolua++-1.0.93/src/bin/lua/template_class.lua b/lib/tolua++/src/bin/lua/template_class.lua index b1ed05abe..b1ed05abe 100644 --- a/tolua++-1.0.93/src/bin/lua/template_class.lua +++ b/lib/tolua++/src/bin/lua/template_class.lua diff --git a/tolua++-1.0.93/src/bin/lua/typedef.lua b/lib/tolua++/src/bin/lua/typedef.lua index a78a84155..a78a84155 100644 --- a/tolua++-1.0.93/src/bin/lua/typedef.lua +++ b/lib/tolua++/src/bin/lua/typedef.lua diff --git a/tolua++-1.0.93/src/bin/lua/variable.lua b/lib/tolua++/src/bin/lua/variable.lua index fbc705dd8..fbc705dd8 100644 --- a/tolua++-1.0.93/src/bin/lua/variable.lua +++ b/lib/tolua++/src/bin/lua/variable.lua diff --git a/tolua++-1.0.93/src/bin/lua/verbatim.lua b/lib/tolua++/src/bin/lua/verbatim.lua index fd3b29b35..fd3b29b35 100644 --- a/tolua++-1.0.93/src/bin/lua/verbatim.lua +++ b/lib/tolua++/src/bin/lua/verbatim.lua diff --git a/lib/tolua++/src/bin/tolua.c b/lib/tolua++/src/bin/tolua.c new file mode 100644 index 000000000..fd8e1ed1e --- /dev/null +++ b/lib/tolua++/src/bin/tolua.c @@ -0,0 +1,169 @@ +/* tolua +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Aug 2003 +** $Id:$ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "../../include/tolua++.h" + +#include "../../../lua/src/lua.h" +#include "../../../lua/src/lualib.h" +#include "../../../lua/src/lauxlib.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + + +static void help (void) +{ + fprintf(stderr,"\n" + "usage: tolua++ [options] input_file\n" + "\n" + "Command line options are:\n" + " -v : print version information.\n" + " -o file : set output file; default is stdout.\n" + " -H file : create include file.\n" + " -n name : set package name; default is input file root name.\n" + " -p : parse only.\n" + " -P : parse and print structure information (for debug).\n" + " -S : disable support for c++ strings.\n" + " -1 : substract 1 to operator[] index (for compatibility with tolua5).\n" + " -L file : run lua file (with dofile()) before doing anything.\n" + " -D : disable automatic exporting of destructors for classes that have\n" + " constructors (for compatibility with tolua5)\n" + " -W : disable warnings for unsupported features (for compatibility\n" + " with tolua5)\n" + " -C : disable cleanup of included lua code (for easier debugging)\n" + " -E value[=value] : add extra values to the luastate\n" + " -t : export a list of types asociates with the C++ typeid name\n" + " -q : don't print warnings to the console\n" + " -h : print this message.\n" + "Should the input file be omitted, stdin is assumed;\n" + "in that case, the package name must be explicitly set.\n\n" + ); +} + +static void version (void) +{ + fprintf(stderr, "%s (written by W. Celes, A. Manzur)\n",TOLUA_VERSION); +} + +static void setfield (lua_State* L, int table, char* f, char* v) +{ + lua_pushstring(L,f); + lua_pushstring(L,v); + lua_settable(L,table); +} + +static void add_extra (lua_State* L, char* value) { + int len; + lua_getglobal(L, "_extra_parameters"); + len = luaL_getn(L, -1); + lua_pushstring(L, value); + lua_rawseti(L, -2, len+1); + lua_pop(L, 1); +}; + +static void error (char* o) +{ + fprintf(stderr,"tolua: unknown option '%s'\n",o); + help(); + exit(1); +} + +int main (int argc, char* argv[]) +{ + #ifdef LUA_VERSION_NUM /* lua 5.1 */ + lua_State* L = luaL_newstate(); + luaL_openlibs(L); + #else + lua_State* L = lua_open(); + luaopen_base(L); + luaopen_io(L); + luaopen_string(L); + luaopen_table(L); + luaopen_math(L); + luaopen_debug(L); + #endif + + lua_pushstring(L,TOLUA_VERSION); lua_setglobal(L,"TOLUA_VERSION"); + lua_pushstring(L,LUA_VERSION); lua_setglobal(L,"TOLUA_LUA_VERSION"); + + if (argc==1) + { + help(); + return 0; + } + else + { + int i, t; + lua_newtable(L); + lua_setglobal(L, "_extra_parameters"); + lua_newtable(L); + lua_pushvalue(L,-1); + lua_setglobal(L,"flags"); + t = lua_gettop(L); + for (i=1; i<argc; ++i) + { + if (*argv[i] == '-') + { + switch (argv[i][1]) + { + case 'v': version(); return 0; + case 'h': help(); return 0; + case 'p': setfield(L,t,"p",""); break; + case 'P': setfield(L,t,"P",""); break; + case 'o': setfield(L,t,"o",argv[++i]); break; + case 'n': setfield(L,t,"n",argv[++i]); break; + case 'H': setfield(L,t,"H",argv[++i]); break; + case 'S': setfield(L,t,"S",""); break; + case '1': setfield(L,t,"1",""); break; + case 'L': setfield(L,t,"L",argv[++i]); break; + case 'D': setfield(L,t,"D",""); break; + case 'W': setfield(L,t,"W",""); break; + case 'C': setfield(L,t,"C",""); break; + case 'E': add_extra(L,argv[++i]); break; + case 't': setfield(L,t,"t",""); break; + case 'q': setfield(L,t,"q",""); break; + default: error(argv[i]); break; + } + } + else + { + setfield(L,t,"f",argv[i]); + break; + } + } + lua_pop(L,1); + } +/* #define TOLUA_SCRIPT_RUN */ +#ifndef TOLUA_SCRIPT_RUN + { + int tolua_tolua_open (lua_State* L); + tolua_tolua_open(L); + } +#else + { + char* p; + char path[BUFSIZ]; + strcpy(path,argv[0]); + p = strrchr(path,'/'); + if (p==NULL) p = strrchr(path,'\\'); + p = (p==NULL) ? path : p+1; + sprintf(p,"%s","../src/bin/lua/"); + lua_pushstring(L,path); lua_setglobal(L,"path"); + strcat(path,"all.lua"); + lua_dofile(L,path); + } +#endif + return 0; +} diff --git a/tolua++-1.0.93/src/bin/tolua_scons.pkg b/lib/tolua++/src/bin/tolua_scons.pkg index da458ea7c..da458ea7c 100644 --- a/tolua++-1.0.93/src/bin/tolua_scons.pkg +++ b/lib/tolua++/src/bin/tolua_scons.pkg diff --git a/tolua++-1.0.93/src/bin/toluabind.c b/lib/tolua++/src/bin/toluabind.c index bf71cf158..bf71cf158 100644 --- a/tolua++-1.0.93/src/bin/toluabind.c +++ b/lib/tolua++/src/bin/toluabind.c diff --git a/tolua++-1.0.93/src/bin/toluabind.h b/lib/tolua++/src/bin/toluabind.h index 7f1f018c9..7f1f018c9 100644 --- a/tolua++-1.0.93/src/bin/toluabind.h +++ b/lib/tolua++/src/bin/toluabind.h diff --git a/tolua++-1.0.93/src/bin/toluabind_default.c b/lib/tolua++/src/bin/toluabind_default.c index b5db813bf..b5db813bf 100644 --- a/tolua++-1.0.93/src/bin/toluabind_default.c +++ b/lib/tolua++/src/bin/toluabind_default.c diff --git a/tolua++-1.0.93/src/bin/toluabind_default.h b/lib/tolua++/src/bin/toluabind_default.h index c31a14875..c31a14875 100644 --- a/tolua++-1.0.93/src/bin/toluabind_default.h +++ b/lib/tolua++/src/bin/toluabind_default.h diff --git a/tolua++-1.0.93/src/lib/SCsub b/lib/tolua++/src/lib/SCsub index 2f9a24691..2f9a24691 100644 --- a/tolua++-1.0.93/src/lib/SCsub +++ b/lib/tolua++/src/lib/SCsub diff --git a/lib/tolua++/src/lib/tolua_event.c b/lib/tolua++/src/lib/tolua_event.c new file mode 100644 index 000000000..3075a60b3 --- /dev/null +++ b/lib/tolua++/src/lib/tolua_event.c @@ -0,0 +1,536 @@ +/* tolua: event functions +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include <stdio.h> + +#include "../../include/tolua++.h" + +/* Store at ubox + * It stores, creating the corresponding table if needed, + * the pair key/value in the corresponding ubox table +*/ +static void storeatubox (lua_State* L, int lo) +{ + #ifdef LUA_VERSION_NUM + lua_getfenv(L, lo); + if (lua_rawequal(L, -1, TOLUA_NOPEER)) { + lua_pop(L, 1); + lua_newtable(L); + lua_pushvalue(L, -1); + lua_setfenv(L, lo); /* stack: k,v,table */ + }; + lua_insert(L, -3); + lua_settable(L, -3); /* on lua 5.1, we trade the "tolua_peers" lookup for a settable call */ + lua_pop(L, 1); + #else + /* stack: key value (to be stored) */ + lua_pushstring(L,"tolua_peers"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: k v ubox */ + lua_pushvalue(L,lo); + lua_rawget(L,-2); /* stack: k v ubox ubox[u] */ + if (!lua_istable(L,-1)) + { + lua_pop(L,1); /* stack: k v ubox */ + lua_newtable(L); /* stack: k v ubox table */ + lua_pushvalue(L,1); + lua_pushvalue(L,-2); /* stack: k v ubox table u table */ + lua_rawset(L,-4); /* stack: k v ubox ubox[u]=table */ + } + lua_insert(L,-4); /* put table before k */ + lua_pop(L,1); /* pop ubox */ + lua_rawset(L,-3); /* store at table */ + lua_pop(L,1); /* pop ubox[u] */ + #endif +} + +/* Module index function +*/ +static int module_index_event (lua_State* L) +{ + lua_pushstring(L,".get"); + lua_rawget(L,-3); + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { + lua_call(L,0,1); + return 1; + } + else if (lua_istable(L,-1)) + return 1; + } + /* call old index meta event */ + if (lua_getmetatable(L,1)) + { + lua_pushstring(L,"__index"); + lua_rawget(L,-2); + lua_pushvalue(L,1); + lua_pushvalue(L,2); + if (lua_isfunction(L,-1)) + { + lua_call(L,2,1); + return 1; + } + else if (lua_istable(L,-1)) + { + lua_gettable(L,-3); + return 1; + } + } + lua_pushnil(L); + return 1; +} + +/* Module newindex function +*/ +static int module_newindex_event (lua_State* L) +{ + lua_pushstring(L,".set"); + lua_rawget(L,-4); + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); + if (lua_iscfunction(L,-1)) + { + lua_pushvalue(L,1); /* only to be compatible with non-static vars */ + lua_pushvalue(L,3); /* value */ + lua_call(L,2,0); + return 0; + } + } + /* call old newindex meta event */ + if (lua_getmetatable(L,1) && lua_getmetatable(L,-1)) + { + lua_pushstring(L,"__newindex"); + lua_rawget(L,-2); + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_pushvalue(L,3); + lua_call(L,3,0); + } + } + lua_settop(L,3); + lua_rawset(L,-3); + return 0; +} + +/* Class index function + * If the object is a userdata (ie, an object), it searches the field in + * the alternative table stored in the corresponding "ubox" table. +*/ +static int class_index_event (lua_State* L) +{ + int t = lua_type(L,1); + if (t == LUA_TUSERDATA) + { + /* Access alternative table */ + #ifdef LUA_VERSION_NUM /* new macro on version 5.1 */ + lua_getfenv(L,1); + if (!lua_rawequal(L, -1, TOLUA_NOPEER)) { + lua_pushvalue(L, 2); /* key */ + lua_gettable(L, -2); /* on lua 5.1, we trade the "tolua_peers" lookup for a gettable call */ + if (!lua_isnil(L, -1)) + return 1; + }; + #else + lua_pushstring(L,"tolua_peers"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: obj key ubox */ + lua_pushvalue(L,1); + lua_rawget(L,-2); /* stack: obj key ubox ubox[u] */ + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); /* key */ + lua_rawget(L,-2); /* stack: obj key ubox ubox[u] value */ + if (!lua_isnil(L,-1)) + return 1; + } + #endif + lua_settop(L,2); /* stack: obj key */ + /* Try metatables */ + lua_pushvalue(L,1); /* stack: obj key obj */ + while (lua_getmetatable(L,-1)) + { /* stack: obj key obj mt */ + lua_remove(L,-2); /* stack: obj key mt */ + if (lua_isnumber(L,2)) /* check if key is a numeric value */ + { + /* try operator[] */ + lua_pushstring(L,".geti"); + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + } + else + { + lua_pushvalue(L,2); /* stack: obj key mt key */ + lua_rawget(L,-2); /* stack: obj key mt value */ + if (!lua_isnil(L,-1)) + return 1; + else + lua_pop(L,1); + /* try C/C++ variable */ + lua_pushstring(L,".get"); + lua_rawget(L,-2); /* stack: obj key mt tget */ + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); + lua_rawget(L,-2); /* stack: obj key mt value */ + if (lua_iscfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + else if (lua_istable(L,-1)) + { + /* deal with array: create table to be returned and cache it in ubox */ + void* u = *((void**)lua_touserdata(L,1)); + lua_newtable(L); /* stack: obj key mt value table */ + lua_pushstring(L,".self"); + lua_pushlightuserdata(L,u); + lua_rawset(L,-3); /* store usertype in ".self" */ + lua_insert(L,-2); /* stack: obj key mt table value */ + lua_setmetatable(L,-2); /* set stored value as metatable */ + lua_pushvalue(L,-1); /* stack: obj key met table table */ + lua_pushvalue(L,2); /* stack: obj key mt table table key */ + lua_insert(L,-2); /* stack: obj key mt table key table */ + storeatubox(L,1); /* stack: obj key mt table */ + return 1; + } + } + } + lua_settop(L,3); + } + lua_pushnil(L); + return 1; + } + else if (t== LUA_TTABLE) + { + module_index_event(L); + return 1; + } + lua_pushnil(L); + return 1; +} + +/* Newindex function + * It first searches for a C/C++ varaible to be set. + * Then, it either stores it in the alternative ubox table (in the case it is + * an object) or in the own table (that represents the class or module). +*/ +static int class_newindex_event (lua_State* L) +{ + int t = lua_type(L,1); + if (t == LUA_TUSERDATA) + { + /* Try accessing a C/C++ variable to be set */ + lua_getmetatable(L,1); + while (lua_istable(L,-1)) /* stack: t k v mt */ + { + if (lua_isnumber(L,2)) /* check if key is a numeric value */ + { + /* try operator[] */ + lua_pushstring(L,".seti"); + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_pushvalue(L,3); + lua_call(L,3,0); + return 0; + } + } + else + { + lua_pushstring(L,".set"); + lua_rawget(L,-2); /* stack: t k v mt tset */ + if (lua_istable(L,-1)) + { + lua_pushvalue(L,2); + lua_rawget(L,-2); /* stack: t k v mt tset func */ + if (lua_iscfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,3); + lua_call(L,2,0); + return 0; + } + lua_pop(L,1); /* stack: t k v mt tset */ + } + lua_pop(L,1); /* stack: t k v mt */ + if (!lua_getmetatable(L,-1)) /* stack: t k v mt mt */ + lua_pushnil(L); + lua_remove(L,-2); /* stack: t k v mt */ + } + } + lua_settop(L,3); /* stack: t k v */ + + /* then, store as a new field */ + storeatubox(L,1); + } + else if (t== LUA_TTABLE) + { + module_newindex_event(L); + } + return 0; +} + +static int class_call_event(lua_State* L) { + + if (lua_istable(L, 1)) { + lua_pushstring(L, ".call"); + lua_rawget(L, 1); + if (lua_isfunction(L, -1)) { + + lua_insert(L, 1); + lua_call(L, lua_gettop(L)-1, 1); + + return 1; + }; + }; + tolua_error(L,"Attempt to call a non-callable object.",NULL); + return 0; +}; + +static int do_operator (lua_State* L, const char* op) +{ + if (lua_isuserdata(L,1)) + { + /* Try metatables */ + lua_pushvalue(L,1); /* stack: op1 op2 */ + while (lua_getmetatable(L,-1)) + { /* stack: op1 op2 op1 mt */ + lua_remove(L,-2); /* stack: op1 op2 mt */ + lua_pushstring(L,op); /* stack: op1 op2 mt key */ + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + lua_settop(L,3); + } + } + tolua_error(L,"Attempt to perform operation on an invalid operand",NULL); + return 0; +} + +static int class_add_event (lua_State* L) +{ + return do_operator(L,".add"); +} + +static int class_sub_event (lua_State* L) +{ + return do_operator(L,".sub"); +} + +static int class_mul_event (lua_State* L) +{ + return do_operator(L,".mul"); +} + +static int class_div_event (lua_State* L) +{ + return do_operator(L,".div"); +} + +static int class_lt_event (lua_State* L) +{ + return do_operator(L,".lt"); +} + +static int class_le_event (lua_State* L) +{ + return do_operator(L,".le"); +} + +static int class_eq_event (lua_State* L) +{ + /* copying code from do_operator here to return false when no operator is found */ + if (lua_isuserdata(L,1)) + { + /* Try metatables */ + lua_pushvalue(L,1); /* stack: op1 op2 */ + while (lua_getmetatable(L,-1)) + { /* stack: op1 op2 op1 mt */ + lua_remove(L,-2); /* stack: op1 op2 mt */ + lua_pushstring(L,".eq"); /* stack: op1 op2 mt key */ + lua_rawget(L,-2); /* stack: obj key mt func */ + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_pushvalue(L,2); + lua_call(L,2,1); + return 1; + } + lua_settop(L,3); + } + } + + lua_settop(L, 3); + lua_pushboolean(L, 0); + return 1; +} + +/* +static int class_gc_event (lua_State* L) +{ + void* u = *((void**)lua_touserdata(L,1)); + fprintf(stderr, "collecting: looking at %p\n", u); + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + lua_pushlightuserdata(L,u); + lua_rawget(L,-2); + if (lua_isfunction(L,-1)) + { + lua_pushvalue(L,1); + lua_call(L,1,0); + lua_pushlightuserdata(L,u); + lua_pushnil(L); + lua_rawset(L,-3); + } + lua_pop(L,2); + return 0; +} +*/ +TOLUA_API int class_gc_event (lua_State* L) +{ + void* u = *((void**)lua_touserdata(L,1)); + int top; + /*fprintf(stderr, "collecting: looking at %p\n", u);*/ + /* + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + */ + lua_pushvalue(L, lua_upvalueindex(1)); + lua_pushlightuserdata(L,u); + lua_rawget(L,-2); /* stack: gc umt */ + lua_getmetatable(L,1); /* stack: gc umt mt */ + /*fprintf(stderr, "checking type\n");*/ + top = lua_gettop(L); + if (tolua_fast_isa(L,top,top-1, lua_upvalueindex(2))) /* make sure we collect correct type */ + { + /*fprintf(stderr, "Found type!\n");*/ + /* get gc function */ + lua_pushliteral(L,".collector"); + lua_rawget(L,-2); /* stack: gc umt mt collector */ + if (lua_isfunction(L,-1)) { + /*fprintf(stderr, "Found .collector!\n");*/ + } + else { + lua_pop(L,1); + /*fprintf(stderr, "Using default cleanup\n");*/ + lua_pushcfunction(L,tolua_default_collect); + } + + lua_pushvalue(L,1); /* stack: gc umt mt collector u */ + lua_call(L,1,0); + + lua_pushlightuserdata(L,u); /* stack: gc umt mt u */ + lua_pushnil(L); /* stack: gc umt mt u nil */ + lua_rawset(L,-5); /* stack: gc umt mt */ + } + lua_pop(L,3); + return 0; +} + + +/* Register module events + * It expects the metatable on the top of the stack +*/ +TOLUA_API void tolua_moduleevents (lua_State* L) +{ + lua_pushstring(L,"__index"); + lua_pushcfunction(L,module_index_event); + lua_rawset(L,-3); + lua_pushstring(L,"__newindex"); + lua_pushcfunction(L,module_newindex_event); + lua_rawset(L,-3); +} + +/* Check if the object on the top has a module metatable +*/ +TOLUA_API int tolua_ismodulemetatable (lua_State* L) +{ + int r = 0; + if (lua_getmetatable(L,-1)) + { + lua_pushstring(L,"__index"); + lua_rawget(L,-2); + r = (lua_tocfunction(L,-1) == module_index_event); + lua_pop(L,2); + } + return r; +} + +/* Register class events + * It expects the metatable on the top of the stack +*/ +TOLUA_API void tolua_classevents (lua_State* L) +{ + lua_pushstring(L,"__index"); + lua_pushcfunction(L,class_index_event); + lua_rawset(L,-3); + lua_pushstring(L,"__newindex"); + lua_pushcfunction(L,class_newindex_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__add"); + lua_pushcfunction(L,class_add_event); + lua_rawset(L,-3); + lua_pushstring(L,"__sub"); + lua_pushcfunction(L,class_sub_event); + lua_rawset(L,-3); + lua_pushstring(L,"__mul"); + lua_pushcfunction(L,class_mul_event); + lua_rawset(L,-3); + lua_pushstring(L,"__div"); + lua_pushcfunction(L,class_div_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__lt"); + lua_pushcfunction(L,class_lt_event); + lua_rawset(L,-3); + lua_pushstring(L,"__le"); + lua_pushcfunction(L,class_le_event); + lua_rawset(L,-3); + lua_pushstring(L,"__eq"); + lua_pushcfunction(L,class_eq_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__call"); + lua_pushcfunction(L,class_call_event); + lua_rawset(L,-3); + + lua_pushstring(L,"__gc"); + lua_pushstring(L, "tolua_gc_event"); + lua_rawget(L, LUA_REGISTRYINDEX); + /*lua_pushcfunction(L,class_gc_event);*/ + lua_rawset(L,-3); +} + diff --git a/tolua++-1.0.93/src/lib/tolua_event.h b/lib/tolua++/src/lib/tolua_event.h index 898f33dfc..898f33dfc 100644 --- a/tolua++-1.0.93/src/lib/tolua_event.h +++ b/lib/tolua++/src/lib/tolua_event.h diff --git a/lib/tolua++/src/lib/tolua_is.c b/lib/tolua++/src/lib/tolua_is.c new file mode 100644 index 000000000..b470477ff --- /dev/null +++ b/lib/tolua++/src/lib/tolua_is.c @@ -0,0 +1,621 @@ +/* tolua: functions to check types. +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "../../include/tolua++.h" +#include "../../../lua/src/lauxlib.h" + +#include <stdlib.h> +#include <string.h> + +/* a fast check if a is b, without parameter validation + i.e. if b is equal to a or a superclass of a. */ +TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index) +{ + int result; + if (lua_rawequal(L,mt_indexa,mt_indexb)) + result = 1; + else + { + if (super_index) { + lua_pushvalue(L, super_index); + } else { + lua_pushliteral(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */ + }; + lua_pushvalue(L,mt_indexa); /* stack: super mta */ + lua_rawget(L,-2); /* stack: super super[mta] */ + lua_pushvalue(L,mt_indexb); /* stack: super super[mta] mtb */ + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super super[mta] typenameB */ + lua_rawget(L,-2); /* stack: super super[mta] bool */ + result = lua_toboolean(L,-1); + lua_pop(L,3); + } + return result; +} + +/* Push and returns the corresponding object typename */ +TOLUA_API const char* tolua_typename (lua_State* L, int lo) +{ + int tag = lua_type(L,lo); + if (tag == LUA_TNONE) + lua_pushstring(L,"[no object]"); + else if (tag != LUA_TUSERDATA && tag != LUA_TTABLE) + lua_pushstring(L,lua_typename(L,tag)); + else if (tag == LUA_TUSERDATA) + { + if (!lua_getmetatable(L,lo)) + lua_pushstring(L,lua_typename(L,tag)); + else + { + lua_rawget(L,LUA_REGISTRYINDEX); + if (!lua_isstring(L,-1)) + { + lua_pop(L,1); + lua_pushstring(L,"[undefined]"); + } + } + } + else /* is table */ + { + lua_pushvalue(L,lo); + lua_rawget(L,LUA_REGISTRYINDEX); + if (!lua_isstring(L,-1)) + { + lua_pop(L,1); + lua_pushstring(L,"table"); + } + else + { + lua_pushstring(L,"class "); + lua_insert(L,-2); + lua_concat(L,2); + } + } + return lua_tostring(L,-1); +} + +TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err) +{ + if (msg[0] == '#') + { + const char* expected = err->type; + const char* provided = tolua_typename(L,err->index); + if (msg[1]=='f') + { + int narg = err->index; + if (err->array) + luaL_error(L,"%s\n argument #%d is array of '%s'; array of '%s' expected.\n", + msg+2,narg,provided,expected); + else + luaL_error(L,"%s\n argument #%d is '%s'; '%s' expected.\n", + msg+2,narg,provided,expected); + } + else if (msg[1]=='v') + { + if (err->array) + luaL_error(L,"%s\n value is array of '%s'; array of '%s' expected.\n", + msg+2,provided,expected); + else + luaL_error(L,"%s\n value is '%s'; '%s' expected.\n", + msg+2,provided,expected); + } + } + else + luaL_error(L,msg); +} + +/* the equivalent of lua_is* for usertable */ +static int lua_isusertable (lua_State* L, int lo, const char* type) +{ + int r = 0; + if (lo < 0) lo = lua_gettop(L)+lo+1; + lua_pushvalue(L,lo); + lua_rawget(L,LUA_REGISTRYINDEX); /* get registry[t] */ + if (lua_isstring(L,-1)) + { + r = strcmp(lua_tostring(L,-1),type)==0; + if (!r) + { + /* try const */ + lua_pushstring(L,"const "); + lua_insert(L,-2); + lua_concat(L,2); + r = lua_isstring(L,-1) && strcmp(lua_tostring(L,-1),type)==0; + } + } + lua_pop(L, 1); + return r; +} + +int push_table_instance(lua_State* L, int lo) { + + if (lua_istable(L, lo)) { + + lua_pushstring(L, ".c_instance"); + lua_gettable(L, lo); + if (lua_isuserdata(L, -1)) { + + lua_replace(L, lo); + return 1; + } else { + + lua_pop(L, 1); + return 0; + }; + } else { + return 0; + }; + + return 0; +}; + +/* the equivalent of lua_is* for usertype */ +static int lua_isusertype (lua_State* L, int lo, const char* type) +{ + if (!lua_isuserdata(L,lo)) { + if (!push_table_instance(L, lo)) { + return 0; + }; + }; + { + /* check if it is of the same type */ + int r; + const char *tn; + if (lua_getmetatable(L,lo)) /* if metatable? */ + { + lua_rawget(L,LUA_REGISTRYINDEX); /* get registry[mt] */ + tn = lua_tostring(L,-1); + r = tn && (strcmp(tn,type) == 0); + lua_pop(L, 1); + if (r) + return 1; + else + { + /* check if it is a specialized class */ + lua_pushstring(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* get super */ + lua_getmetatable(L,lo); + lua_rawget(L,-2); /* get super[mt] */ + if (lua_istable(L,-1)) + { + int b; + lua_pushstring(L,type); + lua_rawget(L,-2); /* get super[mt][type] */ + b = lua_toboolean(L,-1); + lua_pop(L,3); + if (b) + return 1; + } + } + } + } + return 0; +} + +TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err) +{ + if (lua_gettop(L)<abs(lo)) + return 1; + err->index = lo; + err->array = 0; + err->type = "[no object]"; + return 0; +} + +TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_isnil(L,lo) || lua_isboolean(L,lo)) + return 1; + err->index = lo; + err->array = 0; + err->type = "boolean"; + return 0; +} + +TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_isnumber(L,lo)) + return 1; + err->index = lo; + err->array = 0; + err->type = "number"; + return 0; +} + +TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_isnil(L,lo) || lua_isstring(L,lo)) + return 1; + err->index = lo; + err->array = 0; + err->type = "string"; + return 0; +} + +TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_istable(L,lo)) + return 1; + err->index = lo; + err->array = 0; + err->type = "table"; + return 0; +} + +TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_isusertable(L,lo,type)) + return 1; + err->index = lo; + err->array = 0; + err->type = type; + return 0; +} + + +TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_isnil(L,lo) || lua_isuserdata(L,lo)) + return 1; + err->index = lo; + err->array = 0; + err->type = "userdata"; + return 0; +} + +TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err) { + + if (lua_gettop(L)<abs(lo)) + return 0; /* somebody else should chack this */ + if (!lua_isnil(L, lo)) + return 0; + + err->index = lo; + err->array = 0; + err->type = "value"; + return 1; +}; + +TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err) +{ + if (def || abs(lo)<=lua_gettop(L)) /* any valid index */ + return 1; + err->index = lo; + err->array = 0; + err->type = "value"; + return 0; +} + +TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err) +{ + if (def && lua_gettop(L)<abs(lo)) + return 1; + if (lua_isnil(L,lo) || lua_isusertype(L,lo,type)) + return 1; + err->index = lo; + err->array = 0; + err->type = type; + return 0; +} + +TOLUA_API int tolua_isvaluearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + return 1; +} + +TOLUA_API int tolua_isbooleanarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "boolean"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isnumberarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!lua_isnumber(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "number"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isstringarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "string"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_istablearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (! lua_istable(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "table"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isuserdataarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "userdata"; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +TOLUA_API int tolua_isusertypearray + (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err) +{ + if (!tolua_istable(L,lo,def,err)) + return 0; + else + { + int i; + for (i=1; i<=dim; ++i) + { + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->type = type; + err->array = 1; + return 0; + } + lua_pop(L,1); + } + } + return 1; +} + +#if 0 +int tolua_isbooleanfield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "boolean"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isnumberfield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!lua_isnumber(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "number"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isstringfield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "string"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_istablefield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i+1); + lua_gettable(L,lo); + if (! lua_istable(L,-1) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "table"; + return 0; + } + lua_pop(L,1); +} + +int tolua_isusertablefield + (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (! lua_isusertable(L,-1,type) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = type; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isuserdatafield + (lua_State* L, int lo, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->array = 1; + err->type = "userdata"; + return 0; + } + lua_pop(L,1); + return 1; +} + +int tolua_isusertypefield + (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err) +{ + lua_pushnumber(L,i); + lua_gettable(L,lo); + if (!(lua_isnil(L,-1) || lua_isusertype(L,-1,type)) && + !(def && lua_isnil(L,-1)) + ) + { + err->index = lo; + err->type = type; + err->array = 1; + return 0; + } + lua_pop(L,1); + return 1; +} + +#endif diff --git a/lib/tolua++/src/lib/tolua_map.c b/lib/tolua++/src/lib/tolua_map.c new file mode 100644 index 000000000..7c4a22336 --- /dev/null +++ b/lib/tolua++/src/lib/tolua_map.c @@ -0,0 +1,704 @@ +/* tolua: functions to map features +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "../../include/tolua++.h" +#include "../../../lua/src/lauxlib.h" +#include "tolua_event.h" + +#include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <math.h> + + +/* Create metatable + * Create and register new metatable +*/ +static int tolua_newmetatable (lua_State* L, char* name) +{ + int r = luaL_newmetatable(L,name); + + #ifdef LUA_VERSION_NUM /* only lua 5.1 */ + if (r) { + lua_pushvalue(L, -1); + lua_pushstring(L, name); + lua_settable(L, LUA_REGISTRYINDEX); /* reg[mt] = type_name */ + }; + #endif + + if (r) + tolua_classevents(L); /* set meta events */ + lua_pop(L,1); + return r; +} + +/* Map super classes + * It sets 'name' as being also a 'base', mapping all super classes of 'base' in 'name' +*/ +static void mapsuper (lua_State* L, const char* name, const char* base) +{ + /* push registry.super */ + lua_pushstring(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */ + luaL_getmetatable(L,name); /* stack: super mt */ + lua_rawget(L,-2); /* stack: super table */ + if (lua_isnil(L,-1)) + { + /* create table */ + lua_pop(L,1); + lua_newtable(L); /* stack: super table */ + luaL_getmetatable(L,name); /* stack: super table mt */ + lua_pushvalue(L,-2); /* stack: super table mt table */ + lua_rawset(L,-4); /* stack: super table */ + } + + /* set base as super class */ + lua_pushstring(L,base); + lua_pushboolean(L,1); + lua_rawset(L,-3); /* stack: super table */ + + /* set all super class of base as super class of name */ + luaL_getmetatable(L,base); /* stack: super table base_mt */ + lua_rawget(L,-3); /* stack: super table base_table */ + if (lua_istable(L,-1)) + { + /* traverse base table */ + lua_pushnil(L); /* first key */ + while (lua_next(L,-2) != 0) + { + /* stack: ... base_table key value */ + lua_pushvalue(L,-2); /* stack: ... base_table key value key */ + lua_insert(L,-2); /* stack: ... base_table key key value */ + lua_rawset(L,-5); /* stack: ... base_table key */ + } + } + lua_pop(L,3); /* stack: <empty> */ +} + +/* creates a 'tolua_ubox' table for base clases, and +// expects the metatable and base metatable on the stack */ +static void set_ubox(lua_State* L) { + + /* mt basemt */ + if (!lua_isnil(L, -1)) { + lua_pushstring(L, "tolua_ubox"); + lua_rawget(L,-2); + } else { + lua_pushnil(L); + }; + /* mt basemt base_ubox */ + if (!lua_isnil(L,-1)) { + lua_pushstring(L, "tolua_ubox"); + lua_insert(L, -2); + /* mt basemt key ubox */ + lua_rawset(L,-4); + /* (mt with ubox) basemt */ + } else { + /* mt basemt nil */ + lua_pop(L, 1); + lua_pushstring(L,"tolua_ubox"); lua_newtable(L); + /* make weak value metatable for ubox table to allow userdata to be + garbage-collected */ + lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */ + lua_setmetatable(L, -2); /* stack:mt basemt string ubox */ + lua_rawset(L,-4); + }; + +}; + +/* Map inheritance + * It sets 'name' as derived from 'base' by setting 'base' as metatable of 'name' +*/ +static void mapinheritance (lua_State* L, const char* name, const char* base) +{ + /* set metatable inheritance */ + luaL_getmetatable(L,name); + + if (base && *base) + luaL_getmetatable(L,base); + else { + + if (lua_getmetatable(L, -1)) { /* already has a mt, we don't overwrite it */ + lua_pop(L, 2); + return; + }; + luaL_getmetatable(L,"tolua_commonclass"); + }; + + set_ubox(L); + + lua_setmetatable(L,-2); + lua_pop(L,1); +} + +/* Object type +*/ +static int tolua_bnd_type (lua_State* L) +{ + tolua_typename(L,lua_gettop(L)); + return 1; +} + +/* Take ownership +*/ +static int tolua_bnd_takeownership (lua_State* L) +{ + int success = 0; + if (lua_isuserdata(L,1)) + { + if (lua_getmetatable(L,1)) /* if metatable? */ + { + lua_pop(L,1); /* clear metatable off stack */ + /* force garbage collection to avoid C to reuse a to-be-collected address */ + #ifdef LUA_VERSION_NUM + lua_gc(L, LUA_GCCOLLECT, 0); + #else + lua_setgcthreshold(L,0); + #endif + + success = tolua_register_gc(L,1); + } + } + lua_pushboolean(L,success!=0); + return 1; +} + +/* Release ownership +*/ +static int tolua_bnd_releaseownership (lua_State* L) +{ + int done = 0; + if (lua_isuserdata(L,1)) + { + void* u = *((void**)lua_touserdata(L,1)); + /* force garbage collection to avoid releasing a to-be-collected address */ + #ifdef LUA_VERSION_NUM + lua_gc(L, LUA_GCCOLLECT, 0); + #else + lua_setgcthreshold(L,0); + #endif + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + lua_pushlightuserdata(L,u); + lua_rawget(L,-2); + lua_getmetatable(L,1); + if (lua_rawequal(L,-1,-2)) /* check that we are releasing the correct type */ + { + lua_pushlightuserdata(L,u); + lua_pushnil(L); + lua_rawset(L,-5); + done = 1; + } + } + lua_pushboolean(L,done!=0); + return 1; +} + +/* Type casting +*/ +static int tolua_bnd_cast (lua_State* L) +{ + +/* // old code + void* v = tolua_tousertype(L,1,NULL); + const char* s = tolua_tostring(L,2,NULL); + if (v && s) + tolua_pushusertype(L,v,s); + else + lua_pushnil(L); + return 1; +*/ + + void* v; + const char* s; + if (lua_islightuserdata(L, 1)) { + v = tolua_touserdata(L, 1, NULL); + } else { + v = tolua_tousertype(L, 1, 0); + }; + + s = tolua_tostring(L,2,NULL); + if (v && s) + tolua_pushusertype(L,v,s); + else + lua_pushnil(L); + return 1; +} + +/* Inheritance +*/ +static int tolua_bnd_inherit (lua_State* L) { + + /* stack: lua object, c object */ + lua_pushstring(L, ".c_instance"); + lua_pushvalue(L, -2); + lua_rawset(L, -4); + /* l_obj[".c_instance"] = c_obj */ + + return 0; +}; + +#ifdef LUA_VERSION_NUM /* lua 5.1 */ +static int tolua_bnd_setpeer(lua_State* L) { + + /* stack: userdata, table */ + if (!lua_isuserdata(L, -2)) { + lua_pushstring(L, "Invalid argument #1 to setpeer: userdata expected."); + lua_error(L); + }; + + if (lua_isnil(L, -1)) { + + lua_pop(L, 1); + lua_pushvalue(L, TOLUA_NOPEER); + }; + lua_setfenv(L, -2); + + return 0; +}; + +static int tolua_bnd_getpeer(lua_State* L) { + + /* stack: userdata */ + lua_getfenv(L, -1); + if (lua_rawequal(L, -1, TOLUA_NOPEER)) { + lua_pop(L, 1); + lua_pushnil(L); + }; + return 1; +}; +#endif + +/* static int class_gc_event (lua_State* L); */ + +TOLUA_API void tolua_open (lua_State* L) +{ + int top = lua_gettop(L); + lua_pushstring(L,"tolua_opened"); + lua_rawget(L,LUA_REGISTRYINDEX); + if (!lua_isboolean(L,-1)) + { + lua_pushstring(L,"tolua_opened"); lua_pushboolean(L,1); lua_rawset(L,LUA_REGISTRYINDEX); + + #ifndef LUA_VERSION_NUM /* only prior to lua 5.1 */ + /* create peer object table */ + lua_pushstring(L, "tolua_peers"); lua_newtable(L); + /* make weak key metatable for peers indexed by userdata object */ + lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "k"); lua_rawset(L, -3); /* stack: string peers mt */ + lua_setmetatable(L, -2); /* stack: string peers */ + lua_rawset(L,LUA_REGISTRYINDEX); + #endif + + /* create object ptr -> udata mapping table */ + lua_pushstring(L,"tolua_ubox"); lua_newtable(L); + /* make weak value metatable for ubox table to allow userdata to be + garbage-collected */ + lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */ + lua_setmetatable(L, -2); /* stack: string ubox */ + lua_rawset(L,LUA_REGISTRYINDEX); + + lua_pushstring(L,"tolua_super"); lua_newtable(L); lua_rawset(L,LUA_REGISTRYINDEX); + lua_pushstring(L,"tolua_gc"); lua_newtable(L);lua_rawset(L,LUA_REGISTRYINDEX); + + /* create gc_event closure */ + lua_pushstring(L, "tolua_gc_event"); + lua_pushstring(L, "tolua_gc"); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushstring(L, "tolua_super"); + lua_rawget(L, LUA_REGISTRYINDEX); + lua_pushcclosure(L, class_gc_event, 2); + lua_rawset(L, LUA_REGISTRYINDEX); + + tolua_newmetatable(L,"tolua_commonclass"); + + tolua_module(L,NULL,0); + tolua_beginmodule(L,NULL); + tolua_module(L,"tolua",0); + tolua_beginmodule(L,"tolua"); + tolua_function(L,"type",tolua_bnd_type); + tolua_function(L,"takeownership",tolua_bnd_takeownership); + tolua_function(L,"releaseownership",tolua_bnd_releaseownership); + tolua_function(L,"cast",tolua_bnd_cast); + tolua_function(L,"inherit", tolua_bnd_inherit); + #ifdef LUA_VERSION_NUM /* lua 5.1 */ + tolua_function(L, "setpeer", tolua_bnd_setpeer); + tolua_function(L, "getpeer", tolua_bnd_getpeer); + #endif + + tolua_endmodule(L); + tolua_endmodule(L); + } + lua_settop(L,top); +} + +/* Copy a C object +*/ +TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size) +{ + void* clone = (void*)malloc(size); + if (clone) + memcpy(clone,value,size); + else + tolua_error(L,"insuficient memory",NULL); + return clone; +} + +/* Default collect function +*/ +TOLUA_API int tolua_default_collect (lua_State* tolua_S) +{ + void* self = tolua_tousertype(tolua_S,1,0); + free(self); + return 0; +} + +/* Do clone +*/ +TOLUA_API int tolua_register_gc (lua_State* L, int lo) +{ + int success = 1; + void *value = *(void **)lua_touserdata(L,lo); + lua_pushstring(L,"tolua_gc"); + lua_rawget(L,LUA_REGISTRYINDEX); + lua_pushlightuserdata(L,value); + lua_rawget(L,-2); + if (!lua_isnil(L,-1)) /* make sure that object is not already owned */ + success = 0; + else + { + lua_pushlightuserdata(L,value); + lua_getmetatable(L,lo); + lua_rawset(L,-4); + } + lua_pop(L,2); + return success; +} + +/* Register a usertype + * It creates the correspoding metatable in the registry, for both 'type' and 'const type'. + * It maps 'const type' as being also a 'type' +*/ +TOLUA_API void tolua_usertype (lua_State* L, const char* type) +{ + char ctype[128] = "const "; + strncat(ctype,type,120); + + /* create both metatables */ + if (tolua_newmetatable(L,ctype) && tolua_newmetatable(L,type)) + mapsuper(L,type,ctype); /* 'type' is also a 'const type' */ +} + + +/* Begin module + * It pushes the module (or class) table on the stack +*/ +TOLUA_API void tolua_beginmodule (lua_State* L, const char* name) +{ + if (name) + { + lua_pushstring(L,name); + lua_rawget(L,-2); + } + else + lua_pushvalue(L,LUA_GLOBALSINDEX); +} + +/* End module + * It pops the module (or class) from the stack +*/ +TOLUA_API void tolua_endmodule (lua_State* L) +{ + lua_pop(L,1); +} + +/* Map module + * It creates a new module +*/ +#if 1 +TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar) +{ + if (name) + { + /* tolua module */ + lua_pushstring(L,name); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) /* check if module already exists */ + { + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,name); + lua_pushvalue(L,-2); + lua_rawset(L,-4); /* assing module into module */ + } + } + else + { + /* global table */ + lua_pushvalue(L,LUA_GLOBALSINDEX); + } + if (hasvar) + { + if (!tolua_ismodulemetatable(L)) /* check if it already has a module metatable */ + { + /* create metatable to get/set C/C++ variable */ + lua_newtable(L); + tolua_moduleevents(L); + if (lua_getmetatable(L,-2)) + lua_setmetatable(L,-2); /* set old metatable as metatable of metatable */ + lua_setmetatable(L,-2); + } + } + lua_pop(L,1); /* pop module */ +} +#else +TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar) +{ + if (name) + { + /* tolua module */ + lua_pushstring(L,name); + lua_newtable(L); + } + else + { + /* global table */ + lua_pushvalue(L,LUA_GLOBALSINDEX); + } + if (hasvar) + { + /* create metatable to get/set C/C++ variable */ + lua_newtable(L); + tolua_moduleevents(L); + if (lua_getmetatable(L,-2)) + lua_setmetatable(L,-2); /* set old metatable as metatable of metatable */ + lua_setmetatable(L,-2); + } + if (name) + lua_rawset(L,-3); /* assing module into module */ + else + lua_pop(L,1); /* pop global table */ +} +#endif + +static void push_collector(lua_State* L, const char* type, lua_CFunction col) { + + /* push collector function, but only if it's not NULL, or if there's no + collector already */ + if (!col) return; + luaL_getmetatable(L,type); + lua_pushstring(L,".collector"); + /* + if (!col) { + lua_pushvalue(L, -1); + lua_rawget(L, -3); + if (!lua_isnil(L, -1)) { + lua_pop(L, 3); + return; + }; + lua_pop(L, 1); + }; + // */ + lua_pushcfunction(L,col); + + lua_rawset(L,-3); + lua_pop(L, 1); +}; + +/* Map C class + * It maps a C class, setting the appropriate inheritance and super classes. +*/ +TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col) +{ + char cname[128] = "const "; + char cbase[128] = "const "; + strncat(cname,name,120); + strncat(cbase,base,120); + + mapinheritance(L,name,base); + mapinheritance(L,cname,name); + + mapsuper(L,cname,cbase); + mapsuper(L,name,base); + + lua_pushstring(L,lname); + + push_collector(L, name, col); + /* + luaL_getmetatable(L,name); + lua_pushstring(L,".collector"); + lua_pushcfunction(L,col); + + lua_rawset(L,-3); + */ + + luaL_getmetatable(L,name); + lua_rawset(L,-3); /* assign class metatable to module */ + + /* now we also need to store the collector table for the const + instances of the class */ + push_collector(L, cname, col); + /* + luaL_getmetatable(L,cname); + lua_pushstring(L,".collector"); + lua_pushcfunction(L,col); + lua_rawset(L,-3); + lua_pop(L,1); + */ + + +} + +/* Add base + * It adds additional base classes to a class (for multiple inheritance) + * (not for now) +TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base) { + + char cname[128] = "const "; + char cbase[128] = "const "; + strncat(cname,name,120); + strncat(cbase,base,120); + + mapsuper(L,cname,cbase); + mapsuper(L,name,base); +}; +*/ + +/* Map function + * It assigns a function into the current module (or class) +*/ +TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func) +{ + lua_pushstring(L,name); + lua_pushcfunction(L,func); + lua_rawset(L,-3); +} + +/* sets the __call event for the class (expects the class' main table on top) */ +/* never really worked :( +TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type) { + + lua_getmetatable(L, -1); + //luaL_getmetatable(L, type); + lua_pushstring(L,"__call"); + lua_pushcfunction(L,func); + lua_rawset(L,-3); + lua_pop(L, 1); +}; +*/ + +/* Map constant number + * It assigns a constant number into the current module (or class) +*/ +TOLUA_API void tolua_constant (lua_State* L, const char* name, lua_Number value) +{ + lua_pushstring(L,name); + tolua_pushnumber(L,value); + lua_rawset(L,-3); +} + + +/* Map variable + * It assigns a variable into the current module (or class) +*/ +TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set) +{ + /* get func */ + lua_pushstring(L,".get"); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) + { + /* create .get table, leaving it at the top */ + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,".get"); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } + lua_pushstring(L,name); + lua_pushcfunction(L,get); + lua_rawset(L,-3); /* store variable */ + lua_pop(L,1); /* pop .get table */ + + /* set func */ + if (set) + { + lua_pushstring(L,".set"); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) + { + /* create .set table, leaving it at the top */ + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,".set"); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } + lua_pushstring(L,name); + lua_pushcfunction(L,set); + lua_rawset(L,-3); /* store variable */ + lua_pop(L,1); /* pop .set table */ + } +} + +/* Access const array + * It reports an error when trying to write into a const array +*/ +static int const_array (lua_State* L) +{ + luaL_error(L,"value of const array cannot be changed"); + return 0; +} + +/* Map an array + * It assigns an array into the current module (or class) +*/ +TOLUA_API void tolua_array (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set) +{ + lua_pushstring(L,".get"); + lua_rawget(L,-2); + if (!lua_istable(L,-1)) + { + /* create .get table, leaving it at the top */ + lua_pop(L,1); + lua_newtable(L); + lua_pushstring(L,".get"); + lua_pushvalue(L,-2); + lua_rawset(L,-4); + } + lua_pushstring(L,name); + + lua_newtable(L); /* create array metatable */ + lua_pushvalue(L,-1); + lua_setmetatable(L,-2); /* set the own table as metatable (for modules) */ + lua_pushstring(L,"__index"); + lua_pushcfunction(L,get); + lua_rawset(L,-3); + lua_pushstring(L,"__newindex"); + lua_pushcfunction(L,set?set:const_array); + lua_rawset(L,-3); + + lua_rawset(L,-3); /* store variable */ + lua_pop(L,1); /* pop .get table */ +} + + +TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name) { + + #ifdef LUA_VERSION_NUM /* lua 5.1 */ + luaL_loadbuffer(L, B, size, name) || lua_pcall(L, 0, 0, 0); + #else + lua_dobuffer(L, B, size, name); + #endif +}; + diff --git a/lib/tolua++/src/lib/tolua_push.c b/lib/tolua++/src/lib/tolua_push.c new file mode 100644 index 000000000..947f0e7a5 --- /dev/null +++ b/lib/tolua++/src/lib/tolua_push.c @@ -0,0 +1,171 @@ +/* tolua: functions to push C values. +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "../../include/tolua++.h" +#include "../../../lua/src/lauxlib.h" + +#include <stdlib.h> + +TOLUA_API void tolua_pushvalue (lua_State* L, int lo) +{ + lua_pushvalue(L,lo); +} + +TOLUA_API void tolua_pushboolean (lua_State* L, int value) +{ + lua_pushboolean(L,value); +} + +TOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value) +{ + lua_pushnumber(L,value); +} + +TOLUA_API void tolua_pushstring (lua_State* L, const char* value) +{ + if (value == NULL) + lua_pushnil(L); + else + lua_pushstring(L,value); +} + +TOLUA_API void tolua_pushuserdata (lua_State* L, void* value) +{ + if (value == NULL) + lua_pushnil(L); + else + lua_pushlightuserdata(L,value); +} + +TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type) +{ + if (value == NULL) + lua_pushnil(L); + else + { + luaL_getmetatable(L, type); + lua_pushstring(L,"tolua_ubox"); + lua_rawget(L,-2); /* stack: mt ubox */ + if (lua_isnil(L, -1)) { + lua_pop(L, 1); + lua_pushstring(L, "tolua_ubox"); + lua_rawget(L, LUA_REGISTRYINDEX); + }; + lua_pushlightuserdata(L,value); + lua_rawget(L,-2); /* stack: mt ubox ubox[u] */ + if (lua_isnil(L,-1)) + { + lua_pop(L,1); /* stack: mt ubox */ + lua_pushlightuserdata(L,value); + *(void**)lua_newuserdata(L,sizeof(void *)) = value; /* stack: mt ubox u newud */ + lua_pushvalue(L,-1); /* stack: mt ubox u newud newud */ + lua_insert(L,-4); /* stack: mt newud ubox u newud */ + lua_rawset(L,-3); /* stack: mt newud ubox */ + lua_pop(L,1); /* stack: mt newud */ + /*luaL_getmetatable(L,type);*/ + lua_pushvalue(L, -2); /* stack: mt newud mt */ + lua_setmetatable(L,-2); /* stack: mt newud */ + + #ifdef LUA_VERSION_NUM + lua_pushvalue(L, TOLUA_NOPEER); + lua_setfenv(L, -2); + #endif + } + else + { + /* check the need of updating the metatable to a more specialized class */ + lua_insert(L,-2); /* stack: mt ubox[u] ubox */ + lua_pop(L,1); /* stack: mt ubox[u] */ + lua_pushstring(L,"tolua_super"); + lua_rawget(L,LUA_REGISTRYINDEX); /* stack: mt ubox[u] super */ + lua_getmetatable(L,-2); /* stack: mt ubox[u] super mt */ + lua_rawget(L,-2); /* stack: mt ubox[u] super super[mt] */ + if (lua_istable(L,-1)) + { + lua_pushstring(L,type); /* stack: mt ubox[u] super super[mt] type */ + lua_rawget(L,-2); /* stack: mt ubox[u] super super[mt] flag */ + if (lua_toboolean(L,-1) == 1) /* if true */ + { + lua_pop(L,3); /* mt ubox[u]*/ + lua_remove(L, -2); + return; + } + } + /* type represents a more specilized type */ + /*luaL_getmetatable(L,type); // stack: mt ubox[u] super super[mt] flag mt */ + lua_pushvalue(L, -5); /* stack: mt ubox[u] super super[mt] flag mt */ + lua_setmetatable(L,-5); /* stack: mt ubox[u] super super[mt] flag */ + lua_pop(L,3); /* stack: mt ubox[u] */ + } + lua_remove(L, -2); /* stack: ubox[u]*/ + } +} + +TOLUA_API void tolua_pushusertype_and_takeownership (lua_State* L, void* value, const char* type) +{ + tolua_pushusertype(L,value,type); + tolua_register_gc(L,lua_gettop(L)); +} + +TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v) +{ + lua_pushnumber(L,index); + lua_pushvalue(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v) +{ + lua_pushnumber(L,index); + lua_pushboolean(L,v); + lua_settable(L,lo); +} + + +TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v) +{ + lua_pushnumber(L,index); + tolua_pushnumber(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v) +{ + lua_pushnumber(L,index); + tolua_pushstring(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v) +{ + lua_pushnumber(L,index); + tolua_pushuserdata(L,v); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type) +{ + lua_pushnumber(L,index); + tolua_pushusertype(L,v,type); + lua_settable(L,lo); +} + +TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type) +{ + lua_pushnumber(L,index); + tolua_pushusertype(L,v,type); + tolua_register_gc(L,lua_gettop(L)); + lua_settable(L,lo); +} + diff --git a/lib/tolua++/src/lib/tolua_to.c b/lib/tolua++/src/lib/tolua_to.c new file mode 100644 index 000000000..04132e901 --- /dev/null +++ b/lib/tolua++/src/lib/tolua_to.c @@ -0,0 +1,133 @@ +/* tolua: funcitons to convert to C types +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + +#include "../../include/tolua++.h" + +#include <string.h> +#include <stdlib.h> + +TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def) +{ + return lua_gettop(L)<abs(narg) ? def : lua_tonumber(L,narg); +} + +TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def) +{ + return lua_gettop(L)<abs(narg) ? def : lua_tostring(L,narg); +} + +TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def) +{ + + /* return lua_gettop(L)<abs(narg) ? def : lua_touserdata(L,narg); */ + + if (lua_gettop(L)<abs(narg)) { + return def; + }; + + if (lua_islightuserdata(L, narg)) { + + return lua_touserdata(L,narg); + }; + + return tolua_tousertype(L, narg, def); +} + +extern int push_table_instance(lua_State* L, int lo); + +TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def) +{ + if (lua_gettop(L)<abs(narg)) + return def; + else + { + void* u; + if (!lua_isuserdata(L, narg)) { + if (!push_table_instance(L, narg)) return NULL; + }; + u = lua_touserdata(L,narg); + return (u==NULL) ? NULL : *((void**)u); /* nil represents NULL */ + } +} + +TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def) +{ + return lua_gettop(L)<abs(narg) ? def : narg; +} + +TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def) +{ + return lua_gettop(L)<abs(narg) ? def : lua_toboolean(L,narg); +} + +TOLUA_API lua_Number tolua_tofieldnumber (lua_State* L, int lo, int index, lua_Number def) +{ + double v; + lua_pushnumber(L,index); + lua_gettable(L,lo); + v = lua_isnil(L,-1) ? def : lua_tonumber(L,-1); + lua_pop(L,1); + return v; +} + +TOLUA_API const char* tolua_tofieldstring +(lua_State* L, int lo, int index, const char* def) +{ + const char* v; + lua_pushnumber(L,index); + lua_gettable(L,lo); + v = lua_isnil(L,-1) ? def : lua_tostring(L,-1); + lua_pop(L,1); + return v; +} + +TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def) +{ + void* v; + lua_pushnumber(L,index); + lua_gettable(L,lo); + v = lua_isnil(L,-1) ? def : lua_touserdata(L,-1); + lua_pop(L,1); + return v; +} + +TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def) +{ + void* v; + lua_pushnumber(L,index); + lua_gettable(L,lo); + v = lua_isnil(L,-1) ? def : (*(void **)(lua_touserdata(L, -1))); /* lua_unboxpointer(L,-1); */ + lua_pop(L,1); + return v; +} + +TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def) +{ + int v; + lua_pushnumber(L,index); + lua_gettable(L,lo); + v = lua_isnil(L,-1) ? def : lo; + lua_pop(L,1); + return v; +} + +TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def) +{ + int v; + lua_pushnumber(L,index); + lua_gettable(L,lo); + v = lua_isnil(L,-1) ? 0 : lua_toboolean(L,-1); + lua_pop(L,1); + return v; +} diff --git a/tolua++-1.0.93/win32/tolualib/tolualib.vcproj b/lib/tolua++/win32/tolualib/tolualib.vcproj index 598b2d6fe..598b2d6fe 100644 --- a/tolua++-1.0.93/win32/tolualib/tolualib.vcproj +++ b/lib/tolua++/win32/tolualib/tolualib.vcproj diff --git a/tolua++-1.0.93/win32/tolualib/tolualib.vcproj.LAPTOPF.Kevin.user b/lib/tolua++/win32/tolualib/tolualib.vcproj.LAPTOPF.Kevin.user index eaf548aa5..eaf548aa5 100644 --- a/tolua++-1.0.93/win32/tolualib/tolualib.vcproj.LAPTOPF.Kevin.user +++ b/lib/tolua++/win32/tolualib/tolualib.vcproj.LAPTOPF.Kevin.user diff --git a/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj b/lib/tolua++/win32/tolualib/tolualib.vcxproj index f12bfda86..f12bfda86 100644 --- a/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj +++ b/lib/tolua++/win32/tolualib/tolualib.vcxproj diff --git a/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj.filters b/lib/tolua++/win32/tolualib/tolualib.vcxproj.filters index 99f8ce3b6..99f8ce3b6 100644 --- a/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj.filters +++ b/lib/tolua++/win32/tolualib/tolualib.vcxproj.filters diff --git a/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj.user b/lib/tolua++/win32/tolualib/tolualib.vcxproj.user index 4c1e1937c..4c1e1937c 100644 --- a/tolua++-1.0.93/win32/tolualib/tolualib.vcxproj.user +++ b/lib/tolua++/win32/tolualib/tolualib.vcxproj.user diff --git a/tolua++-1.0.93/win32/vc7/clean.bat b/lib/tolua++/win32/vc7/clean.bat index b8f4f2b2f..b8f4f2b2f 100644 --- a/tolua++-1.0.93/win32/vc7/clean.bat +++ b/lib/tolua++/win32/vc7/clean.bat diff --git a/tolua++-1.0.93/win32/vc7/toluapp.sln b/lib/tolua++/win32/vc7/toluapp.sln index 1ab8be380..1ab8be380 100644 --- a/tolua++-1.0.93/win32/vc7/toluapp.sln +++ b/lib/tolua++/win32/vc7/toluapp.sln diff --git a/tolua++-1.0.93/win32/vc7/toluapp.vcproj b/lib/tolua++/win32/vc7/toluapp.vcproj index 285bd2d42..285bd2d42 100644 --- a/tolua++-1.0.93/win32/vc7/toluapp.vcproj +++ b/lib/tolua++/win32/vc7/toluapp.vcproj diff --git a/tolua++-1.0.93/win32/vc7/toluapp.vcproj.LAPTOPF.Kevin.user b/lib/tolua++/win32/vc7/toluapp.vcproj.LAPTOPF.Kevin.user index a2de0fbb2..a2de0fbb2 100644 --- a/tolua++-1.0.93/win32/vc7/toluapp.vcproj.LAPTOPF.Kevin.user +++ b/lib/tolua++/win32/vc7/toluapp.vcproj.LAPTOPF.Kevin.user diff --git a/tolua++-1.0.93/win32/vc7/toluapp.vcxproj b/lib/tolua++/win32/vc7/toluapp.vcxproj index 45601b36f..45601b36f 100644 --- a/tolua++-1.0.93/win32/vc7/toluapp.vcxproj +++ b/lib/tolua++/win32/vc7/toluapp.vcxproj diff --git a/tolua++-1.0.93/win32/vc7/toluapp.vcxproj.filters b/lib/tolua++/win32/vc7/toluapp.vcxproj.filters index c23b20870..c23b20870 100644 --- a/tolua++-1.0.93/win32/vc7/toluapp.vcxproj.filters +++ b/lib/tolua++/win32/vc7/toluapp.vcxproj.filters diff --git a/tolua++-1.0.93/win32/vc7/toluapp.vcxproj.user b/lib/tolua++/win32/vc7/toluapp.vcxproj.user index 4c1e1937c..4c1e1937c 100644 --- a/tolua++-1.0.93/win32/vc7/toluapp.vcxproj.user +++ b/lib/tolua++/win32/vc7/toluapp.vcxproj.user diff --git a/zlib-1.2.7/adler32.c b/lib/zlib/adler32.c index a868f073d..a868f073d 100644 --- a/zlib-1.2.7/adler32.c +++ b/lib/zlib/adler32.c diff --git a/zlib-1.2.7/compress.c b/lib/zlib/compress.c index ea4dfbe9d..ea4dfbe9d 100644 --- a/zlib-1.2.7/compress.c +++ b/lib/zlib/compress.c diff --git a/zlib-1.2.7/crc32.c b/lib/zlib/crc32.c index 979a7190a..979a7190a 100644 --- a/zlib-1.2.7/crc32.c +++ b/lib/zlib/crc32.c diff --git a/zlib-1.2.7/crc32.h b/lib/zlib/crc32.h index 9e0c77810..9e0c77810 100644 --- a/zlib-1.2.7/crc32.h +++ b/lib/zlib/crc32.h diff --git a/zlib-1.2.7/deflate.c b/lib/zlib/deflate.c index 9e4c2cbc8..9e4c2cbc8 100644 --- a/zlib-1.2.7/deflate.c +++ b/lib/zlib/deflate.c diff --git a/zlib-1.2.7/deflate.h b/lib/zlib/deflate.h index fbac44d90..fbac44d90 100644 --- a/zlib-1.2.7/deflate.h +++ b/lib/zlib/deflate.h diff --git a/zlib-1.2.7/example.c b/lib/zlib/example.c index f515a4853..f515a4853 100644 --- a/zlib-1.2.7/example.c +++ b/lib/zlib/example.c diff --git a/zlib-1.2.7/gzclose.c b/lib/zlib/gzclose.c index caeb99a31..caeb99a31 100644 --- a/zlib-1.2.7/gzclose.c +++ b/lib/zlib/gzclose.c diff --git a/zlib-1.2.7/gzguts.h b/lib/zlib/gzguts.h index ee3f281aa..ee3f281aa 100644 --- a/zlib-1.2.7/gzguts.h +++ b/lib/zlib/gzguts.h diff --git a/zlib-1.2.7/gzlib.c b/lib/zlib/gzlib.c index ca55c6ea9..ca55c6ea9 100644 --- a/zlib-1.2.7/gzlib.c +++ b/lib/zlib/gzlib.c diff --git a/zlib-1.2.7/gzread.c b/lib/zlib/gzread.c index 3493d34d4..3493d34d4 100644 --- a/zlib-1.2.7/gzread.c +++ b/lib/zlib/gzread.c diff --git a/zlib-1.2.7/gzwrite.c b/lib/zlib/gzwrite.c index 27cb3428e..27cb3428e 100644 --- a/zlib-1.2.7/gzwrite.c +++ b/lib/zlib/gzwrite.c diff --git a/zlib-1.2.7/infback.c b/lib/zlib/infback.c index 981aff17c..981aff17c 100644 --- a/zlib-1.2.7/infback.c +++ b/lib/zlib/infback.c diff --git a/zlib-1.2.7/inffast.c b/lib/zlib/inffast.c index 2f1d60b43..2f1d60b43 100644 --- a/zlib-1.2.7/inffast.c +++ b/lib/zlib/inffast.c diff --git a/zlib-1.2.7/inffast.h b/lib/zlib/inffast.h index e5c1aa4ca..e5c1aa4ca 100644 --- a/zlib-1.2.7/inffast.h +++ b/lib/zlib/inffast.h diff --git a/zlib-1.2.7/inffixed.h b/lib/zlib/inffixed.h index d62832776..d62832776 100644 --- a/zlib-1.2.7/inffixed.h +++ b/lib/zlib/inffixed.h diff --git a/zlib-1.2.7/inflate.c b/lib/zlib/inflate.c index 47418a1e1..47418a1e1 100644 --- a/zlib-1.2.7/inflate.c +++ b/lib/zlib/inflate.c diff --git a/zlib-1.2.7/inflate.h b/lib/zlib/inflate.h index 95f4986d4..95f4986d4 100644 --- a/zlib-1.2.7/inflate.h +++ b/lib/zlib/inflate.h diff --git a/zlib-1.2.7/inftrees.c b/lib/zlib/inftrees.c index abcd7c45e..abcd7c45e 100644 --- a/zlib-1.2.7/inftrees.c +++ b/lib/zlib/inftrees.c diff --git a/zlib-1.2.7/inftrees.h b/lib/zlib/inftrees.h index baa53a0b1..baa53a0b1 100644 --- a/zlib-1.2.7/inftrees.h +++ b/lib/zlib/inftrees.h diff --git a/zlib-1.2.7/minigzip.c b/lib/zlib/minigzip.c index aa7ac7a04..aa7ac7a04 100644 --- a/zlib-1.2.7/minigzip.c +++ b/lib/zlib/minigzip.c diff --git a/zlib-1.2.7/trees.c b/lib/zlib/trees.c index 8c32b214b..8c32b214b 100644 --- a/zlib-1.2.7/trees.c +++ b/lib/zlib/trees.c diff --git a/zlib-1.2.7/trees.h b/lib/zlib/trees.h index d35639d82..d35639d82 100644 --- a/zlib-1.2.7/trees.h +++ b/lib/zlib/trees.h diff --git a/zlib-1.2.7/uncompr.c b/lib/zlib/uncompr.c index ad98be3a5..ad98be3a5 100644 --- a/zlib-1.2.7/uncompr.c +++ b/lib/zlib/uncompr.c diff --git a/zlib-1.2.7/zconf.h b/lib/zlib/zconf.h index 8a46a58b3..8a46a58b3 100644 --- a/zlib-1.2.7/zconf.h +++ b/lib/zlib/zconf.h diff --git a/zlib-1.2.7/zlib.h b/lib/zlib/zlib.h index 3edf3acdb..3edf3acdb 100644 --- a/zlib-1.2.7/zlib.h +++ b/lib/zlib/zlib.h diff --git a/zlib-1.2.7/zutil.c b/lib/zlib/zutil.c index 65e0d3b72..65e0d3b72 100644 --- a/zlib-1.2.7/zutil.c +++ b/lib/zlib/zutil.c diff --git a/zlib-1.2.7/zutil.h b/lib/zlib/zutil.h index 4e3dcc6ae..4e3dcc6ae 100644 --- a/zlib-1.2.7/zutil.h +++ b/lib/zlib/zutil.h diff --git a/source/AllToLua.pkg b/source/AllToLua.pkg deleted file mode 100644 index ee594be1a..000000000 --- a/source/AllToLua.pkg +++ /dev/null @@ -1,81 +0,0 @@ - -$#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -$#include "tolua_base.h" - -// Typedefs from Globals.h, so that we don't have to include that file: -typedef long long Int64; -typedef int Int32; -typedef short Int16; - -typedef unsigned long long UInt64; -typedef unsigned int UInt32; -typedef unsigned short UInt16; - - -$cfile "ChunkDef.h" - -$cfile "../iniFile/iniFile.h" - -$cfile "OSSupport/File.h" - -$cfile "BlockID.h" -$cfile "StringUtils.h" -$cfile "Defines.h" -$cfile "LuaFunctions.h" -$cfile "ChatColor.h" -$cfile "ClientHandle.h" -$cfile "Entities/Entity.h" -$cfile "Entities/Pawn.h" -$cfile "Entities/Player.h" -$cfile "Entities/Pickup.h" -$cfile "Entities/ProjectileEntity.h" -$cfile "PluginManager.h" -$cfile "Plugin.h" -$cfile "PluginLua.h" -$cfile "Server.h" -$cfile "World.h" -$cfile "Inventory.h" -$cfile "Enchantments.h" -$cfile "Item.h" -$cfile "ItemGrid.h" -$cfile "BlockEntities/BlockEntity.h" -$cfile "BlockEntities/BlockEntityWithItems.h" -$cfile "BlockEntities/ChestEntity.h" -$cfile "BlockEntities/DropSpenserEntity.h" -$cfile "BlockEntities/DispenserEntity.h" -$cfile "BlockEntities/DropperEntity.h" -$cfile "BlockEntities/FurnaceEntity.h" -$cfile "BlockEntities/HopperEntity.h" -$cfile "BlockEntities/JukeboxEntity.h" -$cfile "BlockEntities/NoteEntity.h" -$cfile "BlockEntities/SignEntity.h" -$cfile "WebAdmin.h" -$cfile "WebPlugin.h" -$cfile "Root.h" -$cfile "Vector3f.h" -$cfile "Vector3d.h" -$cfile "Vector3i.h" -$cfile "Matrix4f.h" -$cfile "Cuboid.h" -$cfile "BoundingBox.h" -$cfile "Tracer.h" -$cfile "Group.h" -$cfile "BlockArea.h" -$cfile "Generating/ChunkDesc.h" -$cfile "CraftingRecipes.h" -$cfile "UI/Window.h" -$cfile "LuaWindow.h" -$cfile "Mobs/Monster.h" - - - - - -// Need to declare this class so that the usertype is properly registered in Bindings.cpp - -// it seems impossible to register a usertype in ManualBindings.cpp -class cLineBlockTracer; - - - - diff --git a/source/Authenticator.cpp b/source/Authenticator.cpp deleted file mode 100644 index 9a6dcf51b..000000000 --- a/source/Authenticator.cpp +++ /dev/null @@ -1,267 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "Authenticator.h" -#include "OSSupport/BlockingTCPLink.h" -#include "Root.h" -#include "Server.h" - -#include "../iniFile/iniFile.h" - -#include <sstream> - - - - - -#define DEFAULT_AUTH_SERVER "session.minecraft.net" -#define DEFAULT_AUTH_ADDRESS "/game/checkserver.jsp?user=%USERNAME%&serverId=%SERVERID%" -#define MAX_REDIRECTS 10 - - - - - -cAuthenticator::cAuthenticator(void) : - super("cAuthenticator"), - m_Server(DEFAULT_AUTH_SERVER), - m_Address(DEFAULT_AUTH_ADDRESS), - m_ShouldAuthenticate(true) -{ -} - - - - - -cAuthenticator::~cAuthenticator() -{ - Stop(); -} - - - - - -/// Read custom values from INI -void cAuthenticator::ReadINI(cIniFile & IniFile) -{ - m_Server = IniFile.GetValueSet("Authentication", "Server", DEFAULT_AUTH_SERVER); - m_Address = IniFile.GetValueSet("Authentication", "Address", DEFAULT_AUTH_ADDRESS); - m_ShouldAuthenticate = IniFile.GetValueSetB("Authentication", "Authenticate", true); -} - - - - - -/// Queues a request for authenticating a user. If the auth fails, the user is kicked -void cAuthenticator::Authenticate(int a_ClientID, const AString & a_UserName, const AString & a_ServerHash) -{ - if (!m_ShouldAuthenticate) - { - cRoot::Get()->AuthenticateUser(a_ClientID); - return; - } - - cCSLock Lock(m_CS); - m_Queue.push_back(cUser(a_ClientID, a_UserName, a_ServerHash)); - m_QueueNonempty.Set(); -} - - - - - -void cAuthenticator::Start(cIniFile & IniFile) -{ - ReadINI(IniFile); - m_ShouldTerminate = false; - super::Start(); -} - - - - - -void cAuthenticator::Stop(void) -{ - m_ShouldTerminate = true; - m_QueueNonempty.Set(); - Wait(); -} - - - - - -void cAuthenticator::Execute(void) -{ - for (;;) - { - cCSLock Lock(m_CS); - while (!m_ShouldTerminate && (m_Queue.size() == 0)) - { - cCSUnlock Unlock(Lock); - m_QueueNonempty.Wait(); - } - if (m_ShouldTerminate) - { - return; - } - ASSERT(!m_Queue.empty()); - - int ClientID = m_Queue.front().m_ClientID; - AString UserName = m_Queue.front().m_Name; - AString ActualAddress = m_Address; - ReplaceString(ActualAddress, "%USERNAME%", UserName); - ReplaceString(ActualAddress, "%SERVERID%", m_Queue.front().m_ServerID); - m_Queue.pop_front(); - Lock.Unlock(); - - if (!AuthFromAddress(m_Server, ActualAddress, UserName)) - { - cRoot::Get()->KickUser(ClientID, "Failed to authenticate account!"); - } - else - { - cRoot::Get()->AuthenticateUser(ClientID); - } - } // for (-ever) -} - - - - - -bool cAuthenticator::AuthFromAddress(const AString & a_Server, const AString & a_Address, const AString & a_UserName, int a_Level /* = 1 */) -{ - // Returns true if the user authenticated okay, false on error; iLevel is the recursion deptht (bails out if too deep) - - cBlockingTCPLink Link; - if (!Link.Connect(a_Server.c_str(), 80)) - { - LOGERROR("cAuthenticator: cannot connect to auth server \"%s\", kicking user \"%s\"", a_Server.c_str(), a_Server.c_str()); - return false; - } - - Link.SendMessage( AString( "GET " + a_Address + " HTTP/1.1\r\n" ).c_str()); - Link.SendMessage( AString( "User-Agent: MCServer\r\n" ).c_str()); - Link.SendMessage( AString( "Host: " + a_Server + "\r\n" ).c_str()); - //Link.SendMessage( AString( "Host: session.minecraft.net\r\n" ).c_str()); - Link.SendMessage( AString( "Accept: */*\r\n" ).c_str()); - Link.SendMessage( AString( "Connection: close\r\n" ).c_str()); //Close so we don´t have to mess with the Content-Length :) - Link.SendMessage( AString( "\r\n" ).c_str()); - AString DataRecvd; - Link.ReceiveData(DataRecvd); - Link.CloseSocket(); - - std::stringstream ss(DataRecvd); - - // Parse the data received: - std::string temp; - ss >> temp; - bool bRedirect = false; - bool bOK = false; - if ((temp.compare("HTTP/1.1") == 0) || (temp.compare("HTTP/1.0") == 0)) - { - int code; - ss >> code; - if (code == 302) - { - // redirect blabla - LOGINFO("Need to redirect!"); - if (a_Level > MAX_REDIRECTS) - { - LOGERROR("cAuthenticator: received too many levels of redirection from auth server \"%s\" for user \"%s\", bailing out and kicking the user", a_Server.c_str(), a_UserName.c_str()); - return false; - } - bRedirect = true; - } - else if (code == 200) - { - LOGD("cAuthenticator: Received status 200 OK! :D"); - bOK = true; - } - } - else - { - LOGERROR("cAuthenticator: cannot parse auth reply from server \"%s\" for user \"%s\", kicking the user.", a_Server.c_str(), a_UserName.c_str()); - return false; - } - - if( bRedirect ) - { - AString Location; - // Search for "Location:" - bool bFoundLocation = false; - while( !bFoundLocation && ss.good() ) - { - char c = 0; - while( c != '\n' ) - { - ss.get( c ); - } - AString Name; - ss >> Name; - if (Name.compare("Location:") == 0) - { - bFoundLocation = true; - ss >> Location; - } - } - if (!bFoundLocation) - { - LOGERROR("cAuthenticator: received invalid redirection from auth server \"%s\" for user \"%s\", kicking user.", a_Server.c_str(), a_UserName.c_str()); - return false; - } - - Location = Location.substr(strlen("http://"), std::string::npos); // Strip http:// - std::string Server = Location.substr( 0, Location.find( "/" ) ); // Only leave server address - Location = Location.substr( Server.length(), std::string::npos); - return AuthFromAddress(Server, Location, a_UserName, a_Level + 1); - } - - if (!bOK) - { - LOGERROR("cAuthenticator: received an error from auth server \"%s\" for user \"%s\", kicking user.", a_Server.c_str(), a_UserName.c_str()); - return false; - } - - // Header says OK, so receive the rest. - // Go past header, double \n means end of headers - char c = 0; - while (ss.good()) - { - while (c != '\n') - { - ss.get(c); - } - ss.get(c); - if( c == '\n' || c == '\r' || ss.peek() == '\r' || ss.peek() == '\n' ) - break; - } - if (!ss.good()) - { - LOGERROR("cAuthenticator: error while parsing response body from auth server \"%s\" for user \"%s\", kicking user.", a_Server.c_str(), a_UserName.c_str()); - return false; - } - - std::string Result; - ss >> Result; - LOGD("cAuthenticator: Authentication result was %s", Result.c_str()); - - if (Result.compare("YES") == 0) //Works well - { - LOGINFO("Authentication result \"YES\", player authentication success!"); - return true; - } - - - LOGINFO("Authentication result was \"%s\", player authentication failure!", Result.c_str()); - return false; -} - - - - diff --git a/source/Bindings.cpp b/source/Bindings.cpp deleted file mode 100644 index 62a16b38b..000000000 --- a/source/Bindings.cpp +++ /dev/null @@ -1,31660 +0,0 @@ -/* -** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/26/13 15:29:19. -*/ - -#ifndef __cplusplus -#include "stdlib.h" -#endif -#include "string.h" - -#include "tolua++.h" - -/* Exported function */ -TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S); - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules -#include "tolua_base.h" -#include "ChunkDef.h" -#include "../iniFile/iniFile.h" -#include "OSSupport/File.h" -#include "BlockID.h" -#include "StringUtils.h" -#include "Defines.h" -#include "LuaFunctions.h" -#include "ChatColor.h" -#include "ClientHandle.h" -#include "Entities/Entity.h" -#include "Entities/Pawn.h" -#include "Entities/Player.h" -#include "Entities/Pickup.h" -#include "Entities/ProjectileEntity.h" -#include "PluginManager.h" -#include "Plugin.h" -#include "PluginLua.h" -#include "Server.h" -#include "World.h" -#include "Inventory.h" -#include "Enchantments.h" -#include "Item.h" -#include "ItemGrid.h" -#include "BlockEntities/BlockEntity.h" -#include "BlockEntities/BlockEntityWithItems.h" -#include "BlockEntities/ChestEntity.h" -#include "BlockEntities/DropSpenserEntity.h" -#include "BlockEntities/DispenserEntity.h" -#include "BlockEntities/DropperEntity.h" -#include "BlockEntities/FurnaceEntity.h" -#include "BlockEntities/HopperEntity.h" -#include "BlockEntities/JukeboxEntity.h" -#include "BlockEntities/NoteEntity.h" -#include "BlockEntities/SignEntity.h" -#include "WebAdmin.h" -#include "WebPlugin.h" -#include "Root.h" -#include "Vector3f.h" -#include "Vector3d.h" -#include "Vector3i.h" -#include "Matrix4f.h" -#include "Cuboid.h" -#include "BoundingBox.h" -#include "Tracer.h" -#include "Group.h" -#include "BlockArea.h" -#include "Generating/ChunkDesc.h" -#include "CraftingRecipes.h" -#include "UI/Window.h" -#include "LuaWindow.h" -#include "Mobs/Monster.h" - -/* function to release collected object via destructor */ -#ifdef __cplusplus - -static int tolua_collect_sWebAdminPage (lua_State* tolua_S) -{ - sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_cBoundingBox (lua_State* tolua_S) -{ - cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_cItem (lua_State* tolua_S) -{ - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_Vector3f (lua_State* tolua_S) -{ - Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_cIniFile (lua_State* tolua_S) -{ - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_cPickup (lua_State* tolua_S) -{ - cPickup* self = (cPickup*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_cItems (lua_State* tolua_S) -{ - cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_cBlockArea (lua_State* tolua_S) -{ - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_cTracer (lua_State* tolua_S) -{ - cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_cCraftingGrid (lua_State* tolua_S) -{ - cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_cCuboid (lua_State* tolua_S) -{ - cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_cBlockEntity (lua_State* tolua_S) -{ - cBlockEntity* self = (cBlockEntity*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_Vector3i (lua_State* tolua_S) -{ - Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_cEnchantments (lua_State* tolua_S) -{ - cEnchantments* self = (cEnchantments*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_cLuaWindow (lua_State* tolua_S) -{ - cLuaWindow* self = (cLuaWindow*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} - -static int tolua_collect_Vector3d (lua_State* tolua_S) -{ - Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); - Mtolua_delete(self); - return 0; -} -#endif - - -/* function to register type */ -static void tolua_reg_types (lua_State* tolua_S) -{ - tolua_usertype(tolua_S,"cThrownEnderPearlEntity"); - tolua_usertype(tolua_S,"cFurnaceEntity"); - tolua_usertype(tolua_S,"cEntity"); - tolua_usertype(tolua_S,"cExpBottleEntity"); - tolua_usertype(tolua_S,"cEnchantments"); - tolua_usertype(tolua_S,"cMonster"); - tolua_usertype(tolua_S,"cPluginLua"); - tolua_usertype(tolua_S,"cRoot"); - tolua_usertype(tolua_S,"std::vector<cIniFile::key>"); - tolua_usertype(tolua_S,"cPickup"); - tolua_usertype(tolua_S,"sWebAdminPage"); - tolua_usertype(tolua_S,"cFireChargeEntity"); - tolua_usertype(tolua_S,"cClientHandle"); - tolua_usertype(tolua_S,"cChunkDesc"); - tolua_usertype(tolua_S,"cPluginManager"); - tolua_usertype(tolua_S,"Vector3f"); - tolua_usertype(tolua_S,"cCraftingRecipes"); - tolua_usertype(tolua_S,"cJukeboxEntity"); - tolua_usertype(tolua_S,"cChestEntity"); - tolua_usertype(tolua_S,"cDispenserEntity"); - tolua_usertype(tolua_S,"cGhastFireballEntity"); - tolua_usertype(tolua_S,"cLineBlockTracer"); - tolua_usertype(tolua_S,"cListeners"); - tolua_usertype(tolua_S,"cThrownSnowballEntity"); - tolua_usertype(tolua_S,"cFireworkEntity"); - tolua_usertype(tolua_S,"TakeDamageInfo"); - tolua_usertype(tolua_S,"cCraftingRecipe"); - tolua_usertype(tolua_S,"cPlugin"); - tolua_usertype(tolua_S,"cItemGrid"); - tolua_usertype(tolua_S,"cHTTPServer::cCallbacks"); - tolua_usertype(tolua_S,"cLuaWindow"); - tolua_usertype(tolua_S,"cServer"); - tolua_usertype(tolua_S,"cHopperEntity"); - tolua_usertype(tolua_S,"std::vector<AString>"); - tolua_usertype(tolua_S,"cBlockEntityWithItems"); - tolua_usertype(tolua_S,"cWindow"); - tolua_usertype(tolua_S,"cCraftingGrid"); - tolua_usertype(tolua_S,"cWorld"); - tolua_usertype(tolua_S,"cBlockArea"); - tolua_usertype(tolua_S,"cItem"); - tolua_usertype(tolua_S,"cGroup"); - tolua_usertype(tolua_S,"cArrowEntity"); - tolua_usertype(tolua_S,"cDropSpenserEntity"); - tolua_usertype(tolua_S,"cTracer"); - tolua_usertype(tolua_S,"cBoundingBox"); - tolua_usertype(tolua_S,"cCuboid"); - tolua_usertype(tolua_S,"cNoteEntity"); - tolua_usertype(tolua_S,"Vector3i"); - tolua_usertype(tolua_S,"cBlockEntity"); - tolua_usertype(tolua_S,"cCriticalSection"); - tolua_usertype(tolua_S,"HTTPTemplateRequest"); - tolua_usertype(tolua_S,"Vector3d"); - tolua_usertype(tolua_S,"cFile"); - tolua_usertype(tolua_S,"cItems"); - tolua_usertype(tolua_S,"cWebPlugin"); - tolua_usertype(tolua_S,"cWebAdmin"); - tolua_usertype(tolua_S,"cChatColor"); - tolua_usertype(tolua_S,"cIniFile"); - tolua_usertype(tolua_S,"HTTPRequest"); - tolua_usertype(tolua_S,"HTTPFormData"); - tolua_usertype(tolua_S,"cPawn"); - tolua_usertype(tolua_S,"cPlayer"); - tolua_usertype(tolua_S,"cGroupManager"); - tolua_usertype(tolua_S,"cSignEntity"); - tolua_usertype(tolua_S,"cItemGrid::cListener"); - tolua_usertype(tolua_S,"cProjectileEntity"); - tolua_usertype(tolua_S,"cDropperEntity"); - tolua_usertype(tolua_S,"cInventory"); - tolua_usertype(tolua_S,"cThrownEggEntity"); -} - -/* method: new of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_new00 -static int tolua_AllToLua_cIniFile_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cIniFile* tolua_ret = (cIniFile*) Mtolua_new((cIniFile)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cIniFile"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_new00_local -static int tolua_AllToLua_cIniFile_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cIniFile* tolua_ret = (cIniFile*) Mtolua_new((cIniFile)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cIniFile"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CaseSensitive of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_CaseSensitive00 -static int tolua_AllToLua_cIniFile_CaseSensitive00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CaseSensitive'", NULL); -#endif - { - self->CaseSensitive(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CaseSensitive'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CaseInsensitive of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_CaseInsensitive00 -static int tolua_AllToLua_cIniFile_CaseInsensitive00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CaseInsensitive'", NULL); -#endif - { - self->CaseInsensitive(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CaseInsensitive'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ReadFile of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_ReadFile00 -static int tolua_AllToLua_cIniFile_ReadFile00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isboolean(tolua_S,3,1,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); - bool a_AllowExampleRedirect = ((bool) tolua_toboolean(tolua_S,3,true)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ReadFile'", NULL); -#endif - { - bool tolua_ret = (bool) self->ReadFile(a_FileName,a_AllowExampleRedirect); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_FileName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ReadFile'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: WriteFile of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_WriteFile00 -static int tolua_AllToLua_cIniFile_WriteFile00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'WriteFile'", NULL); -#endif - { - bool tolua_ret = (bool) self->WriteFile(a_FileName); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_FileName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'WriteFile'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Clear of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_Clear00 -static int tolua_AllToLua_cIniFile_Clear00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); -#endif - { - self->Clear(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FindKey of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_FindKey00 -static int tolua_AllToLua_cIniFile_FindKey00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FindKey'", NULL); -#endif - { - int tolua_ret = (int) self->FindKey(keyname); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'FindKey'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FindValue of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_FindValue00 -static int tolua_AllToLua_cIniFile_FindValue00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FindValue'", NULL); -#endif - { - int tolua_ret = (int) self->FindValue(keyID,valuename); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'FindValue'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNumKeys of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumKeys00 -static int tolua_AllToLua_cIniFile_GetNumKeys00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumKeys'", NULL); -#endif - { - int tolua_ret = (int) self->GetNumKeys(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetNumKeys'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddKeyName of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_AddKeyName00 -static int tolua_AllToLua_cIniFile_AddKeyName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddKeyName'", NULL); -#endif - { - int tolua_ret = (int) self->AddKeyName(keyname); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddKeyName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetKeyName of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetKeyName00 -static int tolua_AllToLua_cIniFile_GetKeyName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetKeyName'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetKeyName(keyID); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetKeyName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNumValues of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumValues00 -static int tolua_AllToLua_cIniFile_GetNumValues00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumValues'", NULL); -#endif - { - int tolua_ret = (int) self->GetNumValues(keyname); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetNumValues'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNumValues of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumValues01 -static int tolua_AllToLua_cIniFile_GetNumValues01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumValues'", NULL); -#endif - { - int tolua_ret = (int) self->GetNumValues(keyID); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cIniFile_GetNumValues00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValueName of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueName00 -static int tolua_AllToLua_cIniFile_GetValueName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueName'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetValueName(keyname,valueID); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetValueName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValueName of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueName01 -static int tolua_AllToLua_cIniFile_GetValueName01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); - const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueName'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetValueName(keyID,valueID); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cIniFile_GetValueName00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValue of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValue00 -static int tolua_AllToLua_cIniFile_GetValue00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValue'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetValue(keyname,valuename); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetValue'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValue of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValue01 -static int tolua_AllToLua_cIniFile_GetValue01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_iscppstring(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const AString defValue = ((const AString) tolua_tocppstring(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValue'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetValue(keyname,valuename,defValue); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - tolua_pushcppstring(tolua_S,(const char*)defValue); - } - } - return 4; -tolua_lerror: - return tolua_AllToLua_cIniFile_GetValue00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValue of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValue02 -static int tolua_AllToLua_cIniFile_GetValue02(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); - const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValue'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetValue(keyID,valueID); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cIniFile_GetValue01(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValue of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValue03 -static int tolua_AllToLua_cIniFile_GetValue03(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_iscppstring(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); - const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); - const AString defValue = ((const AString) tolua_tocppstring(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValue'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetValue(keyID,valueID,defValue); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)defValue); - } - } - return 2; -tolua_lerror: - return tolua_AllToLua_cIniFile_GetValue02(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValueF of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueF00 -static int tolua_AllToLua_cIniFile_GetValueF00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,1,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const double defValue = ((const double) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueF'", NULL); -#endif - { - double tolua_ret = (double) self->GetValueF(keyname,valuename,defValue); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetValueF'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValueI of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueI00 -static int tolua_AllToLua_cIniFile_GetValueI00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,1,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const int defValue = ((const int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueI'", NULL); -#endif - { - int tolua_ret = (int) self->GetValueI(keyname,valuename,defValue); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetValueI'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValueB of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueB00 -static int tolua_AllToLua_cIniFile_GetValueB00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isboolean(tolua_S,4,1,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const bool defValue = ((const bool) tolua_toboolean(tolua_S,4,false)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueB'", NULL); -#endif - { - bool tolua_ret = (bool) self->GetValueB(keyname,valuename,defValue); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetValueB'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValueSet of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueSet00 -static int tolua_AllToLua_cIniFile_GetValueSet00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueSet'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetValueSet(keyname,valuename); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetValueSet'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValueSet of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueSet01 -static int tolua_AllToLua_cIniFile_GetValueSet01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_iscppstring(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const AString defValue = ((const AString) tolua_tocppstring(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueSet'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetValueSet(keyname,valuename,defValue); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - tolua_pushcppstring(tolua_S,(const char*)defValue); - } - } - return 4; -tolua_lerror: - return tolua_AllToLua_cIniFile_GetValueSet00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValueSetF of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueSetF00 -static int tolua_AllToLua_cIniFile_GetValueSetF00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,1,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const double defValue = ((const double) tolua_tonumber(tolua_S,4,0.0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueSetF'", NULL); -#endif - { - double tolua_ret = (double) self->GetValueSetF(keyname,valuename,defValue); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetValueSetF'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValueSetI of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueSetI00 -static int tolua_AllToLua_cIniFile_GetValueSetI00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,1,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const int defValue = ((const int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueSetI'", NULL); -#endif - { - int tolua_ret = (int) self->GetValueSetI(keyname,valuename,defValue); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetValueSetI'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetValueSetB of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueSetB00 -static int tolua_AllToLua_cIniFile_GetValueSetB00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isboolean(tolua_S,4,1,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const bool defValue = ((const bool) tolua_toboolean(tolua_S,4,false)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueSetB'", NULL); -#endif - { - bool tolua_ret = (bool) self->GetValueSetB(keyname,valuename,defValue); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetValueSetB'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetValue of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_SetValue00 -static int tolua_AllToLua_cIniFile_SetValue00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_iscppstring(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); - const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); - const AString value = ((const AString) tolua_tocppstring(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValue'", NULL); -#endif - { - bool tolua_ret = (bool) self->SetValue(keyID,valueID,value); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)value); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetValue'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetValue of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_SetValue01 -static int tolua_AllToLua_cIniFile_SetValue01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_iscppstring(tolua_S,4,0,&tolua_err) || - !tolua_isboolean(tolua_S,5,1,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const AString value = ((const AString) tolua_tocppstring(tolua_S,4,0)); - const bool create = ((const bool) tolua_toboolean(tolua_S,5,true)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValue'", NULL); -#endif - { - bool tolua_ret = (bool) self->SetValue(keyname,valuename,value,create); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - tolua_pushcppstring(tolua_S,(const char*)value); - } - } - return 4; -tolua_lerror: - return tolua_AllToLua_cIniFile_SetValue00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetValueI of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_SetValueI00 -static int tolua_AllToLua_cIniFile_SetValueI00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isboolean(tolua_S,5,1,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const int value = ((const int) tolua_tonumber(tolua_S,4,0)); - const bool create = ((const bool) tolua_toboolean(tolua_S,5,true)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValueI'", NULL); -#endif - { - bool tolua_ret = (bool) self->SetValueI(keyname,valuename,value,create); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetValueI'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetValueB of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_SetValueB00 -static int tolua_AllToLua_cIniFile_SetValueB00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isboolean(tolua_S,4,0,&tolua_err) || - !tolua_isboolean(tolua_S,5,1,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const bool value = ((const bool) tolua_toboolean(tolua_S,4,0)); - const bool create = ((const bool) tolua_toboolean(tolua_S,5,true)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValueB'", NULL); -#endif - { - bool tolua_ret = (bool) self->SetValueB(keyname,valuename,value,create); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetValueB'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetValueF of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_SetValueF00 -static int tolua_AllToLua_cIniFile_SetValueF00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isboolean(tolua_S,5,1,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const double value = ((const double) tolua_tonumber(tolua_S,4,0)); - const bool create = ((const bool) tolua_toboolean(tolua_S,5,true)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValueF'", NULL); -#endif - { - bool tolua_ret = (bool) self->SetValueF(keyname,valuename,value,create); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetValueF'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DeleteValueByID of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteValueByID00 -static int tolua_AllToLua_cIniFile_DeleteValueByID00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); - const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteValueByID'", NULL); -#endif - { - bool tolua_ret = (bool) self->DeleteValueByID(keyID,valueID); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DeleteValueByID'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DeleteValue of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteValue00 -static int tolua_AllToLua_cIniFile_DeleteValue00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteValue'", NULL); -#endif - { - bool tolua_ret = (bool) self->DeleteValue(keyname,valuename); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)valuename); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DeleteValue'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DeleteKey of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteKey00 -static int tolua_AllToLua_cIniFile_DeleteKey00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKey'", NULL); -#endif - { - bool tolua_ret = (bool) self->DeleteKey(keyname); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DeleteKey'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNumHeaderComments of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumHeaderComments00 -static int tolua_AllToLua_cIniFile_GetNumHeaderComments00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumHeaderComments'", NULL); -#endif - { - int tolua_ret = (int) self->GetNumHeaderComments(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetNumHeaderComments'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddHeaderComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_AddHeaderComment00 -static int tolua_AllToLua_cIniFile_AddHeaderComment00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString comment = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddHeaderComment'", NULL); -#endif - { - self->AddHeaderComment(comment); - tolua_pushcppstring(tolua_S,(const char*)comment); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddHeaderComment'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetHeaderComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetHeaderComment00 -static int tolua_AllToLua_cIniFile_GetHeaderComment00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const int commentID = ((const int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeaderComment'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetHeaderComment(commentID); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetHeaderComment'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DeleteHeaderComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteHeaderComment00 -static int tolua_AllToLua_cIniFile_DeleteHeaderComment00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - int commentID = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteHeaderComment'", NULL); -#endif - { - bool tolua_ret = (bool) self->DeleteHeaderComment(commentID); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DeleteHeaderComment'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DeleteHeaderComments of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteHeaderComments00 -static int tolua_AllToLua_cIniFile_DeleteHeaderComments00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteHeaderComments'", NULL); -#endif - { - self->DeleteHeaderComments(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DeleteHeaderComments'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNumKeyComments of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumKeyComments00 -static int tolua_AllToLua_cIniFile_GetNumKeyComments00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumKeyComments'", NULL); -#endif - { - int tolua_ret = (int) self->GetNumKeyComments(keyID); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetNumKeyComments'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNumKeyComments of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumKeyComments01 -static int tolua_AllToLua_cIniFile_GetNumKeyComments01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumKeyComments'", NULL); -#endif - { - int tolua_ret = (int) self->GetNumKeyComments(keyname); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - } - } - return 2; -tolua_lerror: - return tolua_AllToLua_cIniFile_GetNumKeyComments00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddKeyComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_AddKeyComment00 -static int tolua_AllToLua_cIniFile_AddKeyComment00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); - const AString comment = ((const AString) tolua_tocppstring(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddKeyComment'", NULL); -#endif - { - bool tolua_ret = (bool) self->AddKeyComment(keyID,comment); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)comment); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddKeyComment'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddKeyComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_AddKeyComment01 -static int tolua_AllToLua_cIniFile_AddKeyComment01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString comment = ((const AString) tolua_tocppstring(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddKeyComment'", NULL); -#endif - { - bool tolua_ret = (bool) self->AddKeyComment(keyname,comment); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - tolua_pushcppstring(tolua_S,(const char*)comment); - } - } - return 3; -tolua_lerror: - return tolua_AllToLua_cIniFile_AddKeyComment00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetKeyComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetKeyComment00 -static int tolua_AllToLua_cIniFile_GetKeyComment00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); - const int commentID = ((const int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetKeyComment'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetKeyComment(keyID,commentID); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetKeyComment'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetKeyComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetKeyComment01 -static int tolua_AllToLua_cIniFile_GetKeyComment01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const int commentID = ((const int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetKeyComment'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetKeyComment(keyname,commentID); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - } - } - return 2; -tolua_lerror: - return tolua_AllToLua_cIniFile_GetKeyComment00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DeleteKeyComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteKeyComment00 -static int tolua_AllToLua_cIniFile_DeleteKeyComment00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); - const int commentID = ((const int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKeyComment'", NULL); -#endif - { - bool tolua_ret = (bool) self->DeleteKeyComment(keyID,commentID); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DeleteKeyComment'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DeleteKeyComment of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteKeyComment01 -static int tolua_AllToLua_cIniFile_DeleteKeyComment01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const int commentID = ((const int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKeyComment'", NULL); -#endif - { - bool tolua_ret = (bool) self->DeleteKeyComment(keyname,commentID); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - } - } - return 2; -tolua_lerror: - return tolua_AllToLua_cIniFile_DeleteKeyComment00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DeleteKeyComments of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteKeyComments00 -static int tolua_AllToLua_cIniFile_DeleteKeyComments00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKeyComments'", NULL); -#endif - { - bool tolua_ret = (bool) self->DeleteKeyComments(keyID); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DeleteKeyComments'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DeleteKeyComments of class cIniFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteKeyComments01 -static int tolua_AllToLua_cIniFile_DeleteKeyComments01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); - const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKeyComments'", NULL); -#endif - { - bool tolua_ret = (bool) self->DeleteKeyComments(keyname); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)keyname); - } - } - return 2; -tolua_lerror: - return tolua_AllToLua_cIniFile_DeleteKeyComments00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Exists of class cFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_Exists00 -static int tolua_AllToLua_cFile_Exists00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - bool tolua_ret = (bool) cFile::Exists(a_FileName); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_FileName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Exists'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Delete of class cFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_Delete00 -static int tolua_AllToLua_cFile_Delete00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - bool tolua_ret = (bool) cFile::Delete(a_FileName); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_FileName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Delete'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Rename of class cFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_Rename00 -static int tolua_AllToLua_cFile_Rename00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_OrigPath = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString a_NewPath = ((const AString) tolua_tocppstring(tolua_S,3,0)); - { - bool tolua_ret = (bool) cFile::Rename(a_OrigPath,a_NewPath); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_OrigPath); - tolua_pushcppstring(tolua_S,(const char*)a_NewPath); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Rename'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Copy of class cFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_Copy00 -static int tolua_AllToLua_cFile_Copy00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_SrcFileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString a_DstFileName = ((const AString) tolua_tocppstring(tolua_S,3,0)); - { - bool tolua_ret = (bool) cFile::Copy(a_SrcFileName,a_DstFileName); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_SrcFileName); - tolua_pushcppstring(tolua_S,(const char*)a_DstFileName); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Copy'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsFolder of class cFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_IsFolder00 -static int tolua_AllToLua_cFile_IsFolder00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_Path = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - bool tolua_ret = (bool) cFile::IsFolder(a_Path); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Path); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsFolder'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsFile of class cFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_IsFile00 -static int tolua_AllToLua_cFile_IsFile00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_Path = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - bool tolua_ret = (bool) cFile::IsFile(a_Path); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Path); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsFile'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSize of class cFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_GetSize00 -static int tolua_AllToLua_cFile_GetSize00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - int tolua_ret = (int) cFile::GetSize(a_FileName); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_FileName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSize'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CreateFolder of class cFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_CreateFolder00 -static int tolua_AllToLua_cFile_CreateFolder00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_FolderPath = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - bool tolua_ret = (bool) cFile::CreateFolder(a_FolderPath); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_FolderPath); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CreateFolder'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ReadWholeFile of class cFile */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_ReadWholeFile00 -static int tolua_AllToLua_cFile_ReadWholeFile00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - AString tolua_ret = (AString) cFile::ReadWholeFile(a_FileName); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_FileName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ReadWholeFile'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: BlockStringToType */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_BlockStringToType00 -static int tolua_AllToLua_BlockStringToType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_iscppstring(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_BlockTypeString = ((const AString) tolua_tocppstring(tolua_S,1,0)); - { - unsigned char tolua_ret = ( unsigned char) BlockStringToType(a_BlockTypeString); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_BlockTypeString); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'BlockStringToType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: StringToItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_StringToItem00 -static int tolua_AllToLua_StringToItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_iscppstring(tolua_S,1,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_ItemTypeString = ((const AString) tolua_tocppstring(tolua_S,1,0)); - cItem* a_Item = ((cItem*) tolua_tousertype(tolua_S,2,0)); - { - bool tolua_ret = (bool) StringToItem(a_ItemTypeString,*a_Item); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_ItemTypeString); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'StringToItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemToString */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemToString00 -static int tolua_AllToLua_ItemToString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - (tolua_isvaluenil(tolua_S,1,&tolua_err) || !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,1,0)); - { - AString tolua_ret = (AString) ItemToString(*a_Item); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ItemToString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemTypeToString */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemTypeToString00 -static int tolua_AllToLua_ItemTypeToString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short a_ItemType = ((short) tolua_tonumber(tolua_S,1,0)); - { - AString tolua_ret = (AString) ItemTypeToString(a_ItemType); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ItemTypeToString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemToFullString */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemToFullString00 -static int tolua_AllToLua_ItemToFullString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - (tolua_isvaluenil(tolua_S,1,&tolua_err) || !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,1,0)); - { - AString tolua_ret = (AString) ItemToFullString(*a_Item); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ItemToFullString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: StringToBiome */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_StringToBiome00 -static int tolua_AllToLua_StringToBiome00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_iscppstring(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_BiomeString = ((const AString) tolua_tocppstring(tolua_S,1,0)); - { - EMCSBiome tolua_ret = (EMCSBiome) StringToBiome(a_BiomeString); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_BiomeString); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'StringToBiome'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: StringToMobType */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_StringToMobType00 -static int tolua_AllToLua_StringToMobType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_iscppstring(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_MobString = ((const AString) tolua_tocppstring(tolua_S,1,0)); - { - int tolua_ret = (int) StringToMobType(a_MobString); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_MobString); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'StringToMobType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: StringToDimension */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_StringToDimension00 -static int tolua_AllToLua_StringToDimension00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_iscppstring(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_DimensionString = ((const AString) tolua_tocppstring(tolua_S,1,0)); - { - eDimension tolua_ret = (eDimension) StringToDimension(a_DimensionString); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_DimensionString); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'StringToDimension'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: DamageTypeToString */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_DamageTypeToString00 -static int tolua_AllToLua_DamageTypeToString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - eDamageType a_DamageType = ((eDamageType) (int) tolua_tonumber(tolua_S,1,0)); - { - AString tolua_ret = (AString) DamageTypeToString(a_DamageType); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DamageTypeToString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: StringToDamageType */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_StringToDamageType00 -static int tolua_AllToLua_StringToDamageType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_iscppstring(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_DamageString = ((const AString) tolua_tocppstring(tolua_S,1,0)); - { - eDamageType tolua_ret = (eDamageType) StringToDamageType(a_DamageString); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_DamageString); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'StringToDamageType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: GetIniItemSet */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_GetIniItemSet00 -static int tolua_AllToLua_GetIniItemSet00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - (tolua_isvaluenil(tolua_S,1,&tolua_err) || !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err)) || - !tolua_isstring(tolua_S,2,0,&tolua_err) || - !tolua_isstring(tolua_S,3,0,&tolua_err) || - !tolua_isstring(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cIniFile* a_IniFile = ((cIniFile*) tolua_tousertype(tolua_S,1,0)); - const char* a_Section = ((const char*) tolua_tostring(tolua_S,2,0)); - const char* a_Key = ((const char*) tolua_tostring(tolua_S,3,0)); - const char* a_Default = ((const char*) tolua_tostring(tolua_S,4,0)); - { - cItem tolua_ret = (cItem) GetIniItemSet(*a_IniFile,a_Section,a_Key,a_Default); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetIniItemSet'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: TrimString */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_TrimString00 -static int tolua_AllToLua_TrimString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_iscppstring(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString str = ((const AString) tolua_tocppstring(tolua_S,1,0)); - { - AString tolua_ret = (AString) TrimString(str); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)str); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'TrimString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: NoCaseCompare */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_NoCaseCompare00 -static int tolua_AllToLua_NoCaseCompare00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_iscppstring(tolua_S,1,0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString s1 = ((const AString) tolua_tocppstring(tolua_S,1,0)); - const AString s2 = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - int tolua_ret = (int) NoCaseCompare(s1,s2); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)s1); - tolua_pushcppstring(tolua_S,(const char*)s2); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'NoCaseCompare'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ReplaceString */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ReplaceString00 -static int tolua_AllToLua_ReplaceString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_iscppstring(tolua_S,1,0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - AString iHayStack = ((AString) tolua_tocppstring(tolua_S,1,0)); - const AString iNeedle = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString iReplaceWith = ((const AString) tolua_tocppstring(tolua_S,3,0)); - { - ReplaceString(iHayStack,iNeedle,iReplaceWith); - tolua_pushcppstring(tolua_S,(const char*)iHayStack); - tolua_pushcppstring(tolua_S,(const char*)iNeedle); - tolua_pushcppstring(tolua_S,(const char*)iReplaceWith); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ReplaceString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: EscapeString */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_EscapeString00 -static int tolua_AllToLua_EscapeString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_iscppstring(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,1,0)); - { - AString tolua_ret = (AString) EscapeString(a_Message); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Message); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'EscapeString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: StripColorCodes */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_StripColorCodes00 -static int tolua_AllToLua_StripColorCodes00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_iscppstring(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,1,0)); - { - AString tolua_ret = (AString) StripColorCodes(a_Message); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Message); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'StripColorCodes'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: g_BlockLightValue */ -#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockLightValue -static int tolua_get_AllToLua_g_BlockLightValue(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)g_BlockLightValue[tolua_index]); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: g_BlockLightValue */ -#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockLightValue -static int tolua_set_AllToLua_g_BlockLightValue(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - g_BlockLightValue[tolua_index] = ((unsigned char) tolua_tonumber(tolua_S,3,0)); - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: g_BlockSpreadLightFalloff */ -#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockSpreadLightFalloff -static int tolua_get_AllToLua_g_BlockSpreadLightFalloff(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)g_BlockSpreadLightFalloff[tolua_index]); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: g_BlockSpreadLightFalloff */ -#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockSpreadLightFalloff -static int tolua_set_AllToLua_g_BlockSpreadLightFalloff(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - g_BlockSpreadLightFalloff[tolua_index] = ((unsigned char) tolua_tonumber(tolua_S,3,0)); - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: g_BlockTransparent */ -#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockTransparent -static int tolua_get_AllToLua_g_BlockTransparent(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - tolua_pushboolean(tolua_S,(bool)g_BlockTransparent[tolua_index]); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: g_BlockTransparent */ -#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockTransparent -static int tolua_set_AllToLua_g_BlockTransparent(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - g_BlockTransparent[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: g_BlockOneHitDig */ -#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockOneHitDig -static int tolua_get_AllToLua_g_BlockOneHitDig(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - tolua_pushboolean(tolua_S,(bool)g_BlockOneHitDig[tolua_index]); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: g_BlockOneHitDig */ -#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockOneHitDig -static int tolua_set_AllToLua_g_BlockOneHitDig(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - g_BlockOneHitDig[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: g_BlockPistonBreakable */ -#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockPistonBreakable -static int tolua_get_AllToLua_g_BlockPistonBreakable(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0 || tolua_index>=256) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - tolua_pushboolean(tolua_S,(bool)g_BlockPistonBreakable[tolua_index]); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: g_BlockPistonBreakable */ -#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockPistonBreakable -static int tolua_set_AllToLua_g_BlockPistonBreakable(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0 || tolua_index>=256) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - g_BlockPistonBreakable[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: g_BlockIsSnowable */ -#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockIsSnowable -static int tolua_get_AllToLua_g_BlockIsSnowable(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0 || tolua_index>=256) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - tolua_pushboolean(tolua_S,(bool)g_BlockIsSnowable[tolua_index]); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: g_BlockIsSnowable */ -#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockIsSnowable -static int tolua_set_AllToLua_g_BlockIsSnowable(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0 || tolua_index>=256) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - g_BlockIsSnowable[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: g_BlockRequiresSpecialTool */ -#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockRequiresSpecialTool -static int tolua_get_AllToLua_g_BlockRequiresSpecialTool(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0 || tolua_index>=256) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - tolua_pushboolean(tolua_S,(bool)g_BlockRequiresSpecialTool[tolua_index]); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: g_BlockRequiresSpecialTool */ -#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockRequiresSpecialTool -static int tolua_set_AllToLua_g_BlockRequiresSpecialTool(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0 || tolua_index>=256) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - g_BlockRequiresSpecialTool[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: g_BlockIsSolid */ -#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockIsSolid -static int tolua_get_AllToLua_g_BlockIsSolid(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0 || tolua_index>=256) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - tolua_pushboolean(tolua_S,(bool)g_BlockIsSolid[tolua_index]); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: g_BlockIsSolid */ -#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockIsSolid -static int tolua_set_AllToLua_g_BlockIsSolid(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0 || tolua_index>=256) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - g_BlockIsSolid[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: g_BlockIsTorchPlaceable */ -#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockIsTorchPlaceable -static int tolua_get_AllToLua_g_BlockIsTorchPlaceable(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0 || tolua_index>=256) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - tolua_pushboolean(tolua_S,(bool)g_BlockIsTorchPlaceable[tolua_index]); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: g_BlockIsTorchPlaceable */ -#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockIsTorchPlaceable -static int tolua_set_AllToLua_g_BlockIsTorchPlaceable(lua_State* tolua_S) -{ - int tolua_index; -#ifndef TOLUA_RELEASE - { - tolua_Error tolua_err; - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); - } -#endif - tolua_index = (int)tolua_tonumber(tolua_S,2,0); -#ifndef TOLUA_RELEASE - if (tolua_index<0 || tolua_index>=256) - tolua_error(tolua_S,"array indexing out of range.",NULL); -#endif - g_BlockIsTorchPlaceable[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ClickActionToString */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ClickActionToString00 -static int tolua_AllToLua_ClickActionToString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - eClickAction a_ClickAction = ((eClickAction) (int) tolua_tonumber(tolua_S,1,0)); - { - const char* tolua_ret = (const char*) ClickActionToString(a_ClickAction); - tolua_pushstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ClickActionToString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: IsValidBlock */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_IsValidBlock00 -static int tolua_AllToLua_IsValidBlock00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - int a_BlockType = ((int) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) IsValidBlock(a_BlockType); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsValidBlock'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: IsValidItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_IsValidItem00 -static int tolua_AllToLua_IsValidItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - int a_ItemType = ((int) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) IsValidItem(a_ItemType); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsValidItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: AddFaceDirection */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_AddFaceDirection00 -static int tolua_AllToLua_AddFaceDirection00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isboolean(tolua_S,5,1,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - int a_BlockX = ((int) tolua_tonumber(tolua_S,1,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,3,0)); - char a_BlockFace = ((char) tolua_tonumber(tolua_S,4,0)); - bool a_bInverse = ((bool) tolua_toboolean(tolua_S,5,false)); - { - AddFaceDirection(a_BlockX,a_BlockY,a_BlockZ,a_BlockFace,a_bInverse); - tolua_pushnumber(tolua_S,(lua_Number)a_BlockX); - tolua_pushnumber(tolua_S,(lua_Number)a_BlockY); - tolua_pushnumber(tolua_S,(lua_Number)a_BlockZ); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddFaceDirection'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemCategory::IsPickaxe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsPickaxe00 -static int tolua_AllToLua_ItemCategory_IsPickaxe00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short a_ItemID = ((short) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) ItemCategory::IsPickaxe(a_ItemID); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsPickaxe'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemCategory::IsAxe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsAxe00 -static int tolua_AllToLua_ItemCategory_IsAxe00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short a_ItemID = ((short) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) ItemCategory::IsAxe(a_ItemID); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsAxe'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemCategory::IsSword */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsSword00 -static int tolua_AllToLua_ItemCategory_IsSword00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short a_ItemID = ((short) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) ItemCategory::IsSword(a_ItemID); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsSword'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemCategory::IsHoe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsHoe00 -static int tolua_AllToLua_ItemCategory_IsHoe00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short a_ItemID = ((short) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) ItemCategory::IsHoe(a_ItemID); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsHoe'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemCategory::IsShovel */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsShovel00 -static int tolua_AllToLua_ItemCategory_IsShovel00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short a_ItemID = ((short) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) ItemCategory::IsShovel(a_ItemID); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsShovel'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemCategory::IsTool */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsTool00 -static int tolua_AllToLua_ItemCategory_IsTool00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short a_ItemID = ((short) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) ItemCategory::IsTool(a_ItemID); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsTool'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemCategory::IsHelmet */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsHelmet00 -static int tolua_AllToLua_ItemCategory_IsHelmet00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short a_ItemType = ((short) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) ItemCategory::IsHelmet(a_ItemType); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsHelmet'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemCategory::IsChestPlate */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsChestPlate00 -static int tolua_AllToLua_ItemCategory_IsChestPlate00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short a_ItemType = ((short) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) ItemCategory::IsChestPlate(a_ItemType); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsChestPlate'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemCategory::IsLeggings */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsLeggings00 -static int tolua_AllToLua_ItemCategory_IsLeggings00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short a_ItemType = ((short) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) ItemCategory::IsLeggings(a_ItemType); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsLeggings'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemCategory::IsBoots */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsBoots00 -static int tolua_AllToLua_ItemCategory_IsBoots00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short a_ItemType = ((short) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) ItemCategory::IsBoots(a_ItemType); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsBoots'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: ItemCategory::IsArmor */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsArmor00 -static int tolua_AllToLua_ItemCategory_IsArmor00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnumber(tolua_S,1,0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short a_ItemType = ((short) tolua_tonumber(tolua_S,1,0)); - { - bool tolua_ret = (bool) ItemCategory::IsArmor(a_ItemType); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsArmor'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: GetTime */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_GetTime00 -static int tolua_AllToLua_GetTime00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isnoobj(tolua_S,1,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - unsigned int tolua_ret = (unsigned int) GetTime(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetTime'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* function: GetChar */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_GetChar00 -static int tolua_AllToLua_GetChar00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_iscppstring(tolua_S,1,0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - std::string a_Str = ((std::string) tolua_tocppstring(tolua_S,1,0)); - unsigned int a_Idx = ((unsigned int) tolua_tonumber(tolua_S,2,0)); - { - std::string tolua_ret = (std::string) GetChar(a_Str,a_Idx); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Str); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetChar'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Color of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Color -static int tolua_get_cChatColor_Color(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Color); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Delimiter of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Delimiter -static int tolua_get_cChatColor_Delimiter(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Delimiter); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Black of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Black -static int tolua_get_cChatColor_Black(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Black); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Navy of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Navy -static int tolua_get_cChatColor_Navy(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Navy); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Green of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Green -static int tolua_get_cChatColor_Green(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Green); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Blue of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Blue -static int tolua_get_cChatColor_Blue(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Blue); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Red of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Red -static int tolua_get_cChatColor_Red(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Red); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Purple of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Purple -static int tolua_get_cChatColor_Purple(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Purple); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Gold of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Gold -static int tolua_get_cChatColor_Gold(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Gold); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: LightGray of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_LightGray -static int tolua_get_cChatColor_LightGray(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::LightGray); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Gray of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Gray -static int tolua_get_cChatColor_Gray(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Gray); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: DarkPurple of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_DarkPurple -static int tolua_get_cChatColor_DarkPurple(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::DarkPurple); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: LightGreen of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_LightGreen -static int tolua_get_cChatColor_LightGreen(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::LightGreen); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: LightBlue of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_LightBlue -static int tolua_get_cChatColor_LightBlue(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::LightBlue); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Rose of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Rose -static int tolua_get_cChatColor_Rose(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Rose); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: LightPurple of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_LightPurple -static int tolua_get_cChatColor_LightPurple(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::LightPurple); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Yellow of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Yellow -static int tolua_get_cChatColor_Yellow(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Yellow); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: White of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_White -static int tolua_get_cChatColor_White(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::White); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Random of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Random -static int tolua_get_cChatColor_Random(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Random); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Bold of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Bold -static int tolua_get_cChatColor_Bold(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Bold); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Strikethrough of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Strikethrough -static int tolua_get_cChatColor_Strikethrough(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Strikethrough); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Underlined of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Underlined -static int tolua_get_cChatColor_Underlined(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Underlined); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Italic of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Italic -static int tolua_get_cChatColor_Italic(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Italic); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Plain of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Plain -static int tolua_get_cChatColor_Plain(lua_State* tolua_S) -{ - tolua_pushcppstring(tolua_S,(const char*)cChatColor::Plain); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* method: MakeColor of class cChatColor */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChatColor_MakeColor00 -static int tolua_AllToLua_cChatColor_MakeColor00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cChatColor",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - char a_Color = ((char) tolua_tonumber(tolua_S,2,0)); - { - const std::string tolua_ret = (const std::string) cChatColor::MakeColor(a_Color); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'MakeColor'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPlayer of class cClientHandle */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_GetPlayer00 -static int tolua_AllToLua_cClientHandle_GetPlayer00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cClientHandle",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cClientHandle* self = (cClientHandle*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPlayer'", NULL); -#endif - { - cPlayer* tolua_ret = (cPlayer*) self->GetPlayer(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPlayer"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPlayer'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Kick of class cClientHandle */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_Kick00 -static int tolua_AllToLua_cClientHandle_Kick00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cClientHandle",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cClientHandle* self = (cClientHandle*) tolua_tousertype(tolua_S,1,0); - const AString a_Reason = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Kick'", NULL); -#endif - { - self->Kick(a_Reason); - tolua_pushcppstring(tolua_S,(const char*)a_Reason); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Kick'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SendBlockChange of class cClientHandle */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_SendBlockChange00 -static int tolua_AllToLua_cClientHandle_SendBlockChange00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cClientHandle",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cClientHandle* self = (cClientHandle*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SendBlockChange'", NULL); -#endif - { - self->SendBlockChange(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SendBlockChange'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetUsername of class cClientHandle */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_GetUsername00 -static int tolua_AllToLua_cClientHandle_GetUsername00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cClientHandle",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cClientHandle* self = (const cClientHandle*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetUsername'", NULL); -#endif - { - const AString tolua_ret = (const AString) self->GetUsername(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetUsername'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetUsername of class cClientHandle */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_SetUsername00 -static int tolua_AllToLua_cClientHandle_SetUsername00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cClientHandle",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cClientHandle* self = (cClientHandle*) tolua_tousertype(tolua_S,1,0); - const AString a_Username = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUsername'", NULL); -#endif - { - self->SetUsername(a_Username); - tolua_pushcppstring(tolua_S,(const char*)a_Username); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetUsername'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPing of class cClientHandle */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_GetPing00 -static int tolua_AllToLua_cClientHandle_GetPing00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cClientHandle",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cClientHandle* self = (const cClientHandle*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPing'", NULL); -#endif - { - short tolua_ret = (short) self->GetPing(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPing'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetViewDistance of class cClientHandle */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_SetViewDistance00 -static int tolua_AllToLua_cClientHandle_SetViewDistance00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cClientHandle",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cClientHandle* self = (cClientHandle*) tolua_tousertype(tolua_S,1,0); - int a_ViewDistance = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetViewDistance'", NULL); -#endif - { - self->SetViewDistance(a_ViewDistance); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetViewDistance'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetViewDistance of class cClientHandle */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_GetViewDistance00 -static int tolua_AllToLua_cClientHandle_GetViewDistance00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cClientHandle",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cClientHandle* self = (const cClientHandle*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetViewDistance'", NULL); -#endif - { - int tolua_ret = (int) self->GetViewDistance(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetViewDistance'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetUniqueID of class cClientHandle */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_GetUniqueID00 -static int tolua_AllToLua_cClientHandle_GetUniqueID00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cClientHandle",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cClientHandle* self = (const cClientHandle*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetUniqueID'", NULL); -#endif - { - int tolua_ret = (int) self->GetUniqueID(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetUniqueID'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: DamageType of class TakeDamageInfo */ -#ifndef TOLUA_DISABLE_tolua_get_TakeDamageInfo_DamageType -static int tolua_get_TakeDamageInfo_DamageType(lua_State* tolua_S) -{ - TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'DamageType'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->DamageType); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: DamageType of class TakeDamageInfo */ -#ifndef TOLUA_DISABLE_tolua_set_TakeDamageInfo_DamageType -static int tolua_set_TakeDamageInfo_DamageType(lua_State* tolua_S) -{ - TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'DamageType'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->DamageType = ((eDamageType) (int) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Attacker of class TakeDamageInfo */ -#ifndef TOLUA_DISABLE_tolua_get_TakeDamageInfo_Attacker_ptr -static int tolua_get_TakeDamageInfo_Attacker_ptr(lua_State* tolua_S) -{ - TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Attacker'",NULL); -#endif - tolua_pushusertype(tolua_S,(void*)self->Attacker,"cEntity"); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: Attacker of class TakeDamageInfo */ -#ifndef TOLUA_DISABLE_tolua_set_TakeDamageInfo_Attacker_ptr -static int tolua_set_TakeDamageInfo_Attacker_ptr(lua_State* tolua_S) -{ - TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Attacker'",NULL); - if (!tolua_isusertype(tolua_S,2,"cEntity",0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->Attacker = ((cEntity*) tolua_tousertype(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: RawDamage of class TakeDamageInfo */ -#ifndef TOLUA_DISABLE_tolua_get_TakeDamageInfo_RawDamage -static int tolua_get_TakeDamageInfo_RawDamage(lua_State* tolua_S) -{ - TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'RawDamage'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->RawDamage); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: RawDamage of class TakeDamageInfo */ -#ifndef TOLUA_DISABLE_tolua_set_TakeDamageInfo_RawDamage -static int tolua_set_TakeDamageInfo_RawDamage(lua_State* tolua_S) -{ - TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'RawDamage'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->RawDamage = ((int) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: FinalDamage of class TakeDamageInfo */ -#ifndef TOLUA_DISABLE_tolua_get_TakeDamageInfo_FinalDamage -static int tolua_get_TakeDamageInfo_FinalDamage(lua_State* tolua_S) -{ - TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'FinalDamage'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->FinalDamage); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: FinalDamage of class TakeDamageInfo */ -#ifndef TOLUA_DISABLE_tolua_set_TakeDamageInfo_FinalDamage -static int tolua_set_TakeDamageInfo_FinalDamage(lua_State* tolua_S) -{ - TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'FinalDamage'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->FinalDamage = ((int) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Knockback of class TakeDamageInfo */ -#ifndef TOLUA_DISABLE_tolua_get_TakeDamageInfo_Knockback -static int tolua_get_TakeDamageInfo_Knockback(lua_State* tolua_S) -{ - TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Knockback'",NULL); -#endif - tolua_pushusertype(tolua_S,(void*)&self->Knockback,"Vector3d"); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: Knockback of class TakeDamageInfo */ -#ifndef TOLUA_DISABLE_tolua_set_TakeDamageInfo_Knockback -static int tolua_set_TakeDamageInfo_Knockback(lua_State* tolua_S) -{ - TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Knockback'",NULL); - if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3d",0,&tolua_err))) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->Knockback = *((Vector3d*) tolua_tousertype(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEntityType of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetEntityType00 -static int tolua_AllToLua_cEntity_GetEntityType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEntityType'", NULL); -#endif - { - cEntity::eEntityType tolua_ret = (cEntity::eEntityType) self->GetEntityType(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEntityType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsPlayer of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsPlayer00 -static int tolua_AllToLua_cEntity_IsPlayer00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsPlayer'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsPlayer(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsPlayer'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsPickup of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsPickup00 -static int tolua_AllToLua_cEntity_IsPickup00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsPickup'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsPickup(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsPickup'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsMob of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsMob00 -static int tolua_AllToLua_cEntity_IsMob00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsMob'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsMob(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsMob'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsFallingBlock of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsFallingBlock00 -static int tolua_AllToLua_cEntity_IsFallingBlock00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsFallingBlock'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsFallingBlock(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsFallingBlock'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsMinecart of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsMinecart00 -static int tolua_AllToLua_cEntity_IsMinecart00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsMinecart'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsMinecart(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsMinecart'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsBoat of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsBoat00 -static int tolua_AllToLua_cEntity_IsBoat00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsBoat'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsBoat(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsBoat'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsTNT of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsTNT00 -static int tolua_AllToLua_cEntity_IsTNT00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsTNT'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsTNT(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsTNT'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsProjectile of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsProjectile00 -static int tolua_AllToLua_cEntity_IsProjectile00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsProjectile'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsProjectile(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsProjectile'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsA of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsA00 -static int tolua_AllToLua_cEntity_IsA00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); - const char* a_ClassName = ((const char*) tolua_tostring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsA'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsA(a_ClassName); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsA'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetClass of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetClass00 -static int tolua_AllToLua_cEntity_GetClass00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetClass'", NULL); -#endif - { - const char* tolua_ret = (const char*) self->GetClass(); - tolua_pushstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetClass'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetClassStatic of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetClassStatic00 -static int tolua_AllToLua_cEntity_GetClassStatic00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - const char* tolua_ret = (const char*) cEntity::GetClassStatic(); - tolua_pushstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetClassStatic'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetParentClass of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetParentClass00 -static int tolua_AllToLua_cEntity_GetParentClass00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetParentClass'", NULL); -#endif - { - const char* tolua_ret = (const char*) self->GetParentClass(); - tolua_pushstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetParentClass'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWorld of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetWorld00 -static int tolua_AllToLua_cEntity_GetWorld00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWorld'", NULL); -#endif - { - cWorld* tolua_ret = (cWorld*) self->GetWorld(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWorld"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWorld'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetHeadYaw of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetHeadYaw00 -static int tolua_AllToLua_cEntity_GetHeadYaw00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeadYaw'", NULL); -#endif - { - double tolua_ret = (double) self->GetHeadYaw(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetHeadYaw'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetHeight of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetHeight00 -static int tolua_AllToLua_cEntity_GetHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeight'", NULL); -#endif - { - double tolua_ret = (double) self->GetHeight(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetMass of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetMass00 -static int tolua_AllToLua_cEntity_GetMass00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMass'", NULL); -#endif - { - double tolua_ret = (double) self->GetMass(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMass'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPosition of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetPosition00 -static int tolua_AllToLua_cEntity_GetPosition00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosition'", NULL); -#endif - { - const Vector3d& tolua_ret = (const Vector3d&) self->GetPosition(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const Vector3d"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPosition'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPosX of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetPosX00 -static int tolua_AllToLua_cEntity_GetPosX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosX'", NULL); -#endif - { - double tolua_ret = (double) self->GetPosX(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPosX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPosY of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetPosY00 -static int tolua_AllToLua_cEntity_GetPosY00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosY'", NULL); -#endif - { - double tolua_ret = (double) self->GetPosY(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPosY'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPosZ of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetPosZ00 -static int tolua_AllToLua_cEntity_GetPosZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosZ'", NULL); -#endif - { - double tolua_ret = (double) self->GetPosZ(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPosZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetRot of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetRot00 -static int tolua_AllToLua_cEntity_GetRot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRot'", NULL); -#endif - { - const Vector3d& tolua_ret = (const Vector3d&) self->GetRot(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const Vector3d"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetRot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetRotation of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetRotation00 -static int tolua_AllToLua_cEntity_GetRotation00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRotation'", NULL); -#endif - { - double tolua_ret = (double) self->GetRotation(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetRotation'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetYaw of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetYaw00 -static int tolua_AllToLua_cEntity_GetYaw00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetYaw'", NULL); -#endif - { - double tolua_ret = (double) self->GetYaw(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetYaw'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPitch of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetPitch00 -static int tolua_AllToLua_cEntity_GetPitch00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPitch'", NULL); -#endif - { - double tolua_ret = (double) self->GetPitch(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPitch'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetRoll of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetRoll00 -static int tolua_AllToLua_cEntity_GetRoll00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRoll'", NULL); -#endif - { - double tolua_ret = (double) self->GetRoll(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetRoll'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetLookVector of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetLookVector00 -static int tolua_AllToLua_cEntity_GetLookVector00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLookVector'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->GetLookVector(); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetLookVector'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSpeed of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetSpeed00 -static int tolua_AllToLua_cEntity_GetSpeed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpeed'", NULL); -#endif - { - const Vector3d& tolua_ret = (const Vector3d&) self->GetSpeed(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const Vector3d"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSpeed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSpeedX of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetSpeedX00 -static int tolua_AllToLua_cEntity_GetSpeedX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpeedX'", NULL); -#endif - { - double tolua_ret = (double) self->GetSpeedX(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSpeedX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSpeedY of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetSpeedY00 -static int tolua_AllToLua_cEntity_GetSpeedY00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpeedY'", NULL); -#endif - { - double tolua_ret = (double) self->GetSpeedY(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSpeedY'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSpeedZ of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetSpeedZ00 -static int tolua_AllToLua_cEntity_GetSpeedZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpeedZ'", NULL); -#endif - { - double tolua_ret = (double) self->GetSpeedZ(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSpeedZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWidth of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetWidth00 -static int tolua_AllToLua_cEntity_GetWidth00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWidth'", NULL); -#endif - { - double tolua_ret = (double) self->GetWidth(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWidth'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetChunkX of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetChunkX00 -static int tolua_AllToLua_cEntity_GetChunkX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetChunkX'", NULL); -#endif - { - int tolua_ret = (int) self->GetChunkX(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetChunkX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetChunkZ of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetChunkZ00 -static int tolua_AllToLua_cEntity_GetChunkZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetChunkZ'", NULL); -#endif - { - int tolua_ret = (int) self->GetChunkZ(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetChunkZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetHeadYaw of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetHeadYaw00 -static int tolua_AllToLua_cEntity_SetHeadYaw00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_HeadYaw = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetHeadYaw'", NULL); -#endif - { - self->SetHeadYaw(a_HeadYaw); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetHeadYaw'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetHeight of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetHeight00 -static int tolua_AllToLua_cEntity_SetHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_Height = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetHeight'", NULL); -#endif - { - self->SetHeight(a_Height); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetMass of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetMass00 -static int tolua_AllToLua_cEntity_SetMass00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_Mass = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetMass'", NULL); -#endif - { - self->SetMass(a_Mass); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetMass'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetPosX of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPosX00 -static int tolua_AllToLua_cEntity_SetPosX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPosX'", NULL); -#endif - { - self->SetPosX(a_PosX); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetPosX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetPosY of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPosY00 -static int tolua_AllToLua_cEntity_SetPosY00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_PosY = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPosY'", NULL); -#endif - { - self->SetPosY(a_PosY); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetPosY'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetPosZ of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPosZ00 -static int tolua_AllToLua_cEntity_SetPosZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_PosZ = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPosZ'", NULL); -#endif - { - self->SetPosZ(a_PosZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetPosZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetPosition of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPosition00 -static int tolua_AllToLua_cEntity_SetPosition00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_PosY = ((double) tolua_tonumber(tolua_S,3,0)); - double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPosition'", NULL); -#endif - { - self->SetPosition(a_PosX,a_PosY,a_PosZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetPosition'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetPosition of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPosition01 -static int tolua_AllToLua_cEntity_SetPosition01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_Pos = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPosition'", NULL); -#endif - { - self->SetPosition(*a_Pos); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cEntity_SetPosition00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetRot of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetRot00 -static int tolua_AllToLua_cEntity_SetRot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - const Vector3f* a_Rot = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRot'", NULL); -#endif - { - self->SetRot(*a_Rot); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetRot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetRotation of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetRotation00 -static int tolua_AllToLua_cEntity_SetRotation00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_Rotation = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRotation'", NULL); -#endif - { - self->SetRotation(a_Rotation); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetRotation'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetYaw of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetYaw00 -static int tolua_AllToLua_cEntity_SetYaw00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_Yaw = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetYaw'", NULL); -#endif - { - self->SetYaw(a_Yaw); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetYaw'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetPitch of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPitch00 -static int tolua_AllToLua_cEntity_SetPitch00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_Pitch = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPitch'", NULL); -#endif - { - self->SetPitch(a_Pitch); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetPitch'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetRoll of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetRoll00 -static int tolua_AllToLua_cEntity_SetRoll00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_Roll = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRoll'", NULL); -#endif - { - self->SetRoll(a_Roll); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetRoll'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSpeed of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetSpeed00 -static int tolua_AllToLua_cEntity_SetSpeed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_SpeedX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_SpeedY = ((double) tolua_tonumber(tolua_S,3,0)); - double a_SpeedZ = ((double) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSpeed'", NULL); -#endif - { - self->SetSpeed(a_SpeedX,a_SpeedY,a_SpeedZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetSpeed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSpeed of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetSpeed01 -static int tolua_AllToLua_cEntity_SetSpeed01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_Speed = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSpeed'", NULL); -#endif - { - self->SetSpeed(*a_Speed); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cEntity_SetSpeed00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSpeedX of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetSpeedX00 -static int tolua_AllToLua_cEntity_SetSpeedX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_SpeedX = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSpeedX'", NULL); -#endif - { - self->SetSpeedX(a_SpeedX); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetSpeedX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSpeedY of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetSpeedY00 -static int tolua_AllToLua_cEntity_SetSpeedY00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_SpeedY = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSpeedY'", NULL); -#endif - { - self->SetSpeedY(a_SpeedY); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetSpeedY'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSpeedZ of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetSpeedZ00 -static int tolua_AllToLua_cEntity_SetSpeedZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_SpeedZ = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSpeedZ'", NULL); -#endif - { - self->SetSpeedZ(a_SpeedZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetSpeedZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetWidth of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetWidth00 -static int tolua_AllToLua_cEntity_SetWidth00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_Width = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetWidth'", NULL); -#endif - { - self->SetWidth(a_Width); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetWidth'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddPosX of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddPosX00 -static int tolua_AllToLua_cEntity_AddPosX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_AddPosX = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddPosX'", NULL); -#endif - { - self->AddPosX(a_AddPosX); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddPosX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddPosY of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddPosY00 -static int tolua_AllToLua_cEntity_AddPosY00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_AddPosY = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddPosY'", NULL); -#endif - { - self->AddPosY(a_AddPosY); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddPosY'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddPosZ of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddPosZ00 -static int tolua_AllToLua_cEntity_AddPosZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_AddPosZ = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddPosZ'", NULL); -#endif - { - self->AddPosZ(a_AddPosZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddPosZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddPosition of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddPosition00 -static int tolua_AllToLua_cEntity_AddPosition00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_AddPosX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_AddPosY = ((double) tolua_tonumber(tolua_S,3,0)); - double a_AddPosZ = ((double) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddPosition'", NULL); -#endif - { - self->AddPosition(a_AddPosX,a_AddPosY,a_AddPosZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddPosition'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddPosition of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddPosition01 -static int tolua_AllToLua_cEntity_AddPosition01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_AddPos = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddPosition'", NULL); -#endif - { - self->AddPosition(*a_AddPos); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cEntity_AddPosition00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddSpeed of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddSpeed00 -static int tolua_AllToLua_cEntity_AddSpeed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_AddSpeedX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_AddSpeedY = ((double) tolua_tonumber(tolua_S,3,0)); - double a_AddSpeedZ = ((double) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddSpeed'", NULL); -#endif - { - self->AddSpeed(a_AddSpeedX,a_AddSpeedY,a_AddSpeedZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddSpeed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddSpeed of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddSpeed01 -static int tolua_AllToLua_cEntity_AddSpeed01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_AddSpeed = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddSpeed'", NULL); -#endif - { - self->AddSpeed(*a_AddSpeed); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cEntity_AddSpeed00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddSpeedX of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddSpeedX00 -static int tolua_AllToLua_cEntity_AddSpeedX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_AddSpeedX = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddSpeedX'", NULL); -#endif - { - self->AddSpeedX(a_AddSpeedX); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddSpeedX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddSpeedY of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddSpeedY00 -static int tolua_AllToLua_cEntity_AddSpeedY00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_AddSpeedY = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddSpeedY'", NULL); -#endif - { - self->AddSpeedY(a_AddSpeedY); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddSpeedY'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddSpeedZ of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddSpeedZ00 -static int tolua_AllToLua_cEntity_AddSpeedZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_AddSpeedZ = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddSpeedZ'", NULL); -#endif - { - self->AddSpeedZ(a_AddSpeedZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddSpeedZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SteerVehicle of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SteerVehicle00 -static int tolua_AllToLua_cEntity_SteerVehicle00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - float a_Forward = ((float) tolua_tonumber(tolua_S,2,0)); - float a_Sideways = ((float) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SteerVehicle'", NULL); -#endif - { - self->SteerVehicle(a_Forward,a_Sideways); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SteerVehicle'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetUniqueID of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetUniqueID00 -static int tolua_AllToLua_cEntity_GetUniqueID00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetUniqueID'", NULL); -#endif - { - int tolua_ret = (int) self->GetUniqueID(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetUniqueID'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsDestroyed of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsDestroyed00 -static int tolua_AllToLua_cEntity_IsDestroyed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsDestroyed'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsDestroyed(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsDestroyed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Destroy of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_Destroy00 -static int tolua_AllToLua_cEntity_Destroy00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,1,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - bool a_ShouldBroadcast = ((bool) tolua_toboolean(tolua_S,2,true)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Destroy'", NULL); -#endif - { - self->Destroy(a_ShouldBroadcast); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Destroy'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: TakeDamage of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_TakeDamage00 -static int tolua_AllToLua_cEntity_TakeDamage00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cEntity",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - cEntity* a_Attacker = ((cEntity*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TakeDamage'", NULL); -#endif - { - self->TakeDamage(*a_Attacker); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'TakeDamage'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: TakeDamage of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_TakeDamage01 -static int tolua_AllToLua_cEntity_TakeDamage01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isusertype(tolua_S,3,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - eDamageType a_DamageType = ((eDamageType) (int) tolua_tonumber(tolua_S,2,0)); - cEntity* a_Attacker = ((cEntity*) tolua_tousertype(tolua_S,3,0)); - int a_RawDamage = ((int) tolua_tonumber(tolua_S,4,0)); - double a_KnockbackAmount = ((double) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TakeDamage'", NULL); -#endif - { - self->TakeDamage(a_DamageType,a_Attacker,a_RawDamage,a_KnockbackAmount); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cEntity_TakeDamage00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: TakeDamage of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_TakeDamage02 -static int tolua_AllToLua_cEntity_TakeDamage02(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isusertype(tolua_S,3,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - eDamageType a_DamageType = ((eDamageType) (int) tolua_tonumber(tolua_S,2,0)); - cEntity* a_Attacker = ((cEntity*) tolua_tousertype(tolua_S,3,0)); - int a_RawDamage = ((int) tolua_tonumber(tolua_S,4,0)); - int a_FinalDamage = ((int) tolua_tonumber(tolua_S,5,0)); - double a_KnockbackAmount = ((double) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TakeDamage'", NULL); -#endif - { - self->TakeDamage(a_DamageType,a_Attacker,a_RawDamage,a_FinalDamage,a_KnockbackAmount); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cEntity_TakeDamage01(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetGravity of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetGravity00 -static int tolua_AllToLua_cEntity_GetGravity00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetGravity'", NULL); -#endif - { - float tolua_ret = (float) self->GetGravity(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetGravity'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetGravity of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetGravity00 -static int tolua_AllToLua_cEntity_SetGravity00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - float a_Gravity = ((float) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetGravity'", NULL); -#endif - { - self->SetGravity(a_Gravity); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetGravity'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetRotationFromSpeed of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetRotationFromSpeed00 -static int tolua_AllToLua_cEntity_SetRotationFromSpeed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRotationFromSpeed'", NULL); -#endif - { - self->SetRotationFromSpeed(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetRotationFromSpeed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetPitchFromSpeed of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPitchFromSpeed00 -static int tolua_AllToLua_cEntity_SetPitchFromSpeed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPitchFromSpeed'", NULL); -#endif - { - self->SetPitchFromSpeed(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetPitchFromSpeed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetRawDamageAgainst of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetRawDamageAgainst00 -static int tolua_AllToLua_cEntity_GetRawDamageAgainst00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cEntity",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - const cEntity* a_Receiver = ((const cEntity*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRawDamageAgainst'", NULL); -#endif - { - int tolua_ret = (int) self->GetRawDamageAgainst(*a_Receiver); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetRawDamageAgainst'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetArmorCoverAgainst of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetArmorCoverAgainst00 -static int tolua_AllToLua_cEntity_GetArmorCoverAgainst00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - const cEntity* a_Attacker = ((const cEntity*) tolua_tousertype(tolua_S,2,0)); - eDamageType a_DamageType = ((eDamageType) (int) tolua_tonumber(tolua_S,3,0)); - int a_RawDamage = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetArmorCoverAgainst'", NULL); -#endif - { - int tolua_ret = (int) self->GetArmorCoverAgainst(a_Attacker,a_DamageType,a_RawDamage); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetArmorCoverAgainst'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetKnockbackAmountAgainst of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetKnockbackAmountAgainst00 -static int tolua_AllToLua_cEntity_GetKnockbackAmountAgainst00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cEntity",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - const cEntity* a_Receiver = ((const cEntity*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetKnockbackAmountAgainst'", NULL); -#endif - { - double tolua_ret = (double) self->GetKnockbackAmountAgainst(*a_Receiver); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetKnockbackAmountAgainst'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEquippedWeapon of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetEquippedWeapon00 -static int tolua_AllToLua_cEntity_GetEquippedWeapon00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedWeapon'", NULL); -#endif - { - cItem tolua_ret = (cItem) self->GetEquippedWeapon(); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEquippedWeapon'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEquippedHelmet of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetEquippedHelmet00 -static int tolua_AllToLua_cEntity_GetEquippedHelmet00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedHelmet'", NULL); -#endif - { - cItem tolua_ret = (cItem) self->GetEquippedHelmet(); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEquippedHelmet'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEquippedChestplate of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetEquippedChestplate00 -static int tolua_AllToLua_cEntity_GetEquippedChestplate00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedChestplate'", NULL); -#endif - { - cItem tolua_ret = (cItem) self->GetEquippedChestplate(); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEquippedChestplate'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEquippedLeggings of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetEquippedLeggings00 -static int tolua_AllToLua_cEntity_GetEquippedLeggings00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedLeggings'", NULL); -#endif - { - cItem tolua_ret = (cItem) self->GetEquippedLeggings(); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEquippedLeggings'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEquippedBoots of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetEquippedBoots00 -static int tolua_AllToLua_cEntity_GetEquippedBoots00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedBoots'", NULL); -#endif - { - cItem tolua_ret = (cItem) self->GetEquippedBoots(); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEquippedBoots'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: KilledBy of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_KilledBy00 -static int tolua_AllToLua_cEntity_KilledBy00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - cEntity* a_Killer = ((cEntity*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'KilledBy'", NULL); -#endif - { - self->KilledBy(a_Killer); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'KilledBy'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Heal of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_Heal00 -static int tolua_AllToLua_cEntity_Heal00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - int a_HitPoints = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Heal'", NULL); -#endif - { - self->Heal(a_HitPoints); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Heal'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetHealth of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetHealth00 -static int tolua_AllToLua_cEntity_GetHealth00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHealth'", NULL); -#endif - { - int tolua_ret = (int) self->GetHealth(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetHealth'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetHealth of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetHealth00 -static int tolua_AllToLua_cEntity_SetHealth00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - int a_Health = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetHealth'", NULL); -#endif - { - self->SetHealth(a_Health); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetHealth'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetMaxHealth of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetMaxHealth00 -static int tolua_AllToLua_cEntity_SetMaxHealth00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - int a_MaxHealth = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetMaxHealth'", NULL); -#endif - { - self->SetMaxHealth(a_MaxHealth); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetMaxHealth'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetMaxHealth of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetMaxHealth00 -static int tolua_AllToLua_cEntity_GetMaxHealth00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxHealth'", NULL); -#endif - { - int tolua_ret = (int) self->GetMaxHealth(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMaxHealth'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: StartBurning of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_StartBurning00 -static int tolua_AllToLua_cEntity_StartBurning00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - int a_TicksLeftBurning = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'StartBurning'", NULL); -#endif - { - self->StartBurning(a_TicksLeftBurning); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'StartBurning'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: StopBurning of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_StopBurning00 -static int tolua_AllToLua_cEntity_StopBurning00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'StopBurning'", NULL); -#endif - { - self->StopBurning(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'StopBurning'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: TeleportToEntity of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_TeleportToEntity00 -static int tolua_AllToLua_cEntity_TeleportToEntity00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cEntity",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - cEntity* a_Entity = ((cEntity*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TeleportToEntity'", NULL); -#endif - { - self->TeleportToEntity(*a_Entity); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'TeleportToEntity'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: TeleportToCoords of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_TeleportToCoords00 -static int tolua_AllToLua_cEntity_TeleportToCoords00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); - double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_PosY = ((double) tolua_tonumber(tolua_S,3,0)); - double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TeleportToCoords'", NULL); -#endif - { - self->TeleportToCoords(a_PosX,a_PosY,a_PosZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'TeleportToCoords'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsOnFire of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsOnFire00 -static int tolua_AllToLua_cEntity_IsOnFire00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsOnFire'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsOnFire(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsOnFire'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsCrouched of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsCrouched00 -static int tolua_AllToLua_cEntity_IsCrouched00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsCrouched'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsCrouched(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsCrouched'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsRiding of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsRiding00 -static int tolua_AllToLua_cEntity_IsRiding00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsRiding'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsRiding(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsRiding'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsSprinting of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsSprinting00 -static int tolua_AllToLua_cEntity_IsSprinting00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSprinting'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsSprinting(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsSprinting'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsRclking of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsRclking00 -static int tolua_AllToLua_cEntity_IsRclking00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsRclking'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsRclking(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsRclking'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsInvisible of class cEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsInvisible00 -static int tolua_AllToLua_cEntity_IsInvisible00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInvisible'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsInvisible(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsInvisible'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetCurrentExperience of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetCurrentExperience00 -static int tolua_AllToLua_cPlayer_SetCurrentExperience00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - short a_XpTotal = ((short) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetCurrentExperience'", NULL); -#endif - { - bool tolua_ret = (bool) self->SetCurrentExperience(a_XpTotal); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetCurrentExperience'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DeltaExperience of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_DeltaExperience00 -static int tolua_AllToLua_cPlayer_DeltaExperience00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - short a_Xp_delta = ((short) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeltaExperience'", NULL); -#endif - { - short tolua_ret = (short) self->DeltaExperience(a_Xp_delta); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DeltaExperience'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetXpLifetimeTotal of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetXpLifetimeTotal00 -static int tolua_AllToLua_cPlayer_GetXpLifetimeTotal00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetXpLifetimeTotal'", NULL); -#endif - { - short tolua_ret = (short) self->GetXpLifetimeTotal(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetXpLifetimeTotal'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetCurrentXp of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetCurrentXp00 -static int tolua_AllToLua_cPlayer_GetCurrentXp00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCurrentXp'", NULL); -#endif - { - short tolua_ret = (short) self->GetCurrentXp(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetCurrentXp'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetXpLevel of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetXpLevel00 -static int tolua_AllToLua_cPlayer_GetXpLevel00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetXpLevel'", NULL); -#endif - { - short tolua_ret = (short) self->GetXpLevel(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetXpLevel'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetXpPercentage of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetXpPercentage00 -static int tolua_AllToLua_cPlayer_GetXpPercentage00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetXpPercentage'", NULL); -#endif - { - float tolua_ret = (float) self->GetXpPercentage(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetXpPercentage'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: XpForLevel of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_XpForLevel00 -static int tolua_AllToLua_cPlayer_XpForLevel00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short int a_Level = ((short int) tolua_tonumber(tolua_S,2,0)); - { - short tolua_ret = (short) cPlayer::XpForLevel(a_Level); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'XpForLevel'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CalcLevelFromXp of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_CalcLevelFromXp00 -static int tolua_AllToLua_cPlayer_CalcLevelFromXp00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - short int a_CurrentXp = ((short int) tolua_tonumber(tolua_S,2,0)); - { - short tolua_ret = (short) cPlayer::CalcLevelFromXp(a_CurrentXp); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CalcLevelFromXp'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEyeHeight of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetEyeHeight00 -static int tolua_AllToLua_cPlayer_GetEyeHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEyeHeight'", NULL); -#endif - { - double tolua_ret = (double) self->GetEyeHeight(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEyeHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEyePosition of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetEyePosition00 -static int tolua_AllToLua_cPlayer_GetEyePosition00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEyePosition'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->GetEyePosition(); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEyePosition'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsOnGround of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsOnGround00 -static int tolua_AllToLua_cPlayer_IsOnGround00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsOnGround'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsOnGround(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsOnGround'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetStance of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetStance00 -static int tolua_AllToLua_cPlayer_GetStance00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetStance'", NULL); -#endif - { - const double tolua_ret = (const double) self->GetStance(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetStance'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetInventory of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetInventory00 -static int tolua_AllToLua_cPlayer_GetInventory00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetInventory'", NULL); -#endif - { - cInventory& tolua_ret = (cInventory&) self->GetInventory(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cInventory"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetInventory'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEquippedItem of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetEquippedItem00 -static int tolua_AllToLua_cPlayer_GetEquippedItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedItem'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetEquippedItem(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEquippedItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetThrowStartPos of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetThrowStartPos00 -static int tolua_AllToLua_cPlayer_GetThrowStartPos00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetThrowStartPos'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->GetThrowStartPos(); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetThrowStartPos'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetThrowSpeed of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetThrowSpeed00 -static int tolua_AllToLua_cPlayer_GetThrowSpeed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); - double a_SpeedCoeff = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetThrowSpeed'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->GetThrowSpeed(a_SpeedCoeff); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetThrowSpeed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetGameMode of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetGameMode00 -static int tolua_AllToLua_cPlayer_GetGameMode00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetGameMode'", NULL); -#endif - { - eGameMode tolua_ret = (eGameMode) self->GetGameMode(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetGameMode'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEffectiveGameMode of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetEffectiveGameMode00 -static int tolua_AllToLua_cPlayer_GetEffectiveGameMode00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEffectiveGameMode'", NULL); -#endif - { - eGameMode tolua_ret = (eGameMode) self->GetEffectiveGameMode(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEffectiveGameMode'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetGameMode of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetGameMode00 -static int tolua_AllToLua_cPlayer_SetGameMode00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - eGameMode a_GameMode = ((eGameMode) (int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetGameMode'", NULL); -#endif - { - self->SetGameMode(a_GameMode); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetGameMode'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsGameModeCreative of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsGameModeCreative00 -static int tolua_AllToLua_cPlayer_IsGameModeCreative00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsGameModeCreative'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsGameModeCreative(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsGameModeCreative'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsGameModeSurvival of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsGameModeSurvival00 -static int tolua_AllToLua_cPlayer_IsGameModeSurvival00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsGameModeSurvival'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsGameModeSurvival(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsGameModeSurvival'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsGameModeAdventure of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsGameModeAdventure00 -static int tolua_AllToLua_cPlayer_IsGameModeAdventure00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsGameModeAdventure'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsGameModeAdventure(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsGameModeAdventure'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetIP of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetIP00 -static int tolua_AllToLua_cPlayer_GetIP00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetIP'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetIP(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetIP'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: MoveTo of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_MoveTo00 -static int tolua_AllToLua_cPlayer_MoveTo00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_NewPos = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MoveTo'", NULL); -#endif - { - self->MoveTo(*a_NewPos); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'MoveTo'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWindow of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetWindow00 -static int tolua_AllToLua_cPlayer_GetWindow00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWindow'", NULL); -#endif - { - cWindow* tolua_ret = (cWindow*) self->GetWindow(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWindow"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWindow'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CloseWindow of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_CloseWindow00 -static int tolua_AllToLua_cPlayer_CloseWindow00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,1,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - bool a_CanRefuse = ((bool) tolua_toboolean(tolua_S,2,true)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CloseWindow'", NULL); -#endif - { - self->CloseWindow(a_CanRefuse); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CloseWindow'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CloseWindowIfID of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_CloseWindowIfID00 -static int tolua_AllToLua_cPlayer_CloseWindowIfID00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isboolean(tolua_S,3,1,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - char a_WindowID = ((char) tolua_tonumber(tolua_S,2,0)); - bool a_CanRefuse = ((bool) tolua_toboolean(tolua_S,3,true)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CloseWindowIfID'", NULL); -#endif - { - self->CloseWindowIfID(a_WindowID,a_CanRefuse); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CloseWindowIfID'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetClientHandle of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetClientHandle00 -static int tolua_AllToLua_cPlayer_GetClientHandle00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetClientHandle'", NULL); -#endif - { - cClientHandle* tolua_ret = (cClientHandle*) self->GetClientHandle(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cClientHandle"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetClientHandle'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SendMessage of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SendMessage00 -static int tolua_AllToLua_cPlayer_SendMessage00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SendMessage'", NULL); -#endif - { - self->SendMessage(a_Message); - tolua_pushcppstring(tolua_S,(const char*)a_Message); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SendMessage'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetName of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetName00 -static int tolua_AllToLua_cPlayer_GetName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetName'", NULL); -#endif - { - const AString tolua_ret = (const AString) self->GetName(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetName of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetName00 -static int tolua_AllToLua_cPlayer_SetName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - const AString a_Name = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetName'", NULL); -#endif - { - self->SetName(a_Name); - tolua_pushcppstring(tolua_S,(const char*)a_Name); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddToGroup of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_AddToGroup00 -static int tolua_AllToLua_cPlayer_AddToGroup00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - const AString a_GroupName = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddToGroup'", NULL); -#endif - { - self->AddToGroup(a_GroupName); - tolua_pushcppstring(tolua_S,(const char*)a_GroupName); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddToGroup'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: RemoveFromGroup of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_RemoveFromGroup00 -static int tolua_AllToLua_cPlayer_RemoveFromGroup00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - const AString a_GroupName = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RemoveFromGroup'", NULL); -#endif - { - self->RemoveFromGroup(a_GroupName); - tolua_pushcppstring(tolua_S,(const char*)a_GroupName); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'RemoveFromGroup'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CanUseCommand of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_CanUseCommand00 -static int tolua_AllToLua_cPlayer_CanUseCommand00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CanUseCommand'", NULL); -#endif - { - bool tolua_ret = (bool) self->CanUseCommand(a_Command); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Command); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CanUseCommand'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HasPermission of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_HasPermission00 -static int tolua_AllToLua_cPlayer_HasPermission00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - const AString a_Permission = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasPermission'", NULL); -#endif - { - bool tolua_ret = (bool) self->HasPermission(a_Permission); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Permission); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HasPermission'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsInGroup of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsInGroup00 -static int tolua_AllToLua_cPlayer_IsInGroup00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - const AString a_Group = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInGroup'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsInGroup(a_Group); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Group); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsInGroup'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetColor of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetColor00 -static int tolua_AllToLua_cPlayer_GetColor00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetColor'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetColor(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetColor'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: TossItem of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_TossItem00 -static int tolua_AllToLua_cPlayer_TossItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,1,&tolua_err) || - !tolua_isnumber(tolua_S,4,1,&tolua_err) || - !tolua_isnumber(tolua_S,5,1,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - bool a_bDraggingItem = ((bool) tolua_toboolean(tolua_S,2,0)); - char a_Amount = ((char) tolua_tonumber(tolua_S,3,1)); - short a_CreateType = ((short) tolua_tonumber(tolua_S,4,0)); - short a_CreateHealth = ((short) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TossItem'", NULL); -#endif - { - self->TossItem(a_bDraggingItem,a_Amount,a_CreateType,a_CreateHealth); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'TossItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Heal of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_Heal00 -static int tolua_AllToLua_cPlayer_Heal00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - int a_Health = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Heal'", NULL); -#endif - { - self->Heal(a_Health); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Heal'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetFoodLevel of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetFoodLevel00 -static int tolua_AllToLua_cPlayer_GetFoodLevel00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFoodLevel'", NULL); -#endif - { - int tolua_ret = (int) self->GetFoodLevel(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetFoodLevel'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetFoodSaturationLevel of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetFoodSaturationLevel00 -static int tolua_AllToLua_cPlayer_GetFoodSaturationLevel00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFoodSaturationLevel'", NULL); -#endif - { - double tolua_ret = (double) self->GetFoodSaturationLevel(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetFoodSaturationLevel'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetFoodTickTimer of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetFoodTickTimer00 -static int tolua_AllToLua_cPlayer_GetFoodTickTimer00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFoodTickTimer'", NULL); -#endif - { - int tolua_ret = (int) self->GetFoodTickTimer(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetFoodTickTimer'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetFoodExhaustionLevel of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetFoodExhaustionLevel00 -static int tolua_AllToLua_cPlayer_GetFoodExhaustionLevel00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFoodExhaustionLevel'", NULL); -#endif - { - double tolua_ret = (double) self->GetFoodExhaustionLevel(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetFoodExhaustionLevel'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetFoodPoisonedTicksRemaining of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetFoodPoisonedTicksRemaining00 -static int tolua_AllToLua_cPlayer_GetFoodPoisonedTicksRemaining00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFoodPoisonedTicksRemaining'", NULL); -#endif - { - int tolua_ret = (int) self->GetFoodPoisonedTicksRemaining(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetFoodPoisonedTicksRemaining'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetAirLevel of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetAirLevel00 -static int tolua_AllToLua_cPlayer_GetAirLevel00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetAirLevel'", NULL); -#endif - { - int tolua_ret = (int) self->GetAirLevel(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetAirLevel'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsSatiated of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsSatiated00 -static int tolua_AllToLua_cPlayer_IsSatiated00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSatiated'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsSatiated(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsSatiated'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetFoodLevel of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetFoodLevel00 -static int tolua_AllToLua_cPlayer_SetFoodLevel00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - int a_FoodLevel = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFoodLevel'", NULL); -#endif - { - self->SetFoodLevel(a_FoodLevel); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetFoodLevel'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetFoodSaturationLevel of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetFoodSaturationLevel00 -static int tolua_AllToLua_cPlayer_SetFoodSaturationLevel00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - double a_FoodSaturationLevel = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFoodSaturationLevel'", NULL); -#endif - { - self->SetFoodSaturationLevel(a_FoodSaturationLevel); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetFoodSaturationLevel'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetFoodTickTimer of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetFoodTickTimer00 -static int tolua_AllToLua_cPlayer_SetFoodTickTimer00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - int a_FoodTickTimer = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFoodTickTimer'", NULL); -#endif - { - self->SetFoodTickTimer(a_FoodTickTimer); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetFoodTickTimer'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetFoodExhaustionLevel of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetFoodExhaustionLevel00 -static int tolua_AllToLua_cPlayer_SetFoodExhaustionLevel00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - double a_FoodExhaustionLevel = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFoodExhaustionLevel'", NULL); -#endif - { - self->SetFoodExhaustionLevel(a_FoodExhaustionLevel); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetFoodExhaustionLevel'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetFoodPoisonedTicksRemaining of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetFoodPoisonedTicksRemaining00 -static int tolua_AllToLua_cPlayer_SetFoodPoisonedTicksRemaining00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - int a_FoodPoisonedTicksRemaining = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFoodPoisonedTicksRemaining'", NULL); -#endif - { - self->SetFoodPoisonedTicksRemaining(a_FoodPoisonedTicksRemaining); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetFoodPoisonedTicksRemaining'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Feed of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_Feed00 -static int tolua_AllToLua_cPlayer_Feed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - int a_Food = ((int) tolua_tonumber(tolua_S,2,0)); - double a_Saturation = ((double) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Feed'", NULL); -#endif - { - bool tolua_ret = (bool) self->Feed(a_Food,a_Saturation); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Feed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddFoodExhaustion of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_AddFoodExhaustion00 -static int tolua_AllToLua_cPlayer_AddFoodExhaustion00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - double a_Exhaustion = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddFoodExhaustion'", NULL); -#endif - { - self->AddFoodExhaustion(a_Exhaustion); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddFoodExhaustion'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FoodPoison of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_FoodPoison00 -static int tolua_AllToLua_cPlayer_FoodPoison00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - int a_NumTicks = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FoodPoison'", NULL); -#endif - { - self->FoodPoison(a_NumTicks); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'FoodPoison'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsEating of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsEating00 -static int tolua_AllToLua_cPlayer_IsEating00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsEating'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsEating(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsEating'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Respawn of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_Respawn00 -static int tolua_AllToLua_cPlayer_Respawn00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Respawn'", NULL); -#endif - { - self->Respawn(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Respawn'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetVisible of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetVisible00 -static int tolua_AllToLua_cPlayer_SetVisible00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - bool a_bVisible = ((bool) tolua_toboolean(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetVisible'", NULL); -#endif - { - self->SetVisible(a_bVisible); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetVisible'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsVisible of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsVisible00 -static int tolua_AllToLua_cPlayer_IsVisible00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsVisible'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsVisible(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsVisible'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: MoveToWorld of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_MoveToWorld00 -static int tolua_AllToLua_cPlayer_MoveToWorld00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - const char* a_WorldName = ((const char*) tolua_tostring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MoveToWorld'", NULL); -#endif - { - bool tolua_ret = (bool) self->MoveToWorld(a_WorldName); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'MoveToWorld'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: LoadPermissionsFromDisk of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_LoadPermissionsFromDisk00 -static int tolua_AllToLua_cPlayer_LoadPermissionsFromDisk00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'LoadPermissionsFromDisk'", NULL); -#endif - { - self->LoadPermissionsFromDisk(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'LoadPermissionsFromDisk'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetMaxSpeed of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetMaxSpeed00 -static int tolua_AllToLua_cPlayer_GetMaxSpeed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxSpeed'", NULL); -#endif - { - double tolua_ret = (double) self->GetMaxSpeed(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMaxSpeed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNormalMaxSpeed of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetNormalMaxSpeed00 -static int tolua_AllToLua_cPlayer_GetNormalMaxSpeed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNormalMaxSpeed'", NULL); -#endif - { - double tolua_ret = (double) self->GetNormalMaxSpeed(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetNormalMaxSpeed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSprintingMaxSpeed of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetSprintingMaxSpeed00 -static int tolua_AllToLua_cPlayer_GetSprintingMaxSpeed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSprintingMaxSpeed'", NULL); -#endif - { - double tolua_ret = (double) self->GetSprintingMaxSpeed(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSprintingMaxSpeed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetNormalMaxSpeed of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetNormalMaxSpeed00 -static int tolua_AllToLua_cPlayer_SetNormalMaxSpeed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - double a_Speed = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetNormalMaxSpeed'", NULL); -#endif - { - self->SetNormalMaxSpeed(a_Speed); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetNormalMaxSpeed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSprintingMaxSpeed of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetSprintingMaxSpeed00 -static int tolua_AllToLua_cPlayer_SetSprintingMaxSpeed00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - double a_Speed = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSprintingMaxSpeed'", NULL); -#endif - { - self->SetSprintingMaxSpeed(a_Speed); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetSprintingMaxSpeed'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetCrouch of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetCrouch00 -static int tolua_AllToLua_cPlayer_SetCrouch00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - bool a_IsCrouched = ((bool) tolua_toboolean(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetCrouch'", NULL); -#endif - { - self->SetCrouch(a_IsCrouched); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetCrouch'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSprint of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetSprint00 -static int tolua_AllToLua_cPlayer_SetSprint00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); - bool a_IsSprinting = ((bool) tolua_toboolean(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSprint'", NULL); -#endif - { - self->SetSprint(a_IsSprinting); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetSprint'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsSwimming of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsSwimming00 -static int tolua_AllToLua_cPlayer_IsSwimming00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSwimming'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsSwimming(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsSwimming'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsSubmerged of class cPlayer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsSubmerged00 -static int tolua_AllToLua_cPlayer_IsSubmerged00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSubmerged'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsSubmerged(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsSubmerged'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cPickup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_new00 -static int tolua_AllToLua_cPickup_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cPickup",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,5,&tolua_err) || !tolua_isusertype(tolua_S,5,"const cItem",0,&tolua_err)) || - !tolua_isboolean(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,1,&tolua_err) || - !tolua_isnumber(tolua_S,8,1,&tolua_err) || - !tolua_isnumber(tolua_S,9,1,&tolua_err) || - !tolua_isnoobj(tolua_S,10,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_PosY = ((double) tolua_tonumber(tolua_S,3,0)); - double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,5,0)); - bool IsPlayerCreated = ((bool) tolua_toboolean(tolua_S,6,0)); - float a_SpeedX = ((float) tolua_tonumber(tolua_S,7,0.f)); - float a_SpeedY = ((float) tolua_tonumber(tolua_S,8,0.f)); - float a_SpeedZ = ((float) tolua_tonumber(tolua_S,9,0.f)); - { - cPickup* tolua_ret = (cPickup*) Mtolua_new((cPickup)(a_PosX,a_PosY,a_PosZ,*a_Item,IsPlayerCreated,a_SpeedX,a_SpeedY,a_SpeedZ)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPickup"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cPickup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_new00_local -static int tolua_AllToLua_cPickup_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cPickup",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,5,&tolua_err) || !tolua_isusertype(tolua_S,5,"const cItem",0,&tolua_err)) || - !tolua_isboolean(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,1,&tolua_err) || - !tolua_isnumber(tolua_S,8,1,&tolua_err) || - !tolua_isnumber(tolua_S,9,1,&tolua_err) || - !tolua_isnoobj(tolua_S,10,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_PosY = ((double) tolua_tonumber(tolua_S,3,0)); - double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,5,0)); - bool IsPlayerCreated = ((bool) tolua_toboolean(tolua_S,6,0)); - float a_SpeedX = ((float) tolua_tonumber(tolua_S,7,0.f)); - float a_SpeedY = ((float) tolua_tonumber(tolua_S,8,0.f)); - float a_SpeedZ = ((float) tolua_tonumber(tolua_S,9,0.f)); - { - cPickup* tolua_ret = (cPickup*) Mtolua_new((cPickup)(a_PosX,a_PosY,a_PosZ,*a_Item,IsPlayerCreated,a_SpeedX,a_SpeedY,a_SpeedZ)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPickup"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetItem of class cPickup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_GetItem00 -static int tolua_AllToLua_cPickup_GetItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPickup",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPickup* self = (cPickup*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetItem'", NULL); -#endif - { - cItem& tolua_ret = (cItem&) self->GetItem(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CollectedBy of class cPickup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_CollectedBy00 -static int tolua_AllToLua_cPickup_CollectedBy00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPickup",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPickup* self = (cPickup*) tolua_tousertype(tolua_S,1,0); - cPlayer* a_Dest = ((cPlayer*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CollectedBy'", NULL); -#endif - { - bool tolua_ret = (bool) self->CollectedBy(a_Dest); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CollectedBy'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetAge of class cPickup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_GetAge00 -static int tolua_AllToLua_cPickup_GetAge00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPickup",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPickup* self = (const cPickup*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetAge'", NULL); -#endif - { - int tolua_ret = (int) self->GetAge(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetAge'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsCollected of class cPickup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_IsCollected00 -static int tolua_AllToLua_cPickup_IsCollected00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPickup",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPickup* self = (const cPickup*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsCollected'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsCollected(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsCollected'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsPlayerCreated of class cPickup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_IsPlayerCreated00 -static int tolua_AllToLua_cPickup_IsPlayerCreated00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPickup",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPickup* self = (const cPickup*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsPlayerCreated'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsPlayerCreated(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsPlayerCreated'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetProjectileKind of class cProjectileEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_GetProjectileKind00 -static int tolua_AllToLua_cProjectileEntity_GetProjectileKind00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cProjectileEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cProjectileEntity* self = (const cProjectileEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetProjectileKind'", NULL); -#endif - { - cProjectileEntity::eKind tolua_ret = (cProjectileEntity::eKind) self->GetProjectileKind(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetProjectileKind'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetCreator of class cProjectileEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_GetCreator00 -static int tolua_AllToLua_cProjectileEntity_GetCreator00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cProjectileEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cProjectileEntity* self = (cProjectileEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCreator'", NULL); -#endif - { - cEntity* tolua_ret = (cEntity*) self->GetCreator(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cEntity"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetCreator'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetMCAClassName of class cProjectileEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_GetMCAClassName00 -static int tolua_AllToLua_cProjectileEntity_GetMCAClassName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cProjectileEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cProjectileEntity* self = (const cProjectileEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMCAClassName'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetMCAClassName(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMCAClassName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsInGround of class cProjectileEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_IsInGround00 -static int tolua_AllToLua_cProjectileEntity_IsInGround00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cProjectileEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cProjectileEntity* self = (const cProjectileEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInGround'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsInGround(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsInGround'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPickupState of class cArrowEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_GetPickupState00 -static int tolua_AllToLua_cArrowEntity_GetPickupState00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cArrowEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cArrowEntity* self = (const cArrowEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPickupState'", NULL); -#endif - { - cArrowEntity::ePickupState tolua_ret = (cArrowEntity::ePickupState) self->GetPickupState(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPickupState'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetPickupState of class cArrowEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_SetPickupState00 -static int tolua_AllToLua_cArrowEntity_SetPickupState00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cArrowEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cArrowEntity* self = (cArrowEntity*) tolua_tousertype(tolua_S,1,0); - cArrowEntity::ePickupState a_PickupState = ((cArrowEntity::ePickupState) (int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPickupState'", NULL); -#endif - { - self->SetPickupState(a_PickupState); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetPickupState'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetDamageCoeff of class cArrowEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_GetDamageCoeff00 -static int tolua_AllToLua_cArrowEntity_GetDamageCoeff00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cArrowEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cArrowEntity* self = (const cArrowEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDamageCoeff'", NULL); -#endif - { - double tolua_ret = (double) self->GetDamageCoeff(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetDamageCoeff'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetDamageCoeff of class cArrowEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_SetDamageCoeff00 -static int tolua_AllToLua_cArrowEntity_SetDamageCoeff00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cArrowEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cArrowEntity* self = (cArrowEntity*) tolua_tousertype(tolua_S,1,0); - double a_DamageCoeff = ((double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetDamageCoeff'", NULL); -#endif - { - self->SetDamageCoeff(a_DamageCoeff); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetDamageCoeff'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CanPickup of class cArrowEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_CanPickup00 -static int tolua_AllToLua_cArrowEntity_CanPickup00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cArrowEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cPlayer",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cArrowEntity* self = (const cArrowEntity*) tolua_tousertype(tolua_S,1,0); - const cPlayer* a_Player = ((const cPlayer*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CanPickup'", NULL); -#endif - { - bool tolua_ret = (bool) self->CanPickup(*a_Player); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CanPickup'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsCritical of class cArrowEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_IsCritical00 -static int tolua_AllToLua_cArrowEntity_IsCritical00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cArrowEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cArrowEntity* self = (const cArrowEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsCritical'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsCritical(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsCritical'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetIsCritical of class cArrowEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_SetIsCritical00 -static int tolua_AllToLua_cArrowEntity_SetIsCritical00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cArrowEntity",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cArrowEntity* self = (cArrowEntity*) tolua_tousertype(tolua_S,1,0); - bool a_IsCritical = ((bool) tolua_toboolean(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetIsCritical'", NULL); -#endif - { - self->SetIsCritical(a_IsCritical); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetIsCritical'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Get of class cPluginManager */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_Get00 -static int tolua_AllToLua_cPluginManager_Get00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cPluginManager",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cPluginManager* tolua_ret = (cPluginManager*) cPluginManager::Get(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPluginManager"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Get'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPlugin of class cPluginManager */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_GetPlugin00 -static int tolua_AllToLua_cPluginManager_GetPlugin00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPluginManager",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPluginManager* self = (const cPluginManager*) tolua_tousertype(tolua_S,1,0); - const AString a_Plugin = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPlugin'", NULL); -#endif - { - cPlugin* tolua_ret = (cPlugin*) self->GetPlugin(a_Plugin); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPlugin"); - tolua_pushcppstring(tolua_S,(const char*)a_Plugin); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPlugin'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FindPlugins of class cPluginManager */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_FindPlugins00 -static int tolua_AllToLua_cPluginManager_FindPlugins00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FindPlugins'", NULL); -#endif - { - self->FindPlugins(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'FindPlugins'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ReloadPlugins of class cPluginManager */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_ReloadPlugins00 -static int tolua_AllToLua_cPluginManager_ReloadPlugins00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ReloadPlugins'", NULL); -#endif - { - self->ReloadPlugins(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ReloadPlugins'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNumPlugins of class cPluginManager */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_GetNumPlugins00 -static int tolua_AllToLua_cPluginManager_GetNumPlugins00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPluginManager",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPluginManager* self = (const cPluginManager*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumPlugins'", NULL); -#endif - { - unsigned int tolua_ret = (unsigned int) self->GetNumPlugins(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetNumPlugins'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DisablePlugin of class cPluginManager */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_DisablePlugin00 -static int tolua_AllToLua_cPluginManager_DisablePlugin00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); - const AString a_PluginName = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DisablePlugin'", NULL); -#endif - { - bool tolua_ret = (bool) self->DisablePlugin(a_PluginName); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_PluginName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DisablePlugin'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: LoadPlugin of class cPluginManager */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_LoadPlugin00 -static int tolua_AllToLua_cPluginManager_LoadPlugin00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); - const AString a_PluginName = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'LoadPlugin'", NULL); -#endif - { - bool tolua_ret = (bool) self->LoadPlugin(a_PluginName); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_PluginName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'LoadPlugin'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsCommandBound of class cPluginManager */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_IsCommandBound00 -static int tolua_AllToLua_cPluginManager_IsCommandBound00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); - const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsCommandBound'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsCommandBound(a_Command); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Command); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsCommandBound'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetCommandPermission of class cPluginManager */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_GetCommandPermission00 -static int tolua_AllToLua_cPluginManager_GetCommandPermission00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); - const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCommandPermission'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetCommandPermission(a_Command); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Command); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetCommandPermission'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ExecuteCommand of class cPluginManager */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_ExecuteCommand00 -static int tolua_AllToLua_cPluginManager_ExecuteCommand00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); - cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0)); - const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ExecuteCommand'", NULL); -#endif - { - bool tolua_ret = (bool) self->ExecuteCommand(a_Player,a_Command); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Command); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ExecuteCommand'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ForceExecuteCommand of class cPluginManager */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_ForceExecuteCommand00 -static int tolua_AllToLua_cPluginManager_ForceExecuteCommand00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); - cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0)); - const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ForceExecuteCommand'", NULL); -#endif - { - bool tolua_ret = (bool) self->ForceExecuteCommand(a_Player,a_Command); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Command); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ForceExecuteCommand'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsConsoleCommandBound of class cPluginManager */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_IsConsoleCommandBound00 -static int tolua_AllToLua_cPluginManager_IsConsoleCommandBound00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); - const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsConsoleCommandBound'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsConsoleCommandBound(a_Command); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Command); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsConsoleCommandBound'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetName of class cPlugin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_GetName00 -static int tolua_AllToLua_cPlugin_GetName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlugin",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlugin* self = (const cPlugin*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetName'", NULL); -#endif - { - const AString tolua_ret = (const AString) self->GetName(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetName of class cPlugin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_SetName00 -static int tolua_AllToLua_cPlugin_SetName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlugin",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0); - const AString a_Name = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetName'", NULL); -#endif - { - self->SetName(a_Name); - tolua_pushcppstring(tolua_S,(const char*)a_Name); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetVersion of class cPlugin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_GetVersion00 -static int tolua_AllToLua_cPlugin_GetVersion00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlugin",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlugin* self = (const cPlugin*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetVersion'", NULL); -#endif - { - int tolua_ret = (int) self->GetVersion(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetVersion'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetVersion of class cPlugin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_SetVersion00 -static int tolua_AllToLua_cPlugin_SetVersion00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cPlugin",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0); - int a_Version = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetVersion'", NULL); -#endif - { - self->SetVersion(a_Version); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetVersion'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetDirectory of class cPlugin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_GetDirectory00 -static int tolua_AllToLua_cPlugin_GetDirectory00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlugin",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlugin* self = (const cPlugin*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDirectory'", NULL); -#endif - { - const AString tolua_ret = (const AString) self->GetDirectory(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetDirectory'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetLocalDirectory of class cPlugin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_GetLocalDirectory00 -static int tolua_AllToLua_cPlugin_GetLocalDirectory00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlugin",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlugin* self = (const cPlugin*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLocalDirectory'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetLocalDirectory(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetLocalDirectory'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetLocalFolder of class cPlugin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_GetLocalFolder00 -static int tolua_AllToLua_cPlugin_GetLocalFolder00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cPlugin",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cPlugin* self = (const cPlugin*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLocalFolder'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetLocalFolder(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetLocalFolder'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: __cWebPlugin__ of class cPluginLua */ -#ifndef TOLUA_DISABLE_tolua_get_cPluginLua___cWebPlugin__ -static int tolua_get_cPluginLua___cWebPlugin__(lua_State* tolua_S) -{ - cPluginLua* self = (cPluginLua*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable '__cWebPlugin__'",NULL); -#endif -#ifdef __cplusplus - tolua_pushusertype(tolua_S,(void*)static_cast<cWebPlugin*>(self), "cWebPlugin"); -#else - tolua_pushusertype(tolua_S,(void*)((cWebPlugin*)self), "cWebPlugin"); -#endif - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetDescription of class cServer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_GetDescription00 -static int tolua_AllToLua_cServer_GetDescription00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cServer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cServer* self = (const cServer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDescription'", NULL); -#endif - { - const AString tolua_ret = (const AString) self->GetDescription(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetDescription'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetMaxPlayers of class cServer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_GetMaxPlayers00 -static int tolua_AllToLua_cServer_GetMaxPlayers00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cServer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cServer* self = (const cServer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxPlayers'", NULL); -#endif - { - int tolua_ret = (int) self->GetMaxPlayers(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMaxPlayers'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNumPlayers of class cServer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_GetNumPlayers00 -static int tolua_AllToLua_cServer_GetNumPlayers00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cServer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cServer* self = (cServer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumPlayers'", NULL); -#endif - { - int tolua_ret = (int) self->GetNumPlayers(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetNumPlayers'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetMaxPlayers of class cServer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_SetMaxPlayers00 -static int tolua_AllToLua_cServer_SetMaxPlayers00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cServer",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cServer* self = (cServer*) tolua_tousertype(tolua_S,1,0); - int a_MaxPlayers = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetMaxPlayers'", NULL); -#endif - { - self->SetMaxPlayers(a_MaxPlayers); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetMaxPlayers'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsHardcore of class cServer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_IsHardcore00 -static int tolua_AllToLua_cServer_IsHardcore00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cServer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cServer* self = (const cServer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsHardcore'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsHardcore(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsHardcore'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetServerID of class cServer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_GetServerID00 -static int tolua_AllToLua_cServer_GetServerID00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cServer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cServer* self = (const cServer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetServerID'", NULL); -#endif - { - const AString tolua_ret = (const AString) self->GetServerID(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetServerID'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetTicksUntilWeatherChange of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetTicksUntilWeatherChange00 -static int tolua_AllToLua_cWorld_GetTicksUntilWeatherChange00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetTicksUntilWeatherChange'", NULL); -#endif - { - int tolua_ret = (int) self->GetTicksUntilWeatherChange(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetTicksUntilWeatherChange'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWorldAge of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetWorldAge00 -static int tolua_AllToLua_cWorld_GetWorldAge00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWorldAge'", NULL); -#endif - { - long long tolua_ret = ( long long) self->GetWorldAge(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWorldAge'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetTimeOfDay of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetTimeOfDay00 -static int tolua_AllToLua_cWorld_GetTimeOfDay00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetTimeOfDay'", NULL); -#endif - { - long long tolua_ret = ( long long) self->GetTimeOfDay(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetTimeOfDay'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetTicksUntilWeatherChange of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetTicksUntilWeatherChange00 -static int tolua_AllToLua_cWorld_SetTicksUntilWeatherChange00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_WeatherInterval = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetTicksUntilWeatherChange'", NULL); -#endif - { - self->SetTicksUntilWeatherChange(a_WeatherInterval); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetTicksUntilWeatherChange'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetTimeOfDay of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetTimeOfDay00 -static int tolua_AllToLua_cWorld_SetTimeOfDay00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - long long a_TimeOfDay = (( long long) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetTimeOfDay'", NULL); -#endif - { - self->SetTimeOfDay(a_TimeOfDay); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetTimeOfDay'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetGameMode of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetGameMode00 -static int tolua_AllToLua_cWorld_GetGameMode00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetGameMode'", NULL); -#endif - { - eGameMode tolua_ret = (eGameMode) self->GetGameMode(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetGameMode'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsGameModeCreative of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsGameModeCreative00 -static int tolua_AllToLua_cWorld_IsGameModeCreative00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsGameModeCreative'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsGameModeCreative(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsGameModeCreative'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsGameModeSurvival of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsGameModeSurvival00 -static int tolua_AllToLua_cWorld_IsGameModeSurvival00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsGameModeSurvival'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsGameModeSurvival(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsGameModeSurvival'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsGameModeAdventure of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsGameModeAdventure00 -static int tolua_AllToLua_cWorld_IsGameModeAdventure00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsGameModeAdventure'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsGameModeAdventure(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsGameModeAdventure'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsPVPEnabled of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsPVPEnabled00 -static int tolua_AllToLua_cWorld_IsPVPEnabled00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsPVPEnabled'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsPVPEnabled(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsPVPEnabled'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsDeepSnowEnabled of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsDeepSnowEnabled00 -static int tolua_AllToLua_cWorld_IsDeepSnowEnabled00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsDeepSnowEnabled'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsDeepSnowEnabled(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsDeepSnowEnabled'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetDimension of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetDimension00 -static int tolua_AllToLua_cWorld_GetDimension00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDimension'", NULL); -#endif - { - eDimension tolua_ret = (eDimension) self->GetDimension(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetDimension'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetHeight of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetHeight00 -static int tolua_AllToLua_cWorld_GetHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeight'", NULL); -#endif - { - int tolua_ret = (int) self->GetHeight(a_BlockX,a_BlockZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: BroadcastChat of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_BroadcastChat00 -static int tolua_AllToLua_cWorld_BroadcastChat00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isusertype(tolua_S,3,"const cClientHandle",1,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const cClientHandle* a_Exclude = ((const cClientHandle*) tolua_tousertype(tolua_S,3,NULL)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'BroadcastChat'", NULL); -#endif - { - self->BroadcastChat(a_Message,a_Exclude); - tolua_pushcppstring(tolua_S,(const char*)a_Message); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'BroadcastChat'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: BroadcastSoundEffect of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_BroadcastSoundEffect00 -static int tolua_AllToLua_cWorld_BroadcastSoundEffect00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isusertype(tolua_S,8,"const cClientHandle",1,&tolua_err) || - !tolua_isnoobj(tolua_S,9,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - const AString a_SoundName = ((const AString) tolua_tocppstring(tolua_S,2,0)); - int a_SrcX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_SrcY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_SrcZ = ((int) tolua_tonumber(tolua_S,5,0)); - float a_Volume = ((float) tolua_tonumber(tolua_S,6,0)); - float a_Pitch = ((float) tolua_tonumber(tolua_S,7,0)); - const cClientHandle* a_Exclude = ((const cClientHandle*) tolua_tousertype(tolua_S,8,NULL)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'BroadcastSoundEffect'", NULL); -#endif - { - self->BroadcastSoundEffect(a_SoundName,a_SrcX,a_SrcY,a_SrcZ,a_Volume,a_Pitch,a_Exclude); - tolua_pushcppstring(tolua_S,(const char*)a_SoundName); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'BroadcastSoundEffect'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: BroadcastSoundParticleEffect of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_BroadcastSoundParticleEffect00 -static int tolua_AllToLua_cWorld_BroadcastSoundParticleEffect00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isusertype(tolua_S,7,"const cClientHandle",1,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_EffectID = ((int) tolua_tonumber(tolua_S,2,0)); - int a_SrcX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_SrcY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_SrcZ = ((int) tolua_tonumber(tolua_S,5,0)); - int a_Data = ((int) tolua_tonumber(tolua_S,6,0)); - const cClientHandle* a_Exclude = ((const cClientHandle*) tolua_tousertype(tolua_S,7,NULL)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'BroadcastSoundParticleEffect'", NULL); -#endif - { - self->BroadcastSoundParticleEffect(a_EffectID,a_SrcX,a_SrcY,a_SrcZ,a_Data,a_Exclude); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'BroadcastSoundParticleEffect'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: UnloadUnusedChunks of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_UnloadUnusedChunks00 -static int tolua_AllToLua_cWorld_UnloadUnusedChunks00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'UnloadUnusedChunks'", NULL); -#endif - { - self->UnloadUnusedChunks(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'UnloadUnusedChunks'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: RegenerateChunk of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_RegenerateChunk00 -static int tolua_AllToLua_cWorld_RegenerateChunk00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_ChunkX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_ChunkZ = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RegenerateChunk'", NULL); -#endif - { - self->RegenerateChunk(a_ChunkX,a_ChunkZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'RegenerateChunk'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GenerateChunk of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GenerateChunk00 -static int tolua_AllToLua_cWorld_GenerateChunk00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_ChunkX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_ChunkZ = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GenerateChunk'", NULL); -#endif - { - self->GenerateChunk(a_ChunkX,a_ChunkZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GenerateChunk'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetBlock of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetBlock00 -static int tolua_AllToLua_cWorld_SetBlock00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlock'", NULL); -#endif - { - self->SetBlock(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetBlock'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FastSetBlock of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_FastSetBlock00 -static int tolua_AllToLua_cWorld_FastSetBlock00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FastSetBlock'", NULL); -#endif - { - self->FastSetBlock(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'FastSetBlock'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: QueueSetBlock of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_QueueSetBlock00 -static int tolua_AllToLua_cWorld_QueueSetBlock00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BLockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); - int a_TickDelay = ((int) tolua_tonumber(tolua_S,7,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'QueueSetBlock'", NULL); -#endif - { - self->QueueSetBlock(a_BlockX,a_BLockY,a_BlockZ,a_BlockType,a_BlockMeta,a_TickDelay); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'QueueSetBlock'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlock of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlock00 -static int tolua_AllToLua_cWorld_GetBlock00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlock'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlock(a_BlockX,a_BlockY,a_BlockZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlock'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockMeta of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlockMeta00 -static int tolua_AllToLua_cWorld_GetBlockMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockMeta'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlockMeta(a_BlockX,a_BlockY,a_BlockZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetBlockMeta of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetBlockMeta00 -static int tolua_AllToLua_cWorld_SetBlockMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_MetaData = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockMeta'", NULL); -#endif - { - self->SetBlockMeta(a_BlockX,a_BlockY,a_BlockZ,a_MetaData); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetBlockMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockSkyLight of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlockSkyLight00 -static int tolua_AllToLua_cWorld_GetBlockSkyLight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockSkyLight'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlockSkyLight(a_BlockX,a_BlockY,a_BlockZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockSkyLight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockBlockLight of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlockBlockLight00 -static int tolua_AllToLua_cWorld_GetBlockBlockLight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockBlockLight'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlockBlockLight(a_BlockX,a_BlockY,a_BlockZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockBlockLight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FastSetBlock of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_FastSetBlock01 -static int tolua_AllToLua_cWorld_FastSetBlock01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - const Vector3i* a_Pos = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,3,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FastSetBlock'", NULL); -#endif - { - self->FastSetBlock(*a_Pos,a_BlockType,a_BlockMeta); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cWorld_FastSetBlock00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlock of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlock01 -static int tolua_AllToLua_cWorld_GetBlock01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - const Vector3i* a_Pos = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlock'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlock(*a_Pos); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cWorld_GetBlock00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockMeta of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlockMeta01 -static int tolua_AllToLua_cWorld_GetBlockMeta01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - const Vector3i* a_Pos = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockMeta'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlockMeta(*a_Pos); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cWorld_GetBlockMeta00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetBlockMeta of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetBlockMeta01 -static int tolua_AllToLua_cWorld_SetBlockMeta01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - const Vector3i* a_Pos = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); - unsigned char a_MetaData = (( unsigned char) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockMeta'", NULL); -#endif - { - self->SetBlockMeta(*a_Pos,a_MetaData); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cWorld_SetBlockMeta00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SpawnItemPickups of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SpawnItemPickups00 -static int tolua_AllToLua_cWorld_SpawnItemPickups00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItems",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,1,&tolua_err) || - !tolua_isboolean(tolua_S,7,1,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - const cItems* a_Pickups = ((const cItems*) tolua_tousertype(tolua_S,2,0)); - double a_BlockX = ((double) tolua_tonumber(tolua_S,3,0)); - double a_BlockY = ((double) tolua_tonumber(tolua_S,4,0)); - double a_BlockZ = ((double) tolua_tonumber(tolua_S,5,0)); - double a_FlyAwaySpeed = ((double) tolua_tonumber(tolua_S,6,1.0)); - bool IsPlayerCreated = ((bool) tolua_toboolean(tolua_S,7,false)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnItemPickups'", NULL); -#endif - { - self->SpawnItemPickups(*a_Pickups,a_BlockX,a_BlockY,a_BlockZ,a_FlyAwaySpeed,IsPlayerCreated); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SpawnItemPickups'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SpawnItemPickups of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SpawnItemPickups01 -static int tolua_AllToLua_cWorld_SpawnItemPickups01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItems",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnumber(tolua_S,8,0,&tolua_err) || - !tolua_isboolean(tolua_S,9,1,&tolua_err) || - !tolua_isnoobj(tolua_S,10,&tolua_err) - ) - goto tolua_lerror; - else - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - const cItems* a_Pickups = ((const cItems*) tolua_tousertype(tolua_S,2,0)); - double a_BlockX = ((double) tolua_tonumber(tolua_S,3,0)); - double a_BlockY = ((double) tolua_tonumber(tolua_S,4,0)); - double a_BlockZ = ((double) tolua_tonumber(tolua_S,5,0)); - double a_SpeedX = ((double) tolua_tonumber(tolua_S,6,0)); - double a_SpeedY = ((double) tolua_tonumber(tolua_S,7,0)); - double a_SpeedZ = ((double) tolua_tonumber(tolua_S,8,0)); - bool IsPlayerCreated = ((bool) tolua_toboolean(tolua_S,9,false)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnItemPickups'", NULL); -#endif - { - self->SpawnItemPickups(*a_Pickups,a_BlockX,a_BlockY,a_BlockZ,a_SpeedX,a_SpeedY,a_SpeedZ,IsPlayerCreated); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cWorld_SpawnItemPickups00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SpawnExperienceOrb of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SpawnExperienceOrb00 -static int tolua_AllToLua_cWorld_SpawnExperienceOrb00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - double a_X = ((double) tolua_tonumber(tolua_S,2,0)); - double a_Y = ((double) tolua_tonumber(tolua_S,3,0)); - double a_Z = ((double) tolua_tonumber(tolua_S,4,0)); - int a_Reward = ((int) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnExperienceOrb'", NULL); -#endif - { - int tolua_ret = (int) self->SpawnExperienceOrb(a_X,a_Y,a_Z,a_Reward); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SpawnExperienceOrb'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SpawnPrimedTNT of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SpawnPrimedTNT00 -static int tolua_AllToLua_cWorld_SpawnPrimedTNT00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,1,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - double a_X = ((double) tolua_tonumber(tolua_S,2,0)); - double a_Y = ((double) tolua_tonumber(tolua_S,3,0)); - double a_Z = ((double) tolua_tonumber(tolua_S,4,0)); - double a_FuseTimeInSec = ((double) tolua_tonumber(tolua_S,5,0)); - double a_InitialVelocityCoeff = ((double) tolua_tonumber(tolua_S,6,1)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnPrimedTNT'", NULL); -#endif - { - self->SpawnPrimedTNT(a_X,a_Y,a_Z,a_FuseTimeInSec,a_InitialVelocityCoeff); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SpawnPrimedTNT'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DigBlock of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_DigBlock00 -static int tolua_AllToLua_cWorld_DigBlock00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); - int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DigBlock'", NULL); -#endif - { - bool tolua_ret = (bool) self->DigBlock(a_X,a_Y,a_Z); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DigBlock'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SendBlockTo of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SendBlockTo00 -static int tolua_AllToLua_cWorld_SendBlockTo00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isusertype(tolua_S,5,"cPlayer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); - int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); - cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SendBlockTo'", NULL); -#endif - { - self->SendBlockTo(a_X,a_Y,a_Z,a_Player); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SendBlockTo'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSpawnX of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetSpawnX00 -static int tolua_AllToLua_cWorld_GetSpawnX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpawnX'", NULL); -#endif - { - double tolua_ret = (double) self->GetSpawnX(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSpawnX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSpawnY of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetSpawnY00 -static int tolua_AllToLua_cWorld_GetSpawnY00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpawnY'", NULL); -#endif - { - double tolua_ret = (double) self->GetSpawnY(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSpawnY'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSpawnZ of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetSpawnZ00 -static int tolua_AllToLua_cWorld_GetSpawnZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpawnZ'", NULL); -#endif - { - double tolua_ret = (double) self->GetSpawnZ(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSpawnZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: WakeUpSimulators of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_WakeUpSimulators00 -static int tolua_AllToLua_cWorld_WakeUpSimulators00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'WakeUpSimulators'", NULL); -#endif - { - self->WakeUpSimulators(a_BlockX,a_BlockY,a_BlockZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'WakeUpSimulators'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: WakeUpSimulatorsInArea of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_WakeUpSimulatorsInArea00 -static int tolua_AllToLua_cWorld_WakeUpSimulatorsInArea00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_MinBlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_MaxBlockX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_MinBlockY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_MaxBlockY = ((int) tolua_tonumber(tolua_S,5,0)); - int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,6,0)); - int a_MaxBlockZ = ((int) tolua_tonumber(tolua_S,7,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'WakeUpSimulatorsInArea'", NULL); -#endif - { - self->WakeUpSimulatorsInArea(a_MinBlockX,a_MaxBlockX,a_MinBlockY,a_MaxBlockY,a_MinBlockZ,a_MaxBlockZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'WakeUpSimulatorsInArea'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DoExplosionAt of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_DoExplosionAt00 -static int tolua_AllToLua_cWorld_DoExplosionAt00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isboolean(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isuserdata(tolua_S,8,0,&tolua_err) || - !tolua_isnoobj(tolua_S,9,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - double a_ExplosionSize = ((double) tolua_tonumber(tolua_S,2,0)); - double a_BlockX = ((double) tolua_tonumber(tolua_S,3,0)); - double a_BlockY = ((double) tolua_tonumber(tolua_S,4,0)); - double a_BlockZ = ((double) tolua_tonumber(tolua_S,5,0)); - bool a_CanCauseFire = ((bool) tolua_toboolean(tolua_S,6,0)); - eExplosionSource a_Source = ((eExplosionSource) (int) tolua_tonumber(tolua_S,7,0)); - void* a_SourceData = ((void*) tolua_touserdata(tolua_S,8,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DoExplosionAt'", NULL); -#endif - { - self->DoExplosionAt(a_ExplosionSize,a_BlockX,a_BlockY,a_BlockZ,a_CanCauseFire,a_Source,a_SourceData); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DoExplosionAt'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: UseBlockEntity of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_UseBlockEntity00 -static int tolua_AllToLua_cWorld_UseBlockEntity00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0)); - int a_BlockX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'UseBlockEntity'", NULL); -#endif - { - self->UseBlockEntity(a_Player,a_BlockX,a_BlockY,a_BlockZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'UseBlockEntity'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GrowTree of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowTree00 -static int tolua_AllToLua_cWorld_GrowTree00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowTree'", NULL); -#endif - { - self->GrowTree(a_BlockX,a_BlockY,a_BlockZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GrowTree'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GrowTreeFromSapling of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowTreeFromSapling00 -static int tolua_AllToLua_cWorld_GrowTreeFromSapling00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_SaplingMeta = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowTreeFromSapling'", NULL); -#endif - { - self->GrowTreeFromSapling(a_BlockX,a_BlockY,a_BlockZ,a_SaplingMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GrowTreeFromSapling'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GrowTreeByBiome of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowTreeByBiome00 -static int tolua_AllToLua_cWorld_GrowTreeByBiome00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowTreeByBiome'", NULL); -#endif - { - self->GrowTreeByBiome(a_BlockX,a_BlockY,a_BlockZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GrowTreeByBiome'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GrowRipePlant of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowRipePlant00 -static int tolua_AllToLua_cWorld_GrowRipePlant00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isboolean(tolua_S,5,1,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - bool a_IsByBonemeal = ((bool) tolua_toboolean(tolua_S,5,false)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowRipePlant'", NULL); -#endif - { - bool tolua_ret = (bool) self->GrowRipePlant(a_BlockX,a_BlockY,a_BlockZ,a_IsByBonemeal); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GrowRipePlant'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GrowCactus of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowCactus00 -static int tolua_AllToLua_cWorld_GrowCactus00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - int a_NumBlocksToGrow = ((int) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowCactus'", NULL); -#endif - { - self->GrowCactus(a_BlockX,a_BlockY,a_BlockZ,a_NumBlocksToGrow); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GrowCactus'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GrowMelonPumpkin of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowMelonPumpkin00 -static int tolua_AllToLua_cWorld_GrowMelonPumpkin00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowMelonPumpkin'", NULL); -#endif - { - self->GrowMelonPumpkin(a_BlockX,a_BlockY,a_BlockZ,a_BlockType); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GrowMelonPumpkin'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GrowSugarcane of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowSugarcane00 -static int tolua_AllToLua_cWorld_GrowSugarcane00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - int a_NumBlocksToGrow = ((int) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowSugarcane'", NULL); -#endif - { - self->GrowSugarcane(a_BlockX,a_BlockY,a_BlockZ,a_NumBlocksToGrow); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GrowSugarcane'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBiomeAt of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBiomeAt00 -static int tolua_AllToLua_cWorld_GetBiomeAt00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBiomeAt'", NULL); -#endif - { - int tolua_ret = (int) self->GetBiomeAt(a_BlockX,a_BlockZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBiomeAt'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetName of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetName00 -static int tolua_AllToLua_cWorld_GetName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetName'", NULL); -#endif - { - const AString tolua_ret = (const AString) self->GetName(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetIniFileName of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetIniFileName00 -static int tolua_AllToLua_cWorld_GetIniFileName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetIniFileName'", NULL); -#endif - { - const AString tolua_ret = (const AString) self->GetIniFileName(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetIniFileName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: QueueSaveAllChunks of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_QueueSaveAllChunks00 -static int tolua_AllToLua_cWorld_QueueSaveAllChunks00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'QueueSaveAllChunks'", NULL); -#endif - { - self->QueueSaveAllChunks(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'QueueSaveAllChunks'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNumChunks of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetNumChunks00 -static int tolua_AllToLua_cWorld_GetNumChunks00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumChunks'", NULL); -#endif - { - int tolua_ret = (int) self->GetNumChunks(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetNumChunks'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetGeneratorQueueLength of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetGeneratorQueueLength00 -static int tolua_AllToLua_cWorld_GetGeneratorQueueLength00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetGeneratorQueueLength'", NULL); -#endif - { - int tolua_ret = (int) self->GetGeneratorQueueLength(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetGeneratorQueueLength'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetLightingQueueLength of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetLightingQueueLength00 -static int tolua_AllToLua_cWorld_GetLightingQueueLength00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLightingQueueLength'", NULL); -#endif - { - int tolua_ret = (int) self->GetLightingQueueLength(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetLightingQueueLength'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetStorageLoadQueueLength of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetStorageLoadQueueLength00 -static int tolua_AllToLua_cWorld_GetStorageLoadQueueLength00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetStorageLoadQueueLength'", NULL); -#endif - { - int tolua_ret = (int) self->GetStorageLoadQueueLength(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetStorageLoadQueueLength'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetStorageSaveQueueLength of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetStorageSaveQueueLength00 -static int tolua_AllToLua_cWorld_GetStorageSaveQueueLength00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetStorageSaveQueueLength'", NULL); -#endif - { - int tolua_ret = (int) self->GetStorageSaveQueueLength(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetStorageSaveQueueLength'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: QueueBlockForTick of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_QueueBlockForTick00 -static int tolua_AllToLua_cWorld_QueueBlockForTick00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - int a_TicksToWait = ((int) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'QueueBlockForTick'", NULL); -#endif - { - self->QueueBlockForTick(a_BlockX,a_BlockY,a_BlockZ,a_TicksToWait); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'QueueBlockForTick'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CastThunderbolt of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_CastThunderbolt00 -static int tolua_AllToLua_cWorld_CastThunderbolt00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CastThunderbolt'", NULL); -#endif - { - self->CastThunderbolt(a_BlockX,a_BlockY,a_BlockZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CastThunderbolt'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetWeather of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetWeather00 -static int tolua_AllToLua_cWorld_SetWeather00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - eWeather a_NewWeather = ((eWeather) (int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetWeather'", NULL); -#endif - { - self->SetWeather(a_NewWeather); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetWeather'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ChangeWeather of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_ChangeWeather00 -static int tolua_AllToLua_cWorld_ChangeWeather00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ChangeWeather'", NULL); -#endif - { - self->ChangeWeather(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ChangeWeather'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWeather of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetWeather00 -static int tolua_AllToLua_cWorld_GetWeather00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWeather'", NULL); -#endif - { - eWeather tolua_ret = (eWeather) self->GetWeather(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWeather'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsWeatherSunny of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherSunny00 -static int tolua_AllToLua_cWorld_IsWeatherSunny00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherSunny'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsWeatherSunny(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsWeatherSunny'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsWeatherRain of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherRain00 -static int tolua_AllToLua_cWorld_IsWeatherRain00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherRain'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsWeatherRain(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsWeatherRain'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsWeatherStorm of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherStorm00 -static int tolua_AllToLua_cWorld_IsWeatherStorm00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherStorm'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsWeatherStorm(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsWeatherStorm'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsWeatherWet of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherWet00 -static int tolua_AllToLua_cWorld_IsWeatherWet00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherWet'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsWeatherWet(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsWeatherWet'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetNextBlockTick of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetNextBlockTick00 -static int tolua_AllToLua_cWorld_SetNextBlockTick00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetNextBlockTick'", NULL); -#endif - { - self->SetNextBlockTick(a_BlockX,a_BlockY,a_BlockZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetNextBlockTick'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetMaxSugarcaneHeight of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetMaxSugarcaneHeight00 -static int tolua_AllToLua_cWorld_GetMaxSugarcaneHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxSugarcaneHeight'", NULL); -#endif - { - int tolua_ret = (int) self->GetMaxSugarcaneHeight(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMaxSugarcaneHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetMaxCactusHeight of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetMaxCactusHeight00 -static int tolua_AllToLua_cWorld_GetMaxCactusHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxCactusHeight'", NULL); -#endif - { - int tolua_ret = (int) self->GetMaxCactusHeight(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMaxCactusHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsBlockDirectlyWatered of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsBlockDirectlyWatered00 -static int tolua_AllToLua_cWorld_IsBlockDirectlyWatered00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsBlockDirectlyWatered'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsBlockDirectlyWatered(a_BlockX,a_BlockY,a_BlockZ); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsBlockDirectlyWatered'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SpawnMob of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SpawnMob00 -static int tolua_AllToLua_cWorld_SpawnMob00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_PosY = ((double) tolua_tonumber(tolua_S,3,0)); - double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0)); - cMonster::eType a_MonsterType = ((cMonster::eType) (int) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnMob'", NULL); -#endif - { - int tolua_ret = (int) self->SpawnMob(a_PosX,a_PosY,a_PosZ,a_MonsterType); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SpawnMob'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CreateProjectile of class cWorld */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_CreateProjectile00 -static int tolua_AllToLua_cWorld_CreateProjectile00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isusertype(tolua_S,6,"cEntity",0,&tolua_err) || - !tolua_isusertype(tolua_S,7,"const Vector3d",1,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); - double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_PosY = ((double) tolua_tonumber(tolua_S,3,0)); - double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0)); - cProjectileEntity::eKind a_Kind = ((cProjectileEntity::eKind) (int) tolua_tonumber(tolua_S,5,0)); - cEntity* a_Creator = ((cEntity*) tolua_tousertype(tolua_S,6,0)); - const Vector3d* a_Speed = ((const Vector3d*) tolua_tousertype(tolua_S,7,NULL)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CreateProjectile'", NULL); -#endif - { - int tolua_ret = (int) self->CreateProjectile(a_PosX,a_PosY,a_PosZ,a_Kind,a_Creator,a_Speed); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CreateProjectile'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Clear of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_Clear00 -static int tolua_AllToLua_cInventory_Clear00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); -#endif - { - self->Clear(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HowManyCanFit of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_HowManyCanFit00 -static int tolua_AllToLua_cInventory_HowManyCanFit00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isboolean(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - const cItem* a_ItemStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); - bool a_ConsiderEmptySlots = ((bool) tolua_toboolean(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HowManyCanFit'", NULL); -#endif - { - int tolua_ret = (int) self->HowManyCanFit(*a_ItemStack,a_ConsiderEmptySlots); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HowManyCanFit'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HowManyCanFit of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_HowManyCanFit01 -static int tolua_AllToLua_cInventory_HowManyCanFit01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isboolean(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - const cItem* a_ItemStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); - int a_BeginSlotNum = ((int) tolua_tonumber(tolua_S,3,0)); - int a_EndSlotNum = ((int) tolua_tonumber(tolua_S,4,0)); - bool a_ConsiderEmptySlots = ((bool) tolua_toboolean(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HowManyCanFit'", NULL); -#endif - { - int tolua_ret = (int) self->HowManyCanFit(*a_ItemStack,a_BeginSlotNum,a_EndSlotNum,a_ConsiderEmptySlots); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cInventory_HowManyCanFit00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddItem of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_AddItem00 -static int tolua_AllToLua_cInventory_AddItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isboolean(tolua_S,3,1,&tolua_err) || - !tolua_isboolean(tolua_S,4,1,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - const cItem* a_ItemStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); - bool a_AllowNewStacks = ((bool) tolua_toboolean(tolua_S,3,true)); - bool a_tryToFillEquippedFirst = ((bool) tolua_toboolean(tolua_S,4,false)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddItem'", NULL); -#endif - { - int tolua_ret = (int) self->AddItem(*a_ItemStack,a_AllowNewStacks,a_tryToFillEquippedFirst); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddItems of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_AddItems00 -static int tolua_AllToLua_cInventory_AddItems00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cItems",0,&tolua_err)) || - !tolua_isboolean(tolua_S,3,0,&tolua_err) || - !tolua_isboolean(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - cItems* a_ItemStackList = ((cItems*) tolua_tousertype(tolua_S,2,0)); - bool a_AllowNewStacks = ((bool) tolua_toboolean(tolua_S,3,0)); - bool a_tryToFillEquippedFirst = ((bool) tolua_toboolean(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddItems'", NULL); -#endif - { - int tolua_ret = (int) self->AddItems(*a_ItemStackList,a_AllowNewStacks,a_tryToFillEquippedFirst); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddItems'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: RemoveOneEquippedItem of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_RemoveOneEquippedItem00 -static int tolua_AllToLua_cInventory_RemoveOneEquippedItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RemoveOneEquippedItem'", NULL); -#endif - { - bool tolua_ret = (bool) self->RemoveOneEquippedItem(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'RemoveOneEquippedItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HowManyItems of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_HowManyItems00 -static int tolua_AllToLua_cInventory_HowManyItems00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HowManyItems'", NULL); -#endif - { - int tolua_ret = (int) self->HowManyItems(*a_Item); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HowManyItems'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HasItems of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_HasItems00 -static int tolua_AllToLua_cInventory_HasItems00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - const cItem* a_ItemStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasItems'", NULL); -#endif - { - bool tolua_ret = (bool) self->HasItems(*a_ItemStack); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HasItems'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetArmorGrid of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetArmorGrid00 -static int tolua_AllToLua_cInventory_GetArmorGrid00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetArmorGrid'", NULL); -#endif - { - cItemGrid& tolua_ret = (cItemGrid&) self->GetArmorGrid(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItemGrid"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetArmorGrid'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetInventoryGrid of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetInventoryGrid00 -static int tolua_AllToLua_cInventory_GetInventoryGrid00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetInventoryGrid'", NULL); -#endif - { - cItemGrid& tolua_ret = (cItemGrid&) self->GetInventoryGrid(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItemGrid"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetInventoryGrid'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetHotbarGrid of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetHotbarGrid00 -static int tolua_AllToLua_cInventory_GetHotbarGrid00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHotbarGrid'", NULL); -#endif - { - cItemGrid& tolua_ret = (cItemGrid&) self->GetHotbarGrid(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItemGrid"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetHotbarGrid'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetOwner of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetOwner00 -static int tolua_AllToLua_cInventory_GetOwner00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOwner'", NULL); -#endif - { - cPlayer& tolua_ret = (cPlayer&) self->GetOwner(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cPlayer"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetOwner'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CopyToItems of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_CopyToItems00 -static int tolua_AllToLua_cInventory_CopyToItems00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cItems",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - cItems* a_Items = ((cItems*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CopyToItems'", NULL); -#endif - { - self->CopyToItems(*a_Items); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CopyToItems'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSlot of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetSlot00 -static int tolua_AllToLua_cInventory_GetSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlot'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetSlot(a_SlotNum); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetArmorSlot of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetArmorSlot00 -static int tolua_AllToLua_cInventory_GetArmorSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); - int a_ArmorSlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetArmorSlot'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetArmorSlot(a_ArmorSlotNum); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetArmorSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetInventorySlot of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetInventorySlot00 -static int tolua_AllToLua_cInventory_GetInventorySlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); - int a_InventorySlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetInventorySlot'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetInventorySlot(a_InventorySlotNum); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetInventorySlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetHotbarSlot of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetHotbarSlot00 -static int tolua_AllToLua_cInventory_GetHotbarSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); - int a_HotBarSlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHotbarSlot'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetHotbarSlot(a_HotBarSlotNum); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetHotbarSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEquippedItem of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetEquippedItem00 -static int tolua_AllToLua_cInventory_GetEquippedItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedItem'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetEquippedItem(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEquippedItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSlot of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_SetSlot00 -static int tolua_AllToLua_cInventory_SetSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); -#endif - { - self->SetSlot(a_SlotNum,*a_Item); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetArmorSlot of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_SetArmorSlot00 -static int tolua_AllToLua_cInventory_SetArmorSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - int a_ArmorSlotNum = ((int) tolua_tonumber(tolua_S,2,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetArmorSlot'", NULL); -#endif - { - self->SetArmorSlot(a_ArmorSlotNum,*a_Item); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetArmorSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetInventorySlot of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_SetInventorySlot00 -static int tolua_AllToLua_cInventory_SetInventorySlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - int a_InventorySlotNum = ((int) tolua_tonumber(tolua_S,2,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetInventorySlot'", NULL); -#endif - { - self->SetInventorySlot(a_InventorySlotNum,*a_Item); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetInventorySlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetHotbarSlot of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_SetHotbarSlot00 -static int tolua_AllToLua_cInventory_SetHotbarSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - int a_HotBarSlotNum = ((int) tolua_tonumber(tolua_S,2,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetHotbarSlot'", NULL); -#endif - { - self->SetHotbarSlot(a_HotBarSlotNum,*a_Item); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetHotbarSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetEquippedSlotNum of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_SetEquippedSlotNum00 -static int tolua_AllToLua_cInventory_SetEquippedSlotNum00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetEquippedSlotNum'", NULL); -#endif - { - self->SetEquippedSlotNum(a_SlotNum); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetEquippedSlotNum'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEquippedSlotNum of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetEquippedSlotNum00 -static int tolua_AllToLua_cInventory_GetEquippedSlotNum00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedSlotNum'", NULL); -#endif - { - int tolua_ret = (int) self->GetEquippedSlotNum(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEquippedSlotNum'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ChangeSlotCount of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_ChangeSlotCount00 -static int tolua_AllToLua_cInventory_ChangeSlotCount00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); - int a_AddToCount = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ChangeSlotCount'", NULL); -#endif - { - int tolua_ret = (int) self->ChangeSlotCount(a_SlotNum,a_AddToCount); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ChangeSlotCount'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DamageItem of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_DamageItem00 -static int tolua_AllToLua_cInventory_DamageItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); - short a_Amount = ((short) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DamageItem'", NULL); -#endif - { - bool tolua_ret = (bool) self->DamageItem(a_SlotNum,a_Amount); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DamageItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DamageEquippedItem of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_DamageEquippedItem00 -static int tolua_AllToLua_cInventory_DamageEquippedItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,1,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); - short a_Amount = ((short) tolua_tonumber(tolua_S,2,1)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DamageEquippedItem'", NULL); -#endif - { - bool tolua_ret = (bool) self->DamageEquippedItem(a_Amount); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DamageEquippedItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEquippedHelmet of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetEquippedHelmet00 -static int tolua_AllToLua_cInventory_GetEquippedHelmet00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedHelmet'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetEquippedHelmet(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEquippedHelmet'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEquippedChestplate of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetEquippedChestplate00 -static int tolua_AllToLua_cInventory_GetEquippedChestplate00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedChestplate'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetEquippedChestplate(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEquippedChestplate'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEquippedLeggings of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetEquippedLeggings00 -static int tolua_AllToLua_cInventory_GetEquippedLeggings00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedLeggings'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetEquippedLeggings(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEquippedLeggings'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetEquippedBoots of class cInventory */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetEquippedBoots00 -static int tolua_AllToLua_cInventory_GetEquippedBoots00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedBoots'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetEquippedBoots(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetEquippedBoots'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cEnchantments */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_new00 -static int tolua_AllToLua_cEnchantments_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cEnchantments",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cEnchantments* tolua_ret = (cEnchantments*) Mtolua_new((cEnchantments)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cEnchantments"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cEnchantments */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_new00_local -static int tolua_AllToLua_cEnchantments_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cEnchantments",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cEnchantments* tolua_ret = (cEnchantments*) Mtolua_new((cEnchantments)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cEnchantments"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cEnchantments */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_new01 -static int tolua_AllToLua_cEnchantments_new01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cEnchantments",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const AString a_StringSpec = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - cEnchantments* tolua_ret = (cEnchantments*) Mtolua_new((cEnchantments)(a_StringSpec)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cEnchantments"); - tolua_pushcppstring(tolua_S,(const char*)a_StringSpec); - } - } - return 2; -tolua_lerror: - return tolua_AllToLua_cEnchantments_new00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cEnchantments */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_new01_local -static int tolua_AllToLua_cEnchantments_new01_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cEnchantments",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const AString a_StringSpec = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - cEnchantments* tolua_ret = (cEnchantments*) Mtolua_new((cEnchantments)(a_StringSpec)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cEnchantments"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - tolua_pushcppstring(tolua_S,(const char*)a_StringSpec); - } - } - return 2; -tolua_lerror: - return tolua_AllToLua_cEnchantments_new00_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddFromString of class cEnchantments */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_AddFromString00 -static int tolua_AllToLua_cEnchantments_AddFromString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEnchantments",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEnchantments* self = (cEnchantments*) tolua_tousertype(tolua_S,1,0); - const AString a_StringSpec = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddFromString'", NULL); -#endif - { - self->AddFromString(a_StringSpec); - tolua_pushcppstring(tolua_S,(const char*)a_StringSpec); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddFromString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ToString of class cEnchantments */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_ToString00 -static int tolua_AllToLua_cEnchantments_ToString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEnchantments",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEnchantments* self = (const cEnchantments*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ToString'", NULL); -#endif - { - AString tolua_ret = (AString) self->ToString(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ToString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetLevel of class cEnchantments */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_GetLevel00 -static int tolua_AllToLua_cEnchantments_GetLevel00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEnchantments",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEnchantments* self = (const cEnchantments*) tolua_tousertype(tolua_S,1,0); - int a_EnchantmentID = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLevel'", NULL); -#endif - { - int tolua_ret = (int) self->GetLevel(a_EnchantmentID); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetLevel'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetLevel of class cEnchantments */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_SetLevel00 -static int tolua_AllToLua_cEnchantments_SetLevel00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEnchantments",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEnchantments* self = (cEnchantments*) tolua_tousertype(tolua_S,1,0); - int a_EnchantmentID = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Level = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetLevel'", NULL); -#endif - { - self->SetLevel(a_EnchantmentID,a_Level); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetLevel'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Clear of class cEnchantments */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_Clear00 -static int tolua_AllToLua_cEnchantments_Clear00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cEnchantments",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cEnchantments* self = (cEnchantments*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); -#endif - { - self->Clear(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsEmpty of class cEnchantments */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_IsEmpty00 -static int tolua_AllToLua_cEnchantments_IsEmpty00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEnchantments",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEnchantments* self = (const cEnchantments*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsEmpty'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsEmpty(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsEmpty'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: StringToEnchantmentID of class cEnchantments */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_StringToEnchantmentID00 -static int tolua_AllToLua_cEnchantments_StringToEnchantmentID00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cEnchantments",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_EnchantmentName = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - int tolua_ret = (int) cEnchantments::StringToEnchantmentID(a_EnchantmentName); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_EnchantmentName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'StringToEnchantmentID'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator== of class cEnchantments */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments__eq00 -static int tolua_AllToLua_cEnchantments__eq00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cEnchantments",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cEnchantments",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cEnchantments* self = (const cEnchantments*) tolua_tousertype(tolua_S,1,0); - const cEnchantments* a_Other = ((const cEnchantments*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator=='", NULL); -#endif - { - bool tolua_ret = (bool) self->operator==(*a_Other); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function '.eq'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new00 -static int tolua_AllToLua_cItem_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cItem* tolua_ret = (cItem*) Mtolua_new((cItem)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new00_local -static int tolua_AllToLua_cItem_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cItem* tolua_ret = (cItem*) Mtolua_new((cItem)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new01 -static int tolua_AllToLua_cItem_new01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,1,&tolua_err) || - !tolua_isnumber(tolua_S,4,1,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - short a_ItemType = ((short) tolua_tonumber(tolua_S,2,0)); - char a_ItemCount = ((char) tolua_tonumber(tolua_S,3,1)); - short a_ItemDamage = ((short) tolua_tonumber(tolua_S,4,0)); - { - cItem* tolua_ret = (cItem*) Mtolua_new((cItem)(a_ItemType,a_ItemCount,a_ItemDamage)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cItem_new00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new01_local -static int tolua_AllToLua_cItem_new01_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,1,&tolua_err) || - !tolua_isnumber(tolua_S,4,1,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - short a_ItemType = ((short) tolua_tonumber(tolua_S,2,0)); - char a_ItemCount = ((char) tolua_tonumber(tolua_S,3,1)); - short a_ItemDamage = ((short) tolua_tonumber(tolua_S,4,0)); - { - cItem* tolua_ret = (cItem*) Mtolua_new((cItem)(a_ItemType,a_ItemCount,a_ItemDamage)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cItem_new00_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new02 -static int tolua_AllToLua_cItem_new02(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_iscppstring(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else - { - short a_ItemType = ((short) tolua_tonumber(tolua_S,2,0)); - char a_ItemCount = ((char) tolua_tonumber(tolua_S,3,0)); - short a_ItemDamage = ((short) tolua_tonumber(tolua_S,4,0)); - const AString a_Enchantments = ((const AString) tolua_tocppstring(tolua_S,5,0)); - { - cItem* tolua_ret = (cItem*) Mtolua_new((cItem)(a_ItemType,a_ItemCount,a_ItemDamage,a_Enchantments)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); - tolua_pushcppstring(tolua_S,(const char*)a_Enchantments); - } - } - return 2; -tolua_lerror: - return tolua_AllToLua_cItem_new01(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new02_local -static int tolua_AllToLua_cItem_new02_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_iscppstring(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else - { - short a_ItemType = ((short) tolua_tonumber(tolua_S,2,0)); - char a_ItemCount = ((char) tolua_tonumber(tolua_S,3,0)); - short a_ItemDamage = ((short) tolua_tonumber(tolua_S,4,0)); - const AString a_Enchantments = ((const AString) tolua_tocppstring(tolua_S,5,0)); - { - cItem* tolua_ret = (cItem*) Mtolua_new((cItem)(a_ItemType,a_ItemCount,a_ItemDamage,a_Enchantments)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - tolua_pushcppstring(tolua_S,(const char*)a_Enchantments); - } - } - return 2; -tolua_lerror: - return tolua_AllToLua_cItem_new01_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new03 -static int tolua_AllToLua_cItem_new03(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const cItem* a_CopyFrom = ((const cItem*) tolua_tousertype(tolua_S,2,0)); - { - cItem* tolua_ret = (cItem*) Mtolua_new((cItem)(*a_CopyFrom)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cItem_new02(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new03_local -static int tolua_AllToLua_cItem_new03_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const cItem* a_CopyFrom = ((const cItem*) tolua_tousertype(tolua_S,2,0)); - { - cItem* tolua_ret = (cItem*) Mtolua_new((cItem)(*a_CopyFrom)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cItem_new02_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Empty of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_Empty00 -static int tolua_AllToLua_cItem_Empty00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItem",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Empty'", NULL); -#endif - { - self->Empty(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Empty'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Clear of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_Clear00 -static int tolua_AllToLua_cItem_Clear00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItem",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); -#endif - { - self->Clear(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsEmpty of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_IsEmpty00 -static int tolua_AllToLua_cItem_IsEmpty00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsEmpty'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsEmpty(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsEmpty'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsEqual of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_IsEqual00 -static int tolua_AllToLua_cItem_IsEqual00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsEqual'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsEqual(*a_Item); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsEqual'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsSameType of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_IsSameType00 -static int tolua_AllToLua_cItem_IsSameType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSameType'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsSameType(*a_Item); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsSameType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CopyOne of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_CopyOne00 -static int tolua_AllToLua_cItem_CopyOne00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CopyOne'", NULL); -#endif - { - cItem tolua_ret = (cItem) self->CopyOne(); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CopyOne'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddCount of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_AddCount00 -static int tolua_AllToLua_cItem_AddCount00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItem",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); - char a_AmountToAdd = ((char) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddCount'", NULL); -#endif - { - cItem& tolua_ret = (cItem&) self->AddCount(a_AmountToAdd); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddCount'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetMaxDamage of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_GetMaxDamage00 -static int tolua_AllToLua_cItem_GetMaxDamage00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxDamage'", NULL); -#endif - { - short tolua_ret = (short) self->GetMaxDamage(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMaxDamage'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DamageItem of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_DamageItem00 -static int tolua_AllToLua_cItem_DamageItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItem",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,1,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); - short a_Amount = ((short) tolua_tonumber(tolua_S,2,1)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DamageItem'", NULL); -#endif - { - bool tolua_ret = (bool) self->DamageItem(a_Amount); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DamageItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsDamageable of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_IsDamageable00 -static int tolua_AllToLua_cItem_IsDamageable00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsDamageable'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsDamageable(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsDamageable'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsStackableWith of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_IsStackableWith00 -static int tolua_AllToLua_cItem_IsStackableWith00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); - const cItem* a_OtherStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsStackableWith'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsStackableWith(*a_OtherStack); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsStackableWith'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsFullStack of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_IsFullStack00 -static int tolua_AllToLua_cItem_IsFullStack00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsFullStack'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsFullStack(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsFullStack'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetMaxStackSize of class cItem */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_GetMaxStackSize00 -static int tolua_AllToLua_cItem_GetMaxStackSize00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxStackSize'", NULL); -#endif - { - char tolua_ret = (char) self->GetMaxStackSize(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMaxStackSize'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: m_ItemType of class cItem */ -#ifndef TOLUA_DISABLE_tolua_get_cItem_m_ItemType -static int tolua_get_cItem_m_ItemType(lua_State* tolua_S) -{ - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_ItemType'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->m_ItemType); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: m_ItemType of class cItem */ -#ifndef TOLUA_DISABLE_tolua_set_cItem_m_ItemType -static int tolua_set_cItem_m_ItemType(lua_State* tolua_S) -{ - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_ItemType'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->m_ItemType = ((short) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: m_ItemCount of class cItem */ -#ifndef TOLUA_DISABLE_tolua_get_cItem_m_ItemCount -static int tolua_get_cItem_m_ItemCount(lua_State* tolua_S) -{ - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_ItemCount'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->m_ItemCount); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: m_ItemCount of class cItem */ -#ifndef TOLUA_DISABLE_tolua_set_cItem_m_ItemCount -static int tolua_set_cItem_m_ItemCount(lua_State* tolua_S) -{ - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_ItemCount'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->m_ItemCount = ((char) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: m_ItemDamage of class cItem */ -#ifndef TOLUA_DISABLE_tolua_get_cItem_m_ItemDamage -static int tolua_get_cItem_m_ItemDamage(lua_State* tolua_S) -{ - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_ItemDamage'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->m_ItemDamage); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: m_ItemDamage of class cItem */ -#ifndef TOLUA_DISABLE_tolua_set_cItem_m_ItemDamage -static int tolua_set_cItem_m_ItemDamage(lua_State* tolua_S) -{ - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_ItemDamage'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->m_ItemDamage = ((short) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: m_Enchantments of class cItem */ -#ifndef TOLUA_DISABLE_tolua_get_cItem_m_Enchantments -static int tolua_get_cItem_m_Enchantments(lua_State* tolua_S) -{ - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_Enchantments'",NULL); -#endif - tolua_pushusertype(tolua_S,(void*)&self->m_Enchantments,"cEnchantments"); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: m_Enchantments of class cItem */ -#ifndef TOLUA_DISABLE_tolua_set_cItem_m_Enchantments -static int tolua_set_cItem_m_Enchantments(lua_State* tolua_S) -{ - cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_Enchantments'",NULL); - if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cEnchantments",0,&tolua_err))) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->m_Enchantments = *((cEnchantments*) tolua_tousertype(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_new00 -static int tolua_AllToLua_cItems_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cItems",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cItems* tolua_ret = (cItems*) Mtolua_new((cItems)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItems"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_new00_local -static int tolua_AllToLua_cItems_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cItems",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cItems* tolua_ret = (cItems*) Mtolua_new((cItems)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItems"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Get of class cItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Get00 -static int tolua_AllToLua_cItems_Get00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); - int a_Idx = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Get'", NULL); -#endif - { - cItem* tolua_ret = (cItem*) self->Get(a_Idx); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Get'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Set of class cItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Set00 -static int tolua_AllToLua_cItems_Set00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); - int a_Idx = ((int) tolua_tonumber(tolua_S,2,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL); -#endif - { - self->Set(a_Idx,*a_Item); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Set'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Add of class cItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Add00 -static int tolua_AllToLua_cItems_Add00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Add'", NULL); -#endif - { - self->Add(*a_Item); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Add'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Delete of class cItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Delete00 -static int tolua_AllToLua_cItems_Delete00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); - int a_Idx = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Delete'", NULL); -#endif - { - self->Delete(a_Idx); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Delete'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Clear of class cItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Clear00 -static int tolua_AllToLua_cItems_Clear00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); -#endif - { - self->Clear(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Size of class cItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Size00 -static int tolua_AllToLua_cItems_Size00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Size'", NULL); -#endif - { - int tolua_ret = (int) self->Size(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Size'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Set of class cItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Set01 -static int tolua_AllToLua_cItems_Set01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else - { - cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); - int a_Idx = ((int) tolua_tonumber(tolua_S,2,0)); - ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,3,0)); - char a_ItemCount = ((char) tolua_tonumber(tolua_S,4,0)); - short a_ItemDamage = ((short) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL); -#endif - { - self->Set(a_Idx,a_ItemType,a_ItemCount,a_ItemDamage); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cItems_Set00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Add of class cItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Add01 -static int tolua_AllToLua_cItems_Add01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); - ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,2,0)); - char a_ItemCount = ((char) tolua_tonumber(tolua_S,3,0)); - short a_ItemDamage = ((short) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Add'", NULL); -#endif - { - self->Add(a_ItemType,a_ItemCount,a_ItemDamage); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cItems_Add00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWidth of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetWidth00 -static int tolua_AllToLua_cItemGrid_GetWidth00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWidth'", NULL); -#endif - { - int tolua_ret = (int) self->GetWidth(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWidth'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetHeight of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetHeight00 -static int tolua_AllToLua_cItemGrid_GetHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeight'", NULL); -#endif - { - int tolua_ret = (int) self->GetHeight(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNumSlots of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetNumSlots00 -static int tolua_AllToLua_cItemGrid_GetNumSlots00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumSlots'", NULL); -#endif - { - int tolua_ret = (int) self->GetNumSlots(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetNumSlots'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSlotNum of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetSlotNum00 -static int tolua_AllToLua_cItemGrid_GetSlotNum00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlotNum'", NULL); -#endif - { - int tolua_ret = (int) self->GetSlotNum(a_X,a_Y); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSlotNum'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetSlot00 -static int tolua_AllToLua_cItemGrid_GetSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlot'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetSlot(a_X,a_Y); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetSlot01 -static int tolua_AllToLua_cItemGrid_GetSlot01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlot'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetSlot(a_SlotNum); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cItemGrid_GetSlot00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_SetSlot00 -static int tolua_AllToLua_cItemGrid_SetSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); -#endif - { - self->SetSlot(a_X,a_Y,*a_Item); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_SetSlot01 -static int tolua_AllToLua_cItemGrid_SetSlot01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); - short a_ItemType = ((short) tolua_tonumber(tolua_S,4,0)); - char a_ItemCount = ((char) tolua_tonumber(tolua_S,5,0)); - short a_ItemDamage = ((short) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); -#endif - { - self->SetSlot(a_X,a_Y,a_ItemType,a_ItemCount,a_ItemDamage); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cItemGrid_SetSlot00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_SetSlot02 -static int tolua_AllToLua_cItemGrid_SetSlot02(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); -#endif - { - self->SetSlot(a_SlotNum,*a_Item); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cItemGrid_SetSlot01(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_SetSlot03 -static int tolua_AllToLua_cItemGrid_SetSlot03(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); - short a_ItemType = ((short) tolua_tonumber(tolua_S,3,0)); - char a_ItemCount = ((char) tolua_tonumber(tolua_S,4,0)); - short a_ItemDamage = ((short) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); -#endif - { - self->SetSlot(a_SlotNum,a_ItemType,a_ItemCount,a_ItemDamage); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cItemGrid_SetSlot02(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: EmptySlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_EmptySlot00 -static int tolua_AllToLua_cItemGrid_EmptySlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'EmptySlot'", NULL); -#endif - { - self->EmptySlot(a_X,a_Y); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'EmptySlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: EmptySlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_EmptySlot01 -static int tolua_AllToLua_cItemGrid_EmptySlot01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'EmptySlot'", NULL); -#endif - { - self->EmptySlot(a_SlotNum); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cItemGrid_EmptySlot00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsSlotEmpty of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_IsSlotEmpty00 -static int tolua_AllToLua_cItemGrid_IsSlotEmpty00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSlotEmpty'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsSlotEmpty(a_SlotNum); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsSlotEmpty'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsSlotEmpty of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_IsSlotEmpty01 -static int tolua_AllToLua_cItemGrid_IsSlotEmpty01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSlotEmpty'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsSlotEmpty(a_X,a_Y); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cItemGrid_IsSlotEmpty00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Clear of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_Clear00 -static int tolua_AllToLua_cItemGrid_Clear00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); -#endif - { - self->Clear(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HowManyCanFit of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_HowManyCanFit00 -static int tolua_AllToLua_cItemGrid_HowManyCanFit00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isboolean(tolua_S,3,1,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - const cItem* a_ItemStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); - bool a_AllowNewStacks = ((bool) tolua_toboolean(tolua_S,3,true)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HowManyCanFit'", NULL); -#endif - { - int tolua_ret = (int) self->HowManyCanFit(*a_ItemStack,a_AllowNewStacks); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HowManyCanFit'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddItem of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_AddItem00 -static int tolua_AllToLua_cItemGrid_AddItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cItem",0,&tolua_err)) || - !tolua_isboolean(tolua_S,3,1,&tolua_err) || - !tolua_isnumber(tolua_S,4,1,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - cItem* a_ItemStack = ((cItem*) tolua_tousertype(tolua_S,2,0)); - bool a_AllowNewStacks = ((bool) tolua_toboolean(tolua_S,3,true)); - int a_PrioritarySlot = ((int) tolua_tonumber(tolua_S,4,-1)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddItem'", NULL); -#endif - { - int tolua_ret = (int) self->AddItem(*a_ItemStack,a_AllowNewStacks,a_PrioritarySlot); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddItems of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_AddItems00 -static int tolua_AllToLua_cItemGrid_AddItems00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cItems",0,&tolua_err)) || - !tolua_isboolean(tolua_S,3,1,&tolua_err) || - !tolua_isnumber(tolua_S,4,1,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - cItems* a_ItemStackList = ((cItems*) tolua_tousertype(tolua_S,2,0)); - bool a_AllowNewStacks = ((bool) tolua_toboolean(tolua_S,3,true)); - int a_PrioritarySlot = ((int) tolua_tonumber(tolua_S,4,-1)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddItems'", NULL); -#endif - { - int tolua_ret = (int) self->AddItems(*a_ItemStackList,a_AllowNewStacks,a_PrioritarySlot); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddItems'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ChangeSlotCount of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_ChangeSlotCount00 -static int tolua_AllToLua_cItemGrid_ChangeSlotCount00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); - int a_AddToCount = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ChangeSlotCount'", NULL); -#endif - { - int tolua_ret = (int) self->ChangeSlotCount(a_SlotNum,a_AddToCount); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ChangeSlotCount'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ChangeSlotCount of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_ChangeSlotCount01 -static int tolua_AllToLua_cItemGrid_ChangeSlotCount01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); - int a_AddToCount = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ChangeSlotCount'", NULL); -#endif - { - int tolua_ret = (int) self->ChangeSlotCount(a_X,a_Y,a_AddToCount); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cItemGrid_ChangeSlotCount00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: RemoveOneItem of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_RemoveOneItem00 -static int tolua_AllToLua_cItemGrid_RemoveOneItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RemoveOneItem'", NULL); -#endif - { - cItem tolua_ret = (cItem) self->RemoveOneItem(a_SlotNum); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'RemoveOneItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: RemoveOneItem of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_RemoveOneItem01 -static int tolua_AllToLua_cItemGrid_RemoveOneItem01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RemoveOneItem'", NULL); -#endif - { - cItem tolua_ret = (cItem) self->RemoveOneItem(a_X,a_Y); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); - tolua_pushusertype(tolua_S,tolua_obj,"cItem"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cItemGrid_RemoveOneItem00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HowManyItems of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_HowManyItems00 -static int tolua_AllToLua_cItemGrid_HowManyItems00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HowManyItems'", NULL); -#endif - { - int tolua_ret = (int) self->HowManyItems(*a_Item); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HowManyItems'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HasItems of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_HasItems00 -static int tolua_AllToLua_cItemGrid_HasItems00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - const cItem* a_ItemStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasItems'", NULL); -#endif - { - bool tolua_ret = (bool) self->HasItems(*a_ItemStack); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HasItems'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetFirstEmptySlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetFirstEmptySlot00 -static int tolua_AllToLua_cItemGrid_GetFirstEmptySlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFirstEmptySlot'", NULL); -#endif - { - int tolua_ret = (int) self->GetFirstEmptySlot(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetFirstEmptySlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetFirstUsedSlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetFirstUsedSlot00 -static int tolua_AllToLua_cItemGrid_GetFirstUsedSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFirstUsedSlot'", NULL); -#endif - { - int tolua_ret = (int) self->GetFirstUsedSlot(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetFirstUsedSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetLastEmptySlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetLastEmptySlot00 -static int tolua_AllToLua_cItemGrid_GetLastEmptySlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLastEmptySlot'", NULL); -#endif - { - int tolua_ret = (int) self->GetLastEmptySlot(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetLastEmptySlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetLastUsedSlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetLastUsedSlot00 -static int tolua_AllToLua_cItemGrid_GetLastUsedSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLastUsedSlot'", NULL); -#endif - { - int tolua_ret = (int) self->GetLastUsedSlot(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetLastUsedSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNextEmptySlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetNextEmptySlot00 -static int tolua_AllToLua_cItemGrid_GetNextEmptySlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_StartFrom = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNextEmptySlot'", NULL); -#endif - { - int tolua_ret = (int) self->GetNextEmptySlot(a_StartFrom); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetNextEmptySlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetNextUsedSlot of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetNextUsedSlot00 -static int tolua_AllToLua_cItemGrid_GetNextUsedSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_StartFrom = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNextUsedSlot'", NULL); -#endif - { - int tolua_ret = (int) self->GetNextUsedSlot(a_StartFrom); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetNextUsedSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CopyToItems of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_CopyToItems00 -static int tolua_AllToLua_cItemGrid_CopyToItems00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cItems",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); - cItems* a_Items = ((cItems*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CopyToItems'", NULL); -#endif - { - self->CopyToItems(*a_Items); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CopyToItems'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DamageItem of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_DamageItem00 -static int tolua_AllToLua_cItemGrid_DamageItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); - short a_Amount = ((short) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DamageItem'", NULL); -#endif - { - bool tolua_ret = (bool) self->DamageItem(a_SlotNum,a_Amount); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DamageItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DamageItem of class cItemGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_DamageItem01 -static int tolua_AllToLua_cItemGrid_DamageItem01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); - short a_Amount = ((short) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DamageItem'", NULL); -#endif - { - bool tolua_ret = (bool) self->DamageItem(a_X,a_Y,a_Amount); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cItemGrid_DamageItem00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPosX of class cBlockEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetPosX00 -static int tolua_AllToLua_cBlockEntity_GetPosX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosX'", NULL); -#endif - { - int tolua_ret = (int) self->GetPosX(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPosX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPosY of class cBlockEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetPosY00 -static int tolua_AllToLua_cBlockEntity_GetPosY00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosY'", NULL); -#endif - { - int tolua_ret = (int) self->GetPosY(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPosY'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPosZ of class cBlockEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetPosZ00 -static int tolua_AllToLua_cBlockEntity_GetPosZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosZ'", NULL); -#endif - { - int tolua_ret = (int) self->GetPosZ(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPosZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockType of class cBlockEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetBlockType00 -static int tolua_AllToLua_cBlockEntity_GetBlockType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockType'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlockType(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWorld of class cBlockEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetWorld00 -static int tolua_AllToLua_cBlockEntity_GetWorld00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWorld'", NULL); -#endif - { - cWorld* tolua_ret = (cWorld*) self->GetWorld(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWorld"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWorld'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetChunkX of class cBlockEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetChunkX00 -static int tolua_AllToLua_cBlockEntity_GetChunkX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetChunkX'", NULL); -#endif - { - int tolua_ret = (int) self->GetChunkX(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetChunkX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetChunkZ of class cBlockEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetChunkZ00 -static int tolua_AllToLua_cBlockEntity_GetChunkZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetChunkZ'", NULL); -#endif - { - int tolua_ret = (int) self->GetChunkZ(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetChunkZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetRelX of class cBlockEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetRelX00 -static int tolua_AllToLua_cBlockEntity_GetRelX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelX'", NULL); -#endif - { - int tolua_ret = (int) self->GetRelX(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetRelX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetRelZ of class cBlockEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetRelZ00 -static int tolua_AllToLua_cBlockEntity_GetRelZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelZ'", NULL); -#endif - { - int tolua_ret = (int) self->GetRelZ(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetRelZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSlot of class cBlockEntityWithItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntityWithItems_GetSlot00 -static int tolua_AllToLua_cBlockEntityWithItems_GetSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockEntityWithItems",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockEntityWithItems* self = (const cBlockEntityWithItems*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlot'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetSlot(a_SlotNum); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSlot of class cBlockEntityWithItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntityWithItems_GetSlot01 -static int tolua_AllToLua_cBlockEntityWithItems_GetSlot01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockEntityWithItems",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - const cBlockEntityWithItems* self = (const cBlockEntityWithItems*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlot'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetSlot(a_X,a_Y); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBlockEntityWithItems_GetSlot00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSlot of class cBlockEntityWithItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntityWithItems_SetSlot00 -static int tolua_AllToLua_cBlockEntityWithItems_SetSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockEntityWithItems",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockEntityWithItems* self = (cBlockEntityWithItems*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); -#endif - { - self->SetSlot(a_SlotNum,*a_Item); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSlot of class cBlockEntityWithItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntityWithItems_SetSlot01 -static int tolua_AllToLua_cBlockEntityWithItems_SetSlot01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockEntityWithItems",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - cBlockEntityWithItems* self = (cBlockEntityWithItems*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); -#endif - { - self->SetSlot(a_X,a_Y,*a_Item); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cBlockEntityWithItems_SetSlot00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetContents of class cBlockEntityWithItems */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntityWithItems_GetContents00 -static int tolua_AllToLua_cBlockEntityWithItems_GetContents00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockEntityWithItems",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockEntityWithItems* self = (cBlockEntityWithItems*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetContents'", NULL); -#endif - { - cItemGrid& tolua_ret = (cItemGrid&) self->GetContents(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItemGrid"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetContents'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddDropSpenserDir of class cDropSpenserEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cDropSpenserEntity_AddDropSpenserDir00 -static int tolua_AllToLua_cDropSpenserEntity_AddDropSpenserDir00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cDropSpenserEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cDropSpenserEntity* self = (cDropSpenserEntity*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_Direction = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddDropSpenserDir'", NULL); -#endif - { - self->AddDropSpenserDir(a_BlockX,a_BlockY,a_BlockZ,a_Direction); - tolua_pushnumber(tolua_S,(lua_Number)a_BlockX); - tolua_pushnumber(tolua_S,(lua_Number)a_BlockY); - tolua_pushnumber(tolua_S,(lua_Number)a_BlockZ); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddDropSpenserDir'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Activate of class cDropSpenserEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cDropSpenserEntity_Activate00 -static int tolua_AllToLua_cDropSpenserEntity_Activate00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cDropSpenserEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cDropSpenserEntity* self = (cDropSpenserEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Activate'", NULL); -#endif - { - self->Activate(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Activate'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetRedstonePower of class cDropSpenserEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cDropSpenserEntity_SetRedstonePower00 -static int tolua_AllToLua_cDropSpenserEntity_SetRedstonePower00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cDropSpenserEntity",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cDropSpenserEntity* self = (cDropSpenserEntity*) tolua_tousertype(tolua_S,1,0); - bool a_IsPowered = ((bool) tolua_toboolean(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRedstonePower'", NULL); -#endif - { - self->SetRedstonePower(a_IsPowered); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetRedstonePower'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetInputSlot of class cFurnaceEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetInputSlot00 -static int tolua_AllToLua_cFurnaceEntity_GetInputSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetInputSlot'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetInputSlot(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetInputSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetFuelSlot of class cFurnaceEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetFuelSlot00 -static int tolua_AllToLua_cFurnaceEntity_GetFuelSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFuelSlot'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetFuelSlot(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetFuelSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetOutputSlot of class cFurnaceEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetOutputSlot00 -static int tolua_AllToLua_cFurnaceEntity_GetOutputSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOutputSlot'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetOutputSlot(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetOutputSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetInputSlot of class cFurnaceEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_SetInputSlot00 -static int tolua_AllToLua_cFurnaceEntity_SetInputSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cFurnaceEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cFurnaceEntity* self = (cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetInputSlot'", NULL); -#endif - { - self->SetInputSlot(*a_Item); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetInputSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetFuelSlot of class cFurnaceEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_SetFuelSlot00 -static int tolua_AllToLua_cFurnaceEntity_SetFuelSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cFurnaceEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cFurnaceEntity* self = (cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFuelSlot'", NULL); -#endif - { - self->SetFuelSlot(*a_Item); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetFuelSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetOutputSlot of class cFurnaceEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_SetOutputSlot00 -static int tolua_AllToLua_cFurnaceEntity_SetOutputSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cFurnaceEntity",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cFurnaceEntity* self = (cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetOutputSlot'", NULL); -#endif - { - self->SetOutputSlot(*a_Item); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetOutputSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetTimeCooked of class cFurnaceEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetTimeCooked00 -static int tolua_AllToLua_cFurnaceEntity_GetTimeCooked00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetTimeCooked'", NULL); -#endif - { - int tolua_ret = (int) self->GetTimeCooked(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetTimeCooked'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetCookTimeLeft of class cFurnaceEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetCookTimeLeft00 -static int tolua_AllToLua_cFurnaceEntity_GetCookTimeLeft00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCookTimeLeft'", NULL); -#endif - { - int tolua_ret = (int) self->GetCookTimeLeft(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetCookTimeLeft'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetFuelBurnTimeLeft of class cFurnaceEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetFuelBurnTimeLeft00 -static int tolua_AllToLua_cFurnaceEntity_GetFuelBurnTimeLeft00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFuelBurnTimeLeft'", NULL); -#endif - { - int tolua_ret = (int) self->GetFuelBurnTimeLeft(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetFuelBurnTimeLeft'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HasFuelTimeLeft of class cFurnaceEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_HasFuelTimeLeft00 -static int tolua_AllToLua_cFurnaceEntity_HasFuelTimeLeft00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasFuelTimeLeft'", NULL); -#endif - { - bool tolua_ret = (bool) self->HasFuelTimeLeft(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HasFuelTimeLeft'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetRecord of class cJukeboxEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cJukeboxEntity_GetRecord00 -static int tolua_AllToLua_cJukeboxEntity_GetRecord00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cJukeboxEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cJukeboxEntity* self = (cJukeboxEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRecord'", NULL); -#endif - { - int tolua_ret = (int) self->GetRecord(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetRecord'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetRecord of class cJukeboxEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cJukeboxEntity_SetRecord00 -static int tolua_AllToLua_cJukeboxEntity_SetRecord00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cJukeboxEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cJukeboxEntity* self = (cJukeboxEntity*) tolua_tousertype(tolua_S,1,0); - int a_Record = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRecord'", NULL); -#endif - { - self->SetRecord(a_Record); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetRecord'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: PlayRecord of class cJukeboxEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cJukeboxEntity_PlayRecord00 -static int tolua_AllToLua_cJukeboxEntity_PlayRecord00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cJukeboxEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cJukeboxEntity* self = (cJukeboxEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'PlayRecord'", NULL); -#endif - { - self->PlayRecord(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'PlayRecord'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: EjectRecord of class cJukeboxEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cJukeboxEntity_EjectRecord00 -static int tolua_AllToLua_cJukeboxEntity_EjectRecord00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cJukeboxEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cJukeboxEntity* self = (cJukeboxEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'EjectRecord'", NULL); -#endif - { - self->EjectRecord(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'EjectRecord'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPitch of class cNoteEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cNoteEntity_GetPitch00 -static int tolua_AllToLua_cNoteEntity_GetPitch00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cNoteEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cNoteEntity* self = (cNoteEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPitch'", NULL); -#endif - { - char tolua_ret = (char) self->GetPitch(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPitch'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetPitch of class cNoteEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cNoteEntity_SetPitch00 -static int tolua_AllToLua_cNoteEntity_SetPitch00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cNoteEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cNoteEntity* self = (cNoteEntity*) tolua_tousertype(tolua_S,1,0); - char a_Pitch = ((char) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPitch'", NULL); -#endif - { - self->SetPitch(a_Pitch); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetPitch'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IncrementPitch of class cNoteEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cNoteEntity_IncrementPitch00 -static int tolua_AllToLua_cNoteEntity_IncrementPitch00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cNoteEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cNoteEntity* self = (cNoteEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IncrementPitch'", NULL); -#endif - { - self->IncrementPitch(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IncrementPitch'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: MakeSound of class cNoteEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cNoteEntity_MakeSound00 -static int tolua_AllToLua_cNoteEntity_MakeSound00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cNoteEntity",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cNoteEntity* self = (cNoteEntity*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MakeSound'", NULL); -#endif - { - self->MakeSound(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'MakeSound'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetLines of class cSignEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cSignEntity_SetLines00 -static int tolua_AllToLua_cSignEntity_SetLines00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cSignEntity",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_iscppstring(tolua_S,4,0,&tolua_err) || - !tolua_iscppstring(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cSignEntity* self = (cSignEntity*) tolua_tousertype(tolua_S,1,0); - const AString a_Line1 = ((const AString) tolua_tocppstring(tolua_S,2,0)); - const AString a_Line2 = ((const AString) tolua_tocppstring(tolua_S,3,0)); - const AString a_Line3 = ((const AString) tolua_tocppstring(tolua_S,4,0)); - const AString a_Line4 = ((const AString) tolua_tocppstring(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetLines'", NULL); -#endif - { - self->SetLines(a_Line1,a_Line2,a_Line3,a_Line4); - tolua_pushcppstring(tolua_S,(const char*)a_Line1); - tolua_pushcppstring(tolua_S,(const char*)a_Line2); - tolua_pushcppstring(tolua_S,(const char*)a_Line3); - tolua_pushcppstring(tolua_S,(const char*)a_Line4); - } - } - return 4; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetLines'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetLine of class cSignEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cSignEntity_SetLine00 -static int tolua_AllToLua_cSignEntity_SetLine00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cSignEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_iscppstring(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cSignEntity* self = (cSignEntity*) tolua_tousertype(tolua_S,1,0); - int a_Index = ((int) tolua_tonumber(tolua_S,2,0)); - const AString a_Line = ((const AString) tolua_tocppstring(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetLine'", NULL); -#endif - { - self->SetLine(a_Index,a_Line); - tolua_pushcppstring(tolua_S,(const char*)a_Line); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetLine'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetLine of class cSignEntity */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cSignEntity_GetLine00 -static int tolua_AllToLua_cSignEntity_GetLine00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cSignEntity",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cSignEntity* self = (const cSignEntity*) tolua_tousertype(tolua_S,1,0); - int a_Index = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLine'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetLine(a_Index); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetLine'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Name of class HTTPFormData */ -#ifndef TOLUA_DISABLE_tolua_get_HTTPFormData_Name -static int tolua_get_HTTPFormData_Name(lua_State* tolua_S) -{ - HTTPFormData* self = (HTTPFormData*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Name'",NULL); -#endif - tolua_pushcppstring(tolua_S,(const char*)self->Name); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: Name of class HTTPFormData */ -#ifndef TOLUA_DISABLE_tolua_set_HTTPFormData_Name -static int tolua_set_HTTPFormData_Name(lua_State* tolua_S) -{ - HTTPFormData* self = (HTTPFormData*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Name'",NULL); - if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->Name = ((std::string) tolua_tocppstring(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Value of class HTTPFormData */ -#ifndef TOLUA_DISABLE_tolua_get_HTTPFormData_Value -static int tolua_get_HTTPFormData_Value(lua_State* tolua_S) -{ - HTTPFormData* self = (HTTPFormData*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Value'",NULL); -#endif - tolua_pushcppstring(tolua_S,(const char*)self->Value); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: Value of class HTTPFormData */ -#ifndef TOLUA_DISABLE_tolua_set_HTTPFormData_Value -static int tolua_set_HTTPFormData_Value(lua_State* tolua_S) -{ - HTTPFormData* self = (HTTPFormData*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Value'",NULL); - if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->Value = ((std::string) tolua_tocppstring(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Type of class HTTPFormData */ -#ifndef TOLUA_DISABLE_tolua_get_HTTPFormData_Type -static int tolua_get_HTTPFormData_Type(lua_State* tolua_S) -{ - HTTPFormData* self = (HTTPFormData*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Type'",NULL); -#endif - tolua_pushcppstring(tolua_S,(const char*)self->Type); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: Type of class HTTPFormData */ -#ifndef TOLUA_DISABLE_tolua_set_HTTPFormData_Type -static int tolua_set_HTTPFormData_Type(lua_State* tolua_S) -{ - HTTPFormData* self = (HTTPFormData*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Type'",NULL); - if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->Type = ((std::string) tolua_tocppstring(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Method of class HTTPRequest */ -#ifndef TOLUA_DISABLE_tolua_get_HTTPRequest_Method -static int tolua_get_HTTPRequest_Method(lua_State* tolua_S) -{ - HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Method'",NULL); -#endif - tolua_pushcppstring(tolua_S,(const char*)self->Method); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: Method of class HTTPRequest */ -#ifndef TOLUA_DISABLE_tolua_set_HTTPRequest_Method -static int tolua_set_HTTPRequest_Method(lua_State* tolua_S) -{ - HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Method'",NULL); - if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->Method = ((AString) tolua_tocppstring(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Path of class HTTPRequest */ -#ifndef TOLUA_DISABLE_tolua_get_HTTPRequest_Path -static int tolua_get_HTTPRequest_Path(lua_State* tolua_S) -{ - HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Path'",NULL); -#endif - tolua_pushcppstring(tolua_S,(const char*)self->Path); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: Path of class HTTPRequest */ -#ifndef TOLUA_DISABLE_tolua_set_HTTPRequest_Path -static int tolua_set_HTTPRequest_Path(lua_State* tolua_S) -{ - HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Path'",NULL); - if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->Path = ((AString) tolua_tocppstring(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Username of class HTTPRequest */ -#ifndef TOLUA_DISABLE_tolua_get_HTTPRequest_Username -static int tolua_get_HTTPRequest_Username(lua_State* tolua_S) -{ - HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Username'",NULL); -#endif - tolua_pushcppstring(tolua_S,(const char*)self->Username); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: Username of class HTTPRequest */ -#ifndef TOLUA_DISABLE_tolua_set_HTTPRequest_Username -static int tolua_set_HTTPRequest_Username(lua_State* tolua_S) -{ - HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Username'",NULL); - if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->Username = ((AString) tolua_tocppstring(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Request of class HTTPTemplateRequest */ -#ifndef TOLUA_DISABLE_tolua_get_HTTPTemplateRequest_Request -static int tolua_get_HTTPTemplateRequest_Request(lua_State* tolua_S) -{ - HTTPTemplateRequest* self = (HTTPTemplateRequest*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Request'",NULL); -#endif - tolua_pushusertype(tolua_S,(void*)&self->Request,"HTTPRequest"); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: Request of class HTTPTemplateRequest */ -#ifndef TOLUA_DISABLE_tolua_set_HTTPTemplateRequest_Request -static int tolua_set_HTTPTemplateRequest_Request(lua_State* tolua_S) -{ - HTTPTemplateRequest* self = (HTTPTemplateRequest*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Request'",NULL); - if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"HTTPRequest",0,&tolua_err))) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->Request = *((HTTPRequest*) tolua_tousertype(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: Content of class sWebAdminPage */ -#ifndef TOLUA_DISABLE_tolua_get_sWebAdminPage_Content -static int tolua_get_sWebAdminPage_Content(lua_State* tolua_S) -{ - sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Content'",NULL); -#endif - tolua_pushcppstring(tolua_S,(const char*)self->Content); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: Content of class sWebAdminPage */ -#ifndef TOLUA_DISABLE_tolua_set_sWebAdminPage_Content -static int tolua_set_sWebAdminPage_Content(lua_State* tolua_S) -{ - sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Content'",NULL); - if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->Content = ((AString) tolua_tocppstring(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: PluginName of class sWebAdminPage */ -#ifndef TOLUA_DISABLE_tolua_get_sWebAdminPage_PluginName -static int tolua_get_sWebAdminPage_PluginName(lua_State* tolua_S) -{ - sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'PluginName'",NULL); -#endif - tolua_pushcppstring(tolua_S,(const char*)self->PluginName); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: PluginName of class sWebAdminPage */ -#ifndef TOLUA_DISABLE_tolua_set_sWebAdminPage_PluginName -static int tolua_set_sWebAdminPage_PluginName(lua_State* tolua_S) -{ - sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'PluginName'",NULL); - if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->PluginName = ((AString) tolua_tocppstring(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: TabName of class sWebAdminPage */ -#ifndef TOLUA_DISABLE_tolua_get_sWebAdminPage_TabName -static int tolua_get_sWebAdminPage_TabName(lua_State* tolua_S) -{ - sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'TabName'",NULL); -#endif - tolua_pushcppstring(tolua_S,(const char*)self->TabName); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: TabName of class sWebAdminPage */ -#ifndef TOLUA_DISABLE_tolua_set_sWebAdminPage_TabName -static int tolua_set_sWebAdminPage_TabName(lua_State* tolua_S) -{ - sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'TabName'",NULL); - if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->TabName = ((AString) tolua_tocppstring(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPage of class cWebAdmin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebAdmin_GetPage00 -static int tolua_AllToLua_cWebAdmin_GetPage00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWebAdmin",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const HTTPRequest",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWebAdmin* self = (cWebAdmin*) tolua_tousertype(tolua_S,1,0); - const HTTPRequest* a_Request = ((const HTTPRequest*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPage'", NULL); -#endif - { - sWebAdminPage tolua_ret = (sWebAdminPage) self->GetPage(*a_Request); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((sWebAdminPage)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"sWebAdminPage"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(sWebAdminPage)); - tolua_pushusertype(tolua_S,tolua_obj,"sWebAdminPage"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPage'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetDefaultPage of class cWebAdmin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebAdmin_GetDefaultPage00 -static int tolua_AllToLua_cWebAdmin_GetDefaultPage00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWebAdmin",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWebAdmin* self = (cWebAdmin*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDefaultPage'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetDefaultPage(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetDefaultPage'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBaseURL of class cWebAdmin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebAdmin_GetBaseURL00 -static int tolua_AllToLua_cWebAdmin_GetBaseURL00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWebAdmin",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWebAdmin* self = (cWebAdmin*) tolua_tousertype(tolua_S,1,0); - const AString a_URL = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBaseURL'", NULL); -#endif - { - AString tolua_ret = (AString) self->GetBaseURL(a_URL); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_URL); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBaseURL'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetHTMLEscapedString of class cWebAdmin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebAdmin_GetHTMLEscapedString00 -static int tolua_AllToLua_cWebAdmin_GetHTMLEscapedString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cWebAdmin",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_Input = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - AString tolua_ret = (AString) cWebAdmin::GetHTMLEscapedString(a_Input); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_Input); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetHTMLEscapedString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWebTitle of class cWebPlugin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebPlugin_GetWebTitle00 -static int tolua_AllToLua_cWebPlugin_GetWebTitle00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWebPlugin",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWebPlugin* self = (const cWebPlugin*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWebTitle'", NULL); -#endif - { - const AString tolua_ret = (const AString) self->GetWebTitle(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWebTitle'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HandleWebRequest of class cWebPlugin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebPlugin_HandleWebRequest00 -static int tolua_AllToLua_cWebPlugin_HandleWebRequest00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWebPlugin",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const HTTPRequest",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWebPlugin* self = (cWebPlugin*) tolua_tousertype(tolua_S,1,0); - const HTTPRequest* a_Request = ((const HTTPRequest*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HandleWebRequest'", NULL); -#endif - { - AString tolua_ret = (AString) self->HandleWebRequest(a_Request); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HandleWebRequest'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SafeString of class cWebPlugin */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebPlugin_SafeString00 -static int tolua_AllToLua_cWebPlugin_SafeString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cWebPlugin",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_String = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - AString tolua_ret = (AString) cWebPlugin::SafeString(a_String); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_String); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SafeString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Get of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_Get00 -static int tolua_AllToLua_cRoot_Get00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cRoot* tolua_ret = (cRoot*) cRoot::Get(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cRoot"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Get'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetServer of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetServer00 -static int tolua_AllToLua_cRoot_GetServer00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetServer'", NULL); -#endif - { - cServer* tolua_ret = (cServer*) self->GetServer(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cServer"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetServer'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetDefaultWorld of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetDefaultWorld00 -static int tolua_AllToLua_cRoot_GetDefaultWorld00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDefaultWorld'", NULL); -#endif - { - cWorld* tolua_ret = (cWorld*) self->GetDefaultWorld(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWorld"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetDefaultWorld'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWorld of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetWorld00 -static int tolua_AllToLua_cRoot_GetWorld00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); - const AString a_WorldName = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWorld'", NULL); -#endif - { - cWorld* tolua_ret = (cWorld*) self->GetWorld(a_WorldName); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWorld"); - tolua_pushcppstring(tolua_S,(const char*)a_WorldName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWorld'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPrimaryServerVersion of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetPrimaryServerVersion00 -static int tolua_AllToLua_cRoot_GetPrimaryServerVersion00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cRoot* self = (const cRoot*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPrimaryServerVersion'", NULL); -#endif - { - int tolua_ret = (int) self->GetPrimaryServerVersion(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPrimaryServerVersion'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetPrimaryServerVersion of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_SetPrimaryServerVersion00 -static int tolua_AllToLua_cRoot_SetPrimaryServerVersion00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); - int a_Version = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPrimaryServerVersion'", NULL); -#endif - { - self->SetPrimaryServerVersion(a_Version); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetPrimaryServerVersion'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetGroupManager of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetGroupManager00 -static int tolua_AllToLua_cRoot_GetGroupManager00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetGroupManager'", NULL); -#endif - { - cGroupManager* tolua_ret = (cGroupManager*) self->GetGroupManager(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cGroupManager"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetGroupManager'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetCraftingRecipes of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetCraftingRecipes00 -static int tolua_AllToLua_cRoot_GetCraftingRecipes00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCraftingRecipes'", NULL); -#endif - { - cCraftingRecipes* tolua_ret = (cCraftingRecipes*) self->GetCraftingRecipes(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCraftingRecipes"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetCraftingRecipes'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetFurnaceFuelBurnTime of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetFurnaceFuelBurnTime00 -static int tolua_AllToLua_cRoot_GetFurnaceFuelBurnTime00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cRoot",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cItem* a_Fuel = ((const cItem*) tolua_tousertype(tolua_S,2,0)); - { - int tolua_ret = (int) cRoot::GetFurnaceFuelBurnTime(*a_Fuel); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetFurnaceFuelBurnTime'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWebAdmin of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetWebAdmin00 -static int tolua_AllToLua_cRoot_GetWebAdmin00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWebAdmin'", NULL); -#endif - { - cWebAdmin* tolua_ret = (cWebAdmin*) self->GetWebAdmin(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWebAdmin"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWebAdmin'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPluginManager of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetPluginManager00 -static int tolua_AllToLua_cRoot_GetPluginManager00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPluginManager'", NULL); -#endif - { - cPluginManager* tolua_ret = (cPluginManager*) self->GetPluginManager(); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPluginManager"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPluginManager'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: QueueExecuteConsoleCommand of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_QueueExecuteConsoleCommand00 -static int tolua_AllToLua_cRoot_QueueExecuteConsoleCommand00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); - const AString a_Cmd = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'QueueExecuteConsoleCommand'", NULL); -#endif - { - self->QueueExecuteConsoleCommand(a_Cmd); - tolua_pushcppstring(tolua_S,(const char*)a_Cmd); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'QueueExecuteConsoleCommand'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetTotalChunkCount of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetTotalChunkCount00 -static int tolua_AllToLua_cRoot_GetTotalChunkCount00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetTotalChunkCount'", NULL); -#endif - { - int tolua_ret = (int) self->GetTotalChunkCount(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetTotalChunkCount'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SaveAllChunks of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_SaveAllChunks00 -static int tolua_AllToLua_cRoot_SaveAllChunks00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SaveAllChunks'", NULL); -#endif - { - self->SaveAllChunks(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SaveAllChunks'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: BroadcastChat of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_BroadcastChat00 -static int tolua_AllToLua_cRoot_BroadcastChat00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); - const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'BroadcastChat'", NULL); -#endif - { - self->BroadcastChat(a_Message); - tolua_pushcppstring(tolua_S,(const char*)a_Message); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'BroadcastChat'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetProtocolVersionTextFromInt of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00 -static int tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - int a_ProtocolVersionNum = ((int) tolua_tonumber(tolua_S,2,0)); - { - AString tolua_ret = (AString) cRoot::GetProtocolVersionTextFromInt(a_ProtocolVersionNum); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetProtocolVersionTextFromInt'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetVirtualRAMUsage of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetVirtualRAMUsage00 -static int tolua_AllToLua_cRoot_GetVirtualRAMUsage00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - int tolua_ret = (int) cRoot::GetVirtualRAMUsage(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetVirtualRAMUsage'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetPhysicalRAMUsage of class cRoot */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetPhysicalRAMUsage00 -static int tolua_AllToLua_cRoot_GetPhysicalRAMUsage00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cRoot",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - int tolua_ret = (int) cRoot::GetPhysicalRAMUsage(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetPhysicalRAMUsage'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new00 -static int tolua_AllToLua_Vector3f_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - { - Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(*v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new00_local -static int tolua_AllToLua_Vector3f_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - { - Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(*v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new01 -static int tolua_AllToLua_Vector3f_new01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - { - Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f_new00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new01_local -static int tolua_AllToLua_Vector3f_new01_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - { - Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f_new00_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new02 -static int tolua_AllToLua_Vector3f_new02(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); - { - Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(*v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f_new01(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new02_local -static int tolua_AllToLua_Vector3f_new02_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); - { - Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(*v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f_new01_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new03 -static int tolua_AllToLua_Vector3f_new03(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); - { - Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f_new02(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new03_local -static int tolua_AllToLua_Vector3f_new03_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); - { - Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f_new02_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new04 -static int tolua_AllToLua_Vector3f_new04(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else - { - { - Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f_new03(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new04_local -static int tolua_AllToLua_Vector3f_new04_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else - { - { - Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f_new03_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new05 -static int tolua_AllToLua_Vector3f_new05(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - float a_x = ((float) tolua_tonumber(tolua_S,2,0)); - float a_y = ((float) tolua_tonumber(tolua_S,3,0)); - float a_z = ((float) tolua_tonumber(tolua_S,4,0)); - { - Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(a_x,a_y,a_z)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f_new04(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new05_local -static int tolua_AllToLua_Vector3f_new05_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - float a_x = ((float) tolua_tonumber(tolua_S,2,0)); - float a_y = ((float) tolua_tonumber(tolua_S,3,0)); - float a_z = ((float) tolua_tonumber(tolua_S,4,0)); - { - Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(a_x,a_y,a_z)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f_new04_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Set of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_Set00 -static int tolua_AllToLua_Vector3f_Set00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"Vector3f",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); - float a_x = ((float) tolua_tonumber(tolua_S,2,0)); - float a_y = ((float) tolua_tonumber(tolua_S,3,0)); - float a_z = ((float) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL); -#endif - { - self->Set(a_x,a_y,a_z); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Set'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Normalize of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_Normalize00 -static int tolua_AllToLua_Vector3f_Normalize00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"Vector3f",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Normalize'", NULL); -#endif - { - self->Normalize(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Normalize'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: NormalizeCopy of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_NormalizeCopy00 -static int tolua_AllToLua_Vector3f_NormalizeCopy00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NormalizeCopy'", NULL); -#endif - { - Vector3f tolua_ret = (Vector3f) self->NormalizeCopy(); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'NormalizeCopy'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: NormalizeCopy of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_NormalizeCopy01 -static int tolua_AllToLua_Vector3f_NormalizeCopy01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3f",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); - Vector3f* a_V = ((Vector3f*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NormalizeCopy'", NULL); -#endif - { - self->NormalizeCopy(*a_V); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_Vector3f_NormalizeCopy00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Length of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_Length00 -static int tolua_AllToLua_Vector3f_Length00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Length'", NULL); -#endif - { - float tolua_ret = (float) self->Length(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Length'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SqrLength of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_SqrLength00 -static int tolua_AllToLua_Vector3f_SqrLength00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SqrLength'", NULL); -#endif - { - float tolua_ret = (float) self->SqrLength(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SqrLength'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Dot of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_Dot00 -static int tolua_AllToLua_Vector3f_Dot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); - const Vector3f* a_V = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Dot'", NULL); -#endif - { - float tolua_ret = (float) self->Dot(*a_V); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Dot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Cross of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_Cross00 -static int tolua_AllToLua_Vector3f_Cross00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); - const Vector3f* v = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Cross'", NULL); -#endif - { - Vector3f tolua_ret = (Vector3f) self->Cross(*v); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Cross'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Equals of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_Equals00 -static int tolua_AllToLua_Vector3f_Equals00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); - const Vector3f* v = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Equals'", NULL); -#endif - { - bool tolua_ret = (bool) self->Equals(*v); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Equals'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator+ of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f__add00 -static int tolua_AllToLua_Vector3f__add00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); - const Vector3f* v2 = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator+'", NULL); -#endif - { - Vector3f tolua_ret = (Vector3f) self->operator+(*v2); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function '.add'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator+ of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f__add01 -static int tolua_AllToLua_Vector3f__add01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); - const Vector3f* v2 = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator+'", NULL); -#endif - { - Vector3f tolua_ret = (Vector3f) self->operator+(v2); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f__add00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator- of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f__sub00 -static int tolua_AllToLua_Vector3f__sub00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); - const Vector3f* v2 = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator-'", NULL); -#endif - { - Vector3f tolua_ret = (Vector3f) self->operator-(*v2); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function '.sub'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator- of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f__sub01 -static int tolua_AllToLua_Vector3f__sub01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); - const Vector3f* v2 = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator-'", NULL); -#endif - { - Vector3f tolua_ret = (Vector3f) self->operator-(v2); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f__sub00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator* of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f__mul00 -static int tolua_AllToLua_Vector3f__mul00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); - const float f = ((const float) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator*'", NULL); -#endif - { - Vector3f tolua_ret = (Vector3f) self->operator*(f); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function '.mul'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator* of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f__mul01 -static int tolua_AllToLua_Vector3f__mul01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); - const Vector3f* v2 = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator*'", NULL); -#endif - { - Vector3f tolua_ret = (Vector3f) self->operator*(*v2); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3f__mul00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: x of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_get_Vector3f_x -static int tolua_get_Vector3f_x(lua_State* tolua_S) -{ - Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->x); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: x of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_set_Vector3f_x -static int tolua_set_Vector3f_x(lua_State* tolua_S) -{ - Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->x = ((float) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: y of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_get_Vector3f_y -static int tolua_get_Vector3f_y(lua_State* tolua_S) -{ - Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->y); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: y of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_set_Vector3f_y -static int tolua_set_Vector3f_y(lua_State* tolua_S) -{ - Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->y = ((float) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: z of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_get_Vector3f_z -static int tolua_get_Vector3f_z(lua_State* tolua_S) -{ - Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'z'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->z); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: z of class Vector3f */ -#ifndef TOLUA_DISABLE_tolua_set_Vector3f_z -static int tolua_set_Vector3f_z(lua_State* tolua_S) -{ - Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'z'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->z = ((float) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new00 -static int tolua_AllToLua_Vector3d_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3f* v = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); - { - Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)(*v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new00_local -static int tolua_AllToLua_Vector3d_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3f* v = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); - { - Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)(*v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new01 -static int tolua_AllToLua_Vector3d_new01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3f* v = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); - { - Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)(v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3d_new00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new01_local -static int tolua_AllToLua_Vector3d_new01_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3f* v = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); - { - Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)(v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3d_new00_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new02 -static int tolua_AllToLua_Vector3d_new02(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else - { - { - Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3d_new01(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new02_local -static int tolua_AllToLua_Vector3d_new02_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else - { - { - Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3d_new01_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new03 -static int tolua_AllToLua_Vector3d_new03(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - double a_x = ((double) tolua_tonumber(tolua_S,2,0)); - double a_y = ((double) tolua_tonumber(tolua_S,3,0)); - double a_z = ((double) tolua_tonumber(tolua_S,4,0)); - { - Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)(a_x,a_y,a_z)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3d_new02(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new03_local -static int tolua_AllToLua_Vector3d_new03_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - double a_x = ((double) tolua_tonumber(tolua_S,2,0)); - double a_y = ((double) tolua_tonumber(tolua_S,3,0)); - double a_z = ((double) tolua_tonumber(tolua_S,4,0)); - { - Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)(a_x,a_y,a_z)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3d_new02_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Set of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Set00 -static int tolua_AllToLua_Vector3d_Set00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"Vector3d",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); - double a_x = ((double) tolua_tonumber(tolua_S,2,0)); - double a_y = ((double) tolua_tonumber(tolua_S,3,0)); - double a_z = ((double) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL); -#endif - { - self->Set(a_x,a_y,a_z); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Set'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Normalize of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Normalize00 -static int tolua_AllToLua_Vector3d_Normalize00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"Vector3d",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Normalize'", NULL); -#endif - { - self->Normalize(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Normalize'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: NormalizeCopy of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_NormalizeCopy00 -static int tolua_AllToLua_Vector3d_NormalizeCopy00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"Vector3d",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NormalizeCopy'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->NormalizeCopy(); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'NormalizeCopy'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: NormalizeCopy of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_NormalizeCopy01 -static int tolua_AllToLua_Vector3d_NormalizeCopy01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"Vector3d",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); - Vector3d* a_V = ((Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NormalizeCopy'", NULL); -#endif - { - self->NormalizeCopy(*a_V); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_Vector3d_NormalizeCopy00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Length of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Length00 -static int tolua_AllToLua_Vector3d_Length00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Length'", NULL); -#endif - { - double tolua_ret = (double) self->Length(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Length'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SqrLength of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_SqrLength00 -static int tolua_AllToLua_Vector3d_SqrLength00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SqrLength'", NULL); -#endif - { - double tolua_ret = (double) self->SqrLength(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SqrLength'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Dot of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Dot00 -static int tolua_AllToLua_Vector3d_Dot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_V = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Dot'", NULL); -#endif - { - double tolua_ret = (double) self->Dot(*a_V); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Dot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Cross of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Cross00 -static int tolua_AllToLua_Vector3d_Cross00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Cross'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->Cross(*v); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Cross'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: LineCoeffToXYPlane of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_LineCoeffToXYPlane00 -static int tolua_AllToLua_Vector3d_LineCoeffToXYPlane00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_OtherEnd = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - double a_Z = ((double) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'LineCoeffToXYPlane'", NULL); -#endif - { - double tolua_ret = (double) self->LineCoeffToXYPlane(*a_OtherEnd,a_Z); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'LineCoeffToXYPlane'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: LineCoeffToXZPlane of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_LineCoeffToXZPlane00 -static int tolua_AllToLua_Vector3d_LineCoeffToXZPlane00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_OtherEnd = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - double a_Y = ((double) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'LineCoeffToXZPlane'", NULL); -#endif - { - double tolua_ret = (double) self->LineCoeffToXZPlane(*a_OtherEnd,a_Y); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'LineCoeffToXZPlane'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: LineCoeffToYZPlane of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_LineCoeffToYZPlane00 -static int tolua_AllToLua_Vector3d_LineCoeffToYZPlane00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_OtherEnd = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - double a_X = ((double) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'LineCoeffToYZPlane'", NULL); -#endif - { - double tolua_ret = (double) self->LineCoeffToYZPlane(*a_OtherEnd,a_X); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'LineCoeffToYZPlane'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Equals of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Equals00 -static int tolua_AllToLua_Vector3d_Equals00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Equals'", NULL); -#endif - { - bool tolua_ret = (bool) self->Equals(*v); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Equals'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator+ of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__add00 -static int tolua_AllToLua_Vector3d__add00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const Vector3d* v2 = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator+'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->operator+(*v2); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function '.add'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator+ of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__add01 -static int tolua_AllToLua_Vector3d__add01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const Vector3d* v2 = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator+'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->operator+(v2); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3d__add00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator- of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__sub00 -static int tolua_AllToLua_Vector3d__sub00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const Vector3d* v2 = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator-'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->operator-(*v2); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function '.sub'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator- of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__sub01 -static int tolua_AllToLua_Vector3d__sub01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const Vector3d* v2 = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator-'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->operator-(v2); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3d__sub00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator* of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__mul00 -static int tolua_AllToLua_Vector3d__mul00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const double f = ((const double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator*'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->operator*(f); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function '.mul'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator* of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__mul01 -static int tolua_AllToLua_Vector3d__mul01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const Vector3d* v2 = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator*'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->operator*(*v2); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3d__mul00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: operator/ of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__div00 -static int tolua_AllToLua_Vector3d__div00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); - const double f = ((const double) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator/'", NULL); -#endif - { - Vector3d tolua_ret = (Vector3d) self->operator/(f); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); - tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function '.div'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: x of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_get_Vector3d_x -static int tolua_get_Vector3d_x(lua_State* tolua_S) -{ - Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->x); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: x of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_set_Vector3d_x -static int tolua_set_Vector3d_x(lua_State* tolua_S) -{ - Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->x = ((double) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: y of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_get_Vector3d_y -static int tolua_get_Vector3d_y(lua_State* tolua_S) -{ - Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->y); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: y of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_set_Vector3d_y -static int tolua_set_Vector3d_y(lua_State* tolua_S) -{ - Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->y = ((double) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: z of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_get_Vector3d_z -static int tolua_get_Vector3d_z(lua_State* tolua_S) -{ - Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'z'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->z); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: z of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_set_Vector3d_z -static int tolua_set_Vector3d_z(lua_State* tolua_S) -{ - Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'z'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->z = ((double) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: EPS of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_get_Vector3d_EPS -static int tolua_get_Vector3d_EPS(lua_State* tolua_S) -{ - tolua_pushnumber(tolua_S,(lua_Number)Vector3d::EPS); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: NO_INTERSECTION of class Vector3d */ -#ifndef TOLUA_DISABLE_tolua_get_Vector3d_NO_INTERSECTION -static int tolua_get_Vector3d_NO_INTERSECTION(lua_State* tolua_S) -{ - tolua_pushnumber(tolua_S,(lua_Number)Vector3d::NO_INTERSECTION); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_new00 -static int tolua_AllToLua_Vector3i_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3i",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - { - Vector3i* tolua_ret = (Vector3i*) Mtolua_new((Vector3i)(*v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3i"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_new00_local -static int tolua_AllToLua_Vector3i_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3i",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - { - Vector3i* tolua_ret = (Vector3i*) Mtolua_new((Vector3i)(*v)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3i"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_new01 -static int tolua_AllToLua_Vector3i_new01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3i",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else - { - { - Vector3i* tolua_ret = (Vector3i*) Mtolua_new((Vector3i)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3i"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3i_new00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_new01_local -static int tolua_AllToLua_Vector3i_new01_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3i",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else - { - { - Vector3i* tolua_ret = (Vector3i*) Mtolua_new((Vector3i)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3i"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3i_new00_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_new02 -static int tolua_AllToLua_Vector3i_new02(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3i",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - int a_x = ((int) tolua_tonumber(tolua_S,2,0)); - int a_y = ((int) tolua_tonumber(tolua_S,3,0)); - int a_z = ((int) tolua_tonumber(tolua_S,4,0)); - { - Vector3i* tolua_ret = (Vector3i*) Mtolua_new((Vector3i)(a_x,a_y,a_z)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3i"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3i_new01(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_new02_local -static int tolua_AllToLua_Vector3i_new02_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"Vector3i",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - int a_x = ((int) tolua_tonumber(tolua_S,2,0)); - int a_y = ((int) tolua_tonumber(tolua_S,3,0)); - int a_z = ((int) tolua_tonumber(tolua_S,4,0)); - { - Vector3i* tolua_ret = (Vector3i*) Mtolua_new((Vector3i)(a_x,a_y,a_z)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3i"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3i_new01_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Set of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_Set00 -static int tolua_AllToLua_Vector3i_Set00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"Vector3i",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); - int a_x = ((int) tolua_tonumber(tolua_S,2,0)); - int a_y = ((int) tolua_tonumber(tolua_S,3,0)); - int a_z = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL); -#endif - { - self->Set(a_x,a_y,a_z); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Set'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Length of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_Length00 -static int tolua_AllToLua_Vector3i_Length00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3i",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3i* self = (const Vector3i*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Length'", NULL); -#endif - { - float tolua_ret = (float) self->Length(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Length'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SqrLength of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_SqrLength00 -static int tolua_AllToLua_Vector3i_SqrLength00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3i",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3i* self = (const Vector3i*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SqrLength'", NULL); -#endif - { - int tolua_ret = (int) self->SqrLength(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SqrLength'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Equals of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_Equals00 -static int tolua_AllToLua_Vector3i_Equals00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3i",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const Vector3i* self = (const Vector3i*) tolua_tousertype(tolua_S,1,0); - const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Equals'", NULL); -#endif - { - bool tolua_ret = (bool) self->Equals(*v); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Equals'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Equals of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_Equals01 -static int tolua_AllToLua_Vector3i_Equals01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const Vector3i",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3i* self = (const Vector3i*) tolua_tousertype(tolua_S,1,0); - const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Equals'", NULL); -#endif - { - bool tolua_ret = (bool) self->Equals(v); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_Vector3i_Equals00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: x of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_get_Vector3i_x -static int tolua_get_Vector3i_x(lua_State* tolua_S) -{ - Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->x); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: x of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_set_Vector3i_x -static int tolua_set_Vector3i_x(lua_State* tolua_S) -{ - Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->x = ((int) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: y of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_get_Vector3i_y -static int tolua_get_Vector3i_y(lua_State* tolua_S) -{ - Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->y); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: y of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_set_Vector3i_y -static int tolua_set_Vector3i_y(lua_State* tolua_S) -{ - Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->y = ((int) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: z of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_get_Vector3i_z -static int tolua_get_Vector3i_z(lua_State* tolua_S) -{ - Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'z'",NULL); -#endif - tolua_pushnumber(tolua_S,(lua_Number)self->z); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: z of class Vector3i */ -#ifndef TOLUA_DISABLE_tolua_set_Vector3i_z -static int tolua_set_Vector3i_z(lua_State* tolua_S) -{ - Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'z'",NULL); - if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->z = ((int) tolua_tonumber(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: p1 of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_get_cCuboid_p1 -static int tolua_get_cCuboid_p1(lua_State* tolua_S) -{ - cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p1'",NULL); -#endif - tolua_pushusertype(tolua_S,(void*)&self->p1,"Vector3i"); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: p1 of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_set_cCuboid_p1 -static int tolua_set_cCuboid_p1(lua_State* tolua_S) -{ - cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p1'",NULL); - if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3i",0,&tolua_err))) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->p1 = *((Vector3i*) tolua_tousertype(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: p2 of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_get_cCuboid_p2 -static int tolua_get_cCuboid_p2(lua_State* tolua_S) -{ - cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p2'",NULL); -#endif - tolua_pushusertype(tolua_S,(void*)&self->p2,"Vector3i"); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: p2 of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_set_cCuboid_p2 -static int tolua_set_cCuboid_p2(lua_State* tolua_S) -{ - cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p2'",NULL); - if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3i",0,&tolua_err))) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->p2 = *((Vector3i*) tolua_tousertype(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new00 -static int tolua_AllToLua_cCuboid_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new00_local -static int tolua_AllToLua_cCuboid_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new01 -static int tolua_AllToLua_cCuboid_new01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const cCuboid* a_Cuboid = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); - { - cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(*a_Cuboid)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cCuboid_new00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new01_local -static int tolua_AllToLua_cCuboid_new01_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const cCuboid* a_Cuboid = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); - { - cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(*a_Cuboid)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cCuboid_new00_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new02 -static int tolua_AllToLua_cCuboid_new02(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3i",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3i* a_p1 = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); - const Vector3i* a_p2 = ((const Vector3i*) tolua_tousertype(tolua_S,3,0)); - { - cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(*a_p1,*a_p2)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cCuboid_new01(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new02_local -static int tolua_AllToLua_cCuboid_new02_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3i",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3i* a_p1 = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); - const Vector3i* a_p2 = ((const Vector3i*) tolua_tousertype(tolua_S,3,0)); - { - cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(*a_p1,*a_p2)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cCuboid_new01_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new03 -static int tolua_AllToLua_cCuboid_new03(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - int a_X1 = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y1 = ((int) tolua_tonumber(tolua_S,3,0)); - int a_Z1 = ((int) tolua_tonumber(tolua_S,4,0)); - { - cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(a_X1,a_Y1,a_Z1)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cCuboid_new02(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new03_local -static int tolua_AllToLua_cCuboid_new03_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - int a_X1 = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y1 = ((int) tolua_tonumber(tolua_S,3,0)); - int a_Z1 = ((int) tolua_tonumber(tolua_S,4,0)); - { - cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(a_X1,a_Y1,a_Z1)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cCuboid_new02_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new04 -static int tolua_AllToLua_cCuboid_new04(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else - { - int a_X1 = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y1 = ((int) tolua_tonumber(tolua_S,3,0)); - int a_Z1 = ((int) tolua_tonumber(tolua_S,4,0)); - int a_X2 = ((int) tolua_tonumber(tolua_S,5,0)); - int a_Y2 = ((int) tolua_tonumber(tolua_S,6,0)); - int a_Z2 = ((int) tolua_tonumber(tolua_S,7,0)); - { - cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(a_X1,a_Y1,a_Z1,a_X2,a_Y2,a_Z2)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cCuboid_new03(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new04_local -static int tolua_AllToLua_cCuboid_new04_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else - { - int a_X1 = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y1 = ((int) tolua_tonumber(tolua_S,3,0)); - int a_Z1 = ((int) tolua_tonumber(tolua_S,4,0)); - int a_X2 = ((int) tolua_tonumber(tolua_S,5,0)); - int a_Y2 = ((int) tolua_tonumber(tolua_S,6,0)); - int a_Z2 = ((int) tolua_tonumber(tolua_S,7,0)); - { - cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(a_X1,a_Y1,a_Z1,a_X2,a_Y2,a_Z2)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cCuboid_new03_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Assign of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_Assign00 -static int tolua_AllToLua_cCuboid_Assign00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCuboid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); - int a_X1 = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y1 = ((int) tolua_tonumber(tolua_S,3,0)); - int a_Z1 = ((int) tolua_tonumber(tolua_S,4,0)); - int a_X2 = ((int) tolua_tonumber(tolua_S,5,0)); - int a_Y2 = ((int) tolua_tonumber(tolua_S,6,0)); - int a_Z2 = ((int) tolua_tonumber(tolua_S,7,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Assign'", NULL); -#endif - { - self->Assign(a_X1,a_Y1,a_Z1,a_X2,a_Y2,a_Z2); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Assign'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Sort of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_Sort00 -static int tolua_AllToLua_cCuboid_Sort00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCuboid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Sort'", NULL); -#endif - { - self->Sort(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Sort'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DifX of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_DifX00 -static int tolua_AllToLua_cCuboid_DifX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DifX'", NULL); -#endif - { - int tolua_ret = (int) self->DifX(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DifX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DifY of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_DifY00 -static int tolua_AllToLua_cCuboid_DifY00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DifY'", NULL); -#endif - { - int tolua_ret = (int) self->DifY(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DifY'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DifZ of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_DifZ00 -static int tolua_AllToLua_cCuboid_DifZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DifZ'", NULL); -#endif - { - int tolua_ret = (int) self->DifZ(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DifZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DoesIntersect of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_DoesIntersect00 -static int tolua_AllToLua_cCuboid_DoesIntersect00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); - const cCuboid* a_Other = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DoesIntersect'", NULL); -#endif - { - bool tolua_ret = (bool) self->DoesIntersect(*a_Other); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DoesIntersect'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsInside of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_IsInside00 -static int tolua_AllToLua_cCuboid_IsInside00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); - const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsInside(*v); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsInside'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsInside of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_IsInside01 -static int tolua_AllToLua_cCuboid_IsInside01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); - int a_X = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); - int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsInside(a_X,a_Y,a_Z); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cCuboid_IsInside00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsInside of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_IsInside02 -static int tolua_AllToLua_cCuboid_IsInside02(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); - const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsInside(*v); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cCuboid_IsInside01(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsCompletelyInside of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_IsCompletelyInside00 -static int tolua_AllToLua_cCuboid_IsCompletelyInside00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); - const cCuboid* a_Outer = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsCompletelyInside'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsCompletelyInside(*a_Outer); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsCompletelyInside'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Move of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_Move00 -static int tolua_AllToLua_cCuboid_Move00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCuboid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); - int a_OfsX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_OfsY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_OfsZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Move'", NULL); -#endif - { - self->Move(a_OfsX,a_OfsY,a_OfsZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Move'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsSorted of class cCuboid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_IsSorted00 -static int tolua_AllToLua_cCuboid_IsSorted00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSorted'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsSorted(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsSorted'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new00 -static int tolua_AllToLua_cBoundingBox_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - double a_MinX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_MaxX = ((double) tolua_tonumber(tolua_S,3,0)); - double a_MinY = ((double) tolua_tonumber(tolua_S,4,0)); - double a_MaxY = ((double) tolua_tonumber(tolua_S,5,0)); - double a_MinZ = ((double) tolua_tonumber(tolua_S,6,0)); - double a_MaxZ = ((double) tolua_tonumber(tolua_S,7,0)); - { - cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new00_local -static int tolua_AllToLua_cBoundingBox_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - double a_MinX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_MaxX = ((double) tolua_tonumber(tolua_S,3,0)); - double a_MinY = ((double) tolua_tonumber(tolua_S,4,0)); - double a_MaxY = ((double) tolua_tonumber(tolua_S,5,0)); - double a_MinZ = ((double) tolua_tonumber(tolua_S,6,0)); - double a_MaxZ = ((double) tolua_tonumber(tolua_S,7,0)); - { - cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new01 -static int tolua_AllToLua_cBoundingBox_new01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); - { - cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Min,*a_Max)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_new00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new01_local -static int tolua_AllToLua_cBoundingBox_new01_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); - { - cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Min,*a_Max)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_new00_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new02 -static int tolua_AllToLua_cBoundingBox_new02(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3d* a_Pos = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - double a_Radius = ((double) tolua_tonumber(tolua_S,3,0)); - double a_Height = ((double) tolua_tonumber(tolua_S,4,0)); - { - cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Pos,a_Radius,a_Height)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_new01(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new02_local -static int tolua_AllToLua_cBoundingBox_new02_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3d* a_Pos = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - double a_Radius = ((double) tolua_tonumber(tolua_S,3,0)); - double a_Height = ((double) tolua_tonumber(tolua_S,4,0)); - { - cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Pos,a_Radius,a_Height)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_new01_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new03 -static int tolua_AllToLua_cBoundingBox_new03(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBoundingBox",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const cBoundingBox* a_Orig = ((const cBoundingBox*) tolua_tousertype(tolua_S,2,0)); - { - cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Orig)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_new02(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new03_local -static int tolua_AllToLua_cBoundingBox_new03_local(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBoundingBox",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - const cBoundingBox* a_Orig = ((const cBoundingBox*) tolua_tousertype(tolua_S,2,0)); - { - cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Orig)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_new02_local(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Move of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_Move00 -static int tolua_AllToLua_cBoundingBox_Move00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); - double a_OffX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_OffY = ((double) tolua_tonumber(tolua_S,3,0)); - double a_OffZ = ((double) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Move'", NULL); -#endif - { - self->Move(a_OffX,a_OffY,a_OffZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Move'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Move of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_Move01 -static int tolua_AllToLua_cBoundingBox_Move01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_Off = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Move'", NULL); -#endif - { - self->Move(*a_Off); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_Move00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Expand of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_Expand00 -static int tolua_AllToLua_cBoundingBox_Expand00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); - double a_ExpandX = ((double) tolua_tonumber(tolua_S,2,0)); - double a_ExpandY = ((double) tolua_tonumber(tolua_S,3,0)); - double a_ExpandZ = ((double) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Expand'", NULL); -#endif - { - self->Expand(a_ExpandX,a_ExpandY,a_ExpandZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Expand'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DoesIntersect of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_DoesIntersect00 -static int tolua_AllToLua_cBoundingBox_DoesIntersect00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBoundingBox",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); - const cBoundingBox* a_Other = ((const cBoundingBox*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DoesIntersect'", NULL); -#endif - { - bool tolua_ret = (bool) self->DoesIntersect(*a_Other); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DoesIntersect'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Union of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_Union00 -static int tolua_AllToLua_cBoundingBox_Union00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBoundingBox",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); - const cBoundingBox* a_Other = ((const cBoundingBox*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Union'", NULL); -#endif - { - cBoundingBox tolua_ret = (cBoundingBox) self->Union(*a_Other); - { -#ifdef __cplusplus - void* tolua_obj = Mtolua_new((cBoundingBox)(tolua_ret)); - tolua_pushusertype(tolua_S,tolua_obj,"cBoundingBox"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#else - void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cBoundingBox)); - tolua_pushusertype(tolua_S,tolua_obj,"cBoundingBox"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); -#endif - } - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Union'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsInside of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside00 -static int tolua_AllToLua_cBoundingBox_IsInside00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_Point = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsInside(*a_Point); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsInside'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsInside of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside01 -static int tolua_AllToLua_cBoundingBox_IsInside01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); - double a_X = ((double) tolua_tonumber(tolua_S,2,0)); - double a_Y = ((double) tolua_tonumber(tolua_S,3,0)); - double a_Z = ((double) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsInside(a_X,a_Y,a_Z); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_IsInside00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsInside of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside02 -static int tolua_AllToLua_cBoundingBox_IsInside02(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cBoundingBox",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); - cBoundingBox* a_Other = ((cBoundingBox*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsInside(*a_Other); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_IsInside01(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsInside of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside03 -static int tolua_AllToLua_cBoundingBox_IsInside03(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else - { - cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsInside(*a_Min,*a_Max); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_IsInside02(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsInside of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside04 -static int tolua_AllToLua_cBoundingBox_IsInside04(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const Vector3d",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); - const Vector3d* a_Point = ((const Vector3d*) tolua_tousertype(tolua_S,4,0)); - { - bool tolua_ret = (bool) cBoundingBox::IsInside(*a_Min,*a_Max,*a_Point); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_IsInside03(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsInside of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside05 -static int tolua_AllToLua_cBoundingBox_IsInside05(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); - double a_X = ((double) tolua_tonumber(tolua_S,4,0)); - double a_Y = ((double) tolua_tonumber(tolua_S,5,0)); - double a_Z = ((double) tolua_tonumber(tolua_S,6,0)); - { - bool tolua_ret = (bool) cBoundingBox::IsInside(*a_Min,*a_Max,a_X,a_Y,a_Z); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_IsInside04(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CalcLineIntersection of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_CalcLineIntersection00 -static int tolua_AllToLua_cBoundingBox_CalcLineIntersection00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); - const Vector3d* a_Line1 = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - const Vector3d* a_Line2 = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); - double a_LineCoeff = ((double) tolua_tonumber(tolua_S,4,0)); - char a_Face = ((char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CalcLineIntersection'", NULL); -#endif - { - bool tolua_ret = (bool) self->CalcLineIntersection(*a_Line1,*a_Line2,a_LineCoeff,a_Face); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushnumber(tolua_S,(lua_Number)a_LineCoeff); - tolua_pushnumber(tolua_S,(lua_Number)a_Face); - } - } - return 3; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CalcLineIntersection'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CalcLineIntersection of class cBoundingBox */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_CalcLineIntersection01 -static int tolua_AllToLua_cBoundingBox_CalcLineIntersection01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const Vector3d",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,5,&tolua_err) || !tolua_isusertype(tolua_S,5,"const Vector3d",0,&tolua_err)) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else - { - const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); - const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); - const Vector3d* a_Line1 = ((const Vector3d*) tolua_tousertype(tolua_S,4,0)); - const Vector3d* a_Line2 = ((const Vector3d*) tolua_tousertype(tolua_S,5,0)); - double a_LineCoeff = ((double) tolua_tonumber(tolua_S,6,0)); - char a_Face = ((char) tolua_tonumber(tolua_S,7,0)); - { - bool tolua_ret = (bool) cBoundingBox::CalcLineIntersection(*a_Min,*a_Max,*a_Line1,*a_Line2,a_LineCoeff,a_Face); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushnumber(tolua_S,(lua_Number)a_LineCoeff); - tolua_pushnumber(tolua_S,(lua_Number)a_Face); - } - } - return 3; -tolua_lerror: - return tolua_AllToLua_cBoundingBox_CalcLineIntersection00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: BlockHitPosition of class cTracer */ -#ifndef TOLUA_DISABLE_tolua_get_cTracer_BlockHitPosition -static int tolua_get_cTracer_BlockHitPosition(lua_State* tolua_S) -{ - cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'BlockHitPosition'",NULL); -#endif - tolua_pushusertype(tolua_S,(void*)&self->BlockHitPosition,"Vector3f"); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: BlockHitPosition of class cTracer */ -#ifndef TOLUA_DISABLE_tolua_set_cTracer_BlockHitPosition -static int tolua_set_cTracer_BlockHitPosition(lua_State* tolua_S) -{ - cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'BlockHitPosition'",NULL); - if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3f",0,&tolua_err))) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->BlockHitPosition = *((Vector3f*) tolua_tousertype(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: HitNormal of class cTracer */ -#ifndef TOLUA_DISABLE_tolua_get_cTracer_HitNormal -static int tolua_get_cTracer_HitNormal(lua_State* tolua_S) -{ - cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'HitNormal'",NULL); -#endif - tolua_pushusertype(tolua_S,(void*)&self->HitNormal,"Vector3f"); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: HitNormal of class cTracer */ -#ifndef TOLUA_DISABLE_tolua_set_cTracer_HitNormal -static int tolua_set_cTracer_HitNormal(lua_State* tolua_S) -{ - cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'HitNormal'",NULL); - if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3f",0,&tolua_err))) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->HitNormal = *((Vector3f*) tolua_tousertype(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* get function: RealHit of class cTracer */ -#ifndef TOLUA_DISABLE_tolua_get_cTracer_RealHit -static int tolua_get_cTracer_RealHit(lua_State* tolua_S) -{ - cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'RealHit'",NULL); -#endif - tolua_pushusertype(tolua_S,(void*)&self->RealHit,"Vector3f"); - return 1; -} -#endif //#ifndef TOLUA_DISABLE - -/* set function: RealHit of class cTracer */ -#ifndef TOLUA_DISABLE_tolua_set_cTracer_RealHit -static int tolua_set_cTracer_RealHit(lua_State* tolua_S) -{ - cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'RealHit'",NULL); - if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3f",0,&tolua_err))) - tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); -#endif - self->RealHit = *((Vector3f*) tolua_tousertype(tolua_S,2,0)) -; - return 0; -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cTracer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cTracer_new00 -static int tolua_AllToLua_cTracer_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cTracer",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0)); - { - cTracer* tolua_ret = (cTracer*) Mtolua_new((cTracer)(a_World)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cTracer"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cTracer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cTracer_new00_local -static int tolua_AllToLua_cTracer_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cTracer",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0)); - { - cTracer* tolua_ret = (cTracer*) Mtolua_new((cTracer)(a_World)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cTracer"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: delete of class cTracer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cTracer_delete00 -static int tolua_AllToLua_cTracer_delete00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cTracer",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL); -#endif - Mtolua_delete(self); - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Trace of class cTracer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cTracer_Trace00 -static int tolua_AllToLua_cTracer_Trace00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cTracer",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3f",0,&tolua_err)) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); - const Vector3f* a_Start = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); - const Vector3f* a_Direction = ((const Vector3f*) tolua_tousertype(tolua_S,3,0)); - int a_Distance = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Trace'", NULL); -#endif - { - bool tolua_ret = (bool) self->Trace(*a_Start,*a_Direction,a_Distance); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Trace'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Trace of class cTracer */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cTracer_Trace01 -static int tolua_AllToLua_cTracer_Trace01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cTracer",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || - (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3f",0,&tolua_err)) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isboolean(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else - { - cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); - const Vector3f* a_Start = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); - const Vector3f* a_Direction = ((const Vector3f*) tolua_tousertype(tolua_S,3,0)); - int a_Distance = ((int) tolua_tonumber(tolua_S,4,0)); - bool a_LineOfSight = ((bool) tolua_toboolean(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Trace'", NULL); -#endif - { - bool tolua_ret = (bool) self->Trace(*a_Start,*a_Direction,a_Distance,a_LineOfSight); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cTracer_Trace00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetName of class cGroup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_SetName00 -static int tolua_AllToLua_cGroup_SetName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cGroup",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cGroup* self = (cGroup*) tolua_tousertype(tolua_S,1,0); - std::string a_Name = ((std::string) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetName'", NULL); -#endif - { - self->SetName(a_Name); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetName of class cGroup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_GetName00 -static int tolua_AllToLua_cGroup_GetName00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cGroup",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cGroup* self = (const cGroup*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetName'", NULL); -#endif - { - const std::string tolua_ret = (const std::string) self->GetName(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetName'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetColor of class cGroup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_SetColor00 -static int tolua_AllToLua_cGroup_SetColor00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cGroup",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cGroup* self = (cGroup*) tolua_tousertype(tolua_S,1,0); - std::string a_Color = ((std::string) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetColor'", NULL); -#endif - { - self->SetColor(a_Color); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetColor'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddCommand of class cGroup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_AddCommand00 -static int tolua_AllToLua_cGroup_AddCommand00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cGroup",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cGroup* self = (cGroup*) tolua_tousertype(tolua_S,1,0); - std::string a_Command = ((std::string) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddCommand'", NULL); -#endif - { - self->AddCommand(a_Command); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddCommand'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: AddPermission of class cGroup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_AddPermission00 -static int tolua_AllToLua_cGroup_AddPermission00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cGroup",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cGroup* self = (cGroup*) tolua_tousertype(tolua_S,1,0); - std::string a_Permission = ((std::string) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddPermission'", NULL); -#endif - { - self->AddPermission(a_Permission); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'AddPermission'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: InheritFrom of class cGroup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_InheritFrom00 -static int tolua_AllToLua_cGroup_InheritFrom00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cGroup",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"cGroup",0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cGroup* self = (cGroup*) tolua_tousertype(tolua_S,1,0); - cGroup* a_Group = ((cGroup*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'InheritFrom'", NULL); -#endif - { - self->InheritFrom(a_Group); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'InheritFrom'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HasCommand of class cGroup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_HasCommand00 -static int tolua_AllToLua_cGroup_HasCommand00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cGroup",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cGroup* self = (cGroup*) tolua_tousertype(tolua_S,1,0); - std::string a_Command = ((std::string) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasCommand'", NULL); -#endif - { - bool tolua_ret = (bool) self->HasCommand(a_Command); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HasCommand'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetColor of class cGroup */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_GetColor00 -static int tolua_AllToLua_cGroup_GetColor00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cGroup",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cGroup* self = (const cGroup*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetColor'", NULL); -#endif - { - const AString tolua_ret = (const AString) self->GetColor(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetColor'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_new00 -static int tolua_AllToLua_cBlockArea_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cBlockArea* tolua_ret = (cBlockArea*) Mtolua_new((cBlockArea)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBlockArea"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_new00_local -static int tolua_AllToLua_cBlockArea_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - { - cBlockArea* tolua_ret = (cBlockArea*) Mtolua_new((cBlockArea)()); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBlockArea"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: delete of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_delete00 -static int tolua_AllToLua_cBlockArea_delete00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL); -#endif - Mtolua_delete(self); - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Clear of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Clear00 -static int tolua_AllToLua_cBlockArea_Clear00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); -#endif - { - self->Clear(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Create of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Create00 -static int tolua_AllToLua_cBlockArea_Create00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_SizeX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_SizeY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_SizeZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Create'", NULL); -#endif - { - self->Create(a_SizeX,a_SizeY,a_SizeZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Create'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Create of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Create01 -static int tolua_AllToLua_cBlockArea_Create01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_SizeX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_SizeY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_SizeZ = ((int) tolua_tonumber(tolua_S,4,0)); - int a_DataTypes = ((int) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Create'", NULL); -#endif - { - self->Create(a_SizeX,a_SizeY,a_SizeZ,a_DataTypes); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cBlockArea_Create00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetOrigin of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetOrigin00 -static int tolua_AllToLua_cBlockArea_SetOrigin00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_OriginX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_OriginY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_OriginZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetOrigin'", NULL); -#endif - { - self->SetOrigin(a_OriginX,a_OriginY,a_OriginZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetOrigin'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Read of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Read00 -static int tolua_AllToLua_cBlockArea_Read00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnumber(tolua_S,8,0,&tolua_err) || - !tolua_isnoobj(tolua_S,9,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0)); - int a_MinBlockX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_MaxBlockX = ((int) tolua_tonumber(tolua_S,4,0)); - int a_MinBlockY = ((int) tolua_tonumber(tolua_S,5,0)); - int a_MaxBlockY = ((int) tolua_tonumber(tolua_S,6,0)); - int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,7,0)); - int a_MaxBlockZ = ((int) tolua_tonumber(tolua_S,8,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Read'", NULL); -#endif - { - bool tolua_ret = (bool) self->Read(a_World,a_MinBlockX,a_MaxBlockX,a_MinBlockY,a_MaxBlockY,a_MinBlockZ,a_MaxBlockZ); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Read'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Read of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Read01 -static int tolua_AllToLua_cBlockArea_Read01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnumber(tolua_S,8,0,&tolua_err) || - !tolua_isnumber(tolua_S,9,0,&tolua_err) || - !tolua_isnoobj(tolua_S,10,&tolua_err) - ) - goto tolua_lerror; - else - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0)); - int a_MinBlockX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_MaxBlockX = ((int) tolua_tonumber(tolua_S,4,0)); - int a_MinBlockY = ((int) tolua_tonumber(tolua_S,5,0)); - int a_MaxBlockY = ((int) tolua_tonumber(tolua_S,6,0)); - int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,7,0)); - int a_MaxBlockZ = ((int) tolua_tonumber(tolua_S,8,0)); - int a_DataTypes = ((int) tolua_tonumber(tolua_S,9,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Read'", NULL); -#endif - { - bool tolua_ret = (bool) self->Read(a_World,a_MinBlockX,a_MaxBlockX,a_MinBlockY,a_MaxBlockY,a_MinBlockZ,a_MaxBlockZ,a_DataTypes); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBlockArea_Read00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Write of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Write00 -static int tolua_AllToLua_cBlockArea_Write00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0)); - int a_MinBlockX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_MinBlockY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Write'", NULL); -#endif - { - bool tolua_ret = (bool) self->Write(a_World,a_MinBlockX,a_MinBlockY,a_MinBlockZ); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Write'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Write of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Write01 -static int tolua_AllToLua_cBlockArea_Write01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0)); - int a_MinBlockX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_MinBlockY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,5,0)); - int a_DataTypes = ((int) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Write'", NULL); -#endif - { - bool tolua_ret = (bool) self->Write(a_World,a_MinBlockX,a_MinBlockY,a_MinBlockZ,a_DataTypes); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -tolua_lerror: - return tolua_AllToLua_cBlockArea_Write00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CopyTo of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_CopyTo00 -static int tolua_AllToLua_cBlockArea_CopyTo00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cBlockArea",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); - cBlockArea* a_Into = ((cBlockArea*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CopyTo'", NULL); -#endif - { - self->CopyTo(*a_Into); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CopyTo'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: CopyFrom of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_CopyFrom00 -static int tolua_AllToLua_cBlockArea_CopyFrom00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBlockArea",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - const cBlockArea* a_From = ((const cBlockArea*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CopyFrom'", NULL); -#endif - { - self->CopyFrom(*a_From); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'CopyFrom'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: DumpToRawFile of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_DumpToRawFile00 -static int tolua_AllToLua_cBlockArea_DumpToRawFile00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DumpToRawFile'", NULL); -#endif - { - self->DumpToRawFile(a_FileName); - tolua_pushcppstring(tolua_S,(const char*)a_FileName); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'DumpToRawFile'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: LoadFromSchematicFile of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_LoadFromSchematicFile00 -static int tolua_AllToLua_cBlockArea_LoadFromSchematicFile00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'LoadFromSchematicFile'", NULL); -#endif - { - bool tolua_ret = (bool) self->LoadFromSchematicFile(a_FileName); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_FileName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'LoadFromSchematicFile'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SaveToSchematicFile of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SaveToSchematicFile00 -static int tolua_AllToLua_cBlockArea_SaveToSchematicFile00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SaveToSchematicFile'", NULL); -#endif - { - bool tolua_ret = (bool) self->SaveToSchematicFile(a_FileName); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_FileName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SaveToSchematicFile'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Crop of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Crop00 -static int tolua_AllToLua_cBlockArea_Crop00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_AddMinX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_SubMaxX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_AddMinY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_SubMaxY = ((int) tolua_tonumber(tolua_S,5,0)); - int a_AddMinZ = ((int) tolua_tonumber(tolua_S,6,0)); - int a_SubMaxZ = ((int) tolua_tonumber(tolua_S,7,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Crop'", NULL); -#endif - { - self->Crop(a_AddMinX,a_SubMaxX,a_AddMinY,a_SubMaxY,a_AddMinZ,a_SubMaxZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Crop'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Expand of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Expand00 -static int tolua_AllToLua_cBlockArea_Expand00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnoobj(tolua_S,8,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_SubMinX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_AddMaxX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_SubMinY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_AddMaxY = ((int) tolua_tonumber(tolua_S,5,0)); - int a_SubMinZ = ((int) tolua_tonumber(tolua_S,6,0)); - int a_AddMaxZ = ((int) tolua_tonumber(tolua_S,7,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Expand'", NULL); -#endif - { - self->Expand(a_SubMinX,a_AddMaxX,a_SubMinY,a_AddMaxY,a_SubMinZ,a_AddMaxZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Expand'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Merge of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Merge00 -static int tolua_AllToLua_cBlockArea_Merge00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBlockArea",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - const cBlockArea* a_Src = ((const cBlockArea*) tolua_tousertype(tolua_S,2,0)); - int a_RelX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,5,0)); - cBlockArea::eMergeStrategy a_Strategy = ((cBlockArea::eMergeStrategy) (int) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Merge'", NULL); -#endif - { - self->Merge(*a_Src,a_RelX,a_RelY,a_RelZ,a_Strategy); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Merge'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Fill of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Fill00 -static int tolua_AllToLua_cBlockArea_Fill00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,1,&tolua_err) || - !tolua_isnumber(tolua_S,5,1,&tolua_err) || - !tolua_isnumber(tolua_S,6,1,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_DataTypes = ((int) tolua_tonumber(tolua_S,2,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,3,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockLight = (( unsigned char) tolua_tonumber(tolua_S,5,0)); - unsigned char a_BlockSkyLight = (( unsigned char) tolua_tonumber(tolua_S,6,0x0f)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Fill'", NULL); -#endif - { - self->Fill(a_DataTypes,a_BlockType,a_BlockMeta,a_BlockLight,a_BlockSkyLight); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Fill'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FillRelCuboid of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_FillRelCuboid00 -static int tolua_AllToLua_cBlockArea_FillRelCuboid00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnumber(tolua_S,8,0,&tolua_err) || - !tolua_isnumber(tolua_S,9,0,&tolua_err) || - !tolua_isnumber(tolua_S,10,1,&tolua_err) || - !tolua_isnumber(tolua_S,11,1,&tolua_err) || - !tolua_isnumber(tolua_S,12,1,&tolua_err) || - !tolua_isnoobj(tolua_S,13,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_MinRelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_MaxRelX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_MinRelY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_MaxRelY = ((int) tolua_tonumber(tolua_S,5,0)); - int a_MinRelZ = ((int) tolua_tonumber(tolua_S,6,0)); - int a_MaxRelZ = ((int) tolua_tonumber(tolua_S,7,0)); - int a_DataTypes = ((int) tolua_tonumber(tolua_S,8,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,9,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,10,0)); - unsigned char a_BlockLight = (( unsigned char) tolua_tonumber(tolua_S,11,0)); - unsigned char a_BlockSkyLight = (( unsigned char) tolua_tonumber(tolua_S,12,0x0f)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FillRelCuboid'", NULL); -#endif - { - self->FillRelCuboid(a_MinRelX,a_MaxRelX,a_MinRelY,a_MaxRelY,a_MinRelZ,a_MaxRelZ,a_DataTypes,a_BlockType,a_BlockMeta,a_BlockLight,a_BlockSkyLight); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'FillRelCuboid'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: RelLine of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RelLine00 -static int tolua_AllToLua_cBlockArea_RelLine00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnumber(tolua_S,8,0,&tolua_err) || - !tolua_isnumber(tolua_S,9,0,&tolua_err) || - !tolua_isnumber(tolua_S,10,1,&tolua_err) || - !tolua_isnumber(tolua_S,11,1,&tolua_err) || - !tolua_isnumber(tolua_S,12,1,&tolua_err) || - !tolua_isnoobj(tolua_S,13,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_RelX1 = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY1 = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ1 = ((int) tolua_tonumber(tolua_S,4,0)); - int a_RelX2 = ((int) tolua_tonumber(tolua_S,5,0)); - int a_RelY2 = ((int) tolua_tonumber(tolua_S,6,0)); - int a_RelZ2 = ((int) tolua_tonumber(tolua_S,7,0)); - int a_DataTypes = ((int) tolua_tonumber(tolua_S,8,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,9,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,10,0)); - unsigned char a_BlockLight = (( unsigned char) tolua_tonumber(tolua_S,11,0)); - unsigned char a_BlockSkyLight = (( unsigned char) tolua_tonumber(tolua_S,12,0x0f)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RelLine'", NULL); -#endif - { - self->RelLine(a_RelX1,a_RelY1,a_RelZ1,a_RelX2,a_RelY2,a_RelZ2,a_DataTypes,a_BlockType,a_BlockMeta,a_BlockLight,a_BlockSkyLight); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'RelLine'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: RotateCCW of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCCW00 -static int tolua_AllToLua_cBlockArea_RotateCCW00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCCW'", NULL); -#endif - { - self->RotateCCW(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'RotateCCW'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: RotateCW of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCW00 -static int tolua_AllToLua_cBlockArea_RotateCW00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCW'", NULL); -#endif - { - self->RotateCW(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'RotateCW'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: MirrorXY of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_MirrorXY00 -static int tolua_AllToLua_cBlockArea_MirrorXY00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MirrorXY'", NULL); -#endif - { - self->MirrorXY(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'MirrorXY'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: MirrorXZ of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_MirrorXZ00 -static int tolua_AllToLua_cBlockArea_MirrorXZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MirrorXZ'", NULL); -#endif - { - self->MirrorXZ(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'MirrorXZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: MirrorYZ of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_MirrorYZ00 -static int tolua_AllToLua_cBlockArea_MirrorYZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MirrorYZ'", NULL); -#endif - { - self->MirrorYZ(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'MirrorYZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: RotateCCWNoMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCCWNoMeta00 -static int tolua_AllToLua_cBlockArea_RotateCCWNoMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCCWNoMeta'", NULL); -#endif - { - self->RotateCCWNoMeta(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'RotateCCWNoMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: RotateCWNoMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCWNoMeta00 -static int tolua_AllToLua_cBlockArea_RotateCWNoMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCWNoMeta'", NULL); -#endif - { - self->RotateCWNoMeta(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'RotateCWNoMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: MirrorXYNoMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_MirrorXYNoMeta00 -static int tolua_AllToLua_cBlockArea_MirrorXYNoMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MirrorXYNoMeta'", NULL); -#endif - { - self->MirrorXYNoMeta(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'MirrorXYNoMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: MirrorXZNoMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_MirrorXZNoMeta00 -static int tolua_AllToLua_cBlockArea_MirrorXZNoMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MirrorXZNoMeta'", NULL); -#endif - { - self->MirrorXZNoMeta(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'MirrorXZNoMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: MirrorYZNoMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_MirrorYZNoMeta00 -static int tolua_AllToLua_cBlockArea_MirrorYZNoMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MirrorYZNoMeta'", NULL); -#endif - { - self->MirrorYZNoMeta(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'MirrorYZNoMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetRelBlockType of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockType00 -static int tolua_AllToLua_cBlockArea_SetRelBlockType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockType'", NULL); -#endif - { - self->SetRelBlockType(a_RelX,a_RelY,a_RelZ,a_BlockType); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetRelBlockType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetBlockType of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockType00 -static int tolua_AllToLua_cBlockArea_SetBlockType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockType'", NULL); -#endif - { - self->SetBlockType(a_BlockX,a_BlockY,a_BlockZ,a_BlockType); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetBlockType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetRelBlockMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockMeta00 -static int tolua_AllToLua_cBlockArea_SetRelBlockMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockMeta'", NULL); -#endif - { - self->SetRelBlockMeta(a_RelX,a_RelY,a_RelZ,a_BlockMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetRelBlockMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetBlockMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockMeta00 -static int tolua_AllToLua_cBlockArea_SetBlockMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockMeta'", NULL); -#endif - { - self->SetBlockMeta(a_BlockX,a_BlockY,a_BlockZ,a_BlockMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetBlockMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetRelBlockLight of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockLight00 -static int tolua_AllToLua_cBlockArea_SetRelBlockLight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockLight = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockLight'", NULL); -#endif - { - self->SetRelBlockLight(a_RelX,a_RelY,a_RelZ,a_BlockLight); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetRelBlockLight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetBlockLight of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockLight00 -static int tolua_AllToLua_cBlockArea_SetBlockLight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockLight = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockLight'", NULL); -#endif - { - self->SetBlockLight(a_BlockX,a_BlockY,a_BlockZ,a_BlockLight); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetBlockLight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetRelBlockSkyLight of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockSkyLight00 -static int tolua_AllToLua_cBlockArea_SetRelBlockSkyLight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockSkyLight = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockSkyLight'", NULL); -#endif - { - self->SetRelBlockSkyLight(a_RelX,a_RelY,a_RelZ,a_BlockSkyLight); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetRelBlockSkyLight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetBlockSkyLight of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockSkyLight00 -static int tolua_AllToLua_cBlockArea_SetBlockSkyLight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockSkyLight = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockSkyLight'", NULL); -#endif - { - self->SetBlockSkyLight(a_BlockX,a_BlockY,a_BlockZ,a_BlockSkyLight); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetBlockSkyLight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetRelBlockType of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockType00 -static int tolua_AllToLua_cBlockArea_GetRelBlockType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockType'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetRelBlockType(a_RelX,a_RelY,a_RelZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetRelBlockType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockType of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockType00 -static int tolua_AllToLua_cBlockArea_GetBlockType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockType'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlockType(a_BlockX,a_BlockY,a_BlockZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetRelBlockMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockMeta00 -static int tolua_AllToLua_cBlockArea_GetRelBlockMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockMeta'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetRelBlockMeta(a_RelX,a_RelY,a_RelZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetRelBlockMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockMeta00 -static int tolua_AllToLua_cBlockArea_GetBlockMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockMeta'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlockMeta(a_BlockX,a_BlockY,a_BlockZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetRelBlockLight of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockLight00 -static int tolua_AllToLua_cBlockArea_GetRelBlockLight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockLight'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetRelBlockLight(a_RelX,a_RelY,a_RelZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetRelBlockLight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockLight of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockLight00 -static int tolua_AllToLua_cBlockArea_GetBlockLight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockLight'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlockLight(a_BlockX,a_BlockY,a_BlockZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockLight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetRelBlockSkyLight of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockSkyLight00 -static int tolua_AllToLua_cBlockArea_GetRelBlockSkyLight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockSkyLight'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetRelBlockSkyLight(a_RelX,a_RelY,a_RelZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetRelBlockSkyLight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockSkyLight of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockSkyLight00 -static int tolua_AllToLua_cBlockArea_GetBlockSkyLight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockSkyLight'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlockSkyLight(a_BlockX,a_BlockY,a_BlockZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockSkyLight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetBlockTypeMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockTypeMeta00 -static int tolua_AllToLua_cBlockArea_SetBlockTypeMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockTypeMeta'", NULL); -#endif - { - self->SetBlockTypeMeta(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetBlockTypeMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetRelBlockTypeMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockTypeMeta00 -static int tolua_AllToLua_cBlockArea_SetRelBlockTypeMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockTypeMeta'", NULL); -#endif - { - self->SetRelBlockTypeMeta(a_RelX,a_RelY,a_RelZ,a_BlockType,a_BlockMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetRelBlockTypeMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockTypeMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockTypeMeta00 -static int tolua_AllToLua_cBlockArea_GetBlockTypeMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockTypeMeta'", NULL); -#endif - { - self->GetBlockTypeMeta(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta); - tolua_pushnumber(tolua_S,(lua_Number)a_BlockType); - tolua_pushnumber(tolua_S,(lua_Number)a_BlockMeta); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockTypeMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetRelBlockTypeMeta of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockTypeMeta00 -static int tolua_AllToLua_cBlockArea_GetRelBlockTypeMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockTypeMeta'", NULL); -#endif - { - self->GetRelBlockTypeMeta(a_RelX,a_RelY,a_RelZ,a_BlockType,a_BlockMeta); - tolua_pushnumber(tolua_S,(lua_Number)a_BlockType); - tolua_pushnumber(tolua_S,(lua_Number)a_BlockMeta); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetRelBlockTypeMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSizeX of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetSizeX00 -static int tolua_AllToLua_cBlockArea_GetSizeX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSizeX'", NULL); -#endif - { - int tolua_ret = (int) self->GetSizeX(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSizeX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSizeY of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetSizeY00 -static int tolua_AllToLua_cBlockArea_GetSizeY00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSizeY'", NULL); -#endif - { - int tolua_ret = (int) self->GetSizeY(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSizeY'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSizeZ of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetSizeZ00 -static int tolua_AllToLua_cBlockArea_GetSizeZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSizeZ'", NULL); -#endif - { - int tolua_ret = (int) self->GetSizeZ(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSizeZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetOriginX of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetOriginX00 -static int tolua_AllToLua_cBlockArea_GetOriginX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOriginX'", NULL); -#endif - { - int tolua_ret = (int) self->GetOriginX(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetOriginX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetOriginY of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetOriginY00 -static int tolua_AllToLua_cBlockArea_GetOriginY00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOriginY'", NULL); -#endif - { - int tolua_ret = (int) self->GetOriginY(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetOriginY'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetOriginZ of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetOriginZ00 -static int tolua_AllToLua_cBlockArea_GetOriginZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOriginZ'", NULL); -#endif - { - int tolua_ret = (int) self->GetOriginZ(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetOriginZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetDataTypes of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetDataTypes00 -static int tolua_AllToLua_cBlockArea_GetDataTypes00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDataTypes'", NULL); -#endif - { - int tolua_ret = (int) self->GetDataTypes(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetDataTypes'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HasBlockTypes of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_HasBlockTypes00 -static int tolua_AllToLua_cBlockArea_HasBlockTypes00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasBlockTypes'", NULL); -#endif - { - bool tolua_ret = (bool) self->HasBlockTypes(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HasBlockTypes'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HasBlockMetas of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_HasBlockMetas00 -static int tolua_AllToLua_cBlockArea_HasBlockMetas00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasBlockMetas'", NULL); -#endif - { - bool tolua_ret = (bool) self->HasBlockMetas(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HasBlockMetas'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HasBlockLights of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_HasBlockLights00 -static int tolua_AllToLua_cBlockArea_HasBlockLights00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasBlockLights'", NULL); -#endif - { - bool tolua_ret = (bool) self->HasBlockLights(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HasBlockLights'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: HasBlockSkyLights of class cBlockArea */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_HasBlockSkyLights00 -static int tolua_AllToLua_cBlockArea_HasBlockSkyLights00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasBlockSkyLights'", NULL); -#endif - { - bool tolua_ret = (bool) self->HasBlockSkyLights(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'HasBlockSkyLights'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetChunkX of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetChunkX00 -static int tolua_AllToLua_cChunkDesc_GetChunkX00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetChunkX'", NULL); -#endif - { - int tolua_ret = (int) self->GetChunkX(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetChunkX'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetChunkZ of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetChunkZ00 -static int tolua_AllToLua_cChunkDesc_GetChunkZ00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetChunkZ'", NULL); -#endif - { - int tolua_ret = (int) self->GetChunkZ(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetChunkZ'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FillBlocks of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FillBlocks00 -static int tolua_AllToLua_cChunkDesc_FillBlocks00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,2,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FillBlocks'", NULL); -#endif - { - self->FillBlocks(a_BlockType,a_BlockMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'FillBlocks'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetBlockTypeMeta of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetBlockTypeMeta00 -static int tolua_AllToLua_cChunkDesc_SetBlockTypeMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockTypeMeta'", NULL); -#endif - { - self->SetBlockTypeMeta(a_RelX,a_RelY,a_RelZ,a_BlockType,a_BlockMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetBlockTypeMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockTypeMeta of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBlockTypeMeta00 -static int tolua_AllToLua_cChunkDesc_GetBlockTypeMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockTypeMeta'", NULL); -#endif - { - self->GetBlockTypeMeta(a_RelX,a_RelY,a_RelZ,a_BlockType,a_BlockMeta); - tolua_pushnumber(tolua_S,(lua_Number)a_BlockType); - tolua_pushnumber(tolua_S,(lua_Number)a_BlockMeta); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockTypeMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetBlockType of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetBlockType00 -static int tolua_AllToLua_cChunkDesc_SetBlockType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockType'", NULL); -#endif - { - self->SetBlockType(a_RelX,a_RelY,a_RelZ,a_BlockType); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetBlockType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockType of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBlockType00 -static int tolua_AllToLua_cChunkDesc_GetBlockType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockType'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlockType(a_RelX,a_RelY,a_RelZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetBlockMeta of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetBlockMeta00 -static int tolua_AllToLua_cChunkDesc_SetBlockMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,5,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockMeta'", NULL); -#endif - { - self->SetBlockMeta(a_RelX,a_RelY,a_RelZ,a_BlockMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetBlockMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockMeta of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBlockMeta00 -static int tolua_AllToLua_cChunkDesc_GetBlockMeta00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockMeta'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetBlockMeta(a_RelX,a_RelY,a_RelZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockMeta'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetBiome of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetBiome00 -static int tolua_AllToLua_cChunkDesc_SetBiome00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,3,0)); - int a_BiomeID = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBiome'", NULL); -#endif - { - self->SetBiome(a_RelX,a_RelZ,a_BiomeID); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetBiome'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBiome of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBiome00 -static int tolua_AllToLua_cChunkDesc_GetBiome00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBiome'", NULL); -#endif - { - EMCSBiome tolua_ret = (EMCSBiome) self->GetBiome(a_RelX,a_RelZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBiome'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetHeight of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetHeight00 -static int tolua_AllToLua_cChunkDesc_SetHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,3,0)); - int a_Height = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetHeight'", NULL); -#endif - { - self->SetHeight(a_RelX,a_RelZ,a_Height); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetHeight of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetHeight00 -static int tolua_AllToLua_cChunkDesc_GetHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeight'", NULL); -#endif - { - int tolua_ret = (int) self->GetHeight(a_RelX,a_RelZ); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetUseDefaultBiomes of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultBiomes00 -static int tolua_AllToLua_cChunkDesc_SetUseDefaultBiomes00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - bool a_bUseDefaultBiomes = ((bool) tolua_toboolean(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultBiomes'", NULL); -#endif - { - self->SetUseDefaultBiomes(a_bUseDefaultBiomes); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetUseDefaultBiomes'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsUsingDefaultBiomes of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultBiomes00 -static int tolua_AllToLua_cChunkDesc_IsUsingDefaultBiomes00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultBiomes'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsUsingDefaultBiomes(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultBiomes'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetUseDefaultHeight of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultHeight00 -static int tolua_AllToLua_cChunkDesc_SetUseDefaultHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - bool a_bUseDefaultHeight = ((bool) tolua_toboolean(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultHeight'", NULL); -#endif - { - self->SetUseDefaultHeight(a_bUseDefaultHeight); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetUseDefaultHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsUsingDefaultHeight of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultHeight00 -static int tolua_AllToLua_cChunkDesc_IsUsingDefaultHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultHeight'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsUsingDefaultHeight(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetUseDefaultComposition of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultComposition00 -static int tolua_AllToLua_cChunkDesc_SetUseDefaultComposition00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - bool a_bUseDefaultComposition = ((bool) tolua_toboolean(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultComposition'", NULL); -#endif - { - self->SetUseDefaultComposition(a_bUseDefaultComposition); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetUseDefaultComposition'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsUsingDefaultComposition of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultComposition00 -static int tolua_AllToLua_cChunkDesc_IsUsingDefaultComposition00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultComposition'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsUsingDefaultComposition(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultComposition'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetUseDefaultStructures of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultStructures00 -static int tolua_AllToLua_cChunkDesc_SetUseDefaultStructures00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - bool a_bUseDefaultStructures = ((bool) tolua_toboolean(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultStructures'", NULL); -#endif - { - self->SetUseDefaultStructures(a_bUseDefaultStructures); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetUseDefaultStructures'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsUsingDefaultStructures of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultStructures00 -static int tolua_AllToLua_cChunkDesc_IsUsingDefaultStructures00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultStructures'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsUsingDefaultStructures(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultStructures'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetUseDefaultFinish of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultFinish00 -static int tolua_AllToLua_cChunkDesc_SetUseDefaultFinish00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isboolean(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - bool a_bUseDefaultFinish = ((bool) tolua_toboolean(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultFinish'", NULL); -#endif - { - self->SetUseDefaultFinish(a_bUseDefaultFinish); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetUseDefaultFinish'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsUsingDefaultFinish of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultFinish00 -static int tolua_AllToLua_cChunkDesc_IsUsingDefaultFinish00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultFinish'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsUsingDefaultFinish(); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultFinish'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: WriteBlockArea of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_WriteBlockArea00 -static int tolua_AllToLua_cChunkDesc_WriteBlockArea00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBlockArea",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,1,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - const cBlockArea* a_BlockArea = ((const cBlockArea*) tolua_tousertype(tolua_S,2,0)); - int a_RelX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,5,0)); - cBlockArea::eMergeStrategy a_MergeStrategy = ((cBlockArea::eMergeStrategy) (int) tolua_tonumber(tolua_S,6,cBlockArea::msOverwrite)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'WriteBlockArea'", NULL); -#endif - { - self->WriteBlockArea(*a_BlockArea,a_RelX,a_RelY,a_RelZ,a_MergeStrategy); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'WriteBlockArea'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ReadBlockArea of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_ReadBlockArea00 -static int tolua_AllToLua_cChunkDesc_ReadBlockArea00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cBlockArea",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnumber(tolua_S,8,0,&tolua_err) || - !tolua_isnoobj(tolua_S,9,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - cBlockArea* a_Dest = ((cBlockArea*) tolua_tousertype(tolua_S,2,0)); - int a_MinRelX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_MaxRelX = ((int) tolua_tonumber(tolua_S,4,0)); - int a_MinRelY = ((int) tolua_tonumber(tolua_S,5,0)); - int a_MaxRelY = ((int) tolua_tonumber(tolua_S,6,0)); - int a_MinRelZ = ((int) tolua_tonumber(tolua_S,7,0)); - int a_MaxRelZ = ((int) tolua_tonumber(tolua_S,8,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ReadBlockArea'", NULL); -#endif - { - self->ReadBlockArea(*a_Dest,a_MinRelX,a_MaxRelX,a_MinRelY,a_MaxRelY,a_MinRelZ,a_MaxRelZ); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ReadBlockArea'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetMaxHeight of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetMaxHeight00 -static int tolua_AllToLua_cChunkDesc_GetMaxHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxHeight'", NULL); -#endif - { - unsigned char tolua_ret = ( unsigned char) self->GetMaxHeight(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMaxHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FillRelCuboid of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FillRelCuboid00 -static int tolua_AllToLua_cChunkDesc_FillRelCuboid00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnumber(tolua_S,8,0,&tolua_err) || - !tolua_isnumber(tolua_S,9,0,&tolua_err) || - !tolua_isnoobj(tolua_S,10,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_MinX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_MaxX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_MinY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_MaxY = ((int) tolua_tonumber(tolua_S,5,0)); - int a_MinZ = ((int) tolua_tonumber(tolua_S,6,0)); - int a_MaxZ = ((int) tolua_tonumber(tolua_S,7,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,8,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,9,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FillRelCuboid'", NULL); -#endif - { - self->FillRelCuboid(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ,a_BlockType,a_BlockMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'FillRelCuboid'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FillRelCuboid of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FillRelCuboid01 -static int tolua_AllToLua_cChunkDesc_FillRelCuboid01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - const cCuboid* a_RelCuboid = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,3,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FillRelCuboid'", NULL); -#endif - { - self->FillRelCuboid(*a_RelCuboid,a_BlockType,a_BlockMeta); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cChunkDesc_FillRelCuboid00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ReplaceRelCuboid of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_ReplaceRelCuboid00 -static int tolua_AllToLua_cChunkDesc_ReplaceRelCuboid00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnumber(tolua_S,8,0,&tolua_err) || - !tolua_isnumber(tolua_S,9,0,&tolua_err) || - !tolua_isnumber(tolua_S,10,0,&tolua_err) || - !tolua_isnumber(tolua_S,11,0,&tolua_err) || - !tolua_isnoobj(tolua_S,12,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_MinX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_MaxX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_MinY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_MaxY = ((int) tolua_tonumber(tolua_S,5,0)); - int a_MinZ = ((int) tolua_tonumber(tolua_S,6,0)); - int a_MaxZ = ((int) tolua_tonumber(tolua_S,7,0)); - unsigned char a_SrcType = (( unsigned char) tolua_tonumber(tolua_S,8,0)); - unsigned char a_SrcMeta = (( unsigned char) tolua_tonumber(tolua_S,9,0)); - unsigned char a_DstType = (( unsigned char) tolua_tonumber(tolua_S,10,0)); - unsigned char a_DstMeta = (( unsigned char) tolua_tonumber(tolua_S,11,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ReplaceRelCuboid'", NULL); -#endif - { - self->ReplaceRelCuboid(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ,a_SrcType,a_SrcMeta,a_DstType,a_DstMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ReplaceRelCuboid'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ReplaceRelCuboid of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_ReplaceRelCuboid01 -static int tolua_AllToLua_cChunkDesc_ReplaceRelCuboid01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - const cCuboid* a_RelCuboid = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); - unsigned char a_SrcType = (( unsigned char) tolua_tonumber(tolua_S,3,0)); - unsigned char a_SrcMeta = (( unsigned char) tolua_tonumber(tolua_S,4,0)); - unsigned char a_DstType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); - unsigned char a_DstMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ReplaceRelCuboid'", NULL); -#endif - { - self->ReplaceRelCuboid(*a_RelCuboid,a_SrcType,a_SrcMeta,a_DstType,a_DstMeta); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cChunkDesc_ReplaceRelCuboid00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FloorRelCuboid of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FloorRelCuboid00 -static int tolua_AllToLua_cChunkDesc_FloorRelCuboid00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnumber(tolua_S,8,0,&tolua_err) || - !tolua_isnumber(tolua_S,9,0,&tolua_err) || - !tolua_isnoobj(tolua_S,10,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_MinX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_MaxX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_MinY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_MaxY = ((int) tolua_tonumber(tolua_S,5,0)); - int a_MinZ = ((int) tolua_tonumber(tolua_S,6,0)); - int a_MaxZ = ((int) tolua_tonumber(tolua_S,7,0)); - unsigned char a_DstType = (( unsigned char) tolua_tonumber(tolua_S,8,0)); - unsigned char a_DstMeta = (( unsigned char) tolua_tonumber(tolua_S,9,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FloorRelCuboid'", NULL); -#endif - { - self->FloorRelCuboid(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ,a_DstType,a_DstMeta); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'FloorRelCuboid'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FloorRelCuboid of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FloorRelCuboid01 -static int tolua_AllToLua_cChunkDesc_FloorRelCuboid01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - const cCuboid* a_RelCuboid = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); - unsigned char a_DstType = (( unsigned char) tolua_tonumber(tolua_S,3,0)); - unsigned char a_DstMeta = (( unsigned char) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FloorRelCuboid'", NULL); -#endif - { - self->FloorRelCuboid(*a_RelCuboid,a_DstType,a_DstMeta); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cChunkDesc_FloorRelCuboid00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: RandomFillRelCuboid of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_RandomFillRelCuboid00 -static int tolua_AllToLua_cChunkDesc_RandomFillRelCuboid00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnumber(tolua_S,7,0,&tolua_err) || - !tolua_isnumber(tolua_S,8,0,&tolua_err) || - !tolua_isnumber(tolua_S,9,0,&tolua_err) || - !tolua_isnumber(tolua_S,10,0,&tolua_err) || - !tolua_isnumber(tolua_S,11,0,&tolua_err) || - !tolua_isnoobj(tolua_S,12,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_MinX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_MaxX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_MinY = ((int) tolua_tonumber(tolua_S,4,0)); - int a_MaxY = ((int) tolua_tonumber(tolua_S,5,0)); - int a_MinZ = ((int) tolua_tonumber(tolua_S,6,0)); - int a_MaxZ = ((int) tolua_tonumber(tolua_S,7,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,8,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,9,0)); - int a_RandomSeed = ((int) tolua_tonumber(tolua_S,10,0)); - int a_ChanceOutOf10k = ((int) tolua_tonumber(tolua_S,11,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RandomFillRelCuboid'", NULL); -#endif - { - self->RandomFillRelCuboid(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ,a_BlockType,a_BlockMeta,a_RandomSeed,a_ChanceOutOf10k); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'RandomFillRelCuboid'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: RandomFillRelCuboid of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_RandomFillRelCuboid01 -static int tolua_AllToLua_cChunkDesc_RandomFillRelCuboid01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - const cCuboid* a_RelCuboid = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); - unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,3,0)); - unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,4,0)); - int a_RandomSeed = ((int) tolua_tonumber(tolua_S,5,0)); - int a_ChanceOutOf10k = ((int) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RandomFillRelCuboid'", NULL); -#endif - { - self->RandomFillRelCuboid(*a_RelCuboid,a_BlockType,a_BlockMeta,a_RandomSeed,a_ChanceOutOf10k); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cChunkDesc_RandomFillRelCuboid00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetBlockEntity of class cChunkDesc */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBlockEntity00 -static int tolua_AllToLua_cChunkDesc_GetBlockEntity00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); - int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); - int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); - int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockEntity'", NULL); -#endif - { - cBlockEntity* tolua_ret = (cBlockEntity*) self->GetBlockEntity(a_RelX,a_RelY,a_RelZ); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBlockEntity"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetBlockEntity'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cCraftingGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_new00 -static int tolua_AllToLua_cCraftingGrid_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cCraftingGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - int a_Width = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Height = ((int) tolua_tonumber(tolua_S,3,0)); - { - cCraftingGrid* tolua_ret = (cCraftingGrid*) Mtolua_new((cCraftingGrid)(a_Width,a_Height)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCraftingGrid"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cCraftingGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_new00_local -static int tolua_AllToLua_cCraftingGrid_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cCraftingGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - int a_Width = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Height = ((int) tolua_tonumber(tolua_S,3,0)); - { - cCraftingGrid* tolua_ret = (cCraftingGrid*) Mtolua_new((cCraftingGrid)(a_Width,a_Height)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCraftingGrid"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWidth of class cCraftingGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_GetWidth00 -static int tolua_AllToLua_cCraftingGrid_GetWidth00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCraftingGrid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCraftingGrid* self = (const cCraftingGrid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWidth'", NULL); -#endif - { - int tolua_ret = (int) self->GetWidth(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWidth'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetHeight of class cCraftingGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_GetHeight00 -static int tolua_AllToLua_cCraftingGrid_GetHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCraftingGrid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCraftingGrid* self = (const cCraftingGrid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeight'", NULL); -#endif - { - int tolua_ret = (int) self->GetHeight(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetItem of class cCraftingGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_GetItem00 -static int tolua_AllToLua_cCraftingGrid_GetItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCraftingGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCraftingGrid* self = (const cCraftingGrid*) tolua_tousertype(tolua_S,1,0); - int x = ((int) tolua_tonumber(tolua_S,2,0)); - int y = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetItem'", NULL); -#endif - { - cItem& tolua_ret = (cItem&) self->GetItem(x,y); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetItem of class cCraftingGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_SetItem00 -static int tolua_AllToLua_cCraftingGrid_SetItem00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCraftingGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0); - int x = ((int) tolua_tonumber(tolua_S,2,0)); - int y = ((int) tolua_tonumber(tolua_S,3,0)); - ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,4,0)); - int a_ItemCount = ((int) tolua_tonumber(tolua_S,5,0)); - short a_ItemHealth = ((short) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetItem'", NULL); -#endif - { - self->SetItem(x,y,a_ItemType,a_ItemCount,a_ItemHealth); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetItem'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetItem of class cCraftingGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_SetItem01 -static int tolua_AllToLua_cCraftingGrid_SetItem01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCraftingGrid",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0); - int x = ((int) tolua_tonumber(tolua_S,2,0)); - int y = ((int) tolua_tonumber(tolua_S,3,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetItem'", NULL); -#endif - { - self->SetItem(x,y,*a_Item); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cCraftingGrid_SetItem00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Clear of class cCraftingGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_Clear00 -static int tolua_AllToLua_cCraftingGrid_Clear00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCraftingGrid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); -#endif - { - self->Clear(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ConsumeGrid of class cCraftingGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_ConsumeGrid00 -static int tolua_AllToLua_cCraftingGrid_ConsumeGrid00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCraftingGrid",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCraftingGrid",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0); - const cCraftingGrid* a_Grid = ((const cCraftingGrid*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ConsumeGrid'", NULL); -#endif - { - self->ConsumeGrid(*a_Grid); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ConsumeGrid'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Dump of class cCraftingGrid */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_Dump00 -static int tolua_AllToLua_cCraftingGrid_Dump00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCraftingGrid",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Dump'", NULL); -#endif - { - self->Dump(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Dump'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Clear of class cCraftingRecipe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_Clear00 -static int tolua_AllToLua_cCraftingRecipe_Clear00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); -#endif - { - self->Clear(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetIngredientsWidth of class cCraftingRecipe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_GetIngredientsWidth00 -static int tolua_AllToLua_cCraftingRecipe_GetIngredientsWidth00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCraftingRecipe",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCraftingRecipe* self = (const cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetIngredientsWidth'", NULL); -#endif - { - int tolua_ret = (int) self->GetIngredientsWidth(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetIngredientsWidth'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetIngredientsHeight of class cCraftingRecipe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_GetIngredientsHeight00 -static int tolua_AllToLua_cCraftingRecipe_GetIngredientsHeight00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCraftingRecipe",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCraftingRecipe* self = (const cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetIngredientsHeight'", NULL); -#endif - { - int tolua_ret = (int) self->GetIngredientsHeight(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetIngredientsHeight'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetIngredient of class cCraftingRecipe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_GetIngredient00 -static int tolua_AllToLua_cCraftingRecipe_GetIngredient00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCraftingRecipe",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCraftingRecipe* self = (const cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); - int x = ((int) tolua_tonumber(tolua_S,2,0)); - int y = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetIngredient'", NULL); -#endif - { - cItem& tolua_ret = (cItem&) self->GetIngredient(x,y); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetIngredient'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetResult of class cCraftingRecipe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_GetResult00 -static int tolua_AllToLua_cCraftingRecipe_GetResult00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cCraftingRecipe",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cCraftingRecipe* self = (const cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetResult'", NULL); -#endif - { - const cItem& tolua_ret = (const cItem&) self->GetResult(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetResult'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetResult of class cCraftingRecipe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_SetResult00 -static int tolua_AllToLua_cCraftingRecipe_SetResult00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); - ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,2,0)); - int a_ItemCount = ((int) tolua_tonumber(tolua_S,3,0)); - short a_ItemHealth = ((short) tolua_tonumber(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetResult'", NULL); -#endif - { - self->SetResult(a_ItemType,a_ItemCount,a_ItemHealth); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetResult'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetResult of class cCraftingRecipe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_SetResult01 -static int tolua_AllToLua_cCraftingRecipe_SetResult01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else - { - cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetResult'", NULL); -#endif - { - self->SetResult(*a_Item); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cCraftingRecipe_SetResult00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetIngredient of class cCraftingRecipe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_SetIngredient00 -static int tolua_AllToLua_cCraftingRecipe_SetIngredient00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_isnumber(tolua_S,5,0,&tolua_err) || - !tolua_isnumber(tolua_S,6,0,&tolua_err) || - !tolua_isnoobj(tolua_S,7,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); - int x = ((int) tolua_tonumber(tolua_S,2,0)); - int y = ((int) tolua_tonumber(tolua_S,3,0)); - ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,4,0)); - int a_ItemCount = ((int) tolua_tonumber(tolua_S,5,0)); - short a_ItemHealth = ((short) tolua_tonumber(tolua_S,6,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetIngredient'", NULL); -#endif - { - self->SetIngredient(x,y,a_ItemType,a_ItemCount,a_ItemHealth); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetIngredient'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetIngredient of class cCraftingRecipe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_SetIngredient01 -static int tolua_AllToLua_cCraftingRecipe_SetIngredient01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); - int x = ((int) tolua_tonumber(tolua_S,2,0)); - int y = ((int) tolua_tonumber(tolua_S,3,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetIngredient'", NULL); -#endif - { - self->SetIngredient(x,y,*a_Item); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cCraftingRecipe_SetIngredient00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: ConsumeIngredients of class cCraftingRecipe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_ConsumeIngredients00 -static int tolua_AllToLua_cCraftingRecipe_ConsumeIngredients00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cCraftingGrid",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); - cCraftingGrid* a_CraftingGrid = ((cCraftingGrid*) tolua_tousertype(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ConsumeIngredients'", NULL); -#endif - { - self->ConsumeIngredients(*a_CraftingGrid); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'ConsumeIngredients'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: Dump of class cCraftingRecipe */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_Dump00 -static int tolua_AllToLua_cCraftingRecipe_Dump00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Dump'", NULL); -#endif - { - self->Dump(); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'Dump'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWindowID of class cWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_GetWindowID00 -static int tolua_AllToLua_cWindow_GetWindowID00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWindowID'", NULL); -#endif - { - char tolua_ret = (char) self->GetWindowID(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWindowID'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWindowType of class cWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_GetWindowType00 -static int tolua_AllToLua_cWindow_GetWindowType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWindowType'", NULL); -#endif - { - int tolua_ret = (int) self->GetWindowType(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWindowType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSlot of class cWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_GetSlot00 -static int tolua_AllToLua_cWindow_GetSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); - cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0)); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlot'", NULL); -#endif - { - const cItem* tolua_ret = (const cItem*) self->GetSlot(*a_Player,a_SlotNum); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"const cItem"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetSlot of class cWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_SetSlot00 -static int tolua_AllToLua_cWindow_SetSlot00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWindow",0,&tolua_err) || - (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err)) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const cItem",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWindow* self = (cWindow*) tolua_tousertype(tolua_S,1,0); - cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0)); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,3,0)); - const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); -#endif - { - self->SetSlot(*a_Player,a_SlotNum,*a_Item); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetSlot'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsSlotInPlayerMainInventory of class cWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_IsSlotInPlayerMainInventory00 -static int tolua_AllToLua_cWindow_IsSlotInPlayerMainInventory00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSlotInPlayerMainInventory'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsSlotInPlayerMainInventory(a_SlotNum); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsSlotInPlayerMainInventory'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsSlotInPlayerHotbar of class cWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_IsSlotInPlayerHotbar00 -static int tolua_AllToLua_cWindow_IsSlotInPlayerHotbar00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSlotInPlayerHotbar'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsSlotInPlayerHotbar(a_SlotNum); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsSlotInPlayerHotbar'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: IsSlotInPlayerInventory of class cWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_IsSlotInPlayerInventory00 -static int tolua_AllToLua_cWindow_IsSlotInPlayerInventory00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); - int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSlotInPlayerInventory'", NULL); -#endif - { - bool tolua_ret = (bool) self->IsSlotInPlayerInventory(a_SlotNum); - tolua_pushboolean(tolua_S,(bool)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'IsSlotInPlayerInventory'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetWindowTitle of class cWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_GetWindowTitle00 -static int tolua_AllToLua_cWindow_GetWindowTitle00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWindowTitle'", NULL); -#endif - { - const AString tolua_ret = (const AString) self->GetWindowTitle(); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetWindowTitle'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetWindowTitle of class cWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_SetWindowTitle00 -static int tolua_AllToLua_cWindow_SetWindowTitle00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWindow",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWindow* self = (cWindow*) tolua_tousertype(tolua_S,1,0); - const AString a_WindowTitle = ((const AString) tolua_tocppstring(tolua_S,2,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetWindowTitle'", NULL); -#endif - { - self->SetWindowTitle(a_WindowTitle); - tolua_pushcppstring(tolua_S,(const char*)a_WindowTitle); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetWindowTitle'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetProperty of class cWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_SetProperty00 -static int tolua_AllToLua_cWindow_SetProperty00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWindow",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnoobj(tolua_S,4,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWindow* self = (cWindow*) tolua_tousertype(tolua_S,1,0); - int a_Property = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Value = ((int) tolua_tonumber(tolua_S,3,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetProperty'", NULL); -#endif - { - self->SetProperty(a_Property,a_Value); - } - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'SetProperty'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: SetProperty of class cWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_SetProperty01 -static int tolua_AllToLua_cWindow_SetProperty01(lua_State* tolua_S) -{ - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cWindow",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"cPlayer",0,&tolua_err)) || - !tolua_isnoobj(tolua_S,5,&tolua_err) - ) - goto tolua_lerror; - else - { - cWindow* self = (cWindow*) tolua_tousertype(tolua_S,1,0); - int a_Property = ((int) tolua_tonumber(tolua_S,2,0)); - int a_Value = ((int) tolua_tonumber(tolua_S,3,0)); - cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,4,0)); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetProperty'", NULL); -#endif - { - self->SetProperty(a_Property,a_Value,*a_Player); - } - } - return 0; -tolua_lerror: - return tolua_AllToLua_cWindow_SetProperty00(tolua_S); -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new of class cLuaWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaWindow_new00 -static int tolua_AllToLua_cLuaWindow_new00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cLuaWindow",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_iscppstring(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWindow::WindowType a_WindowType = ((cWindow::WindowType) (int) tolua_tonumber(tolua_S,2,0)); - int a_SlotsX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_SlotsY = ((int) tolua_tonumber(tolua_S,4,0)); - const AString a_Title = ((const AString) tolua_tocppstring(tolua_S,5,0)); - { - cLuaWindow* tolua_ret = (cLuaWindow*) Mtolua_new((cLuaWindow)(a_WindowType,a_SlotsX,a_SlotsY,a_Title)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cLuaWindow"); - tolua_pushcppstring(tolua_S,(const char*)a_Title); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: new_local of class cLuaWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaWindow_new00_local -static int tolua_AllToLua_cLuaWindow_new00_local(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cLuaWindow",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnumber(tolua_S,3,0,&tolua_err) || - !tolua_isnumber(tolua_S,4,0,&tolua_err) || - !tolua_iscppstring(tolua_S,5,0,&tolua_err) || - !tolua_isnoobj(tolua_S,6,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cWindow::WindowType a_WindowType = ((cWindow::WindowType) (int) tolua_tonumber(tolua_S,2,0)); - int a_SlotsX = ((int) tolua_tonumber(tolua_S,3,0)); - int a_SlotsY = ((int) tolua_tonumber(tolua_S,4,0)); - const AString a_Title = ((const AString) tolua_tocppstring(tolua_S,5,0)); - { - cLuaWindow* tolua_ret = (cLuaWindow*) Mtolua_new((cLuaWindow)(a_WindowType,a_SlotsX,a_SlotsY,a_Title)); - tolua_pushusertype(tolua_S,(void*)tolua_ret,"cLuaWindow"); - tolua_register_gc(tolua_S,lua_gettop(tolua_S)); - tolua_pushcppstring(tolua_S,(const char*)a_Title); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: delete of class cLuaWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaWindow_delete00 -static int tolua_AllToLua_cLuaWindow_delete00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cLuaWindow",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cLuaWindow* self = (cLuaWindow*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL); -#endif - Mtolua_delete(self); - } - return 0; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetContents of class cLuaWindow */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaWindow_GetContents00 -static int tolua_AllToLua_cLuaWindow_GetContents00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"cLuaWindow",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cLuaWindow* self = (cLuaWindow*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetContents'", NULL); -#endif - { - cItemGrid& tolua_ret = (cItemGrid&) self->GetContents(); - tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItemGrid"); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetContents'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetMobType of class cMonster */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cMonster_GetMobType00 -static int tolua_AllToLua_cMonster_GetMobType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cMonster",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cMonster* self = (const cMonster*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMobType'", NULL); -#endif - { - cMonster::eType tolua_ret = (cMonster::eType) self->GetMobType(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMobType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetMobFamily of class cMonster */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cMonster_GetMobFamily00 -static int tolua_AllToLua_cMonster_GetMobFamily00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertype(tolua_S,1,"const cMonster",0,&tolua_err) || - !tolua_isnoobj(tolua_S,2,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const cMonster* self = (const cMonster*) tolua_tousertype(tolua_S,1,0); -#ifndef TOLUA_RELEASE - if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMobFamily'", NULL); -#endif - { - cMonster::eFamily tolua_ret = (cMonster::eFamily) self->GetMobFamily(); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetMobFamily'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: MobTypeToString of class cMonster */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cMonster_MobTypeToString00 -static int tolua_AllToLua_cMonster_MobTypeToString00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cMonster",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cMonster::eType a_MobType = ((cMonster::eType) (int) tolua_tonumber(tolua_S,2,0)); - { - AString tolua_ret = (AString) cMonster::MobTypeToString(a_MobType); - tolua_pushcppstring(tolua_S,(const char*)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'MobTypeToString'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: StringToMobType of class cMonster */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cMonster_StringToMobType00 -static int tolua_AllToLua_cMonster_StringToMobType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cMonster",0,&tolua_err) || - !tolua_iscppstring(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - const AString a_MobTypeName = ((const AString) tolua_tocppstring(tolua_S,2,0)); - { - cMonster::eType tolua_ret = (cMonster::eType) cMonster::StringToMobType(a_MobTypeName); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - tolua_pushcppstring(tolua_S,(const char*)a_MobTypeName); - } - } - return 2; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'StringToMobType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: FamilyFromType of class cMonster */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cMonster_FamilyFromType00 -static int tolua_AllToLua_cMonster_FamilyFromType00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cMonster",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cMonster::eType a_MobType = ((cMonster::eType) (int) tolua_tonumber(tolua_S,2,0)); - { - cMonster::eFamily tolua_ret = (cMonster::eFamily) cMonster::FamilyFromType(a_MobType); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'FamilyFromType'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* method: GetSpawnDelay of class cMonster */ -#ifndef TOLUA_DISABLE_tolua_AllToLua_cMonster_GetSpawnDelay00 -static int tolua_AllToLua_cMonster_GetSpawnDelay00(lua_State* tolua_S) -{ -#ifndef TOLUA_RELEASE - tolua_Error tolua_err; - if ( - !tolua_isusertable(tolua_S,1,"cMonster",0,&tolua_err) || - !tolua_isnumber(tolua_S,2,0,&tolua_err) || - !tolua_isnoobj(tolua_S,3,&tolua_err) - ) - goto tolua_lerror; - else -#endif - { - cMonster::eFamily a_MobFamily = ((cMonster::eFamily) (int) tolua_tonumber(tolua_S,2,0)); - { - int tolua_ret = (int) cMonster::GetSpawnDelay(a_MobFamily); - tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); - } - } - return 1; -#ifndef TOLUA_RELEASE - tolua_lerror: - tolua_error(tolua_S,"#ferror in function 'GetSpawnDelay'.",&tolua_err); - return 0; -#endif -} -#endif //#ifndef TOLUA_DISABLE - -/* Open function */ -TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) -{ - tolua_open(tolua_S); - tolua_reg_types(tolua_S); - tolua_module(tolua_S,NULL,1); - tolua_beginmodule(tolua_S,NULL); - tolua_constant(tolua_S,"biOcean",biOcean); - tolua_constant(tolua_S,"biPlains",biPlains); - tolua_constant(tolua_S,"biDesert",biDesert); - tolua_constant(tolua_S,"biExtremeHills",biExtremeHills); - tolua_constant(tolua_S,"biForest",biForest); - tolua_constant(tolua_S,"biTaiga",biTaiga); - tolua_constant(tolua_S,"biSwampland",biSwampland); - tolua_constant(tolua_S,"biRiver",biRiver); - tolua_constant(tolua_S,"biHell",biHell); - tolua_constant(tolua_S,"biNether",biNether); - tolua_constant(tolua_S,"biSky",biSky); - tolua_constant(tolua_S,"biEnd",biEnd); - tolua_constant(tolua_S,"biFrozenOcean",biFrozenOcean); - tolua_constant(tolua_S,"biFrozenRiver",biFrozenRiver); - tolua_constant(tolua_S,"biIcePlains",biIcePlains); - tolua_constant(tolua_S,"biTundra",biTundra); - tolua_constant(tolua_S,"biIceMountains",biIceMountains); - tolua_constant(tolua_S,"biMushroomIsland",biMushroomIsland); - tolua_constant(tolua_S,"biMushroomShore",biMushroomShore); - tolua_constant(tolua_S,"biBeach",biBeach); - tolua_constant(tolua_S,"biDesertHills",biDesertHills); - tolua_constant(tolua_S,"biForestHills",biForestHills); - tolua_constant(tolua_S,"biTaigaHills",biTaigaHills); - tolua_constant(tolua_S,"biExtremeHillsEdge",biExtremeHillsEdge); - tolua_constant(tolua_S,"biJungle",biJungle); - tolua_constant(tolua_S,"biJungleHills",biJungleHills); - tolua_constant(tolua_S,"biJungleEdge",biJungleEdge); - tolua_constant(tolua_S,"biDeepOcean",biDeepOcean); - tolua_constant(tolua_S,"biStoneBeach",biStoneBeach); - tolua_constant(tolua_S,"biColdBeach",biColdBeach); - tolua_constant(tolua_S,"biBirchForest",biBirchForest); - tolua_constant(tolua_S,"biBirchForestHills",biBirchForestHills); - tolua_constant(tolua_S,"biRoofedForest",biRoofedForest); - tolua_constant(tolua_S,"biColdTaiga",biColdTaiga); - tolua_constant(tolua_S,"biColdTaigaHills",biColdTaigaHills); - tolua_constant(tolua_S,"biMegaTaiga",biMegaTaiga); - tolua_constant(tolua_S,"biMegaTaigaHills",biMegaTaigaHills); - tolua_constant(tolua_S,"biExtremeHillsPlus",biExtremeHillsPlus); - tolua_constant(tolua_S,"biSavanna",biSavanna); - tolua_constant(tolua_S,"biSavannaPlateau",biSavannaPlateau); - tolua_constant(tolua_S,"biMesa",biMesa); - tolua_constant(tolua_S,"biMesaPlateauF",biMesaPlateauF); - tolua_constant(tolua_S,"biMesaPlateau",biMesaPlateau); - tolua_constant(tolua_S,"biNumBiomes",biNumBiomes); - tolua_constant(tolua_S,"biMaxBiome",biMaxBiome); - tolua_constant(tolua_S,"biVariant",biVariant); - tolua_constant(tolua_S,"biSunflowerPlains",biSunflowerPlains); - tolua_constant(tolua_S,"biDesertM",biDesertM); - tolua_constant(tolua_S,"biExtremeHillsM",biExtremeHillsM); - tolua_constant(tolua_S,"biFlowerForest",biFlowerForest); - tolua_constant(tolua_S,"biTaigaM",biTaigaM); - tolua_constant(tolua_S,"biSwamplandM",biSwamplandM); - tolua_constant(tolua_S,"biIcePlainsSpikes",biIcePlainsSpikes); - tolua_constant(tolua_S,"biJungleM",biJungleM); - tolua_constant(tolua_S,"biJungleEdgeM",biJungleEdgeM); - tolua_constant(tolua_S,"biBirchForestM",biBirchForestM); - tolua_constant(tolua_S,"biBirchForestHillsM",biBirchForestHillsM); - tolua_constant(tolua_S,"biRoofedForestM",biRoofedForestM); - tolua_constant(tolua_S,"biColdTaigaM",biColdTaigaM); - tolua_constant(tolua_S,"biMegaSpruceTaiga",biMegaSpruceTaiga); - tolua_constant(tolua_S,"biMegaSpruceTaigaHills",biMegaSpruceTaigaHills); - tolua_constant(tolua_S,"biExtremeHillsPlusM",biExtremeHillsPlusM); - tolua_constant(tolua_S,"biSavannaM",biSavannaM); - tolua_constant(tolua_S,"biSavannaPlateauM",biSavannaPlateauM); - tolua_constant(tolua_S,"biMesaBryce",biMesaBryce); - tolua_constant(tolua_S,"biMesaPlateauFM",biMesaPlateauFM); - tolua_constant(tolua_S,"biMesaPlateauM",biMesaPlateauM); - #ifdef __cplusplus - tolua_cclass(tolua_S,"cIniFile","cIniFile","",tolua_collect_cIniFile); - #else - tolua_cclass(tolua_S,"cIniFile","cIniFile","",NULL); - #endif - tolua_beginmodule(tolua_S,"cIniFile"); - tolua_constant(tolua_S,"noID",cIniFile::noID); - tolua_function(tolua_S,"new",tolua_AllToLua_cIniFile_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cIniFile_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cIniFile_new00_local); - tolua_function(tolua_S,"CaseSensitive",tolua_AllToLua_cIniFile_CaseSensitive00); - tolua_function(tolua_S,"CaseInsensitive",tolua_AllToLua_cIniFile_CaseInsensitive00); - tolua_function(tolua_S,"ReadFile",tolua_AllToLua_cIniFile_ReadFile00); - tolua_function(tolua_S,"WriteFile",tolua_AllToLua_cIniFile_WriteFile00); - tolua_function(tolua_S,"Clear",tolua_AllToLua_cIniFile_Clear00); - tolua_function(tolua_S,"FindKey",tolua_AllToLua_cIniFile_FindKey00); - tolua_function(tolua_S,"FindValue",tolua_AllToLua_cIniFile_FindValue00); - tolua_function(tolua_S,"GetNumKeys",tolua_AllToLua_cIniFile_GetNumKeys00); - tolua_function(tolua_S,"AddKeyName",tolua_AllToLua_cIniFile_AddKeyName00); - tolua_function(tolua_S,"GetKeyName",tolua_AllToLua_cIniFile_GetKeyName00); - tolua_function(tolua_S,"GetNumValues",tolua_AllToLua_cIniFile_GetNumValues00); - tolua_function(tolua_S,"GetNumValues",tolua_AllToLua_cIniFile_GetNumValues01); - tolua_function(tolua_S,"GetValueName",tolua_AllToLua_cIniFile_GetValueName00); - tolua_function(tolua_S,"GetValueName",tolua_AllToLua_cIniFile_GetValueName01); - tolua_function(tolua_S,"GetValue",tolua_AllToLua_cIniFile_GetValue00); - tolua_function(tolua_S,"GetValue",tolua_AllToLua_cIniFile_GetValue01); - tolua_function(tolua_S,"GetValue",tolua_AllToLua_cIniFile_GetValue02); - tolua_function(tolua_S,"GetValue",tolua_AllToLua_cIniFile_GetValue03); - tolua_function(tolua_S,"GetValueF",tolua_AllToLua_cIniFile_GetValueF00); - tolua_function(tolua_S,"GetValueI",tolua_AllToLua_cIniFile_GetValueI00); - tolua_function(tolua_S,"GetValueB",tolua_AllToLua_cIniFile_GetValueB00); - tolua_function(tolua_S,"GetValueSet",tolua_AllToLua_cIniFile_GetValueSet00); - tolua_function(tolua_S,"GetValueSet",tolua_AllToLua_cIniFile_GetValueSet01); - tolua_function(tolua_S,"GetValueSetF",tolua_AllToLua_cIniFile_GetValueSetF00); - tolua_function(tolua_S,"GetValueSetI",tolua_AllToLua_cIniFile_GetValueSetI00); - tolua_function(tolua_S,"GetValueSetB",tolua_AllToLua_cIniFile_GetValueSetB00); - tolua_function(tolua_S,"SetValue",tolua_AllToLua_cIniFile_SetValue00); - tolua_function(tolua_S,"SetValue",tolua_AllToLua_cIniFile_SetValue01); - tolua_function(tolua_S,"SetValueI",tolua_AllToLua_cIniFile_SetValueI00); - tolua_function(tolua_S,"SetValueB",tolua_AllToLua_cIniFile_SetValueB00); - tolua_function(tolua_S,"SetValueF",tolua_AllToLua_cIniFile_SetValueF00); - tolua_function(tolua_S,"DeleteValueByID",tolua_AllToLua_cIniFile_DeleteValueByID00); - tolua_function(tolua_S,"DeleteValue",tolua_AllToLua_cIniFile_DeleteValue00); - tolua_function(tolua_S,"DeleteKey",tolua_AllToLua_cIniFile_DeleteKey00); - tolua_function(tolua_S,"GetNumHeaderComments",tolua_AllToLua_cIniFile_GetNumHeaderComments00); - tolua_function(tolua_S,"AddHeaderComment",tolua_AllToLua_cIniFile_AddHeaderComment00); - tolua_function(tolua_S,"GetHeaderComment",tolua_AllToLua_cIniFile_GetHeaderComment00); - tolua_function(tolua_S,"DeleteHeaderComment",tolua_AllToLua_cIniFile_DeleteHeaderComment00); - tolua_function(tolua_S,"DeleteHeaderComments",tolua_AllToLua_cIniFile_DeleteHeaderComments00); - tolua_function(tolua_S,"GetNumKeyComments",tolua_AllToLua_cIniFile_GetNumKeyComments00); - tolua_function(tolua_S,"GetNumKeyComments",tolua_AllToLua_cIniFile_GetNumKeyComments01); - tolua_function(tolua_S,"AddKeyComment",tolua_AllToLua_cIniFile_AddKeyComment00); - tolua_function(tolua_S,"AddKeyComment",tolua_AllToLua_cIniFile_AddKeyComment01); - tolua_function(tolua_S,"GetKeyComment",tolua_AllToLua_cIniFile_GetKeyComment00); - tolua_function(tolua_S,"GetKeyComment",tolua_AllToLua_cIniFile_GetKeyComment01); - tolua_function(tolua_S,"DeleteKeyComment",tolua_AllToLua_cIniFile_DeleteKeyComment00); - tolua_function(tolua_S,"DeleteKeyComment",tolua_AllToLua_cIniFile_DeleteKeyComment01); - tolua_function(tolua_S,"DeleteKeyComments",tolua_AllToLua_cIniFile_DeleteKeyComments00); - tolua_function(tolua_S,"DeleteKeyComments",tolua_AllToLua_cIniFile_DeleteKeyComments01); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cFile","cFile","",NULL); - tolua_beginmodule(tolua_S,"cFile"); - tolua_function(tolua_S,"Exists",tolua_AllToLua_cFile_Exists00); - tolua_function(tolua_S,"Delete",tolua_AllToLua_cFile_Delete00); - tolua_function(tolua_S,"Rename",tolua_AllToLua_cFile_Rename00); - tolua_function(tolua_S,"Copy",tolua_AllToLua_cFile_Copy00); - tolua_function(tolua_S,"IsFolder",tolua_AllToLua_cFile_IsFolder00); - tolua_function(tolua_S,"IsFile",tolua_AllToLua_cFile_IsFile00); - tolua_function(tolua_S,"GetSize",tolua_AllToLua_cFile_GetSize00); - tolua_function(tolua_S,"CreateFolder",tolua_AllToLua_cFile_CreateFolder00); - tolua_function(tolua_S,"ReadWholeFile",tolua_AllToLua_cFile_ReadWholeFile00); - tolua_endmodule(tolua_S); - tolua_constant(tolua_S,"E_BLOCK_AIR",E_BLOCK_AIR); - tolua_constant(tolua_S,"E_BLOCK_STONE",E_BLOCK_STONE); - tolua_constant(tolua_S,"E_BLOCK_GRASS",E_BLOCK_GRASS); - tolua_constant(tolua_S,"E_BLOCK_DIRT",E_BLOCK_DIRT); - tolua_constant(tolua_S,"E_BLOCK_COBBLESTONE",E_BLOCK_COBBLESTONE); - tolua_constant(tolua_S,"E_BLOCK_PLANKS",E_BLOCK_PLANKS); - tolua_constant(tolua_S,"E_BLOCK_SAPLING",E_BLOCK_SAPLING); - tolua_constant(tolua_S,"E_BLOCK_BEDROCK",E_BLOCK_BEDROCK); - tolua_constant(tolua_S,"E_BLOCK_WATER",E_BLOCK_WATER); - tolua_constant(tolua_S,"E_BLOCK_STATIONARY_WATER",E_BLOCK_STATIONARY_WATER); - tolua_constant(tolua_S,"E_BLOCK_LAVA",E_BLOCK_LAVA); - tolua_constant(tolua_S,"E_BLOCK_STATIONARY_LAVA",E_BLOCK_STATIONARY_LAVA); - tolua_constant(tolua_S,"E_BLOCK_SAND",E_BLOCK_SAND); - tolua_constant(tolua_S,"E_BLOCK_GRAVEL",E_BLOCK_GRAVEL); - tolua_constant(tolua_S,"E_BLOCK_GOLD_ORE",E_BLOCK_GOLD_ORE); - tolua_constant(tolua_S,"E_BLOCK_IRON_ORE",E_BLOCK_IRON_ORE); - tolua_constant(tolua_S,"E_BLOCK_COAL_ORE",E_BLOCK_COAL_ORE); - tolua_constant(tolua_S,"E_BLOCK_LOG",E_BLOCK_LOG); - tolua_constant(tolua_S,"E_BLOCK_LEAVES",E_BLOCK_LEAVES); - tolua_constant(tolua_S,"E_BLOCK_SPONGE",E_BLOCK_SPONGE); - tolua_constant(tolua_S,"E_BLOCK_GLASS",E_BLOCK_GLASS); - tolua_constant(tolua_S,"E_BLOCK_LAPIS_ORE",E_BLOCK_LAPIS_ORE); - tolua_constant(tolua_S,"E_BLOCK_LAPIS_BLOCK",E_BLOCK_LAPIS_BLOCK); - tolua_constant(tolua_S,"E_BLOCK_DISPENSER",E_BLOCK_DISPENSER); - tolua_constant(tolua_S,"E_BLOCK_SANDSTONE",E_BLOCK_SANDSTONE); - tolua_constant(tolua_S,"E_BLOCK_NOTE_BLOCK",E_BLOCK_NOTE_BLOCK); - tolua_constant(tolua_S,"E_BLOCK_BED",E_BLOCK_BED); - tolua_constant(tolua_S,"E_BLOCK_POWERED_RAIL",E_BLOCK_POWERED_RAIL); - tolua_constant(tolua_S,"E_BLOCK_DETECTOR_RAIL",E_BLOCK_DETECTOR_RAIL); - tolua_constant(tolua_S,"E_BLOCK_STICKY_PISTON",E_BLOCK_STICKY_PISTON); - tolua_constant(tolua_S,"E_BLOCK_COBWEB",E_BLOCK_COBWEB); - tolua_constant(tolua_S,"E_BLOCK_TALL_GRASS",E_BLOCK_TALL_GRASS); - tolua_constant(tolua_S,"E_BLOCK_DEAD_BUSH",E_BLOCK_DEAD_BUSH); - tolua_constant(tolua_S,"E_BLOCK_PISTON",E_BLOCK_PISTON); - tolua_constant(tolua_S,"E_BLOCK_PISTON_EXTENSION",E_BLOCK_PISTON_EXTENSION); - tolua_constant(tolua_S,"E_BLOCK_WOOL",E_BLOCK_WOOL); - tolua_constant(tolua_S,"E_BLOCK_PISTON_MOVED_BLOCK",E_BLOCK_PISTON_MOVED_BLOCK); - tolua_constant(tolua_S,"E_BLOCK_DANDELION",E_BLOCK_DANDELION); - tolua_constant(tolua_S,"E_BLOCK_FLOWER",E_BLOCK_FLOWER); - tolua_constant(tolua_S,"E_BLOCK_BROWN_MUSHROOM",E_BLOCK_BROWN_MUSHROOM); - tolua_constant(tolua_S,"E_BLOCK_RED_MUSHROOM",E_BLOCK_RED_MUSHROOM); - tolua_constant(tolua_S,"E_BLOCK_GOLD_BLOCK",E_BLOCK_GOLD_BLOCK); - tolua_constant(tolua_S,"E_BLOCK_IRON_BLOCK",E_BLOCK_IRON_BLOCK); - tolua_constant(tolua_S,"E_BLOCK_DOUBLE_STONE_SLAB",E_BLOCK_DOUBLE_STONE_SLAB); - tolua_constant(tolua_S,"E_BLOCK_STONE_SLAB",E_BLOCK_STONE_SLAB); - tolua_constant(tolua_S,"E_BLOCK_BRICK",E_BLOCK_BRICK); - tolua_constant(tolua_S,"E_BLOCK_TNT",E_BLOCK_TNT); - tolua_constant(tolua_S,"E_BLOCK_BOOKCASE",E_BLOCK_BOOKCASE); - tolua_constant(tolua_S,"E_BLOCK_MOSSY_COBBLESTONE",E_BLOCK_MOSSY_COBBLESTONE); - tolua_constant(tolua_S,"E_BLOCK_OBSIDIAN",E_BLOCK_OBSIDIAN); - tolua_constant(tolua_S,"E_BLOCK_TORCH",E_BLOCK_TORCH); - tolua_constant(tolua_S,"E_BLOCK_FIRE",E_BLOCK_FIRE); - tolua_constant(tolua_S,"E_BLOCK_MOB_SPAWNER",E_BLOCK_MOB_SPAWNER); - tolua_constant(tolua_S,"E_BLOCK_WOODEN_STAIRS",E_BLOCK_WOODEN_STAIRS); - tolua_constant(tolua_S,"E_BLOCK_CHEST",E_BLOCK_CHEST); - tolua_constant(tolua_S,"E_BLOCK_REDSTONE_WIRE",E_BLOCK_REDSTONE_WIRE); - tolua_constant(tolua_S,"E_BLOCK_DIAMOND_ORE",E_BLOCK_DIAMOND_ORE); - tolua_constant(tolua_S,"E_BLOCK_DIAMOND_BLOCK",E_BLOCK_DIAMOND_BLOCK); - tolua_constant(tolua_S,"E_BLOCK_CRAFTING_TABLE",E_BLOCK_CRAFTING_TABLE); - tolua_constant(tolua_S,"E_BLOCK_WORKBENCH",E_BLOCK_WORKBENCH); - tolua_constant(tolua_S,"E_BLOCK_CROPS",E_BLOCK_CROPS); - tolua_constant(tolua_S,"E_BLOCK_FARMLAND",E_BLOCK_FARMLAND); - tolua_constant(tolua_S,"E_BLOCK_FURNACE",E_BLOCK_FURNACE); - tolua_constant(tolua_S,"E_BLOCK_LIT_FURNACE",E_BLOCK_LIT_FURNACE); - tolua_constant(tolua_S,"E_BLOCK_BURNING_FURNACE",E_BLOCK_BURNING_FURNACE); - tolua_constant(tolua_S,"E_BLOCK_SIGN_POST",E_BLOCK_SIGN_POST); - tolua_constant(tolua_S,"E_BLOCK_WOODEN_DOOR",E_BLOCK_WOODEN_DOOR); - tolua_constant(tolua_S,"E_BLOCK_LADDER",E_BLOCK_LADDER); - tolua_constant(tolua_S,"E_BLOCK_RAIL",E_BLOCK_RAIL); - tolua_constant(tolua_S,"E_BLOCK_MINECART_TRACKS",E_BLOCK_MINECART_TRACKS); - tolua_constant(tolua_S,"E_BLOCK_COBBLESTONE_STAIRS",E_BLOCK_COBBLESTONE_STAIRS); - tolua_constant(tolua_S,"E_BLOCK_WALLSIGN",E_BLOCK_WALLSIGN); - tolua_constant(tolua_S,"E_BLOCK_LEVER",E_BLOCK_LEVER); - tolua_constant(tolua_S,"E_BLOCK_STONE_PRESSURE_PLATE",E_BLOCK_STONE_PRESSURE_PLATE); - tolua_constant(tolua_S,"E_BLOCK_IRON_DOOR",E_BLOCK_IRON_DOOR); - tolua_constant(tolua_S,"E_BLOCK_WOODEN_PRESSURE_PLATE",E_BLOCK_WOODEN_PRESSURE_PLATE); - tolua_constant(tolua_S,"E_BLOCK_REDSTONE_ORE",E_BLOCK_REDSTONE_ORE); - tolua_constant(tolua_S,"E_BLOCK_REDSTONE_ORE_GLOWING",E_BLOCK_REDSTONE_ORE_GLOWING); - tolua_constant(tolua_S,"E_BLOCK_REDSTONE_TORCH_OFF",E_BLOCK_REDSTONE_TORCH_OFF); - tolua_constant(tolua_S,"E_BLOCK_REDSTONE_TORCH_ON",E_BLOCK_REDSTONE_TORCH_ON); - tolua_constant(tolua_S,"E_BLOCK_STONE_BUTTON",E_BLOCK_STONE_BUTTON); - tolua_constant(tolua_S,"E_BLOCK_SNOW",E_BLOCK_SNOW); - tolua_constant(tolua_S,"E_BLOCK_ICE",E_BLOCK_ICE); - tolua_constant(tolua_S,"E_BLOCK_SNOW_BLOCK",E_BLOCK_SNOW_BLOCK); - tolua_constant(tolua_S,"E_BLOCK_CACTUS",E_BLOCK_CACTUS); - tolua_constant(tolua_S,"E_BLOCK_CLAY",E_BLOCK_CLAY); - tolua_constant(tolua_S,"E_BLOCK_SUGARCANE",E_BLOCK_SUGARCANE); - tolua_constant(tolua_S,"E_BLOCK_REEDS",E_BLOCK_REEDS); - tolua_constant(tolua_S,"E_BLOCK_JUKEBOX",E_BLOCK_JUKEBOX); - tolua_constant(tolua_S,"E_BLOCK_FENCE",E_BLOCK_FENCE); - tolua_constant(tolua_S,"E_BLOCK_PUMPKIN",E_BLOCK_PUMPKIN); - tolua_constant(tolua_S,"E_BLOCK_NETHERRACK",E_BLOCK_NETHERRACK); - tolua_constant(tolua_S,"E_BLOCK_SOULSAND",E_BLOCK_SOULSAND); - tolua_constant(tolua_S,"E_BLOCK_GLOWSTONE",E_BLOCK_GLOWSTONE); - tolua_constant(tolua_S,"E_BLOCK_NETHER_PORTAL",E_BLOCK_NETHER_PORTAL); - tolua_constant(tolua_S,"E_BLOCK_JACK_O_LANTERN",E_BLOCK_JACK_O_LANTERN); - tolua_constant(tolua_S,"E_BLOCK_CAKE",E_BLOCK_CAKE); - tolua_constant(tolua_S,"E_BLOCK_REDSTONE_REPEATER_OFF",E_BLOCK_REDSTONE_REPEATER_OFF); - tolua_constant(tolua_S,"E_BLOCK_REDSTONE_REPEATER_ON",E_BLOCK_REDSTONE_REPEATER_ON); - tolua_constant(tolua_S,"E_BLOCK_STAINED_GLASS",E_BLOCK_STAINED_GLASS); - tolua_constant(tolua_S,"E_BLOCK_TRAPDOOR",E_BLOCK_TRAPDOOR); - tolua_constant(tolua_S,"E_BLOCK_SILVERFISH_EGG",E_BLOCK_SILVERFISH_EGG); - tolua_constant(tolua_S,"E_BLOCK_STONE_BRICKS",E_BLOCK_STONE_BRICKS); - tolua_constant(tolua_S,"E_BLOCK_HUGE_BROWN_MUSHROOM",E_BLOCK_HUGE_BROWN_MUSHROOM); - tolua_constant(tolua_S,"E_BLOCK_HUGE_RED_MUSHROOM",E_BLOCK_HUGE_RED_MUSHROOM); - tolua_constant(tolua_S,"E_BLOCK_IRON_BARS",E_BLOCK_IRON_BARS); - tolua_constant(tolua_S,"E_BLOCK_GLASS_PANE",E_BLOCK_GLASS_PANE); - tolua_constant(tolua_S,"E_BLOCK_MELON",E_BLOCK_MELON); - tolua_constant(tolua_S,"E_BLOCK_PUMPKIN_STEM",E_BLOCK_PUMPKIN_STEM); - tolua_constant(tolua_S,"E_BLOCK_MELON_STEM",E_BLOCK_MELON_STEM); - tolua_constant(tolua_S,"E_BLOCK_VINES",E_BLOCK_VINES); - tolua_constant(tolua_S,"E_BLOCK_FENCE_GATE",E_BLOCK_FENCE_GATE); - tolua_constant(tolua_S,"E_BLOCK_BRICK_STAIRS",E_BLOCK_BRICK_STAIRS); - tolua_constant(tolua_S,"E_BLOCK_STONE_BRICK_STAIRS",E_BLOCK_STONE_BRICK_STAIRS); - tolua_constant(tolua_S,"E_BLOCK_MYCELIUM",E_BLOCK_MYCELIUM); - tolua_constant(tolua_S,"E_BLOCK_LILY_PAD",E_BLOCK_LILY_PAD); - tolua_constant(tolua_S,"E_BLOCK_NETHER_BRICK",E_BLOCK_NETHER_BRICK); - tolua_constant(tolua_S,"E_BLOCK_NETHER_BRICK_FENCE",E_BLOCK_NETHER_BRICK_FENCE); - tolua_constant(tolua_S,"E_BLOCK_NETHER_BRICK_STAIRS",E_BLOCK_NETHER_BRICK_STAIRS); - tolua_constant(tolua_S,"E_BLOCK_NETHER_WART",E_BLOCK_NETHER_WART); - tolua_constant(tolua_S,"E_BLOCK_ENCHANTMENT_TABLE",E_BLOCK_ENCHANTMENT_TABLE); - tolua_constant(tolua_S,"E_BLOCK_BREWING_STAND",E_BLOCK_BREWING_STAND); - tolua_constant(tolua_S,"E_BLOCK_CAULDRON",E_BLOCK_CAULDRON); - tolua_constant(tolua_S,"E_BLOCK_END_PORTAL",E_BLOCK_END_PORTAL); - tolua_constant(tolua_S,"E_BLOCK_END_PORTAL_FRAME",E_BLOCK_END_PORTAL_FRAME); - tolua_constant(tolua_S,"E_BLOCK_END_STONE",E_BLOCK_END_STONE); - tolua_constant(tolua_S,"E_BLOCK_DRAGON_EGG",E_BLOCK_DRAGON_EGG); - tolua_constant(tolua_S,"E_BLOCK_REDSTONE_LAMP_OFF",E_BLOCK_REDSTONE_LAMP_OFF); - tolua_constant(tolua_S,"E_BLOCK_REDSTONE_LAMP_ON",E_BLOCK_REDSTONE_LAMP_ON); - tolua_constant(tolua_S,"E_BLOCK_DOUBLE_WOODEN_SLAB",E_BLOCK_DOUBLE_WOODEN_SLAB); - tolua_constant(tolua_S,"E_BLOCK_WOODEN_SLAB",E_BLOCK_WOODEN_SLAB); - tolua_constant(tolua_S,"E_BLOCK_COCOA_POD",E_BLOCK_COCOA_POD); - tolua_constant(tolua_S,"E_BLOCK_SANDSTONE_STAIRS",E_BLOCK_SANDSTONE_STAIRS); - tolua_constant(tolua_S,"E_BLOCK_EMERALD_ORE",E_BLOCK_EMERALD_ORE); - tolua_constant(tolua_S,"E_BLOCK_ENDER_CHEST",E_BLOCK_ENDER_CHEST); - tolua_constant(tolua_S,"E_BLOCK_TRIPWIRE_HOOK",E_BLOCK_TRIPWIRE_HOOK); - tolua_constant(tolua_S,"E_BLOCK_TRIPWIRE",E_BLOCK_TRIPWIRE); - tolua_constant(tolua_S,"E_BLOCK_EMERALD_BLOCK",E_BLOCK_EMERALD_BLOCK); - tolua_constant(tolua_S,"E_BLOCK_SPRUCE_WOOD_STAIRS",E_BLOCK_SPRUCE_WOOD_STAIRS); - tolua_constant(tolua_S,"E_BLOCK_BIRCH_WOOD_STAIRS",E_BLOCK_BIRCH_WOOD_STAIRS); - tolua_constant(tolua_S,"E_BLOCK_JUNGLE_WOOD_STAIRS",E_BLOCK_JUNGLE_WOOD_STAIRS); - tolua_constant(tolua_S,"E_BLOCK_COMMAND_BLOCK",E_BLOCK_COMMAND_BLOCK); - tolua_constant(tolua_S,"E_BLOCK_BEACON",E_BLOCK_BEACON); - tolua_constant(tolua_S,"E_BLOCK_COBBLESTONE_WALL",E_BLOCK_COBBLESTONE_WALL); - tolua_constant(tolua_S,"E_BLOCK_FLOWER_POT",E_BLOCK_FLOWER_POT); - tolua_constant(tolua_S,"E_BLOCK_CARROTS",E_BLOCK_CARROTS); - tolua_constant(tolua_S,"E_BLOCK_POTATOES",E_BLOCK_POTATOES); - tolua_constant(tolua_S,"E_BLOCK_WOODEN_BUTTON",E_BLOCK_WOODEN_BUTTON); - tolua_constant(tolua_S,"E_BLOCK_HEAD",E_BLOCK_HEAD); - tolua_constant(tolua_S,"E_BLOCK_ANVIL",E_BLOCK_ANVIL); - tolua_constant(tolua_S,"E_BLOCK_TRAPPED_CHEST",E_BLOCK_TRAPPED_CHEST); - tolua_constant(tolua_S,"E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE",E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE); - tolua_constant(tolua_S,"E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE",E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE); - tolua_constant(tolua_S,"E_BLOCK_INACTIVE_COMPARATOR",E_BLOCK_INACTIVE_COMPARATOR); - tolua_constant(tolua_S,"E_BLOCK_ACTIVE_COMPARATOR",E_BLOCK_ACTIVE_COMPARATOR); - tolua_constant(tolua_S,"E_BLOCK_DAYLIGHT_SENSOR",E_BLOCK_DAYLIGHT_SENSOR); - tolua_constant(tolua_S,"E_BLOCK_BLOCK_OF_REDSTONE",E_BLOCK_BLOCK_OF_REDSTONE); - tolua_constant(tolua_S,"E_BLOCK_NETHER_QUARTZ_ORE",E_BLOCK_NETHER_QUARTZ_ORE); - tolua_constant(tolua_S,"E_BLOCK_HOPPER",E_BLOCK_HOPPER); - tolua_constant(tolua_S,"E_BLOCK_QUARTZ_BLOCK",E_BLOCK_QUARTZ_BLOCK); - tolua_constant(tolua_S,"E_BLOCK_QUARTZ_STAIRS",E_BLOCK_QUARTZ_STAIRS); - tolua_constant(tolua_S,"E_BLOCK_ACTIVATOR_RAIL",E_BLOCK_ACTIVATOR_RAIL); - tolua_constant(tolua_S,"E_BLOCK_DROPPER",E_BLOCK_DROPPER); - tolua_constant(tolua_S,"E_BLOCK_STAINED_CLAY",E_BLOCK_STAINED_CLAY); - tolua_constant(tolua_S,"E_BLOCK_STAINED_GLASS_PANE",E_BLOCK_STAINED_GLASS_PANE); - tolua_constant(tolua_S,"E_BLOCK_NEW_LEAVES",E_BLOCK_NEW_LEAVES); - tolua_constant(tolua_S,"E_BLOCK_NEW_LOG",E_BLOCK_NEW_LOG); - tolua_constant(tolua_S,"E_BLOCK_ACACIA_WOOD_STAIRS",E_BLOCK_ACACIA_WOOD_STAIRS); - tolua_constant(tolua_S,"E_BLOCK_DARK_OAK_WOOD_STAIRS",E_BLOCK_DARK_OAK_WOOD_STAIRS); - tolua_constant(tolua_S,"E_BLOCK_HAY_BALE",E_BLOCK_HAY_BALE); - tolua_constant(tolua_S,"E_BLOCK_CARPET",E_BLOCK_CARPET); - tolua_constant(tolua_S,"E_BLOCK_HARDENED_CLAY",E_BLOCK_HARDENED_CLAY); - tolua_constant(tolua_S,"E_BLOCK_BLOCK_OF_COAL",E_BLOCK_BLOCK_OF_COAL); - tolua_constant(tolua_S,"E_BLOCK_PACKED_ICE",E_BLOCK_PACKED_ICE); - tolua_constant(tolua_S,"E_BLOCK_BIG_FLOWER",E_BLOCK_BIG_FLOWER); - tolua_constant(tolua_S,"E_BLOCK_NUMBER_OF_TYPES",E_BLOCK_NUMBER_OF_TYPES); - tolua_constant(tolua_S,"E_BLOCK_MAX_TYPE_ID",E_BLOCK_MAX_TYPE_ID); - tolua_constant(tolua_S,"E_BLOCK_YELLOW_FLOWER",E_BLOCK_YELLOW_FLOWER); - tolua_constant(tolua_S,"E_BLOCK_RED_ROSE",E_BLOCK_RED_ROSE); - tolua_constant(tolua_S,"E_BLOCK_LOCKED_CHEST",E_BLOCK_LOCKED_CHEST); - tolua_constant(tolua_S,"E_ITEM_EMPTY",E_ITEM_EMPTY); - tolua_constant(tolua_S,"E_ITEM_FIRST",E_ITEM_FIRST); - tolua_constant(tolua_S,"E_ITEM_IRON_SHOVEL",E_ITEM_IRON_SHOVEL); - tolua_constant(tolua_S,"E_ITEM_IRON_PICKAXE",E_ITEM_IRON_PICKAXE); - tolua_constant(tolua_S,"E_ITEM_IRON_AXE",E_ITEM_IRON_AXE); - tolua_constant(tolua_S,"E_ITEM_FLINT_AND_STEEL",E_ITEM_FLINT_AND_STEEL); - tolua_constant(tolua_S,"E_ITEM_RED_APPLE",E_ITEM_RED_APPLE); - tolua_constant(tolua_S,"E_ITEM_BOW",E_ITEM_BOW); - tolua_constant(tolua_S,"E_ITEM_ARROW",E_ITEM_ARROW); - tolua_constant(tolua_S,"E_ITEM_COAL",E_ITEM_COAL); - tolua_constant(tolua_S,"E_ITEM_DIAMOND",E_ITEM_DIAMOND); - tolua_constant(tolua_S,"E_ITEM_IRON",E_ITEM_IRON); - tolua_constant(tolua_S,"E_ITEM_GOLD",E_ITEM_GOLD); - tolua_constant(tolua_S,"E_ITEM_IRON_SWORD",E_ITEM_IRON_SWORD); - tolua_constant(tolua_S,"E_ITEM_WOODEN_SWORD",E_ITEM_WOODEN_SWORD); - tolua_constant(tolua_S,"E_ITEM_WOODEN_SHOVEL",E_ITEM_WOODEN_SHOVEL); - tolua_constant(tolua_S,"E_ITEM_WOODEN_PICKAXE",E_ITEM_WOODEN_PICKAXE); - tolua_constant(tolua_S,"E_ITEM_WOODEN_AXE",E_ITEM_WOODEN_AXE); - tolua_constant(tolua_S,"E_ITEM_STONE_SWORD",E_ITEM_STONE_SWORD); - tolua_constant(tolua_S,"E_ITEM_STONE_SHOVEL",E_ITEM_STONE_SHOVEL); - tolua_constant(tolua_S,"E_ITEM_STONE_PICKAXE",E_ITEM_STONE_PICKAXE); - tolua_constant(tolua_S,"E_ITEM_STONE_AXE",E_ITEM_STONE_AXE); - tolua_constant(tolua_S,"E_ITEM_DIAMOND_SWORD",E_ITEM_DIAMOND_SWORD); - tolua_constant(tolua_S,"E_ITEM_DIAMOND_SHOVEL",E_ITEM_DIAMOND_SHOVEL); - tolua_constant(tolua_S,"E_ITEM_DIAMOND_PICKAXE",E_ITEM_DIAMOND_PICKAXE); - tolua_constant(tolua_S,"E_ITEM_DIAMOND_AXE",E_ITEM_DIAMOND_AXE); - tolua_constant(tolua_S,"E_ITEM_STICK",E_ITEM_STICK); - tolua_constant(tolua_S,"E_ITEM_BOWL",E_ITEM_BOWL); - tolua_constant(tolua_S,"E_ITEM_MUSHROOM_SOUP",E_ITEM_MUSHROOM_SOUP); - tolua_constant(tolua_S,"E_ITEM_GOLD_SWORD",E_ITEM_GOLD_SWORD); - tolua_constant(tolua_S,"E_ITEM_GOLD_SHOVEL",E_ITEM_GOLD_SHOVEL); - tolua_constant(tolua_S,"E_ITEM_GOLD_PICKAXE",E_ITEM_GOLD_PICKAXE); - tolua_constant(tolua_S,"E_ITEM_GOLD_AXE",E_ITEM_GOLD_AXE); - tolua_constant(tolua_S,"E_ITEM_STRING",E_ITEM_STRING); - tolua_constant(tolua_S,"E_ITEM_FEATHER",E_ITEM_FEATHER); - tolua_constant(tolua_S,"E_ITEM_GUNPOWDER",E_ITEM_GUNPOWDER); - tolua_constant(tolua_S,"E_ITEM_WOODEN_HOE",E_ITEM_WOODEN_HOE); - tolua_constant(tolua_S,"E_ITEM_STONE_HOE",E_ITEM_STONE_HOE); - tolua_constant(tolua_S,"E_ITEM_IRON_HOE",E_ITEM_IRON_HOE); - tolua_constant(tolua_S,"E_ITEM_DIAMOND_HOE",E_ITEM_DIAMOND_HOE); - tolua_constant(tolua_S,"E_ITEM_GOLD_HOE",E_ITEM_GOLD_HOE); - tolua_constant(tolua_S,"E_ITEM_SEEDS",E_ITEM_SEEDS); - tolua_constant(tolua_S,"E_ITEM_WHEAT",E_ITEM_WHEAT); - tolua_constant(tolua_S,"E_ITEM_BREAD",E_ITEM_BREAD); - tolua_constant(tolua_S,"E_ITEM_LEATHER_CAP",E_ITEM_LEATHER_CAP); - tolua_constant(tolua_S,"E_ITEM_LEATHER_TUNIC",E_ITEM_LEATHER_TUNIC); - tolua_constant(tolua_S,"E_ITEM_LEATHER_PANTS",E_ITEM_LEATHER_PANTS); - tolua_constant(tolua_S,"E_ITEM_LEATHER_BOOTS",E_ITEM_LEATHER_BOOTS); - tolua_constant(tolua_S,"E_ITEM_CHAIN_HELMET",E_ITEM_CHAIN_HELMET); - tolua_constant(tolua_S,"E_ITEM_CHAIN_CHESTPLATE",E_ITEM_CHAIN_CHESTPLATE); - tolua_constant(tolua_S,"E_ITEM_CHAIN_LEGGINGS",E_ITEM_CHAIN_LEGGINGS); - tolua_constant(tolua_S,"E_ITEM_CHAIN_BOOTS",E_ITEM_CHAIN_BOOTS); - tolua_constant(tolua_S,"E_ITEM_IRON_HELMET",E_ITEM_IRON_HELMET); - tolua_constant(tolua_S,"E_ITEM_IRON_CHESTPLATE",E_ITEM_IRON_CHESTPLATE); - tolua_constant(tolua_S,"E_ITEM_IRON_LEGGINGS",E_ITEM_IRON_LEGGINGS); - tolua_constant(tolua_S,"E_ITEM_IRON_BOOTS",E_ITEM_IRON_BOOTS); - tolua_constant(tolua_S,"E_ITEM_DIAMOND_HELMET",E_ITEM_DIAMOND_HELMET); - tolua_constant(tolua_S,"E_ITEM_DIAMOND_CHESTPLATE",E_ITEM_DIAMOND_CHESTPLATE); - tolua_constant(tolua_S,"E_ITEM_DIAMOND_LEGGINGS",E_ITEM_DIAMOND_LEGGINGS); - tolua_constant(tolua_S,"E_ITEM_DIAMOND_BOOTS",E_ITEM_DIAMOND_BOOTS); - tolua_constant(tolua_S,"E_ITEM_GOLD_HELMET",E_ITEM_GOLD_HELMET); - tolua_constant(tolua_S,"E_ITEM_GOLD_CHESTPLATE",E_ITEM_GOLD_CHESTPLATE); - tolua_constant(tolua_S,"E_ITEM_GOLD_LEGGINGS",E_ITEM_GOLD_LEGGINGS); - tolua_constant(tolua_S,"E_ITEM_GOLD_BOOTS",E_ITEM_GOLD_BOOTS); - tolua_constant(tolua_S,"E_ITEM_FLINT",E_ITEM_FLINT); - tolua_constant(tolua_S,"E_ITEM_RAW_PORKCHOP",E_ITEM_RAW_PORKCHOP); - tolua_constant(tolua_S,"E_ITEM_COOKED_PORKCHOP",E_ITEM_COOKED_PORKCHOP); - tolua_constant(tolua_S,"E_ITEM_PAINTINGS",E_ITEM_PAINTINGS); - tolua_constant(tolua_S,"E_ITEM_GOLDEN_APPLE",E_ITEM_GOLDEN_APPLE); - tolua_constant(tolua_S,"E_ITEM_SIGN",E_ITEM_SIGN); - tolua_constant(tolua_S,"E_ITEM_WOODEN_DOOR",E_ITEM_WOODEN_DOOR); - tolua_constant(tolua_S,"E_ITEM_BUCKET",E_ITEM_BUCKET); - tolua_constant(tolua_S,"E_ITEM_WATER_BUCKET",E_ITEM_WATER_BUCKET); - tolua_constant(tolua_S,"E_ITEM_LAVA_BUCKET",E_ITEM_LAVA_BUCKET); - tolua_constant(tolua_S,"E_ITEM_MINECART",E_ITEM_MINECART); - tolua_constant(tolua_S,"E_ITEM_SADDLE",E_ITEM_SADDLE); - tolua_constant(tolua_S,"E_ITEM_IRON_DOOR",E_ITEM_IRON_DOOR); - tolua_constant(tolua_S,"E_ITEM_REDSTONE_DUST",E_ITEM_REDSTONE_DUST); - tolua_constant(tolua_S,"E_ITEM_SNOWBALL",E_ITEM_SNOWBALL); - tolua_constant(tolua_S,"E_ITEM_BOAT",E_ITEM_BOAT); - tolua_constant(tolua_S,"E_ITEM_LEATHER",E_ITEM_LEATHER); - tolua_constant(tolua_S,"E_ITEM_MILK",E_ITEM_MILK); - tolua_constant(tolua_S,"E_ITEM_CLAY_BRICK",E_ITEM_CLAY_BRICK); - tolua_constant(tolua_S,"E_ITEM_CLAY",E_ITEM_CLAY); - tolua_constant(tolua_S,"E_ITEM_SUGARCANE",E_ITEM_SUGARCANE); - tolua_constant(tolua_S,"E_ITEM_SUGAR_CANE",E_ITEM_SUGAR_CANE); - tolua_constant(tolua_S,"E_ITEM_PAPER",E_ITEM_PAPER); - tolua_constant(tolua_S,"E_ITEM_BOOK",E_ITEM_BOOK); - tolua_constant(tolua_S,"E_ITEM_SLIMEBALL",E_ITEM_SLIMEBALL); - tolua_constant(tolua_S,"E_ITEM_CHEST_MINECART",E_ITEM_CHEST_MINECART); - tolua_constant(tolua_S,"E_ITEM_FURNACE_MINECART",E_ITEM_FURNACE_MINECART); - tolua_constant(tolua_S,"E_ITEM_EGG",E_ITEM_EGG); - tolua_constant(tolua_S,"E_ITEM_COMPASS",E_ITEM_COMPASS); - tolua_constant(tolua_S,"E_ITEM_FISHING_ROD",E_ITEM_FISHING_ROD); - tolua_constant(tolua_S,"E_ITEM_CLOCK",E_ITEM_CLOCK); - tolua_constant(tolua_S,"E_ITEM_GLOWSTONE_DUST",E_ITEM_GLOWSTONE_DUST); - tolua_constant(tolua_S,"E_ITEM_RAW_FISH",E_ITEM_RAW_FISH); - tolua_constant(tolua_S,"E_ITEM_COOKED_FISH",E_ITEM_COOKED_FISH); - tolua_constant(tolua_S,"E_ITEM_DYE",E_ITEM_DYE); - tolua_constant(tolua_S,"E_ITEM_BONE",E_ITEM_BONE); - tolua_constant(tolua_S,"E_ITEM_SUGAR",E_ITEM_SUGAR); - tolua_constant(tolua_S,"E_ITEM_CAKE",E_ITEM_CAKE); - tolua_constant(tolua_S,"E_ITEM_BED",E_ITEM_BED); - tolua_constant(tolua_S,"E_ITEM_REDSTONE_REPEATER",E_ITEM_REDSTONE_REPEATER); - tolua_constant(tolua_S,"E_ITEM_COOKIE",E_ITEM_COOKIE); - tolua_constant(tolua_S,"E_ITEM_MAP",E_ITEM_MAP); - tolua_constant(tolua_S,"E_ITEM_SHEARS",E_ITEM_SHEARS); - tolua_constant(tolua_S,"E_ITEM_MELON_SLICE",E_ITEM_MELON_SLICE); - tolua_constant(tolua_S,"E_ITEM_PUMPKIN_SEEDS",E_ITEM_PUMPKIN_SEEDS); - tolua_constant(tolua_S,"E_ITEM_MELON_SEEDS",E_ITEM_MELON_SEEDS); - tolua_constant(tolua_S,"E_ITEM_RAW_BEEF",E_ITEM_RAW_BEEF); - tolua_constant(tolua_S,"E_ITEM_STEAK",E_ITEM_STEAK); - tolua_constant(tolua_S,"E_ITEM_RAW_CHICKEN",E_ITEM_RAW_CHICKEN); - tolua_constant(tolua_S,"E_ITEM_COOKED_CHICKEN",E_ITEM_COOKED_CHICKEN); - tolua_constant(tolua_S,"E_ITEM_ROTTEN_FLESH",E_ITEM_ROTTEN_FLESH); - tolua_constant(tolua_S,"E_ITEM_ENDER_PEARL",E_ITEM_ENDER_PEARL); - tolua_constant(tolua_S,"E_ITEM_BLAZE_ROD",E_ITEM_BLAZE_ROD); - tolua_constant(tolua_S,"E_ITEM_GHAST_TEAR",E_ITEM_GHAST_TEAR); - tolua_constant(tolua_S,"E_ITEM_GOLD_NUGGET",E_ITEM_GOLD_NUGGET); - tolua_constant(tolua_S,"E_ITEM_NETHER_WART",E_ITEM_NETHER_WART); - tolua_constant(tolua_S,"E_ITEM_POTIONS",E_ITEM_POTIONS); - tolua_constant(tolua_S,"E_ITEM_GLASS_BOTTLE",E_ITEM_GLASS_BOTTLE); - tolua_constant(tolua_S,"E_ITEM_SPIDER_EYE",E_ITEM_SPIDER_EYE); - tolua_constant(tolua_S,"E_ITEM_FERMENTED_SPIDER_EYE",E_ITEM_FERMENTED_SPIDER_EYE); - tolua_constant(tolua_S,"E_ITEM_BLAZE_POWDER",E_ITEM_BLAZE_POWDER); - tolua_constant(tolua_S,"E_ITEM_MAGMA_CREAM",E_ITEM_MAGMA_CREAM); - tolua_constant(tolua_S,"E_ITEM_BREWING_STAND",E_ITEM_BREWING_STAND); - tolua_constant(tolua_S,"E_ITEM_CAULDRON",E_ITEM_CAULDRON); - tolua_constant(tolua_S,"E_ITEM_EYE_OF_ENDER",E_ITEM_EYE_OF_ENDER); - tolua_constant(tolua_S,"E_ITEM_GLISTERING_MELON",E_ITEM_GLISTERING_MELON); - tolua_constant(tolua_S,"E_ITEM_SPAWN_EGG",E_ITEM_SPAWN_EGG); - tolua_constant(tolua_S,"E_ITEM_BOTTLE_O_ENCHANTING",E_ITEM_BOTTLE_O_ENCHANTING); - tolua_constant(tolua_S,"E_ITEM_FIRE_CHARGE",E_ITEM_FIRE_CHARGE); - tolua_constant(tolua_S,"E_ITEM_BOOK_AND_QUILL",E_ITEM_BOOK_AND_QUILL); - tolua_constant(tolua_S,"E_ITEM_WRITTEN_BOOK",E_ITEM_WRITTEN_BOOK); - tolua_constant(tolua_S,"E_ITEM_EMERALD",E_ITEM_EMERALD); - tolua_constant(tolua_S,"E_ITEM_ITEM_FRAME",E_ITEM_ITEM_FRAME); - tolua_constant(tolua_S,"E_ITEM_FLOWER_POT",E_ITEM_FLOWER_POT); - tolua_constant(tolua_S,"E_ITEM_CARROT",E_ITEM_CARROT); - tolua_constant(tolua_S,"E_ITEM_POTATO",E_ITEM_POTATO); - tolua_constant(tolua_S,"E_ITEM_BAKED_POTATO",E_ITEM_BAKED_POTATO); - tolua_constant(tolua_S,"E_ITEM_POISONOUS_POTATO",E_ITEM_POISONOUS_POTATO); - tolua_constant(tolua_S,"E_ITEM_EMPTY_MAP",E_ITEM_EMPTY_MAP); - tolua_constant(tolua_S,"E_ITEM_GOLDEN_CARROT",E_ITEM_GOLDEN_CARROT); - tolua_constant(tolua_S,"E_ITEM_HEAD",E_ITEM_HEAD); - tolua_constant(tolua_S,"E_ITEM_CARROT_ON_STICK",E_ITEM_CARROT_ON_STICK); - tolua_constant(tolua_S,"E_ITEM_NETHER_STAR",E_ITEM_NETHER_STAR); - tolua_constant(tolua_S,"E_ITEM_PUMPKIN_PIE",E_ITEM_PUMPKIN_PIE); - tolua_constant(tolua_S,"E_ITEM_FIREWORK_ROCKET",E_ITEM_FIREWORK_ROCKET); - tolua_constant(tolua_S,"E_ITEM_FIREWORK_STAR",E_ITEM_FIREWORK_STAR); - tolua_constant(tolua_S,"E_ITEM_ENCHANTED_BOOK",E_ITEM_ENCHANTED_BOOK); - tolua_constant(tolua_S,"E_ITEM_COMPARATOR",E_ITEM_COMPARATOR); - tolua_constant(tolua_S,"E_ITEM_NETHER_BRICK",E_ITEM_NETHER_BRICK); - tolua_constant(tolua_S,"E_ITEM_NETHER_QUARTZ",E_ITEM_NETHER_QUARTZ); - tolua_constant(tolua_S,"E_ITEM_MINECART_WITH_TNT",E_ITEM_MINECART_WITH_TNT); - tolua_constant(tolua_S,"E_ITEM_MINECART_WITH_HOPPER",E_ITEM_MINECART_WITH_HOPPER); - tolua_constant(tolua_S,"E_ITEM_IRON_HORSE_ARMOR",E_ITEM_IRON_HORSE_ARMOR); - tolua_constant(tolua_S,"E_ITEM_GOLD_HORSE_ARMOR",E_ITEM_GOLD_HORSE_ARMOR); - tolua_constant(tolua_S,"E_ITEM_DIAMOND_HORSE_ARMOR",E_ITEM_DIAMOND_HORSE_ARMOR); - tolua_constant(tolua_S,"E_ITEM_LEAD",E_ITEM_LEAD); - tolua_constant(tolua_S,"E_ITEM_NAME_TAG",E_ITEM_NAME_TAG); - tolua_constant(tolua_S,"E_ITEM_MINECART_WITH_COMMAND_BLOCK",E_ITEM_MINECART_WITH_COMMAND_BLOCK); - tolua_constant(tolua_S,"E_ITEM_NUMBER_OF_CONSECUTIVE_TYPES",E_ITEM_NUMBER_OF_CONSECUTIVE_TYPES); - tolua_constant(tolua_S,"E_ITEM_MAX_CONSECUTIVE_TYPE_ID",E_ITEM_MAX_CONSECUTIVE_TYPE_ID); - tolua_constant(tolua_S,"E_ITEM_FIRST_DISC",E_ITEM_FIRST_DISC); - tolua_constant(tolua_S,"E_ITEM_13_DISC",E_ITEM_13_DISC); - tolua_constant(tolua_S,"E_ITEM_CAT_DISC",E_ITEM_CAT_DISC); - tolua_constant(tolua_S,"E_ITEM_BLOCKS_DISC",E_ITEM_BLOCKS_DISC); - tolua_constant(tolua_S,"E_ITEM_CHIRP_DISC",E_ITEM_CHIRP_DISC); - tolua_constant(tolua_S,"E_ITEM_FAR_DISC",E_ITEM_FAR_DISC); - tolua_constant(tolua_S,"E_ITEM_MALL_DISC",E_ITEM_MALL_DISC); - tolua_constant(tolua_S,"E_ITEM_MELLOHI_DISC",E_ITEM_MELLOHI_DISC); - tolua_constant(tolua_S,"E_ITEM_STAL_DISC",E_ITEM_STAL_DISC); - tolua_constant(tolua_S,"E_ITEM_STRAD_DISC",E_ITEM_STRAD_DISC); - tolua_constant(tolua_S,"E_ITEM_WARD_DISC",E_ITEM_WARD_DISC); - tolua_constant(tolua_S,"E_ITEM_11_DISC",E_ITEM_11_DISC); - tolua_constant(tolua_S,"E_ITEM_WAIT_DISC",E_ITEM_WAIT_DISC); - tolua_constant(tolua_S,"E_ITEM_LAST_DISC_PLUS_ONE",E_ITEM_LAST_DISC_PLUS_ONE); - tolua_constant(tolua_S,"E_ITEM_LAST_DISC",E_ITEM_LAST_DISC); - tolua_constant(tolua_S,"E_ITEM_LAST",E_ITEM_LAST); - tolua_constant(tolua_S,"E_META_CHEST_FACING_ZM",E_META_CHEST_FACING_ZM); - tolua_constant(tolua_S,"E_META_CHEST_FACING_ZP",E_META_CHEST_FACING_ZP); - tolua_constant(tolua_S,"E_META_CHEST_FACING_XM",E_META_CHEST_FACING_XM); - tolua_constant(tolua_S,"E_META_CHEST_FACING_XP",E_META_CHEST_FACING_XP); - tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_YM",E_META_DROPSPENSER_FACING_YM); - tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_YP",E_META_DROPSPENSER_FACING_YP); - tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_ZM",E_META_DROPSPENSER_FACING_ZM); - tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_ZP",E_META_DROPSPENSER_FACING_ZP); - tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_XM",E_META_DROPSPENSER_FACING_XM); - tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_XP",E_META_DROPSPENSER_FACING_XP); - tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_STONE",E_META_DOUBLE_STONE_SLAB_STONE); - tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_SANDSTONE",E_META_DOUBLE_STONE_SLAB_SANDSTONE); - tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_WOODEN",E_META_DOUBLE_STONE_SLAB_WOODEN); - tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_COBBLESTONE",E_META_DOUBLE_STONE_SLAB_COBBLESTONE); - tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_BRICK",E_META_DOUBLE_STONE_SLAB_BRICK); - tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_STONE_BRICK",E_META_DOUBLE_STONE_SLAB_STONE_BRICK); - tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_NETHER_BRICK",E_META_DOUBLE_STONE_SLAB_NETHER_BRICK); - tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_STONE_SECRET",E_META_DOUBLE_STONE_SLAB_STONE_SECRET); - tolua_constant(tolua_S,"E_META_HOPPER_FACING_YM",E_META_HOPPER_FACING_YM); - tolua_constant(tolua_S,"E_META_HOPPER_UNATTACHED",E_META_HOPPER_UNATTACHED); - tolua_constant(tolua_S,"E_META_HOPPER_FACING_ZM",E_META_HOPPER_FACING_ZM); - tolua_constant(tolua_S,"E_META_HOPPER_FACING_ZP",E_META_HOPPER_FACING_ZP); - tolua_constant(tolua_S,"E_META_HOPPER_FACING_XM",E_META_HOPPER_FACING_XM); - tolua_constant(tolua_S,"E_META_HOPPER_FACING_XP",E_META_HOPPER_FACING_XP); - tolua_constant(tolua_S,"E_META_LEAVES_APPLE",E_META_LEAVES_APPLE); - tolua_constant(tolua_S,"E_META_LEAVES_CONIFER",E_META_LEAVES_CONIFER); - tolua_constant(tolua_S,"E_META_LEAVES_BIRCH",E_META_LEAVES_BIRCH); - tolua_constant(tolua_S,"E_META_LEAVES_JUNGLE",E_META_LEAVES_JUNGLE); - tolua_constant(tolua_S,"E_META_LOG_APPLE",E_META_LOG_APPLE); - tolua_constant(tolua_S,"E_META_LOG_CONIFER",E_META_LOG_CONIFER); - tolua_constant(tolua_S,"E_META_LOG_BIRCH",E_META_LOG_BIRCH); - tolua_constant(tolua_S,"E_META_LOG_JUNGLE",E_META_LOG_JUNGLE); - tolua_constant(tolua_S,"E_META_PLANKS_APPLE",E_META_PLANKS_APPLE); - tolua_constant(tolua_S,"E_META_PLANKS_CONIFER",E_META_PLANKS_CONIFER); - tolua_constant(tolua_S,"E_META_PLANKS_BIRCH",E_META_PLANKS_BIRCH); - tolua_constant(tolua_S,"E_META_PLANKS_JUNGLE",E_META_PLANKS_JUNGLE); - tolua_constant(tolua_S,"E_META_SANDSTONE_NORMAL",E_META_SANDSTONE_NORMAL); - tolua_constant(tolua_S,"E_META_SANDSTONE_ORNAMENT",E_META_SANDSTONE_ORNAMENT); - tolua_constant(tolua_S,"E_META_SANDSTONE_SMOOTH",E_META_SANDSTONE_SMOOTH); - tolua_constant(tolua_S,"E_META_SAPLING_APPLE",E_META_SAPLING_APPLE); - tolua_constant(tolua_S,"E_META_SAPLING_CONIFER",E_META_SAPLING_CONIFER); - tolua_constant(tolua_S,"E_META_SAPLING_BIRCH",E_META_SAPLING_BIRCH); - tolua_constant(tolua_S,"E_META_SAPLING_JUNGLE",E_META_SAPLING_JUNGLE); - tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE",E_META_SILVERFISH_EGG_STONE); - tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_COBBLESTONE",E_META_SILVERFISH_EGG_COBBLESTONE); - tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE_BRICK",E_META_SILVERFISH_EGG_STONE_BRICK); - tolua_constant(tolua_S,"E_META_STONE_SLAB_STONE",E_META_STONE_SLAB_STONE); - tolua_constant(tolua_S,"E_META_STONE_SLAB_SANDSTONE",E_META_STONE_SLAB_SANDSTONE); - tolua_constant(tolua_S,"E_META_STONE_SLAB_PLANKS",E_META_STONE_SLAB_PLANKS); - tolua_constant(tolua_S,"E_META_STONE_SLAB_COBBLESTONE",E_META_STONE_SLAB_COBBLESTONE); - tolua_constant(tolua_S,"E_META_STONE_SLAB_BRICK",E_META_STONE_SLAB_BRICK); - tolua_constant(tolua_S,"E_META_STONE_SLAB_STONE_BRICK",E_META_STONE_SLAB_STONE_BRICK); - tolua_constant(tolua_S,"E_META_STONE_SLAB_NETHER_BRICK",E_META_STONE_SLAB_NETHER_BRICK); - tolua_constant(tolua_S,"E_META_STONE_SLAB_STONE_SECRET",E_META_STONE_SLAB_STONE_SECRET); - tolua_constant(tolua_S,"E_META_STONE_BRICK_NORMAL",E_META_STONE_BRICK_NORMAL); - tolua_constant(tolua_S,"E_META_STONE_BRICK_MOSSY",E_META_STONE_BRICK_MOSSY); - tolua_constant(tolua_S,"E_META_STONE_BRICK_CRACKED",E_META_STONE_BRICK_CRACKED); - tolua_constant(tolua_S,"E_META_STONE_BRICK_ORNAMENT",E_META_STONE_BRICK_ORNAMENT); - tolua_constant(tolua_S,"E_META_TALL_GRASS_DEAD_SHRUB",E_META_TALL_GRASS_DEAD_SHRUB); - tolua_constant(tolua_S,"E_META_TALL_GRASS_GRASS",E_META_TALL_GRASS_GRASS); - tolua_constant(tolua_S,"E_META_TALL_GRASS_FERN",E_META_TALL_GRASS_FERN); - tolua_constant(tolua_S,"E_META_TORCH_EAST",E_META_TORCH_EAST); - tolua_constant(tolua_S,"E_META_TORCH_WEST",E_META_TORCH_WEST); - tolua_constant(tolua_S,"E_META_TORCH_SOUTH",E_META_TORCH_SOUTH); - tolua_constant(tolua_S,"E_META_TORCH_NORTH",E_META_TORCH_NORTH); - tolua_constant(tolua_S,"E_META_TORCH_FLOOR",E_META_TORCH_FLOOR); - tolua_constant(tolua_S,"E_META_TORCH_XM",E_META_TORCH_XM); - tolua_constant(tolua_S,"E_META_TORCH_XP",E_META_TORCH_XP); - tolua_constant(tolua_S,"E_META_TORCH_ZM",E_META_TORCH_ZM); - tolua_constant(tolua_S,"E_META_TORCH_ZP",E_META_TORCH_ZP); - tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_APPLE",E_META_WOODEN_DOUBLE_SLAB_APPLE); - tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_CONIFER",E_META_WOODEN_DOUBLE_SLAB_CONIFER); - tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_BIRCH",E_META_WOODEN_DOUBLE_SLAB_BIRCH); - tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_JUNGLE",E_META_WOODEN_DOUBLE_SLAB_JUNGLE); - tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_ACACIA",E_META_WOODEN_DOUBLE_SLAB_ACACIA); - tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_DARK_OAK",E_META_WOODEN_DOUBLE_SLAB_DARK_OAK); - tolua_constant(tolua_S,"E_META_WOODEN_SLAB_APPLE",E_META_WOODEN_SLAB_APPLE); - tolua_constant(tolua_S,"E_META_WOODEN_SLAB_CONIFER",E_META_WOODEN_SLAB_CONIFER); - tolua_constant(tolua_S,"E_META_WOODEN_SLAB_BIRCH",E_META_WOODEN_SLAB_BIRCH); - tolua_constant(tolua_S,"E_META_WOODEN_SLAB_JUNGLE",E_META_WOODEN_SLAB_JUNGLE); - tolua_constant(tolua_S,"E_META_WOODEN_SLAB_ACACIA",E_META_WOODEN_SLAB_ACACIA); - tolua_constant(tolua_S,"E_META_WOODEN_SLAB_DARK_OAK",E_META_WOODEN_SLAB_DARK_OAK); - tolua_constant(tolua_S,"E_META_WOOL_WHITE",E_META_WOOL_WHITE); - tolua_constant(tolua_S,"E_META_WOOL_ORANGE",E_META_WOOL_ORANGE); - tolua_constant(tolua_S,"E_META_WOOL_MAGENTA",E_META_WOOL_MAGENTA); - tolua_constant(tolua_S,"E_META_WOOL_LIGHTBLUE",E_META_WOOL_LIGHTBLUE); - tolua_constant(tolua_S,"E_META_WOOL_YELLOW",E_META_WOOL_YELLOW); - tolua_constant(tolua_S,"E_META_WOOL_LIGHTGREEN",E_META_WOOL_LIGHTGREEN); - tolua_constant(tolua_S,"E_META_WOOL_PINK",E_META_WOOL_PINK); - tolua_constant(tolua_S,"E_META_WOOL_GRAY",E_META_WOOL_GRAY); - tolua_constant(tolua_S,"E_META_WOOL_LIGHTGRAY",E_META_WOOL_LIGHTGRAY); - tolua_constant(tolua_S,"E_META_WOOL_CYAN",E_META_WOOL_CYAN); - tolua_constant(tolua_S,"E_META_WOOL_PURPLE",E_META_WOOL_PURPLE); - tolua_constant(tolua_S,"E_META_WOOL_BLUE",E_META_WOOL_BLUE); - tolua_constant(tolua_S,"E_META_WOOL_BROWN",E_META_WOOL_BROWN); - tolua_constant(tolua_S,"E_META_WOOL_GREEN",E_META_WOOL_GREEN); - tolua_constant(tolua_S,"E_META_WOOL_RED",E_META_WOOL_RED); - tolua_constant(tolua_S,"E_META_WOOL_BLACK",E_META_WOOL_BLACK); - tolua_constant(tolua_S,"E_META_CARPET_WHITE",E_META_CARPET_WHITE); - tolua_constant(tolua_S,"E_META_CARPET_ORANGE",E_META_CARPET_ORANGE); - tolua_constant(tolua_S,"E_META_CARPET_MAGENTA",E_META_CARPET_MAGENTA); - tolua_constant(tolua_S,"E_META_CARPET_LIGHTBLUE",E_META_CARPET_LIGHTBLUE); - tolua_constant(tolua_S,"E_META_CARPET_YELLOW",E_META_CARPET_YELLOW); - tolua_constant(tolua_S,"E_META_CARPET_LIGHTGREEN",E_META_CARPET_LIGHTGREEN); - tolua_constant(tolua_S,"E_META_CARPET_PINK",E_META_CARPET_PINK); - tolua_constant(tolua_S,"E_META_CARPET_GRAY",E_META_CARPET_GRAY); - tolua_constant(tolua_S,"E_META_CARPET_LIGHTGRAY",E_META_CARPET_LIGHTGRAY); - tolua_constant(tolua_S,"E_META_CARPET_CYAN",E_META_CARPET_CYAN); - tolua_constant(tolua_S,"E_META_CARPET_PURPLE",E_META_CARPET_PURPLE); - tolua_constant(tolua_S,"E_META_CARPET_BLUE",E_META_CARPET_BLUE); - tolua_constant(tolua_S,"E_META_CARPET_BROWN",E_META_CARPET_BROWN); - tolua_constant(tolua_S,"E_META_CARPET_GREEN",E_META_CARPET_GREEN); - tolua_constant(tolua_S,"E_META_CARPET_RED",E_META_CARPET_RED); - tolua_constant(tolua_S,"E_META_CARPET_BLACK",E_META_CARPET_BLACK); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_WHITE",E_META_STAINED_CLAY_WHITE); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_ORANGE",E_META_STAINED_CLAY_ORANGE); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_MAGENTA",E_META_STAINED_CLAY_MAGENTA); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_LIGHTBLUE",E_META_STAINED_CLAY_LIGHTBLUE); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_YELLOW",E_META_STAINED_CLAY_YELLOW); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_LIGHTGREEN",E_META_STAINED_CLAY_LIGHTGREEN); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_PINK",E_META_STAINED_CLAY_PINK); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_GRAY",E_META_STAINED_CLAY_GRAY); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_LIGHTGRAY",E_META_STAINED_CLAY_LIGHTGRAY); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_CYAN",E_META_STAINED_CLAY_CYAN); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_PURPLE",E_META_STAINED_CLAY_PURPLE); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_BLUE",E_META_STAINED_CLAY_BLUE); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_BROWN",E_META_STAINED_CLAY_BROWN); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_GREEN",E_META_STAINED_CLAY_GREEN); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_RED",E_META_STAINED_CLAY_RED); - tolua_constant(tolua_S,"E_META_STAINED_CLAY_BLACK",E_META_STAINED_CLAY_BLACK); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_WHITE",E_META_STAINED_GLASS_WHITE); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_ORANGE",E_META_STAINED_GLASS_ORANGE); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_MAGENTA",E_META_STAINED_GLASS_MAGENTA); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_LIGHTBLUE",E_META_STAINED_GLASS_LIGHTBLUE); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_YELLOW",E_META_STAINED_GLASS_YELLOW); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_LIGHTGREEN",E_META_STAINED_GLASS_LIGHTGREEN); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PINK",E_META_STAINED_GLASS_PINK); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_GRAY",E_META_STAINED_GLASS_GRAY); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_LIGHTGRAY",E_META_STAINED_GLASS_LIGHTGRAY); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_CYAN",E_META_STAINED_GLASS_CYAN); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PURPLE",E_META_STAINED_GLASS_PURPLE); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_BLUE",E_META_STAINED_GLASS_BLUE); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_BROWN",E_META_STAINED_GLASS_BROWN); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_GREEN",E_META_STAINED_GLASS_GREEN); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_RED",E_META_STAINED_GLASS_RED); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_BLACK",E_META_STAINED_GLASS_BLACK); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_WHITE",E_META_STAINED_GLASS_PANE_WHITE); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_ORANGE",E_META_STAINED_GLASS_PANE_ORANGE); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_MAGENTA",E_META_STAINED_GLASS_PANE_MAGENTA); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_LIGHTBLUE",E_META_STAINED_GLASS_PANE_LIGHTBLUE); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_YELLOW",E_META_STAINED_GLASS_PANE_YELLOW); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_LIGHTGREEN",E_META_STAINED_GLASS_PANE_LIGHTGREEN); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_PINK",E_META_STAINED_GLASS_PANE_PINK); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_GRAY",E_META_STAINED_GLASS_PANE_GRAY); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_LIGHTGRAY",E_META_STAINED_GLASS_PANE_LIGHTGRAY); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_CYAN",E_META_STAINED_GLASS_PANE_CYAN); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_PURPLE",E_META_STAINED_GLASS_PANE_PURPLE); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_BLUE",E_META_STAINED_GLASS_PANE_BLUE); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_BROWN",E_META_STAINED_GLASS_PANE_BROWN); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_GREEN",E_META_STAINED_GLASS_PANE_GREEN); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_RED",E_META_STAINED_GLASS_PANE_RED); - tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_BLACK",E_META_STAINED_GLASS_PANE_BLACK); - tolua_constant(tolua_S,"E_META_SNOW_LAYER_ONE",E_META_SNOW_LAYER_ONE); - tolua_constant(tolua_S,"E_META_SNOW_LAYER_TWO",E_META_SNOW_LAYER_TWO); - tolua_constant(tolua_S,"E_META_SNOW_LAYER_THREE",E_META_SNOW_LAYER_THREE); - tolua_constant(tolua_S,"E_META_SNOW_LAYER_FOUR",E_META_SNOW_LAYER_FOUR); - tolua_constant(tolua_S,"E_META_SNOW_LAYER_FIVE",E_META_SNOW_LAYER_FIVE); - tolua_constant(tolua_S,"E_META_SNOW_LAYER_SIX",E_META_SNOW_LAYER_SIX); - tolua_constant(tolua_S,"E_META_SNOW_LAYER_SEVEN",E_META_SNOW_LAYER_SEVEN); - tolua_constant(tolua_S,"E_META_SNOW_LAYER_EIGHT",E_META_SNOW_LAYER_EIGHT); - tolua_constant(tolua_S,"E_META_RAIL_ZM_ZP",E_META_RAIL_ZM_ZP); - tolua_constant(tolua_S,"E_META_RAIL_XM_XP",E_META_RAIL_XM_XP); - tolua_constant(tolua_S,"E_META_RAIL_ASCEND_XP",E_META_RAIL_ASCEND_XP); - tolua_constant(tolua_S,"E_META_RAIL_ASCEND_XM",E_META_RAIL_ASCEND_XM); - tolua_constant(tolua_S,"E_META_RAIL_ASCEND_ZM",E_META_RAIL_ASCEND_ZM); - tolua_constant(tolua_S,"E_META_RAIL_ASCEND_ZP",E_META_RAIL_ASCEND_ZP); - tolua_constant(tolua_S,"E_META_RAIL_CURVED_ZP_XP",E_META_RAIL_CURVED_ZP_XP); - tolua_constant(tolua_S,"E_META_RAIL_CURVED_ZP_XM",E_META_RAIL_CURVED_ZP_XM); - tolua_constant(tolua_S,"E_META_RAIL_CURVED_ZM_XM",E_META_RAIL_CURVED_ZM_XM); - tolua_constant(tolua_S,"E_META_RAIL_CURVED_ZM_XP",E_META_RAIL_CURVED_ZM_XP); - tolua_constant(tolua_S,"E_META_NEW_LEAVES_ACACIA_WOOD",E_META_NEW_LEAVES_ACACIA_WOOD); - tolua_constant(tolua_S,"E_META_NEW_LEAVES_DARK_OAK_WOOD",E_META_NEW_LEAVES_DARK_OAK_WOOD); - tolua_constant(tolua_S,"E_META_NEW_LOG_ACACIA_WOOD",E_META_NEW_LOG_ACACIA_WOOD); - tolua_constant(tolua_S,"E_META_NEW_LOG_DARK_OAK_WOOD",E_META_NEW_LOG_DARK_OAK_WOOD); - tolua_constant(tolua_S,"E_META_FLOWER_POPPY",E_META_FLOWER_POPPY); - tolua_constant(tolua_S,"E_META_FLOWER_BLUE_ORCHID",E_META_FLOWER_BLUE_ORCHID); - tolua_constant(tolua_S,"E_META_FLOWER_ALLIUM",E_META_FLOWER_ALLIUM); - tolua_constant(tolua_S,"E_META_FLOWER_RED_TULIP",E_META_FLOWER_RED_TULIP); - tolua_constant(tolua_S,"E_META_FLOWER_ORANGE_TULIP",E_META_FLOWER_ORANGE_TULIP); - tolua_constant(tolua_S,"E_META_FLOWER_WHITE_TULIP",E_META_FLOWER_WHITE_TULIP); - tolua_constant(tolua_S,"E_META_FLOWER_PINK_TULIP",E_META_FLOWER_PINK_TULIP); - tolua_constant(tolua_S,"E_META_FLOWER_OXEYE_DAISY",E_META_FLOWER_OXEYE_DAISY); - tolua_constant(tolua_S,"E_META_BIG_FLOWER_SUNFLOWER",E_META_BIG_FLOWER_SUNFLOWER); - tolua_constant(tolua_S,"E_META_BIG_FLOWER_LILAC",E_META_BIG_FLOWER_LILAC); - tolua_constant(tolua_S,"E_META_BIG_FLOWER_DOUBLE_TALL_GRASS",E_META_BIG_FLOWER_DOUBLE_TALL_GRASS); - tolua_constant(tolua_S,"E_META_BIG_FLOWER_LARGE_FERN",E_META_BIG_FLOWER_LARGE_FERN); - tolua_constant(tolua_S,"E_META_BIG_FLOWER_ROSE_BUSH",E_META_BIG_FLOWER_ROSE_BUSH); - tolua_constant(tolua_S,"E_META_BIG_FLOWER_PEONY",E_META_BIG_FLOWER_PEONY); - tolua_constant(tolua_S,"E_META_COAL_NORMAL",E_META_COAL_NORMAL); - tolua_constant(tolua_S,"E_META_COAL_CHARCOAL",E_META_COAL_CHARCOAL); - tolua_constant(tolua_S,"E_META_DYE_BLACK",E_META_DYE_BLACK); - tolua_constant(tolua_S,"E_META_DYE_RED",E_META_DYE_RED); - tolua_constant(tolua_S,"E_META_DYE_GREEN",E_META_DYE_GREEN); - tolua_constant(tolua_S,"E_META_DYE_BROWN",E_META_DYE_BROWN); - tolua_constant(tolua_S,"E_META_DYE_BLUE",E_META_DYE_BLUE); - tolua_constant(tolua_S,"E_META_DYE_PURPLE",E_META_DYE_PURPLE); - tolua_constant(tolua_S,"E_META_DYE_CYAN",E_META_DYE_CYAN); - tolua_constant(tolua_S,"E_META_DYE_LIGHTGRAY",E_META_DYE_LIGHTGRAY); - tolua_constant(tolua_S,"E_META_DYE_GRAY",E_META_DYE_GRAY); - tolua_constant(tolua_S,"E_META_DYE_PINK",E_META_DYE_PINK); - tolua_constant(tolua_S,"E_META_DYE_LIGHTGREEN",E_META_DYE_LIGHTGREEN); - tolua_constant(tolua_S,"E_META_DYE_YELLOW",E_META_DYE_YELLOW); - tolua_constant(tolua_S,"E_META_DYE_LIGHTBLUE",E_META_DYE_LIGHTBLUE); - tolua_constant(tolua_S,"E_META_DYE_MAGENTA",E_META_DYE_MAGENTA); - tolua_constant(tolua_S,"E_META_DYE_ORANGE",E_META_DYE_ORANGE); - tolua_constant(tolua_S,"E_META_DYE_WHITE",E_META_DYE_WHITE); - tolua_constant(tolua_S,"E_META_GOLDEN_APPLE_NORMAL",E_META_GOLDEN_APPLE_NORMAL); - tolua_constant(tolua_S,"E_META_GOLDEN_APPLE_ENCHANTED",E_META_GOLDEN_APPLE_ENCHANTED); - tolua_constant(tolua_S,"E_META_RAW_FISH_FISH",E_META_RAW_FISH_FISH); - tolua_constant(tolua_S,"E_META_RAW_FISH_SALMON",E_META_RAW_FISH_SALMON); - tolua_constant(tolua_S,"E_META_RAW_FISH_CLOWNFISH",E_META_RAW_FISH_CLOWNFISH); - tolua_constant(tolua_S,"E_META_RAW_FISH_PUFFERFISH",E_META_RAW_FISH_PUFFERFISH); - tolua_constant(tolua_S,"E_META_COOKED_FISH_FISH",E_META_COOKED_FISH_FISH); - tolua_constant(tolua_S,"E_META_COOKED_FISH_SALMON",E_META_COOKED_FISH_SALMON); - tolua_constant(tolua_S,"E_META_COOKED_FISH_CLOWNFISH",E_META_COOKED_FISH_CLOWNFISH); - tolua_constant(tolua_S,"E_META_COOKED_FISH_PUFFERFISH",E_META_COOKED_FISH_PUFFERFISH); - tolua_constant(tolua_S,"E_META_TRACKS_X",E_META_TRACKS_X); - tolua_constant(tolua_S,"E_META_TRACKS_Z",E_META_TRACKS_Z); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_PICKUP",E_META_SPAWN_EGG_PICKUP); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_EXPERIENCE_ORB",E_META_SPAWN_EGG_EXPERIENCE_ORB); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_LEASH_KNOT",E_META_SPAWN_EGG_LEASH_KNOT); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_PAINTING",E_META_SPAWN_EGG_PAINTING); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_ARROW",E_META_SPAWN_EGG_ARROW); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_SNOWBALL",E_META_SPAWN_EGG_SNOWBALL); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_FIREBALL",E_META_SPAWN_EGG_FIREBALL); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_SMALL_FIREBALL",E_META_SPAWN_EGG_SMALL_FIREBALL); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_ENDER_PEARL",E_META_SPAWN_EGG_ENDER_PEARL); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_EYE_OF_ENDER",E_META_SPAWN_EGG_EYE_OF_ENDER); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_SPLASH_POTION",E_META_SPAWN_EGG_SPLASH_POTION); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_EXP_BOTTLE",E_META_SPAWN_EGG_EXP_BOTTLE); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_ITEM_FRAME",E_META_SPAWN_EGG_ITEM_FRAME); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_WITHER_SKULL",E_META_SPAWN_EGG_WITHER_SKULL); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_PRIMED_TNT",E_META_SPAWN_EGG_PRIMED_TNT); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_FALLING_BLOCK",E_META_SPAWN_EGG_FALLING_BLOCK); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_FIREWORK",E_META_SPAWN_EGG_FIREWORK); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_BOAT",E_META_SPAWN_EGG_BOAT); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_MINECART",E_META_SPAWN_EGG_MINECART); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_MINECART_CHEST",E_META_SPAWN_EGG_MINECART_CHEST); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_MINECART_FURNACE",E_META_SPAWN_EGG_MINECART_FURNACE); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_MINECART_TNT",E_META_SPAWN_EGG_MINECART_TNT); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_MINECART_HOPPER",E_META_SPAWN_EGG_MINECART_HOPPER); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_MINECART_SPAWNER",E_META_SPAWN_EGG_MINECART_SPAWNER); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_CREEPER",E_META_SPAWN_EGG_CREEPER); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_SKELETON",E_META_SPAWN_EGG_SKELETON); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_SPIDER",E_META_SPAWN_EGG_SPIDER); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_GIANT",E_META_SPAWN_EGG_GIANT); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_ZOMBIE",E_META_SPAWN_EGG_ZOMBIE); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_SLIME",E_META_SPAWN_EGG_SLIME); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_GHAST",E_META_SPAWN_EGG_GHAST); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_ZOMBIE_PIGMAN",E_META_SPAWN_EGG_ZOMBIE_PIGMAN); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_ENDERMAN",E_META_SPAWN_EGG_ENDERMAN); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_CAVE_SPIDER",E_META_SPAWN_EGG_CAVE_SPIDER); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_SILVERFISH",E_META_SPAWN_EGG_SILVERFISH); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_BLAZE",E_META_SPAWN_EGG_BLAZE); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_MAGMA_CUBE",E_META_SPAWN_EGG_MAGMA_CUBE); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_ENDER_DRAGON",E_META_SPAWN_EGG_ENDER_DRAGON); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_WITHER",E_META_SPAWN_EGG_WITHER); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_BAT",E_META_SPAWN_EGG_BAT); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_WITCH",E_META_SPAWN_EGG_WITCH); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_PIG",E_META_SPAWN_EGG_PIG); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_SHEEP",E_META_SPAWN_EGG_SHEEP); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_COW",E_META_SPAWN_EGG_COW); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_CHICKEN",E_META_SPAWN_EGG_CHICKEN); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_SQUID",E_META_SPAWN_EGG_SQUID); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_WOLF",E_META_SPAWN_EGG_WOLF); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_MOOSHROOM",E_META_SPAWN_EGG_MOOSHROOM); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_SNOW_GOLEM",E_META_SPAWN_EGG_SNOW_GOLEM); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_OCELOT",E_META_SPAWN_EGG_OCELOT); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_IRON_GOLEM",E_META_SPAWN_EGG_IRON_GOLEM); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_HORSE",E_META_SPAWN_EGG_HORSE); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_VILLAGER",E_META_SPAWN_EGG_VILLAGER); - tolua_constant(tolua_S,"E_META_SPAWN_EGG_ENDER_CRYSTAL",E_META_SPAWN_EGG_ENDER_CRYSTAL); - tolua_constant(tolua_S,"dimNether",dimNether); - tolua_constant(tolua_S,"dimOverworld",dimOverworld); - tolua_constant(tolua_S,"dimEnd",dimEnd); - tolua_constant(tolua_S,"dtAttack",dtAttack); - tolua_constant(tolua_S,"dtRangedAttack",dtRangedAttack); - tolua_constant(tolua_S,"dtLightning",dtLightning); - tolua_constant(tolua_S,"dtFalling",dtFalling); - tolua_constant(tolua_S,"dtDrowning",dtDrowning); - tolua_constant(tolua_S,"dtSuffocating",dtSuffocating); - tolua_constant(tolua_S,"dtStarving",dtStarving); - tolua_constant(tolua_S,"dtCactusContact",dtCactusContact); - tolua_constant(tolua_S,"dtLavaContact",dtLavaContact); - tolua_constant(tolua_S,"dtPoisoning",dtPoisoning); - tolua_constant(tolua_S,"dtOnFire",dtOnFire); - tolua_constant(tolua_S,"dtFireContact",dtFireContact); - tolua_constant(tolua_S,"dtInVoid",dtInVoid); - tolua_constant(tolua_S,"dtPotionOfHarming",dtPotionOfHarming); - tolua_constant(tolua_S,"dtEnderPearl",dtEnderPearl); - tolua_constant(tolua_S,"dtAdmin",dtAdmin); - tolua_constant(tolua_S,"dtPawnAttack",dtPawnAttack); - tolua_constant(tolua_S,"dtEntityAttack",dtEntityAttack); - tolua_constant(tolua_S,"dtMob",dtMob); - tolua_constant(tolua_S,"dtMobAttack",dtMobAttack); - tolua_constant(tolua_S,"dtArrowAttack",dtArrowAttack); - tolua_constant(tolua_S,"dtArrow",dtArrow); - tolua_constant(tolua_S,"dtProjectile",dtProjectile); - tolua_constant(tolua_S,"dtFall",dtFall); - tolua_constant(tolua_S,"dtDrown",dtDrown); - tolua_constant(tolua_S,"dtSuffocation",dtSuffocation); - tolua_constant(tolua_S,"dtStarvation",dtStarvation); - tolua_constant(tolua_S,"dtHunger",dtHunger); - tolua_constant(tolua_S,"dtCactus",dtCactus); - tolua_constant(tolua_S,"dtCactuses",dtCactuses); - tolua_constant(tolua_S,"dtCacti",dtCacti); - tolua_constant(tolua_S,"dtLava",dtLava); - tolua_constant(tolua_S,"dtPoison",dtPoison); - tolua_constant(tolua_S,"dtBurning",dtBurning); - tolua_constant(tolua_S,"dtInFire",dtInFire); - tolua_constant(tolua_S,"dtPlugin",dtPlugin); - tolua_constant(tolua_S,"esOther",esOther); - tolua_constant(tolua_S,"esPrimedTNT",esPrimedTNT); - tolua_constant(tolua_S,"esCreeper",esCreeper); - tolua_constant(tolua_S,"esBed",esBed); - tolua_constant(tolua_S,"esEnderCrystal",esEnderCrystal); - tolua_constant(tolua_S,"esGhastFireball",esGhastFireball); - tolua_constant(tolua_S,"esWitherSkullBlack",esWitherSkullBlack); - tolua_constant(tolua_S,"esWitherSkullBlue",esWitherSkullBlue); - tolua_constant(tolua_S,"esWitherBirth",esWitherBirth); - tolua_constant(tolua_S,"esPlugin",esPlugin); - tolua_function(tolua_S,"BlockStringToType",tolua_AllToLua_BlockStringToType00); - tolua_function(tolua_S,"StringToItem",tolua_AllToLua_StringToItem00); - tolua_function(tolua_S,"ItemToString",tolua_AllToLua_ItemToString00); - tolua_function(tolua_S,"ItemTypeToString",tolua_AllToLua_ItemTypeToString00); - tolua_function(tolua_S,"ItemToFullString",tolua_AllToLua_ItemToFullString00); - tolua_function(tolua_S,"StringToBiome",tolua_AllToLua_StringToBiome00); - tolua_function(tolua_S,"StringToMobType",tolua_AllToLua_StringToMobType00); - tolua_function(tolua_S,"StringToDimension",tolua_AllToLua_StringToDimension00); - tolua_function(tolua_S,"DamageTypeToString",tolua_AllToLua_DamageTypeToString00); - tolua_function(tolua_S,"StringToDamageType",tolua_AllToLua_StringToDamageType00); - tolua_function(tolua_S,"GetIniItemSet",tolua_AllToLua_GetIniItemSet00); - tolua_function(tolua_S,"TrimString",tolua_AllToLua_TrimString00); - tolua_function(tolua_S,"NoCaseCompare",tolua_AllToLua_NoCaseCompare00); - tolua_function(tolua_S,"ReplaceString",tolua_AllToLua_ReplaceString00); - tolua_function(tolua_S,"EscapeString",tolua_AllToLua_EscapeString00); - tolua_function(tolua_S,"StripColorCodes",tolua_AllToLua_StripColorCodes00); - tolua_array(tolua_S,"g_BlockLightValue",tolua_get_AllToLua_g_BlockLightValue,tolua_set_AllToLua_g_BlockLightValue); - tolua_array(tolua_S,"g_BlockSpreadLightFalloff",tolua_get_AllToLua_g_BlockSpreadLightFalloff,tolua_set_AllToLua_g_BlockSpreadLightFalloff); - tolua_array(tolua_S,"g_BlockTransparent",tolua_get_AllToLua_g_BlockTransparent,tolua_set_AllToLua_g_BlockTransparent); - tolua_array(tolua_S,"g_BlockOneHitDig",tolua_get_AllToLua_g_BlockOneHitDig,tolua_set_AllToLua_g_BlockOneHitDig); - tolua_array(tolua_S,"g_BlockPistonBreakable",tolua_get_AllToLua_g_BlockPistonBreakable,tolua_set_AllToLua_g_BlockPistonBreakable); - tolua_array(tolua_S,"g_BlockIsSnowable",tolua_get_AllToLua_g_BlockIsSnowable,tolua_set_AllToLua_g_BlockIsSnowable); - tolua_array(tolua_S,"g_BlockRequiresSpecialTool",tolua_get_AllToLua_g_BlockRequiresSpecialTool,tolua_set_AllToLua_g_BlockRequiresSpecialTool); - tolua_array(tolua_S,"g_BlockIsSolid",tolua_get_AllToLua_g_BlockIsSolid,tolua_set_AllToLua_g_BlockIsSolid); - tolua_array(tolua_S,"g_BlockIsTorchPlaceable",tolua_get_AllToLua_g_BlockIsTorchPlaceable,tolua_set_AllToLua_g_BlockIsTorchPlaceable); - tolua_constant(tolua_S,"MAX_EXPERIENCE_ORB_SIZE",MAX_EXPERIENCE_ORB_SIZE); - tolua_constant(tolua_S,"BLOCK_FACE_NONE",BLOCK_FACE_NONE); - tolua_constant(tolua_S,"BLOCK_FACE_XM",BLOCK_FACE_XM); - tolua_constant(tolua_S,"BLOCK_FACE_XP",BLOCK_FACE_XP); - tolua_constant(tolua_S,"BLOCK_FACE_YM",BLOCK_FACE_YM); - tolua_constant(tolua_S,"BLOCK_FACE_YP",BLOCK_FACE_YP); - tolua_constant(tolua_S,"BLOCK_FACE_ZM",BLOCK_FACE_ZM); - tolua_constant(tolua_S,"BLOCK_FACE_ZP",BLOCK_FACE_ZP); - tolua_constant(tolua_S,"BLOCK_FACE_BOTTOM",BLOCK_FACE_BOTTOM); - tolua_constant(tolua_S,"BLOCK_FACE_TOP",BLOCK_FACE_TOP); - tolua_constant(tolua_S,"BLOCK_FACE_NORTH",BLOCK_FACE_NORTH); - tolua_constant(tolua_S,"BLOCK_FACE_SOUTH",BLOCK_FACE_SOUTH); - tolua_constant(tolua_S,"BLOCK_FACE_WEST",BLOCK_FACE_WEST); - tolua_constant(tolua_S,"BLOCK_FACE_EAST",BLOCK_FACE_EAST); - tolua_constant(tolua_S,"DIG_STATUS_STARTED",DIG_STATUS_STARTED); - tolua_constant(tolua_S,"DIG_STATUS_CANCELLED",DIG_STATUS_CANCELLED); - tolua_constant(tolua_S,"DIG_STATUS_FINISHED",DIG_STATUS_FINISHED); - tolua_constant(tolua_S,"DIG_STATUS_DROP_HELD",DIG_STATUS_DROP_HELD); - tolua_constant(tolua_S,"DIG_STATUS_SHOOT_EAT",DIG_STATUS_SHOOT_EAT); - tolua_constant(tolua_S,"caLeftClick",caLeftClick); - tolua_constant(tolua_S,"caRightClick",caRightClick); - tolua_constant(tolua_S,"caShiftLeftClick",caShiftLeftClick); - tolua_constant(tolua_S,"caShiftRightClick",caShiftRightClick); - tolua_constant(tolua_S,"caNumber1",caNumber1); - tolua_constant(tolua_S,"caNumber2",caNumber2); - tolua_constant(tolua_S,"caNumber3",caNumber3); - tolua_constant(tolua_S,"caNumber4",caNumber4); - tolua_constant(tolua_S,"caNumber5",caNumber5); - tolua_constant(tolua_S,"caNumber6",caNumber6); - tolua_constant(tolua_S,"caNumber7",caNumber7); - tolua_constant(tolua_S,"caNumber8",caNumber8); - tolua_constant(tolua_S,"caNumber9",caNumber9); - tolua_constant(tolua_S,"caMiddleClick",caMiddleClick); - tolua_constant(tolua_S,"caDropKey",caDropKey); - tolua_constant(tolua_S,"caCtrlDropKey",caCtrlDropKey); - tolua_constant(tolua_S,"caLeftClickOutside",caLeftClickOutside); - tolua_constant(tolua_S,"caRightClickOutside",caRightClickOutside); - tolua_constant(tolua_S,"caLeftClickOutsideHoldNothing",caLeftClickOutsideHoldNothing); - tolua_constant(tolua_S,"caRightClickOutsideHoldNothing",caRightClickOutsideHoldNothing); - tolua_constant(tolua_S,"caLeftPaintBegin",caLeftPaintBegin); - tolua_constant(tolua_S,"caRightPaintBegin",caRightPaintBegin); - tolua_constant(tolua_S,"caLeftPaintProgress",caLeftPaintProgress); - tolua_constant(tolua_S,"caRightPaintProgress",caRightPaintProgress); - tolua_constant(tolua_S,"caLeftPaintEnd",caLeftPaintEnd); - tolua_constant(tolua_S,"caRightPaintEnd",caRightPaintEnd); - tolua_constant(tolua_S,"caDblClick",caDblClick); - tolua_constant(tolua_S,"caUnknown",caUnknown); - tolua_constant(tolua_S,"eGameMode_NotSet",eGameMode_NotSet); - tolua_constant(tolua_S,"eGameMode_Survival",eGameMode_Survival); - tolua_constant(tolua_S,"eGameMode_Creative",eGameMode_Creative); - tolua_constant(tolua_S,"eGameMode_Adventure",eGameMode_Adventure); - tolua_constant(tolua_S,"gmNotSet",gmNotSet); - tolua_constant(tolua_S,"gmSurvival",gmSurvival); - tolua_constant(tolua_S,"gmCreative",gmCreative); - tolua_constant(tolua_S,"gmAdventure",gmAdventure); - tolua_constant(tolua_S,"gmMax",gmMax); - tolua_constant(tolua_S,"gmMin",gmMin); - tolua_constant(tolua_S,"eWeather_Sunny",eWeather_Sunny); - tolua_constant(tolua_S,"eWeather_Rain",eWeather_Rain); - tolua_constant(tolua_S,"eWeather_ThunderStorm",eWeather_ThunderStorm); - tolua_constant(tolua_S,"wSunny",wSunny); - tolua_constant(tolua_S,"wRain",wRain); - tolua_constant(tolua_S,"wThunderstorm",wThunderstorm); - tolua_constant(tolua_S,"wStorm",wStorm); - tolua_function(tolua_S,"ClickActionToString",tolua_AllToLua_ClickActionToString00); - tolua_function(tolua_S,"IsValidBlock",tolua_AllToLua_IsValidBlock00); - tolua_function(tolua_S,"IsValidItem",tolua_AllToLua_IsValidItem00); - tolua_function(tolua_S,"AddFaceDirection",tolua_AllToLua_AddFaceDirection00); - tolua_module(tolua_S,"ItemCategory",0); - tolua_beginmodule(tolua_S,"ItemCategory"); - tolua_function(tolua_S,"IsPickaxe",tolua_AllToLua_ItemCategory_IsPickaxe00); - tolua_function(tolua_S,"IsAxe",tolua_AllToLua_ItemCategory_IsAxe00); - tolua_function(tolua_S,"IsSword",tolua_AllToLua_ItemCategory_IsSword00); - tolua_function(tolua_S,"IsHoe",tolua_AllToLua_ItemCategory_IsHoe00); - tolua_function(tolua_S,"IsShovel",tolua_AllToLua_ItemCategory_IsShovel00); - tolua_function(tolua_S,"IsTool",tolua_AllToLua_ItemCategory_IsTool00); - tolua_function(tolua_S,"IsHelmet",tolua_AllToLua_ItemCategory_IsHelmet00); - tolua_function(tolua_S,"IsChestPlate",tolua_AllToLua_ItemCategory_IsChestPlate00); - tolua_function(tolua_S,"IsLeggings",tolua_AllToLua_ItemCategory_IsLeggings00); - tolua_function(tolua_S,"IsBoots",tolua_AllToLua_ItemCategory_IsBoots00); - tolua_function(tolua_S,"IsArmor",tolua_AllToLua_ItemCategory_IsArmor00); - tolua_endmodule(tolua_S); - tolua_function(tolua_S,"GetTime",tolua_AllToLua_GetTime00); - tolua_function(tolua_S,"GetChar",tolua_AllToLua_GetChar00); - tolua_cclass(tolua_S,"cChatColor","cChatColor","",NULL); - tolua_beginmodule(tolua_S,"cChatColor"); - tolua_variable(tolua_S,"Color",tolua_get_cChatColor_Color,NULL); - tolua_variable(tolua_S,"Delimiter",tolua_get_cChatColor_Delimiter,NULL); - tolua_variable(tolua_S,"Black",tolua_get_cChatColor_Black,NULL); - tolua_variable(tolua_S,"Navy",tolua_get_cChatColor_Navy,NULL); - tolua_variable(tolua_S,"Green",tolua_get_cChatColor_Green,NULL); - tolua_variable(tolua_S,"Blue",tolua_get_cChatColor_Blue,NULL); - tolua_variable(tolua_S,"Red",tolua_get_cChatColor_Red,NULL); - tolua_variable(tolua_S,"Purple",tolua_get_cChatColor_Purple,NULL); - tolua_variable(tolua_S,"Gold",tolua_get_cChatColor_Gold,NULL); - tolua_variable(tolua_S,"LightGray",tolua_get_cChatColor_LightGray,NULL); - tolua_variable(tolua_S,"Gray",tolua_get_cChatColor_Gray,NULL); - tolua_variable(tolua_S,"DarkPurple",tolua_get_cChatColor_DarkPurple,NULL); - tolua_variable(tolua_S,"LightGreen",tolua_get_cChatColor_LightGreen,NULL); - tolua_variable(tolua_S,"LightBlue",tolua_get_cChatColor_LightBlue,NULL); - tolua_variable(tolua_S,"Rose",tolua_get_cChatColor_Rose,NULL); - tolua_variable(tolua_S,"LightPurple",tolua_get_cChatColor_LightPurple,NULL); - tolua_variable(tolua_S,"Yellow",tolua_get_cChatColor_Yellow,NULL); - tolua_variable(tolua_S,"White",tolua_get_cChatColor_White,NULL); - tolua_variable(tolua_S,"Random",tolua_get_cChatColor_Random,NULL); - tolua_variable(tolua_S,"Bold",tolua_get_cChatColor_Bold,NULL); - tolua_variable(tolua_S,"Strikethrough",tolua_get_cChatColor_Strikethrough,NULL); - tolua_variable(tolua_S,"Underlined",tolua_get_cChatColor_Underlined,NULL); - tolua_variable(tolua_S,"Italic",tolua_get_cChatColor_Italic,NULL); - tolua_variable(tolua_S,"Plain",tolua_get_cChatColor_Plain,NULL); - tolua_function(tolua_S,"MakeColor",tolua_AllToLua_cChatColor_MakeColor00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cClientHandle","cClientHandle","",NULL); - tolua_beginmodule(tolua_S,"cClientHandle"); - tolua_function(tolua_S,"GetPlayer",tolua_AllToLua_cClientHandle_GetPlayer00); - tolua_function(tolua_S,"Kick",tolua_AllToLua_cClientHandle_Kick00); - tolua_function(tolua_S,"SendBlockChange",tolua_AllToLua_cClientHandle_SendBlockChange00); - tolua_function(tolua_S,"GetUsername",tolua_AllToLua_cClientHandle_GetUsername00); - tolua_function(tolua_S,"SetUsername",tolua_AllToLua_cClientHandle_SetUsername00); - tolua_function(tolua_S,"GetPing",tolua_AllToLua_cClientHandle_GetPing00); - tolua_function(tolua_S,"SetViewDistance",tolua_AllToLua_cClientHandle_SetViewDistance00); - tolua_function(tolua_S,"GetViewDistance",tolua_AllToLua_cClientHandle_GetViewDistance00); - tolua_function(tolua_S,"GetUniqueID",tolua_AllToLua_cClientHandle_GetUniqueID00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"TakeDamageInfo","TakeDamageInfo","",NULL); - tolua_beginmodule(tolua_S,"TakeDamageInfo"); - tolua_variable(tolua_S,"DamageType",tolua_get_TakeDamageInfo_DamageType,tolua_set_TakeDamageInfo_DamageType); - tolua_variable(tolua_S,"Attacker",tolua_get_TakeDamageInfo_Attacker_ptr,tolua_set_TakeDamageInfo_Attacker_ptr); - tolua_variable(tolua_S,"RawDamage",tolua_get_TakeDamageInfo_RawDamage,tolua_set_TakeDamageInfo_RawDamage); - tolua_variable(tolua_S,"FinalDamage",tolua_get_TakeDamageInfo_FinalDamage,tolua_set_TakeDamageInfo_FinalDamage); - tolua_variable(tolua_S,"Knockback",tolua_get_TakeDamageInfo_Knockback,tolua_set_TakeDamageInfo_Knockback); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cEntity","cEntity","",NULL); - tolua_beginmodule(tolua_S,"cEntity"); - tolua_constant(tolua_S,"etEntity",cEntity::etEntity); - tolua_constant(tolua_S,"etPlayer",cEntity::etPlayer); - tolua_constant(tolua_S,"etPickup",cEntity::etPickup); - tolua_constant(tolua_S,"etMonster",cEntity::etMonster); - tolua_constant(tolua_S,"etFallingBlock",cEntity::etFallingBlock); - tolua_constant(tolua_S,"etMinecart",cEntity::etMinecart); - tolua_constant(tolua_S,"etBoat",cEntity::etBoat); - tolua_constant(tolua_S,"etTNT",cEntity::etTNT); - tolua_constant(tolua_S,"etProjectile",cEntity::etProjectile); - tolua_constant(tolua_S,"etExpOrb",cEntity::etExpOrb); - tolua_constant(tolua_S,"etMob",cEntity::etMob); - tolua_function(tolua_S,"GetEntityType",tolua_AllToLua_cEntity_GetEntityType00); - tolua_function(tolua_S,"IsPlayer",tolua_AllToLua_cEntity_IsPlayer00); - tolua_function(tolua_S,"IsPickup",tolua_AllToLua_cEntity_IsPickup00); - tolua_function(tolua_S,"IsMob",tolua_AllToLua_cEntity_IsMob00); - tolua_function(tolua_S,"IsFallingBlock",tolua_AllToLua_cEntity_IsFallingBlock00); - tolua_function(tolua_S,"IsMinecart",tolua_AllToLua_cEntity_IsMinecart00); - tolua_function(tolua_S,"IsBoat",tolua_AllToLua_cEntity_IsBoat00); - tolua_function(tolua_S,"IsTNT",tolua_AllToLua_cEntity_IsTNT00); - tolua_function(tolua_S,"IsProjectile",tolua_AllToLua_cEntity_IsProjectile00); - tolua_function(tolua_S,"IsA",tolua_AllToLua_cEntity_IsA00); - tolua_function(tolua_S,"GetClass",tolua_AllToLua_cEntity_GetClass00); - tolua_function(tolua_S,"GetClassStatic",tolua_AllToLua_cEntity_GetClassStatic00); - tolua_function(tolua_S,"GetParentClass",tolua_AllToLua_cEntity_GetParentClass00); - tolua_function(tolua_S,"GetWorld",tolua_AllToLua_cEntity_GetWorld00); - tolua_function(tolua_S,"GetHeadYaw",tolua_AllToLua_cEntity_GetHeadYaw00); - tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cEntity_GetHeight00); - tolua_function(tolua_S,"GetMass",tolua_AllToLua_cEntity_GetMass00); - tolua_function(tolua_S,"GetPosition",tolua_AllToLua_cEntity_GetPosition00); - tolua_function(tolua_S,"GetPosX",tolua_AllToLua_cEntity_GetPosX00); - tolua_function(tolua_S,"GetPosY",tolua_AllToLua_cEntity_GetPosY00); - tolua_function(tolua_S,"GetPosZ",tolua_AllToLua_cEntity_GetPosZ00); - tolua_function(tolua_S,"GetRot",tolua_AllToLua_cEntity_GetRot00); - tolua_function(tolua_S,"GetRotation",tolua_AllToLua_cEntity_GetRotation00); - tolua_function(tolua_S,"GetYaw",tolua_AllToLua_cEntity_GetYaw00); - tolua_function(tolua_S,"GetPitch",tolua_AllToLua_cEntity_GetPitch00); - tolua_function(tolua_S,"GetRoll",tolua_AllToLua_cEntity_GetRoll00); - tolua_function(tolua_S,"GetLookVector",tolua_AllToLua_cEntity_GetLookVector00); - tolua_function(tolua_S,"GetSpeed",tolua_AllToLua_cEntity_GetSpeed00); - tolua_function(tolua_S,"GetSpeedX",tolua_AllToLua_cEntity_GetSpeedX00); - tolua_function(tolua_S,"GetSpeedY",tolua_AllToLua_cEntity_GetSpeedY00); - tolua_function(tolua_S,"GetSpeedZ",tolua_AllToLua_cEntity_GetSpeedZ00); - tolua_function(tolua_S,"GetWidth",tolua_AllToLua_cEntity_GetWidth00); - tolua_function(tolua_S,"GetChunkX",tolua_AllToLua_cEntity_GetChunkX00); - tolua_function(tolua_S,"GetChunkZ",tolua_AllToLua_cEntity_GetChunkZ00); - tolua_function(tolua_S,"SetHeadYaw",tolua_AllToLua_cEntity_SetHeadYaw00); - tolua_function(tolua_S,"SetHeight",tolua_AllToLua_cEntity_SetHeight00); - tolua_function(tolua_S,"SetMass",tolua_AllToLua_cEntity_SetMass00); - tolua_function(tolua_S,"SetPosX",tolua_AllToLua_cEntity_SetPosX00); - tolua_function(tolua_S,"SetPosY",tolua_AllToLua_cEntity_SetPosY00); - tolua_function(tolua_S,"SetPosZ",tolua_AllToLua_cEntity_SetPosZ00); - tolua_function(tolua_S,"SetPosition",tolua_AllToLua_cEntity_SetPosition00); - tolua_function(tolua_S,"SetPosition",tolua_AllToLua_cEntity_SetPosition01); - tolua_function(tolua_S,"SetRot",tolua_AllToLua_cEntity_SetRot00); - tolua_function(tolua_S,"SetRotation",tolua_AllToLua_cEntity_SetRotation00); - tolua_function(tolua_S,"SetYaw",tolua_AllToLua_cEntity_SetYaw00); - tolua_function(tolua_S,"SetPitch",tolua_AllToLua_cEntity_SetPitch00); - tolua_function(tolua_S,"SetRoll",tolua_AllToLua_cEntity_SetRoll00); - tolua_function(tolua_S,"SetSpeed",tolua_AllToLua_cEntity_SetSpeed00); - tolua_function(tolua_S,"SetSpeed",tolua_AllToLua_cEntity_SetSpeed01); - tolua_function(tolua_S,"SetSpeedX",tolua_AllToLua_cEntity_SetSpeedX00); - tolua_function(tolua_S,"SetSpeedY",tolua_AllToLua_cEntity_SetSpeedY00); - tolua_function(tolua_S,"SetSpeedZ",tolua_AllToLua_cEntity_SetSpeedZ00); - tolua_function(tolua_S,"SetWidth",tolua_AllToLua_cEntity_SetWidth00); - tolua_function(tolua_S,"AddPosX",tolua_AllToLua_cEntity_AddPosX00); - tolua_function(tolua_S,"AddPosY",tolua_AllToLua_cEntity_AddPosY00); - tolua_function(tolua_S,"AddPosZ",tolua_AllToLua_cEntity_AddPosZ00); - tolua_function(tolua_S,"AddPosition",tolua_AllToLua_cEntity_AddPosition00); - tolua_function(tolua_S,"AddPosition",tolua_AllToLua_cEntity_AddPosition01); - tolua_function(tolua_S,"AddSpeed",tolua_AllToLua_cEntity_AddSpeed00); - tolua_function(tolua_S,"AddSpeed",tolua_AllToLua_cEntity_AddSpeed01); - tolua_function(tolua_S,"AddSpeedX",tolua_AllToLua_cEntity_AddSpeedX00); - tolua_function(tolua_S,"AddSpeedY",tolua_AllToLua_cEntity_AddSpeedY00); - tolua_function(tolua_S,"AddSpeedZ",tolua_AllToLua_cEntity_AddSpeedZ00); - tolua_function(tolua_S,"SteerVehicle",tolua_AllToLua_cEntity_SteerVehicle00); - tolua_function(tolua_S,"GetUniqueID",tolua_AllToLua_cEntity_GetUniqueID00); - tolua_function(tolua_S,"IsDestroyed",tolua_AllToLua_cEntity_IsDestroyed00); - tolua_function(tolua_S,"Destroy",tolua_AllToLua_cEntity_Destroy00); - tolua_function(tolua_S,"TakeDamage",tolua_AllToLua_cEntity_TakeDamage00); - tolua_function(tolua_S,"TakeDamage",tolua_AllToLua_cEntity_TakeDamage01); - tolua_function(tolua_S,"TakeDamage",tolua_AllToLua_cEntity_TakeDamage02); - tolua_function(tolua_S,"GetGravity",tolua_AllToLua_cEntity_GetGravity00); - tolua_function(tolua_S,"SetGravity",tolua_AllToLua_cEntity_SetGravity00); - tolua_function(tolua_S,"SetRotationFromSpeed",tolua_AllToLua_cEntity_SetRotationFromSpeed00); - tolua_function(tolua_S,"SetPitchFromSpeed",tolua_AllToLua_cEntity_SetPitchFromSpeed00); - tolua_function(tolua_S,"GetRawDamageAgainst",tolua_AllToLua_cEntity_GetRawDamageAgainst00); - tolua_function(tolua_S,"GetArmorCoverAgainst",tolua_AllToLua_cEntity_GetArmorCoverAgainst00); - tolua_function(tolua_S,"GetKnockbackAmountAgainst",tolua_AllToLua_cEntity_GetKnockbackAmountAgainst00); - tolua_function(tolua_S,"GetEquippedWeapon",tolua_AllToLua_cEntity_GetEquippedWeapon00); - tolua_function(tolua_S,"GetEquippedHelmet",tolua_AllToLua_cEntity_GetEquippedHelmet00); - tolua_function(tolua_S,"GetEquippedChestplate",tolua_AllToLua_cEntity_GetEquippedChestplate00); - tolua_function(tolua_S,"GetEquippedLeggings",tolua_AllToLua_cEntity_GetEquippedLeggings00); - tolua_function(tolua_S,"GetEquippedBoots",tolua_AllToLua_cEntity_GetEquippedBoots00); - tolua_function(tolua_S,"KilledBy",tolua_AllToLua_cEntity_KilledBy00); - tolua_function(tolua_S,"Heal",tolua_AllToLua_cEntity_Heal00); - tolua_function(tolua_S,"GetHealth",tolua_AllToLua_cEntity_GetHealth00); - tolua_function(tolua_S,"SetHealth",tolua_AllToLua_cEntity_SetHealth00); - tolua_function(tolua_S,"SetMaxHealth",tolua_AllToLua_cEntity_SetMaxHealth00); - tolua_function(tolua_S,"GetMaxHealth",tolua_AllToLua_cEntity_GetMaxHealth00); - tolua_function(tolua_S,"StartBurning",tolua_AllToLua_cEntity_StartBurning00); - tolua_function(tolua_S,"StopBurning",tolua_AllToLua_cEntity_StopBurning00); - tolua_function(tolua_S,"TeleportToEntity",tolua_AllToLua_cEntity_TeleportToEntity00); - tolua_function(tolua_S,"TeleportToCoords",tolua_AllToLua_cEntity_TeleportToCoords00); - tolua_function(tolua_S,"IsOnFire",tolua_AllToLua_cEntity_IsOnFire00); - tolua_function(tolua_S,"IsCrouched",tolua_AllToLua_cEntity_IsCrouched00); - tolua_function(tolua_S,"IsRiding",tolua_AllToLua_cEntity_IsRiding00); - tolua_function(tolua_S,"IsSprinting",tolua_AllToLua_cEntity_IsSprinting00); - tolua_function(tolua_S,"IsRclking",tolua_AllToLua_cEntity_IsRclking00); - tolua_function(tolua_S,"IsInvisible",tolua_AllToLua_cEntity_IsInvisible00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cPawn","cPawn","cEntity",NULL); - tolua_beginmodule(tolua_S,"cPawn"); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cPlayer","cPlayer","cPawn",NULL); - tolua_beginmodule(tolua_S,"cPlayer"); - tolua_constant(tolua_S,"MAX_HEALTH",cPlayer::MAX_HEALTH); - tolua_constant(tolua_S,"MAX_FOOD_LEVEL",cPlayer::MAX_FOOD_LEVEL); - tolua_constant(tolua_S,"EATING_TICKS",cPlayer::EATING_TICKS); - tolua_constant(tolua_S,"MAX_AIR_LEVEL",cPlayer::MAX_AIR_LEVEL); - tolua_constant(tolua_S,"DROWNING_TICKS",cPlayer::DROWNING_TICKS); - tolua_function(tolua_S,"SetCurrentExperience",tolua_AllToLua_cPlayer_SetCurrentExperience00); - tolua_function(tolua_S,"DeltaExperience",tolua_AllToLua_cPlayer_DeltaExperience00); - tolua_function(tolua_S,"GetXpLifetimeTotal",tolua_AllToLua_cPlayer_GetXpLifetimeTotal00); - tolua_function(tolua_S,"GetCurrentXp",tolua_AllToLua_cPlayer_GetCurrentXp00); - tolua_function(tolua_S,"GetXpLevel",tolua_AllToLua_cPlayer_GetXpLevel00); - tolua_function(tolua_S,"GetXpPercentage",tolua_AllToLua_cPlayer_GetXpPercentage00); - tolua_function(tolua_S,"XpForLevel",tolua_AllToLua_cPlayer_XpForLevel00); - tolua_function(tolua_S,"CalcLevelFromXp",tolua_AllToLua_cPlayer_CalcLevelFromXp00); - tolua_function(tolua_S,"GetEyeHeight",tolua_AllToLua_cPlayer_GetEyeHeight00); - tolua_function(tolua_S,"GetEyePosition",tolua_AllToLua_cPlayer_GetEyePosition00); - tolua_function(tolua_S,"IsOnGround",tolua_AllToLua_cPlayer_IsOnGround00); - tolua_function(tolua_S,"GetStance",tolua_AllToLua_cPlayer_GetStance00); - tolua_function(tolua_S,"GetInventory",tolua_AllToLua_cPlayer_GetInventory00); - tolua_function(tolua_S,"GetEquippedItem",tolua_AllToLua_cPlayer_GetEquippedItem00); - tolua_function(tolua_S,"GetThrowStartPos",tolua_AllToLua_cPlayer_GetThrowStartPos00); - tolua_function(tolua_S,"GetThrowSpeed",tolua_AllToLua_cPlayer_GetThrowSpeed00); - tolua_function(tolua_S,"GetGameMode",tolua_AllToLua_cPlayer_GetGameMode00); - tolua_function(tolua_S,"GetEffectiveGameMode",tolua_AllToLua_cPlayer_GetEffectiveGameMode00); - tolua_function(tolua_S,"SetGameMode",tolua_AllToLua_cPlayer_SetGameMode00); - tolua_function(tolua_S,"IsGameModeCreative",tolua_AllToLua_cPlayer_IsGameModeCreative00); - tolua_function(tolua_S,"IsGameModeSurvival",tolua_AllToLua_cPlayer_IsGameModeSurvival00); - tolua_function(tolua_S,"IsGameModeAdventure",tolua_AllToLua_cPlayer_IsGameModeAdventure00); - tolua_function(tolua_S,"GetIP",tolua_AllToLua_cPlayer_GetIP00); - tolua_function(tolua_S,"MoveTo",tolua_AllToLua_cPlayer_MoveTo00); - tolua_function(tolua_S,"GetWindow",tolua_AllToLua_cPlayer_GetWindow00); - tolua_function(tolua_S,"CloseWindow",tolua_AllToLua_cPlayer_CloseWindow00); - tolua_function(tolua_S,"CloseWindowIfID",tolua_AllToLua_cPlayer_CloseWindowIfID00); - tolua_function(tolua_S,"GetClientHandle",tolua_AllToLua_cPlayer_GetClientHandle00); - tolua_function(tolua_S,"SendMessage",tolua_AllToLua_cPlayer_SendMessage00); - tolua_function(tolua_S,"GetName",tolua_AllToLua_cPlayer_GetName00); - tolua_function(tolua_S,"SetName",tolua_AllToLua_cPlayer_SetName00); - tolua_function(tolua_S,"AddToGroup",tolua_AllToLua_cPlayer_AddToGroup00); - tolua_function(tolua_S,"RemoveFromGroup",tolua_AllToLua_cPlayer_RemoveFromGroup00); - tolua_function(tolua_S,"CanUseCommand",tolua_AllToLua_cPlayer_CanUseCommand00); - tolua_function(tolua_S,"HasPermission",tolua_AllToLua_cPlayer_HasPermission00); - tolua_function(tolua_S,"IsInGroup",tolua_AllToLua_cPlayer_IsInGroup00); - tolua_function(tolua_S,"GetColor",tolua_AllToLua_cPlayer_GetColor00); - tolua_function(tolua_S,"TossItem",tolua_AllToLua_cPlayer_TossItem00); - tolua_function(tolua_S,"Heal",tolua_AllToLua_cPlayer_Heal00); - tolua_function(tolua_S,"GetFoodLevel",tolua_AllToLua_cPlayer_GetFoodLevel00); - tolua_function(tolua_S,"GetFoodSaturationLevel",tolua_AllToLua_cPlayer_GetFoodSaturationLevel00); - tolua_function(tolua_S,"GetFoodTickTimer",tolua_AllToLua_cPlayer_GetFoodTickTimer00); - tolua_function(tolua_S,"GetFoodExhaustionLevel",tolua_AllToLua_cPlayer_GetFoodExhaustionLevel00); - tolua_function(tolua_S,"GetFoodPoisonedTicksRemaining",tolua_AllToLua_cPlayer_GetFoodPoisonedTicksRemaining00); - tolua_function(tolua_S,"GetAirLevel",tolua_AllToLua_cPlayer_GetAirLevel00); - tolua_function(tolua_S,"IsSatiated",tolua_AllToLua_cPlayer_IsSatiated00); - tolua_function(tolua_S,"SetFoodLevel",tolua_AllToLua_cPlayer_SetFoodLevel00); - tolua_function(tolua_S,"SetFoodSaturationLevel",tolua_AllToLua_cPlayer_SetFoodSaturationLevel00); - tolua_function(tolua_S,"SetFoodTickTimer",tolua_AllToLua_cPlayer_SetFoodTickTimer00); - tolua_function(tolua_S,"SetFoodExhaustionLevel",tolua_AllToLua_cPlayer_SetFoodExhaustionLevel00); - tolua_function(tolua_S,"SetFoodPoisonedTicksRemaining",tolua_AllToLua_cPlayer_SetFoodPoisonedTicksRemaining00); - tolua_function(tolua_S,"Feed",tolua_AllToLua_cPlayer_Feed00); - tolua_function(tolua_S,"AddFoodExhaustion",tolua_AllToLua_cPlayer_AddFoodExhaustion00); - tolua_function(tolua_S,"FoodPoison",tolua_AllToLua_cPlayer_FoodPoison00); - tolua_function(tolua_S,"IsEating",tolua_AllToLua_cPlayer_IsEating00); - tolua_function(tolua_S,"Respawn",tolua_AllToLua_cPlayer_Respawn00); - tolua_function(tolua_S,"SetVisible",tolua_AllToLua_cPlayer_SetVisible00); - tolua_function(tolua_S,"IsVisible",tolua_AllToLua_cPlayer_IsVisible00); - tolua_function(tolua_S,"MoveToWorld",tolua_AllToLua_cPlayer_MoveToWorld00); - tolua_function(tolua_S,"LoadPermissionsFromDisk",tolua_AllToLua_cPlayer_LoadPermissionsFromDisk00); - tolua_function(tolua_S,"GetMaxSpeed",tolua_AllToLua_cPlayer_GetMaxSpeed00); - tolua_function(tolua_S,"GetNormalMaxSpeed",tolua_AllToLua_cPlayer_GetNormalMaxSpeed00); - tolua_function(tolua_S,"GetSprintingMaxSpeed",tolua_AllToLua_cPlayer_GetSprintingMaxSpeed00); - tolua_function(tolua_S,"SetNormalMaxSpeed",tolua_AllToLua_cPlayer_SetNormalMaxSpeed00); - tolua_function(tolua_S,"SetSprintingMaxSpeed",tolua_AllToLua_cPlayer_SetSprintingMaxSpeed00); - tolua_function(tolua_S,"SetCrouch",tolua_AllToLua_cPlayer_SetCrouch00); - tolua_function(tolua_S,"SetSprint",tolua_AllToLua_cPlayer_SetSprint00); - tolua_function(tolua_S,"IsSwimming",tolua_AllToLua_cPlayer_IsSwimming00); - tolua_function(tolua_S,"IsSubmerged",tolua_AllToLua_cPlayer_IsSubmerged00); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"cPickup","cPickup","cEntity",tolua_collect_cPickup); - #else - tolua_cclass(tolua_S,"cPickup","cPickup","cEntity",NULL); - #endif - tolua_beginmodule(tolua_S,"cPickup"); - tolua_function(tolua_S,"new",tolua_AllToLua_cPickup_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cPickup_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cPickup_new00_local); - tolua_function(tolua_S,"GetItem",tolua_AllToLua_cPickup_GetItem00); - tolua_function(tolua_S,"CollectedBy",tolua_AllToLua_cPickup_CollectedBy00); - tolua_function(tolua_S,"GetAge",tolua_AllToLua_cPickup_GetAge00); - tolua_function(tolua_S,"IsCollected",tolua_AllToLua_cPickup_IsCollected00); - tolua_function(tolua_S,"IsPlayerCreated",tolua_AllToLua_cPickup_IsPlayerCreated00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cProjectileEntity","cProjectileEntity","cEntity",NULL); - tolua_beginmodule(tolua_S,"cProjectileEntity"); - tolua_constant(tolua_S,"pkArrow",cProjectileEntity::pkArrow); - tolua_constant(tolua_S,"pkSnowball",cProjectileEntity::pkSnowball); - tolua_constant(tolua_S,"pkEgg",cProjectileEntity::pkEgg); - tolua_constant(tolua_S,"pkGhastFireball",cProjectileEntity::pkGhastFireball); - tolua_constant(tolua_S,"pkFireCharge",cProjectileEntity::pkFireCharge); - tolua_constant(tolua_S,"pkEnderPearl",cProjectileEntity::pkEnderPearl); - tolua_constant(tolua_S,"pkExpBottle",cProjectileEntity::pkExpBottle); - tolua_constant(tolua_S,"pkSplashPotion",cProjectileEntity::pkSplashPotion); - tolua_constant(tolua_S,"pkFirework",cProjectileEntity::pkFirework); - tolua_constant(tolua_S,"pkWitherSkull",cProjectileEntity::pkWitherSkull); - tolua_constant(tolua_S,"pkFishingFloat",cProjectileEntity::pkFishingFloat); - tolua_function(tolua_S,"GetProjectileKind",tolua_AllToLua_cProjectileEntity_GetProjectileKind00); - tolua_function(tolua_S,"GetCreator",tolua_AllToLua_cProjectileEntity_GetCreator00); - tolua_function(tolua_S,"GetMCAClassName",tolua_AllToLua_cProjectileEntity_GetMCAClassName00); - tolua_function(tolua_S,"IsInGround",tolua_AllToLua_cProjectileEntity_IsInGround00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cArrowEntity","cArrowEntity","cProjectileEntity",NULL); - tolua_beginmodule(tolua_S,"cArrowEntity"); - tolua_constant(tolua_S,"psNoPickup",cArrowEntity::psNoPickup); - tolua_constant(tolua_S,"psInSurvivalOrCreative",cArrowEntity::psInSurvivalOrCreative); - tolua_constant(tolua_S,"psInCreative",cArrowEntity::psInCreative); - tolua_function(tolua_S,"GetPickupState",tolua_AllToLua_cArrowEntity_GetPickupState00); - tolua_function(tolua_S,"SetPickupState",tolua_AllToLua_cArrowEntity_SetPickupState00); - tolua_function(tolua_S,"GetDamageCoeff",tolua_AllToLua_cArrowEntity_GetDamageCoeff00); - tolua_function(tolua_S,"SetDamageCoeff",tolua_AllToLua_cArrowEntity_SetDamageCoeff00); - tolua_function(tolua_S,"CanPickup",tolua_AllToLua_cArrowEntity_CanPickup00); - tolua_function(tolua_S,"IsCritical",tolua_AllToLua_cArrowEntity_IsCritical00); - tolua_function(tolua_S,"SetIsCritical",tolua_AllToLua_cArrowEntity_SetIsCritical00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cThrownEggEntity","cThrownEggEntity","cProjectileEntity",NULL); - tolua_beginmodule(tolua_S,"cThrownEggEntity"); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cThrownEnderPearlEntity","cThrownEnderPearlEntity","cProjectileEntity",NULL); - tolua_beginmodule(tolua_S,"cThrownEnderPearlEntity"); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cThrownSnowballEntity","cThrownSnowballEntity","cProjectileEntity",NULL); - tolua_beginmodule(tolua_S,"cThrownSnowballEntity"); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cExpBottleEntity","cExpBottleEntity","cProjectileEntity",NULL); - tolua_beginmodule(tolua_S,"cExpBottleEntity"); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cFireworkEntity","cFireworkEntity","cProjectileEntity",NULL); - tolua_beginmodule(tolua_S,"cFireworkEntity"); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cGhastFireballEntity","cGhastFireballEntity","cProjectileEntity",NULL); - tolua_beginmodule(tolua_S,"cGhastFireballEntity"); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cFireChargeEntity","cFireChargeEntity","cProjectileEntity",NULL); - tolua_beginmodule(tolua_S,"cFireChargeEntity"); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cPluginManager","cPluginManager","",NULL); - tolua_beginmodule(tolua_S,"cPluginManager"); - tolua_constant(tolua_S,"HOOK_BLOCK_TO_PICKUPS",cPluginManager::HOOK_BLOCK_TO_PICKUPS); - tolua_constant(tolua_S,"HOOK_CHAT",cPluginManager::HOOK_CHAT); - tolua_constant(tolua_S,"HOOK_CHUNK_AVAILABLE",cPluginManager::HOOK_CHUNK_AVAILABLE); - tolua_constant(tolua_S,"HOOK_CHUNK_GENERATED",cPluginManager::HOOK_CHUNK_GENERATED); - tolua_constant(tolua_S,"HOOK_CHUNK_GENERATING",cPluginManager::HOOK_CHUNK_GENERATING); - tolua_constant(tolua_S,"HOOK_CHUNK_UNLOADED",cPluginManager::HOOK_CHUNK_UNLOADED); - tolua_constant(tolua_S,"HOOK_CHUNK_UNLOADING",cPluginManager::HOOK_CHUNK_UNLOADING); - tolua_constant(tolua_S,"HOOK_COLLECTING_PICKUP",cPluginManager::HOOK_COLLECTING_PICKUP); - tolua_constant(tolua_S,"HOOK_CRAFTING_NO_RECIPE",cPluginManager::HOOK_CRAFTING_NO_RECIPE); - tolua_constant(tolua_S,"HOOK_DISCONNECT",cPluginManager::HOOK_DISCONNECT); - tolua_constant(tolua_S,"HOOK_EXECUTE_COMMAND",cPluginManager::HOOK_EXECUTE_COMMAND); - tolua_constant(tolua_S,"HOOK_EXPLODED",cPluginManager::HOOK_EXPLODED); - tolua_constant(tolua_S,"HOOK_EXPLODING",cPluginManager::HOOK_EXPLODING); - tolua_constant(tolua_S,"HOOK_HANDSHAKE",cPluginManager::HOOK_HANDSHAKE); - tolua_constant(tolua_S,"HOOK_HOPPER_PULLING_ITEM",cPluginManager::HOOK_HOPPER_PULLING_ITEM); - tolua_constant(tolua_S,"HOOK_HOPPER_PUSHING_ITEM",cPluginManager::HOOK_HOPPER_PUSHING_ITEM); - tolua_constant(tolua_S,"HOOK_KILLING",cPluginManager::HOOK_KILLING); - tolua_constant(tolua_S,"HOOK_LOGIN",cPluginManager::HOOK_LOGIN); - tolua_constant(tolua_S,"HOOK_PLAYER_ANIMATION",cPluginManager::HOOK_PLAYER_ANIMATION); - tolua_constant(tolua_S,"HOOK_PLAYER_BREAKING_BLOCK",cPluginManager::HOOK_PLAYER_BREAKING_BLOCK); - tolua_constant(tolua_S,"HOOK_PLAYER_BROKEN_BLOCK",cPluginManager::HOOK_PLAYER_BROKEN_BLOCK); - tolua_constant(tolua_S,"HOOK_PLAYER_EATING",cPluginManager::HOOK_PLAYER_EATING); - tolua_constant(tolua_S,"HOOK_PLAYER_JOINED",cPluginManager::HOOK_PLAYER_JOINED); - tolua_constant(tolua_S,"HOOK_PLAYER_LEFT_CLICK",cPluginManager::HOOK_PLAYER_LEFT_CLICK); - tolua_constant(tolua_S,"HOOK_PLAYER_MOVING",cPluginManager::HOOK_PLAYER_MOVING); - tolua_constant(tolua_S,"HOOK_PLAYER_PLACED_BLOCK",cPluginManager::HOOK_PLAYER_PLACED_BLOCK); - tolua_constant(tolua_S,"HOOK_PLAYER_PLACING_BLOCK",cPluginManager::HOOK_PLAYER_PLACING_BLOCK); - tolua_constant(tolua_S,"HOOK_PLAYER_RIGHT_CLICK",cPluginManager::HOOK_PLAYER_RIGHT_CLICK); - tolua_constant(tolua_S,"HOOK_PLAYER_RIGHT_CLICKING_ENTITY",cPluginManager::HOOK_PLAYER_RIGHT_CLICKING_ENTITY); - tolua_constant(tolua_S,"HOOK_PLAYER_SHOOTING",cPluginManager::HOOK_PLAYER_SHOOTING); - tolua_constant(tolua_S,"HOOK_PLAYER_SPAWNED",cPluginManager::HOOK_PLAYER_SPAWNED); - tolua_constant(tolua_S,"HOOK_PLAYER_TOSSING_ITEM",cPluginManager::HOOK_PLAYER_TOSSING_ITEM); - tolua_constant(tolua_S,"HOOK_PLAYER_USED_BLOCK",cPluginManager::HOOK_PLAYER_USED_BLOCK); - tolua_constant(tolua_S,"HOOK_PLAYER_USED_ITEM",cPluginManager::HOOK_PLAYER_USED_ITEM); - tolua_constant(tolua_S,"HOOK_PLAYER_USING_BLOCK",cPluginManager::HOOK_PLAYER_USING_BLOCK); - tolua_constant(tolua_S,"HOOK_PLAYER_USING_ITEM",cPluginManager::HOOK_PLAYER_USING_ITEM); - tolua_constant(tolua_S,"HOOK_POST_CRAFTING",cPluginManager::HOOK_POST_CRAFTING); - tolua_constant(tolua_S,"HOOK_PRE_CRAFTING",cPluginManager::HOOK_PRE_CRAFTING); - tolua_constant(tolua_S,"HOOK_SPAWNED_ENTITY",cPluginManager::HOOK_SPAWNED_ENTITY); - tolua_constant(tolua_S,"HOOK_SPAWNED_MONSTER",cPluginManager::HOOK_SPAWNED_MONSTER); - tolua_constant(tolua_S,"HOOK_SPAWNING_ENTITY",cPluginManager::HOOK_SPAWNING_ENTITY); - tolua_constant(tolua_S,"HOOK_SPAWNING_MONSTER",cPluginManager::HOOK_SPAWNING_MONSTER); - tolua_constant(tolua_S,"HOOK_TAKE_DAMAGE",cPluginManager::HOOK_TAKE_DAMAGE); - tolua_constant(tolua_S,"HOOK_TICK",cPluginManager::HOOK_TICK); - tolua_constant(tolua_S,"HOOK_UPDATED_SIGN",cPluginManager::HOOK_UPDATED_SIGN); - tolua_constant(tolua_S,"HOOK_UPDATING_SIGN",cPluginManager::HOOK_UPDATING_SIGN); - tolua_constant(tolua_S,"HOOK_WEATHER_CHANGED",cPluginManager::HOOK_WEATHER_CHANGED); - tolua_constant(tolua_S,"HOOK_WEATHER_CHANGING",cPluginManager::HOOK_WEATHER_CHANGING); - tolua_constant(tolua_S,"HOOK_WORLD_TICK",cPluginManager::HOOK_WORLD_TICK); - tolua_constant(tolua_S,"HOOK_NUM_HOOKS",cPluginManager::HOOK_NUM_HOOKS); - tolua_constant(tolua_S,"HOOK_MAX",cPluginManager::HOOK_MAX); - tolua_function(tolua_S,"Get",tolua_AllToLua_cPluginManager_Get00); - tolua_function(tolua_S,"GetPlugin",tolua_AllToLua_cPluginManager_GetPlugin00); - tolua_function(tolua_S,"FindPlugins",tolua_AllToLua_cPluginManager_FindPlugins00); - tolua_function(tolua_S,"ReloadPlugins",tolua_AllToLua_cPluginManager_ReloadPlugins00); - tolua_function(tolua_S,"GetNumPlugins",tolua_AllToLua_cPluginManager_GetNumPlugins00); - tolua_function(tolua_S,"DisablePlugin",tolua_AllToLua_cPluginManager_DisablePlugin00); - tolua_function(tolua_S,"LoadPlugin",tolua_AllToLua_cPluginManager_LoadPlugin00); - tolua_function(tolua_S,"IsCommandBound",tolua_AllToLua_cPluginManager_IsCommandBound00); - tolua_function(tolua_S,"GetCommandPermission",tolua_AllToLua_cPluginManager_GetCommandPermission00); - tolua_function(tolua_S,"ExecuteCommand",tolua_AllToLua_cPluginManager_ExecuteCommand00); - tolua_function(tolua_S,"ForceExecuteCommand",tolua_AllToLua_cPluginManager_ForceExecuteCommand00); - tolua_function(tolua_S,"IsConsoleCommandBound",tolua_AllToLua_cPluginManager_IsConsoleCommandBound00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cPlugin","cPlugin","",NULL); - tolua_beginmodule(tolua_S,"cPlugin"); - tolua_function(tolua_S,"GetName",tolua_AllToLua_cPlugin_GetName00); - tolua_function(tolua_S,"SetName",tolua_AllToLua_cPlugin_SetName00); - tolua_function(tolua_S,"GetVersion",tolua_AllToLua_cPlugin_GetVersion00); - tolua_function(tolua_S,"SetVersion",tolua_AllToLua_cPlugin_SetVersion00); - tolua_function(tolua_S,"GetDirectory",tolua_AllToLua_cPlugin_GetDirectory00); - tolua_function(tolua_S,"GetLocalDirectory",tolua_AllToLua_cPlugin_GetLocalDirectory00); - tolua_function(tolua_S,"GetLocalFolder",tolua_AllToLua_cPlugin_GetLocalFolder00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cPluginLua","cPluginLua","cPlugin",NULL); - tolua_beginmodule(tolua_S,"cPluginLua"); - tolua_variable(tolua_S,"__cWebPlugin__",tolua_get_cPluginLua___cWebPlugin__,NULL); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cServer","cServer","",NULL); - tolua_beginmodule(tolua_S,"cServer"); - tolua_function(tolua_S,"GetDescription",tolua_AllToLua_cServer_GetDescription00); - tolua_function(tolua_S,"GetMaxPlayers",tolua_AllToLua_cServer_GetMaxPlayers00); - tolua_function(tolua_S,"GetNumPlayers",tolua_AllToLua_cServer_GetNumPlayers00); - tolua_function(tolua_S,"SetMaxPlayers",tolua_AllToLua_cServer_SetMaxPlayers00); - tolua_function(tolua_S,"IsHardcore",tolua_AllToLua_cServer_IsHardcore00); - tolua_function(tolua_S,"GetServerID",tolua_AllToLua_cServer_GetServerID00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cWorld","cWorld","",NULL); - tolua_beginmodule(tolua_S,"cWorld"); - tolua_function(tolua_S,"GetTicksUntilWeatherChange",tolua_AllToLua_cWorld_GetTicksUntilWeatherChange00); - tolua_function(tolua_S,"GetWorldAge",tolua_AllToLua_cWorld_GetWorldAge00); - tolua_function(tolua_S,"GetTimeOfDay",tolua_AllToLua_cWorld_GetTimeOfDay00); - tolua_function(tolua_S,"SetTicksUntilWeatherChange",tolua_AllToLua_cWorld_SetTicksUntilWeatherChange00); - tolua_function(tolua_S,"SetTimeOfDay",tolua_AllToLua_cWorld_SetTimeOfDay00); - tolua_function(tolua_S,"GetGameMode",tolua_AllToLua_cWorld_GetGameMode00); - tolua_function(tolua_S,"IsGameModeCreative",tolua_AllToLua_cWorld_IsGameModeCreative00); - tolua_function(tolua_S,"IsGameModeSurvival",tolua_AllToLua_cWorld_IsGameModeSurvival00); - tolua_function(tolua_S,"IsGameModeAdventure",tolua_AllToLua_cWorld_IsGameModeAdventure00); - tolua_function(tolua_S,"IsPVPEnabled",tolua_AllToLua_cWorld_IsPVPEnabled00); - tolua_function(tolua_S,"IsDeepSnowEnabled",tolua_AllToLua_cWorld_IsDeepSnowEnabled00); - tolua_function(tolua_S,"GetDimension",tolua_AllToLua_cWorld_GetDimension00); - tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cWorld_GetHeight00); - tolua_function(tolua_S,"BroadcastChat",tolua_AllToLua_cWorld_BroadcastChat00); - tolua_function(tolua_S,"BroadcastSoundEffect",tolua_AllToLua_cWorld_BroadcastSoundEffect00); - tolua_function(tolua_S,"BroadcastSoundParticleEffect",tolua_AllToLua_cWorld_BroadcastSoundParticleEffect00); - tolua_function(tolua_S,"UnloadUnusedChunks",tolua_AllToLua_cWorld_UnloadUnusedChunks00); - tolua_function(tolua_S,"RegenerateChunk",tolua_AllToLua_cWorld_RegenerateChunk00); - tolua_function(tolua_S,"GenerateChunk",tolua_AllToLua_cWorld_GenerateChunk00); - tolua_function(tolua_S,"SetBlock",tolua_AllToLua_cWorld_SetBlock00); - tolua_function(tolua_S,"FastSetBlock",tolua_AllToLua_cWorld_FastSetBlock00); - tolua_function(tolua_S,"QueueSetBlock",tolua_AllToLua_cWorld_QueueSetBlock00); - tolua_function(tolua_S,"GetBlock",tolua_AllToLua_cWorld_GetBlock00); - tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cWorld_GetBlockMeta00); - tolua_function(tolua_S,"SetBlockMeta",tolua_AllToLua_cWorld_SetBlockMeta00); - tolua_function(tolua_S,"GetBlockSkyLight",tolua_AllToLua_cWorld_GetBlockSkyLight00); - tolua_function(tolua_S,"GetBlockBlockLight",tolua_AllToLua_cWorld_GetBlockBlockLight00); - tolua_function(tolua_S,"FastSetBlock",tolua_AllToLua_cWorld_FastSetBlock01); - tolua_function(tolua_S,"GetBlock",tolua_AllToLua_cWorld_GetBlock01); - tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cWorld_GetBlockMeta01); - tolua_function(tolua_S,"SetBlockMeta",tolua_AllToLua_cWorld_SetBlockMeta01); - tolua_function(tolua_S,"SpawnItemPickups",tolua_AllToLua_cWorld_SpawnItemPickups00); - tolua_function(tolua_S,"SpawnItemPickups",tolua_AllToLua_cWorld_SpawnItemPickups01); - tolua_function(tolua_S,"SpawnExperienceOrb",tolua_AllToLua_cWorld_SpawnExperienceOrb00); - tolua_function(tolua_S,"SpawnPrimedTNT",tolua_AllToLua_cWorld_SpawnPrimedTNT00); - tolua_function(tolua_S,"DigBlock",tolua_AllToLua_cWorld_DigBlock00); - tolua_function(tolua_S,"SendBlockTo",tolua_AllToLua_cWorld_SendBlockTo00); - tolua_function(tolua_S,"GetSpawnX",tolua_AllToLua_cWorld_GetSpawnX00); - tolua_function(tolua_S,"GetSpawnY",tolua_AllToLua_cWorld_GetSpawnY00); - tolua_function(tolua_S,"GetSpawnZ",tolua_AllToLua_cWorld_GetSpawnZ00); - tolua_function(tolua_S,"WakeUpSimulators",tolua_AllToLua_cWorld_WakeUpSimulators00); - tolua_function(tolua_S,"WakeUpSimulatorsInArea",tolua_AllToLua_cWorld_WakeUpSimulatorsInArea00); - tolua_function(tolua_S,"DoExplosionAt",tolua_AllToLua_cWorld_DoExplosionAt00); - tolua_function(tolua_S,"UseBlockEntity",tolua_AllToLua_cWorld_UseBlockEntity00); - tolua_function(tolua_S,"GrowTree",tolua_AllToLua_cWorld_GrowTree00); - tolua_function(tolua_S,"GrowTreeFromSapling",tolua_AllToLua_cWorld_GrowTreeFromSapling00); - tolua_function(tolua_S,"GrowTreeByBiome",tolua_AllToLua_cWorld_GrowTreeByBiome00); - tolua_function(tolua_S,"GrowRipePlant",tolua_AllToLua_cWorld_GrowRipePlant00); - tolua_function(tolua_S,"GrowCactus",tolua_AllToLua_cWorld_GrowCactus00); - tolua_function(tolua_S,"GrowMelonPumpkin",tolua_AllToLua_cWorld_GrowMelonPumpkin00); - tolua_function(tolua_S,"GrowSugarcane",tolua_AllToLua_cWorld_GrowSugarcane00); - tolua_function(tolua_S,"GetBiomeAt",tolua_AllToLua_cWorld_GetBiomeAt00); - tolua_function(tolua_S,"GetName",tolua_AllToLua_cWorld_GetName00); - tolua_function(tolua_S,"GetIniFileName",tolua_AllToLua_cWorld_GetIniFileName00); - tolua_function(tolua_S,"QueueSaveAllChunks",tolua_AllToLua_cWorld_QueueSaveAllChunks00); - tolua_function(tolua_S,"GetNumChunks",tolua_AllToLua_cWorld_GetNumChunks00); - tolua_function(tolua_S,"GetGeneratorQueueLength",tolua_AllToLua_cWorld_GetGeneratorQueueLength00); - tolua_function(tolua_S,"GetLightingQueueLength",tolua_AllToLua_cWorld_GetLightingQueueLength00); - tolua_function(tolua_S,"GetStorageLoadQueueLength",tolua_AllToLua_cWorld_GetStorageLoadQueueLength00); - tolua_function(tolua_S,"GetStorageSaveQueueLength",tolua_AllToLua_cWorld_GetStorageSaveQueueLength00); - tolua_function(tolua_S,"QueueBlockForTick",tolua_AllToLua_cWorld_QueueBlockForTick00); - tolua_function(tolua_S,"CastThunderbolt",tolua_AllToLua_cWorld_CastThunderbolt00); - tolua_function(tolua_S,"SetWeather",tolua_AllToLua_cWorld_SetWeather00); - tolua_function(tolua_S,"ChangeWeather",tolua_AllToLua_cWorld_ChangeWeather00); - tolua_function(tolua_S,"GetWeather",tolua_AllToLua_cWorld_GetWeather00); - tolua_function(tolua_S,"IsWeatherSunny",tolua_AllToLua_cWorld_IsWeatherSunny00); - tolua_function(tolua_S,"IsWeatherRain",tolua_AllToLua_cWorld_IsWeatherRain00); - tolua_function(tolua_S,"IsWeatherStorm",tolua_AllToLua_cWorld_IsWeatherStorm00); - tolua_function(tolua_S,"IsWeatherWet",tolua_AllToLua_cWorld_IsWeatherWet00); - tolua_function(tolua_S,"SetNextBlockTick",tolua_AllToLua_cWorld_SetNextBlockTick00); - tolua_function(tolua_S,"GetMaxSugarcaneHeight",tolua_AllToLua_cWorld_GetMaxSugarcaneHeight00); - tolua_function(tolua_S,"GetMaxCactusHeight",tolua_AllToLua_cWorld_GetMaxCactusHeight00); - tolua_function(tolua_S,"IsBlockDirectlyWatered",tolua_AllToLua_cWorld_IsBlockDirectlyWatered00); - tolua_function(tolua_S,"SpawnMob",tolua_AllToLua_cWorld_SpawnMob00); - tolua_function(tolua_S,"CreateProjectile",tolua_AllToLua_cWorld_CreateProjectile00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cInventory","cInventory","cItemGrid::cListener",NULL); - tolua_beginmodule(tolua_S,"cInventory"); - tolua_constant(tolua_S,"invArmorCount",cInventory::invArmorCount); - tolua_constant(tolua_S,"invInventoryCount",cInventory::invInventoryCount); - tolua_constant(tolua_S,"invHotbarCount",cInventory::invHotbarCount); - tolua_constant(tolua_S,"invArmorOffset",cInventory::invArmorOffset); - tolua_constant(tolua_S,"invInventoryOffset",cInventory::invInventoryOffset); - tolua_constant(tolua_S,"invHotbarOffset",cInventory::invHotbarOffset); - tolua_constant(tolua_S,"invNumSlots",cInventory::invNumSlots); - tolua_function(tolua_S,"Clear",tolua_AllToLua_cInventory_Clear00); - tolua_function(tolua_S,"HowManyCanFit",tolua_AllToLua_cInventory_HowManyCanFit00); - tolua_function(tolua_S,"HowManyCanFit",tolua_AllToLua_cInventory_HowManyCanFit01); - tolua_function(tolua_S,"AddItem",tolua_AllToLua_cInventory_AddItem00); - tolua_function(tolua_S,"AddItems",tolua_AllToLua_cInventory_AddItems00); - tolua_function(tolua_S,"RemoveOneEquippedItem",tolua_AllToLua_cInventory_RemoveOneEquippedItem00); - tolua_function(tolua_S,"HowManyItems",tolua_AllToLua_cInventory_HowManyItems00); - tolua_function(tolua_S,"HasItems",tolua_AllToLua_cInventory_HasItems00); - tolua_function(tolua_S,"GetArmorGrid",tolua_AllToLua_cInventory_GetArmorGrid00); - tolua_function(tolua_S,"GetInventoryGrid",tolua_AllToLua_cInventory_GetInventoryGrid00); - tolua_function(tolua_S,"GetHotbarGrid",tolua_AllToLua_cInventory_GetHotbarGrid00); - tolua_function(tolua_S,"GetOwner",tolua_AllToLua_cInventory_GetOwner00); - tolua_function(tolua_S,"CopyToItems",tolua_AllToLua_cInventory_CopyToItems00); - tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cInventory_GetSlot00); - tolua_function(tolua_S,"GetArmorSlot",tolua_AllToLua_cInventory_GetArmorSlot00); - tolua_function(tolua_S,"GetInventorySlot",tolua_AllToLua_cInventory_GetInventorySlot00); - tolua_function(tolua_S,"GetHotbarSlot",tolua_AllToLua_cInventory_GetHotbarSlot00); - tolua_function(tolua_S,"GetEquippedItem",tolua_AllToLua_cInventory_GetEquippedItem00); - tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cInventory_SetSlot00); - tolua_function(tolua_S,"SetArmorSlot",tolua_AllToLua_cInventory_SetArmorSlot00); - tolua_function(tolua_S,"SetInventorySlot",tolua_AllToLua_cInventory_SetInventorySlot00); - tolua_function(tolua_S,"SetHotbarSlot",tolua_AllToLua_cInventory_SetHotbarSlot00); - tolua_function(tolua_S,"SetEquippedSlotNum",tolua_AllToLua_cInventory_SetEquippedSlotNum00); - tolua_function(tolua_S,"GetEquippedSlotNum",tolua_AllToLua_cInventory_GetEquippedSlotNum00); - tolua_function(tolua_S,"ChangeSlotCount",tolua_AllToLua_cInventory_ChangeSlotCount00); - tolua_function(tolua_S,"DamageItem",tolua_AllToLua_cInventory_DamageItem00); - tolua_function(tolua_S,"DamageEquippedItem",tolua_AllToLua_cInventory_DamageEquippedItem00); - tolua_function(tolua_S,"GetEquippedHelmet",tolua_AllToLua_cInventory_GetEquippedHelmet00); - tolua_function(tolua_S,"GetEquippedChestplate",tolua_AllToLua_cInventory_GetEquippedChestplate00); - tolua_function(tolua_S,"GetEquippedLeggings",tolua_AllToLua_cInventory_GetEquippedLeggings00); - tolua_function(tolua_S,"GetEquippedBoots",tolua_AllToLua_cInventory_GetEquippedBoots00); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"cEnchantments","cEnchantments","",tolua_collect_cEnchantments); - #else - tolua_cclass(tolua_S,"cEnchantments","cEnchantments","",NULL); - #endif - tolua_beginmodule(tolua_S,"cEnchantments"); - tolua_constant(tolua_S,"enchProtection",cEnchantments::enchProtection); - tolua_constant(tolua_S,"enchFireProtection",cEnchantments::enchFireProtection); - tolua_constant(tolua_S,"enchFeatherFalling",cEnchantments::enchFeatherFalling); - tolua_constant(tolua_S,"enchBlastProtection",cEnchantments::enchBlastProtection); - tolua_constant(tolua_S,"enchProjectileProtection",cEnchantments::enchProjectileProtection); - tolua_constant(tolua_S,"enchRespiration",cEnchantments::enchRespiration); - tolua_constant(tolua_S,"enchAquaAffinity",cEnchantments::enchAquaAffinity); - tolua_constant(tolua_S,"enchThorns",cEnchantments::enchThorns); - tolua_constant(tolua_S,"enchSharpness",cEnchantments::enchSharpness); - tolua_constant(tolua_S,"enchSmite",cEnchantments::enchSmite); - tolua_constant(tolua_S,"enchBaneOfArthropods",cEnchantments::enchBaneOfArthropods); - tolua_constant(tolua_S,"enchKnockback",cEnchantments::enchKnockback); - tolua_constant(tolua_S,"enchFireAspect",cEnchantments::enchFireAspect); - tolua_constant(tolua_S,"enchLooting",cEnchantments::enchLooting); - tolua_constant(tolua_S,"enchEfficiency",cEnchantments::enchEfficiency); - tolua_constant(tolua_S,"enchSilkTouch",cEnchantments::enchSilkTouch); - tolua_constant(tolua_S,"enchUnbreaking",cEnchantments::enchUnbreaking); - tolua_constant(tolua_S,"enchFortune",cEnchantments::enchFortune); - tolua_constant(tolua_S,"enchPower",cEnchantments::enchPower); - tolua_constant(tolua_S,"enchPunch",cEnchantments::enchPunch); - tolua_constant(tolua_S,"enchFlame",cEnchantments::enchFlame); - tolua_constant(tolua_S,"enchInfinity",cEnchantments::enchInfinity); - tolua_constant(tolua_S,"enchLuckOfTheSea",cEnchantments::enchLuckOfTheSea); - tolua_constant(tolua_S,"enchLure",cEnchantments::enchLure); - tolua_function(tolua_S,"new",tolua_AllToLua_cEnchantments_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cEnchantments_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cEnchantments_new00_local); - tolua_function(tolua_S,"new",tolua_AllToLua_cEnchantments_new01); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cEnchantments_new01_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cEnchantments_new01_local); - tolua_function(tolua_S,"AddFromString",tolua_AllToLua_cEnchantments_AddFromString00); - tolua_function(tolua_S,"ToString",tolua_AllToLua_cEnchantments_ToString00); - tolua_function(tolua_S,"GetLevel",tolua_AllToLua_cEnchantments_GetLevel00); - tolua_function(tolua_S,"SetLevel",tolua_AllToLua_cEnchantments_SetLevel00); - tolua_function(tolua_S,"Clear",tolua_AllToLua_cEnchantments_Clear00); - tolua_function(tolua_S,"IsEmpty",tolua_AllToLua_cEnchantments_IsEmpty00); - tolua_function(tolua_S,"StringToEnchantmentID",tolua_AllToLua_cEnchantments_StringToEnchantmentID00); - tolua_function(tolua_S,".eq",tolua_AllToLua_cEnchantments__eq00); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"cItem","cItem","",tolua_collect_cItem); - #else - tolua_cclass(tolua_S,"cItem","cItem","",NULL); - #endif - tolua_beginmodule(tolua_S,"cItem"); - tolua_function(tolua_S,"new",tolua_AllToLua_cItem_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cItem_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cItem_new00_local); - tolua_function(tolua_S,"new",tolua_AllToLua_cItem_new01); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cItem_new01_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cItem_new01_local); - tolua_function(tolua_S,"new",tolua_AllToLua_cItem_new02); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cItem_new02_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cItem_new02_local); - tolua_function(tolua_S,"new",tolua_AllToLua_cItem_new03); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cItem_new03_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cItem_new03_local); - tolua_function(tolua_S,"Empty",tolua_AllToLua_cItem_Empty00); - tolua_function(tolua_S,"Clear",tolua_AllToLua_cItem_Clear00); - tolua_function(tolua_S,"IsEmpty",tolua_AllToLua_cItem_IsEmpty00); - tolua_function(tolua_S,"IsEqual",tolua_AllToLua_cItem_IsEqual00); - tolua_function(tolua_S,"IsSameType",tolua_AllToLua_cItem_IsSameType00); - tolua_function(tolua_S,"CopyOne",tolua_AllToLua_cItem_CopyOne00); - tolua_function(tolua_S,"AddCount",tolua_AllToLua_cItem_AddCount00); - tolua_function(tolua_S,"GetMaxDamage",tolua_AllToLua_cItem_GetMaxDamage00); - tolua_function(tolua_S,"DamageItem",tolua_AllToLua_cItem_DamageItem00); - tolua_function(tolua_S,"IsDamageable",tolua_AllToLua_cItem_IsDamageable00); - tolua_function(tolua_S,"IsStackableWith",tolua_AllToLua_cItem_IsStackableWith00); - tolua_function(tolua_S,"IsFullStack",tolua_AllToLua_cItem_IsFullStack00); - tolua_function(tolua_S,"GetMaxStackSize",tolua_AllToLua_cItem_GetMaxStackSize00); - tolua_variable(tolua_S,"m_ItemType",tolua_get_cItem_m_ItemType,tolua_set_cItem_m_ItemType); - tolua_variable(tolua_S,"m_ItemCount",tolua_get_cItem_m_ItemCount,tolua_set_cItem_m_ItemCount); - tolua_variable(tolua_S,"m_ItemDamage",tolua_get_cItem_m_ItemDamage,tolua_set_cItem_m_ItemDamage); - tolua_variable(tolua_S,"m_Enchantments",tolua_get_cItem_m_Enchantments,tolua_set_cItem_m_Enchantments); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"cItems","cItems","",tolua_collect_cItems); - #else - tolua_cclass(tolua_S,"cItems","cItems","",NULL); - #endif - tolua_beginmodule(tolua_S,"cItems"); - tolua_function(tolua_S,"new",tolua_AllToLua_cItems_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cItems_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cItems_new00_local); - tolua_function(tolua_S,"Get",tolua_AllToLua_cItems_Get00); - tolua_function(tolua_S,"Set",tolua_AllToLua_cItems_Set00); - tolua_function(tolua_S,"Add",tolua_AllToLua_cItems_Add00); - tolua_function(tolua_S,"Delete",tolua_AllToLua_cItems_Delete00); - tolua_function(tolua_S,"Clear",tolua_AllToLua_cItems_Clear00); - tolua_function(tolua_S,"Size",tolua_AllToLua_cItems_Size00); - tolua_function(tolua_S,"Set",tolua_AllToLua_cItems_Set01); - tolua_function(tolua_S,"Add",tolua_AllToLua_cItems_Add01); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cItemGrid","cItemGrid","",NULL); - tolua_beginmodule(tolua_S,"cItemGrid"); - tolua_function(tolua_S,"GetWidth",tolua_AllToLua_cItemGrid_GetWidth00); - tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cItemGrid_GetHeight00); - tolua_function(tolua_S,"GetNumSlots",tolua_AllToLua_cItemGrid_GetNumSlots00); - tolua_function(tolua_S,"GetSlotNum",tolua_AllToLua_cItemGrid_GetSlotNum00); - tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cItemGrid_GetSlot00); - tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cItemGrid_GetSlot01); - tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cItemGrid_SetSlot00); - tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cItemGrid_SetSlot01); - tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cItemGrid_SetSlot02); - tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cItemGrid_SetSlot03); - tolua_function(tolua_S,"EmptySlot",tolua_AllToLua_cItemGrid_EmptySlot00); - tolua_function(tolua_S,"EmptySlot",tolua_AllToLua_cItemGrid_EmptySlot01); - tolua_function(tolua_S,"IsSlotEmpty",tolua_AllToLua_cItemGrid_IsSlotEmpty00); - tolua_function(tolua_S,"IsSlotEmpty",tolua_AllToLua_cItemGrid_IsSlotEmpty01); - tolua_function(tolua_S,"Clear",tolua_AllToLua_cItemGrid_Clear00); - tolua_function(tolua_S,"HowManyCanFit",tolua_AllToLua_cItemGrid_HowManyCanFit00); - tolua_function(tolua_S,"AddItem",tolua_AllToLua_cItemGrid_AddItem00); - tolua_function(tolua_S,"AddItems",tolua_AllToLua_cItemGrid_AddItems00); - tolua_function(tolua_S,"ChangeSlotCount",tolua_AllToLua_cItemGrid_ChangeSlotCount00); - tolua_function(tolua_S,"ChangeSlotCount",tolua_AllToLua_cItemGrid_ChangeSlotCount01); - tolua_function(tolua_S,"RemoveOneItem",tolua_AllToLua_cItemGrid_RemoveOneItem00); - tolua_function(tolua_S,"RemoveOneItem",tolua_AllToLua_cItemGrid_RemoveOneItem01); - tolua_function(tolua_S,"HowManyItems",tolua_AllToLua_cItemGrid_HowManyItems00); - tolua_function(tolua_S,"HasItems",tolua_AllToLua_cItemGrid_HasItems00); - tolua_function(tolua_S,"GetFirstEmptySlot",tolua_AllToLua_cItemGrid_GetFirstEmptySlot00); - tolua_function(tolua_S,"GetFirstUsedSlot",tolua_AllToLua_cItemGrid_GetFirstUsedSlot00); - tolua_function(tolua_S,"GetLastEmptySlot",tolua_AllToLua_cItemGrid_GetLastEmptySlot00); - tolua_function(tolua_S,"GetLastUsedSlot",tolua_AllToLua_cItemGrid_GetLastUsedSlot00); - tolua_function(tolua_S,"GetNextEmptySlot",tolua_AllToLua_cItemGrid_GetNextEmptySlot00); - tolua_function(tolua_S,"GetNextUsedSlot",tolua_AllToLua_cItemGrid_GetNextUsedSlot00); - tolua_function(tolua_S,"CopyToItems",tolua_AllToLua_cItemGrid_CopyToItems00); - tolua_function(tolua_S,"DamageItem",tolua_AllToLua_cItemGrid_DamageItem00); - tolua_function(tolua_S,"DamageItem",tolua_AllToLua_cItemGrid_DamageItem01); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"cBlockEntity","cBlockEntity","",tolua_collect_cBlockEntity); - #else - tolua_cclass(tolua_S,"cBlockEntity","cBlockEntity","",NULL); - #endif - tolua_beginmodule(tolua_S,"cBlockEntity"); - tolua_function(tolua_S,"GetPosX",tolua_AllToLua_cBlockEntity_GetPosX00); - tolua_function(tolua_S,"GetPosY",tolua_AllToLua_cBlockEntity_GetPosY00); - tolua_function(tolua_S,"GetPosZ",tolua_AllToLua_cBlockEntity_GetPosZ00); - tolua_function(tolua_S,"GetBlockType",tolua_AllToLua_cBlockEntity_GetBlockType00); - tolua_function(tolua_S,"GetWorld",tolua_AllToLua_cBlockEntity_GetWorld00); - tolua_function(tolua_S,"GetChunkX",tolua_AllToLua_cBlockEntity_GetChunkX00); - tolua_function(tolua_S,"GetChunkZ",tolua_AllToLua_cBlockEntity_GetChunkZ00); - tolua_function(tolua_S,"GetRelX",tolua_AllToLua_cBlockEntity_GetRelX00); - tolua_function(tolua_S,"GetRelZ",tolua_AllToLua_cBlockEntity_GetRelZ00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cBlockEntityWithItems","cBlockEntityWithItems","cBlockEntity",NULL); - tolua_beginmodule(tolua_S,"cBlockEntityWithItems"); - tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cBlockEntityWithItems_GetSlot00); - tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cBlockEntityWithItems_GetSlot01); - tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cBlockEntityWithItems_SetSlot00); - tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cBlockEntityWithItems_SetSlot01); - tolua_function(tolua_S,"GetContents",tolua_AllToLua_cBlockEntityWithItems_GetContents00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cChestEntity","cChestEntity","cBlockEntityWithItems",NULL); - tolua_beginmodule(tolua_S,"cChestEntity"); - tolua_constant(tolua_S,"ContentsHeight",cChestEntity::ContentsHeight); - tolua_constant(tolua_S,"ContentsWidth",cChestEntity::ContentsWidth); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cDropSpenserEntity","cDropSpenserEntity","cBlockEntityWithItems",NULL); - tolua_beginmodule(tolua_S,"cDropSpenserEntity"); - tolua_constant(tolua_S,"ContentsHeight",cDropSpenserEntity::ContentsHeight); - tolua_constant(tolua_S,"ContentsWidth",cDropSpenserEntity::ContentsWidth); - tolua_function(tolua_S,"AddDropSpenserDir",tolua_AllToLua_cDropSpenserEntity_AddDropSpenserDir00); - tolua_function(tolua_S,"Activate",tolua_AllToLua_cDropSpenserEntity_Activate00); - tolua_function(tolua_S,"SetRedstonePower",tolua_AllToLua_cDropSpenserEntity_SetRedstonePower00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cDispenserEntity","cDispenserEntity","cDropSpenserEntity",NULL); - tolua_beginmodule(tolua_S,"cDispenserEntity"); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cDropperEntity","cDropperEntity","cDropSpenserEntity",NULL); - tolua_beginmodule(tolua_S,"cDropperEntity"); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cFurnaceEntity","cFurnaceEntity","cBlockEntityWithItems",NULL); - tolua_beginmodule(tolua_S,"cFurnaceEntity"); - tolua_constant(tolua_S,"fsInput",cFurnaceEntity::fsInput); - tolua_constant(tolua_S,"fsFuel",cFurnaceEntity::fsFuel); - tolua_constant(tolua_S,"fsOutput",cFurnaceEntity::fsOutput); - tolua_constant(tolua_S,"ContentsWidth",cFurnaceEntity::ContentsWidth); - tolua_constant(tolua_S,"ContentsHeight",cFurnaceEntity::ContentsHeight); - tolua_function(tolua_S,"GetInputSlot",tolua_AllToLua_cFurnaceEntity_GetInputSlot00); - tolua_function(tolua_S,"GetFuelSlot",tolua_AllToLua_cFurnaceEntity_GetFuelSlot00); - tolua_function(tolua_S,"GetOutputSlot",tolua_AllToLua_cFurnaceEntity_GetOutputSlot00); - tolua_function(tolua_S,"SetInputSlot",tolua_AllToLua_cFurnaceEntity_SetInputSlot00); - tolua_function(tolua_S,"SetFuelSlot",tolua_AllToLua_cFurnaceEntity_SetFuelSlot00); - tolua_function(tolua_S,"SetOutputSlot",tolua_AllToLua_cFurnaceEntity_SetOutputSlot00); - tolua_function(tolua_S,"GetTimeCooked",tolua_AllToLua_cFurnaceEntity_GetTimeCooked00); - tolua_function(tolua_S,"GetCookTimeLeft",tolua_AllToLua_cFurnaceEntity_GetCookTimeLeft00); - tolua_function(tolua_S,"GetFuelBurnTimeLeft",tolua_AllToLua_cFurnaceEntity_GetFuelBurnTimeLeft00); - tolua_function(tolua_S,"HasFuelTimeLeft",tolua_AllToLua_cFurnaceEntity_HasFuelTimeLeft00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cHopperEntity","cHopperEntity","cBlockEntityWithItems",NULL); - tolua_beginmodule(tolua_S,"cHopperEntity"); - tolua_constant(tolua_S,"ContentsHeight",cHopperEntity::ContentsHeight); - tolua_constant(tolua_S,"ContentsWidth",cHopperEntity::ContentsWidth); - tolua_constant(tolua_S,"TICKS_PER_TRANSFER",cHopperEntity::TICKS_PER_TRANSFER); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cJukeboxEntity","cJukeboxEntity","cBlockEntity",NULL); - tolua_beginmodule(tolua_S,"cJukeboxEntity"); - tolua_function(tolua_S,"GetRecord",tolua_AllToLua_cJukeboxEntity_GetRecord00); - tolua_function(tolua_S,"SetRecord",tolua_AllToLua_cJukeboxEntity_SetRecord00); - tolua_function(tolua_S,"PlayRecord",tolua_AllToLua_cJukeboxEntity_PlayRecord00); - tolua_function(tolua_S,"EjectRecord",tolua_AllToLua_cJukeboxEntity_EjectRecord00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cNoteEntity","cNoteEntity","cBlockEntity",NULL); - tolua_beginmodule(tolua_S,"cNoteEntity"); - tolua_function(tolua_S,"GetPitch",tolua_AllToLua_cNoteEntity_GetPitch00); - tolua_function(tolua_S,"SetPitch",tolua_AllToLua_cNoteEntity_SetPitch00); - tolua_function(tolua_S,"IncrementPitch",tolua_AllToLua_cNoteEntity_IncrementPitch00); - tolua_function(tolua_S,"MakeSound",tolua_AllToLua_cNoteEntity_MakeSound00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cSignEntity","cSignEntity","cBlockEntity",NULL); - tolua_beginmodule(tolua_S,"cSignEntity"); - tolua_function(tolua_S,"SetLines",tolua_AllToLua_cSignEntity_SetLines00); - tolua_function(tolua_S,"SetLine",tolua_AllToLua_cSignEntity_SetLine00); - tolua_function(tolua_S,"GetLine",tolua_AllToLua_cSignEntity_GetLine00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"HTTPFormData","HTTPFormData","",NULL); - tolua_beginmodule(tolua_S,"HTTPFormData"); - tolua_variable(tolua_S,"Name",tolua_get_HTTPFormData_Name,tolua_set_HTTPFormData_Name); - tolua_variable(tolua_S,"Value",tolua_get_HTTPFormData_Value,tolua_set_HTTPFormData_Value); - tolua_variable(tolua_S,"Type",tolua_get_HTTPFormData_Type,tolua_set_HTTPFormData_Type); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"HTTPRequest","HTTPRequest","",NULL); - tolua_beginmodule(tolua_S,"HTTPRequest"); - tolua_variable(tolua_S,"Method",tolua_get_HTTPRequest_Method,tolua_set_HTTPRequest_Method); - tolua_variable(tolua_S,"Path",tolua_get_HTTPRequest_Path,tolua_set_HTTPRequest_Path); - tolua_variable(tolua_S,"Username",tolua_get_HTTPRequest_Username,tolua_set_HTTPRequest_Username); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"HTTPTemplateRequest","HTTPTemplateRequest","",NULL); - tolua_beginmodule(tolua_S,"HTTPTemplateRequest"); - tolua_variable(tolua_S,"Request",tolua_get_HTTPTemplateRequest_Request,tolua_set_HTTPTemplateRequest_Request); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"sWebAdminPage","sWebAdminPage","",tolua_collect_sWebAdminPage); - #else - tolua_cclass(tolua_S,"sWebAdminPage","sWebAdminPage","",NULL); - #endif - tolua_beginmodule(tolua_S,"sWebAdminPage"); - tolua_variable(tolua_S,"Content",tolua_get_sWebAdminPage_Content,tolua_set_sWebAdminPage_Content); - tolua_variable(tolua_S,"PluginName",tolua_get_sWebAdminPage_PluginName,tolua_set_sWebAdminPage_PluginName); - tolua_variable(tolua_S,"TabName",tolua_get_sWebAdminPage_TabName,tolua_set_sWebAdminPage_TabName); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cWebAdmin","cWebAdmin","cHTTPServer::cCallbacks",NULL); - tolua_beginmodule(tolua_S,"cWebAdmin"); - tolua_function(tolua_S,"GetPage",tolua_AllToLua_cWebAdmin_GetPage00); - tolua_function(tolua_S,"GetDefaultPage",tolua_AllToLua_cWebAdmin_GetDefaultPage00); - tolua_function(tolua_S,"GetBaseURL",tolua_AllToLua_cWebAdmin_GetBaseURL00); - tolua_function(tolua_S,"GetHTMLEscapedString",tolua_AllToLua_cWebAdmin_GetHTMLEscapedString00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cWebPlugin","cWebPlugin","",NULL); - tolua_beginmodule(tolua_S,"cWebPlugin"); - tolua_function(tolua_S,"GetWebTitle",tolua_AllToLua_cWebPlugin_GetWebTitle00); - tolua_function(tolua_S,"HandleWebRequest",tolua_AllToLua_cWebPlugin_HandleWebRequest00); - tolua_function(tolua_S,"SafeString",tolua_AllToLua_cWebPlugin_SafeString00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cRoot","cRoot","",NULL); - tolua_beginmodule(tolua_S,"cRoot"); - tolua_function(tolua_S,"Get",tolua_AllToLua_cRoot_Get00); - tolua_function(tolua_S,"GetServer",tolua_AllToLua_cRoot_GetServer00); - tolua_function(tolua_S,"GetDefaultWorld",tolua_AllToLua_cRoot_GetDefaultWorld00); - tolua_function(tolua_S,"GetWorld",tolua_AllToLua_cRoot_GetWorld00); - tolua_function(tolua_S,"GetPrimaryServerVersion",tolua_AllToLua_cRoot_GetPrimaryServerVersion00); - tolua_function(tolua_S,"SetPrimaryServerVersion",tolua_AllToLua_cRoot_SetPrimaryServerVersion00); - tolua_function(tolua_S,"GetGroupManager",tolua_AllToLua_cRoot_GetGroupManager00); - tolua_function(tolua_S,"GetCraftingRecipes",tolua_AllToLua_cRoot_GetCraftingRecipes00); - tolua_function(tolua_S,"GetFurnaceFuelBurnTime",tolua_AllToLua_cRoot_GetFurnaceFuelBurnTime00); - tolua_function(tolua_S,"GetWebAdmin",tolua_AllToLua_cRoot_GetWebAdmin00); - tolua_function(tolua_S,"GetPluginManager",tolua_AllToLua_cRoot_GetPluginManager00); - tolua_function(tolua_S,"QueueExecuteConsoleCommand",tolua_AllToLua_cRoot_QueueExecuteConsoleCommand00); - tolua_function(tolua_S,"GetTotalChunkCount",tolua_AllToLua_cRoot_GetTotalChunkCount00); - tolua_function(tolua_S,"SaveAllChunks",tolua_AllToLua_cRoot_SaveAllChunks00); - tolua_function(tolua_S,"BroadcastChat",tolua_AllToLua_cRoot_BroadcastChat00); - tolua_function(tolua_S,"GetProtocolVersionTextFromInt",tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00); - tolua_function(tolua_S,"GetVirtualRAMUsage",tolua_AllToLua_cRoot_GetVirtualRAMUsage00); - tolua_function(tolua_S,"GetPhysicalRAMUsage",tolua_AllToLua_cRoot_GetPhysicalRAMUsage00); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"Vector3f","Vector3f","",tolua_collect_Vector3f); - #else - tolua_cclass(tolua_S,"Vector3f","Vector3f","",NULL); - #endif - tolua_beginmodule(tolua_S,"Vector3f"); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3f_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3f_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3f_new00_local); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3f_new01); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3f_new01_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3f_new01_local); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3f_new02); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3f_new02_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3f_new02_local); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3f_new03); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3f_new03_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3f_new03_local); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3f_new04); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3f_new04_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3f_new04_local); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3f_new05); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3f_new05_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3f_new05_local); - tolua_function(tolua_S,"Set",tolua_AllToLua_Vector3f_Set00); - tolua_function(tolua_S,"Normalize",tolua_AllToLua_Vector3f_Normalize00); - tolua_function(tolua_S,"NormalizeCopy",tolua_AllToLua_Vector3f_NormalizeCopy00); - tolua_function(tolua_S,"NormalizeCopy",tolua_AllToLua_Vector3f_NormalizeCopy01); - tolua_function(tolua_S,"Length",tolua_AllToLua_Vector3f_Length00); - tolua_function(tolua_S,"SqrLength",tolua_AllToLua_Vector3f_SqrLength00); - tolua_function(tolua_S,"Dot",tolua_AllToLua_Vector3f_Dot00); - tolua_function(tolua_S,"Cross",tolua_AllToLua_Vector3f_Cross00); - tolua_function(tolua_S,"Equals",tolua_AllToLua_Vector3f_Equals00); - tolua_function(tolua_S,".add",tolua_AllToLua_Vector3f__add00); - tolua_function(tolua_S,".add",tolua_AllToLua_Vector3f__add01); - tolua_function(tolua_S,".sub",tolua_AllToLua_Vector3f__sub00); - tolua_function(tolua_S,".sub",tolua_AllToLua_Vector3f__sub01); - tolua_function(tolua_S,".mul",tolua_AllToLua_Vector3f__mul00); - tolua_function(tolua_S,".mul",tolua_AllToLua_Vector3f__mul01); - tolua_variable(tolua_S,"x",tolua_get_Vector3f_x,tolua_set_Vector3f_x); - tolua_variable(tolua_S,"y",tolua_get_Vector3f_y,tolua_set_Vector3f_y); - tolua_variable(tolua_S,"z",tolua_get_Vector3f_z,tolua_set_Vector3f_z); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"Vector3d","Vector3d","",tolua_collect_Vector3d); - #else - tolua_cclass(tolua_S,"Vector3d","Vector3d","",NULL); - #endif - tolua_beginmodule(tolua_S,"Vector3d"); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3d_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3d_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3d_new00_local); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3d_new01); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3d_new01_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3d_new01_local); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3d_new02); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3d_new02_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3d_new02_local); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3d_new03); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3d_new03_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3d_new03_local); - tolua_function(tolua_S,"Set",tolua_AllToLua_Vector3d_Set00); - tolua_function(tolua_S,"Normalize",tolua_AllToLua_Vector3d_Normalize00); - tolua_function(tolua_S,"NormalizeCopy",tolua_AllToLua_Vector3d_NormalizeCopy00); - tolua_function(tolua_S,"NormalizeCopy",tolua_AllToLua_Vector3d_NormalizeCopy01); - tolua_function(tolua_S,"Length",tolua_AllToLua_Vector3d_Length00); - tolua_function(tolua_S,"SqrLength",tolua_AllToLua_Vector3d_SqrLength00); - tolua_function(tolua_S,"Dot",tolua_AllToLua_Vector3d_Dot00); - tolua_function(tolua_S,"Cross",tolua_AllToLua_Vector3d_Cross00); - tolua_function(tolua_S,"LineCoeffToXYPlane",tolua_AllToLua_Vector3d_LineCoeffToXYPlane00); - tolua_function(tolua_S,"LineCoeffToXZPlane",tolua_AllToLua_Vector3d_LineCoeffToXZPlane00); - tolua_function(tolua_S,"LineCoeffToYZPlane",tolua_AllToLua_Vector3d_LineCoeffToYZPlane00); - tolua_function(tolua_S,"Equals",tolua_AllToLua_Vector3d_Equals00); - tolua_function(tolua_S,".add",tolua_AllToLua_Vector3d__add00); - tolua_function(tolua_S,".add",tolua_AllToLua_Vector3d__add01); - tolua_function(tolua_S,".sub",tolua_AllToLua_Vector3d__sub00); - tolua_function(tolua_S,".sub",tolua_AllToLua_Vector3d__sub01); - tolua_function(tolua_S,".mul",tolua_AllToLua_Vector3d__mul00); - tolua_function(tolua_S,".mul",tolua_AllToLua_Vector3d__mul01); - tolua_function(tolua_S,".div",tolua_AllToLua_Vector3d__div00); - tolua_variable(tolua_S,"x",tolua_get_Vector3d_x,tolua_set_Vector3d_x); - tolua_variable(tolua_S,"y",tolua_get_Vector3d_y,tolua_set_Vector3d_y); - tolua_variable(tolua_S,"z",tolua_get_Vector3d_z,tolua_set_Vector3d_z); - tolua_variable(tolua_S,"EPS",tolua_get_Vector3d_EPS,NULL); - tolua_variable(tolua_S,"NO_INTERSECTION",tolua_get_Vector3d_NO_INTERSECTION,NULL); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"Vector3i","Vector3i","",tolua_collect_Vector3i); - #else - tolua_cclass(tolua_S,"Vector3i","Vector3i","",NULL); - #endif - tolua_beginmodule(tolua_S,"Vector3i"); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3i_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3i_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3i_new00_local); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3i_new01); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3i_new01_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3i_new01_local); - tolua_function(tolua_S,"new",tolua_AllToLua_Vector3i_new02); - tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3i_new02_local); - tolua_function(tolua_S,".call",tolua_AllToLua_Vector3i_new02_local); - tolua_function(tolua_S,"Set",tolua_AllToLua_Vector3i_Set00); - tolua_function(tolua_S,"Length",tolua_AllToLua_Vector3i_Length00); - tolua_function(tolua_S,"SqrLength",tolua_AllToLua_Vector3i_SqrLength00); - tolua_function(tolua_S,"Equals",tolua_AllToLua_Vector3i_Equals00); - tolua_function(tolua_S,"Equals",tolua_AllToLua_Vector3i_Equals01); - tolua_variable(tolua_S,"x",tolua_get_Vector3i_x,tolua_set_Vector3i_x); - tolua_variable(tolua_S,"y",tolua_get_Vector3i_y,tolua_set_Vector3i_y); - tolua_variable(tolua_S,"z",tolua_get_Vector3i_z,tolua_set_Vector3i_z); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"cCuboid","cCuboid","",tolua_collect_cCuboid); - #else - tolua_cclass(tolua_S,"cCuboid","cCuboid","",NULL); - #endif - tolua_beginmodule(tolua_S,"cCuboid"); - tolua_variable(tolua_S,"p1",tolua_get_cCuboid_p1,tolua_set_cCuboid_p1); - tolua_variable(tolua_S,"p2",tolua_get_cCuboid_p2,tolua_set_cCuboid_p2); - tolua_function(tolua_S,"new",tolua_AllToLua_cCuboid_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cCuboid_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cCuboid_new00_local); - tolua_function(tolua_S,"new",tolua_AllToLua_cCuboid_new01); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cCuboid_new01_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cCuboid_new01_local); - tolua_function(tolua_S,"new",tolua_AllToLua_cCuboid_new02); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cCuboid_new02_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cCuboid_new02_local); - tolua_function(tolua_S,"new",tolua_AllToLua_cCuboid_new03); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cCuboid_new03_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cCuboid_new03_local); - tolua_function(tolua_S,"new",tolua_AllToLua_cCuboid_new04); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cCuboid_new04_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cCuboid_new04_local); - tolua_function(tolua_S,"Assign",tolua_AllToLua_cCuboid_Assign00); - tolua_function(tolua_S,"Sort",tolua_AllToLua_cCuboid_Sort00); - tolua_function(tolua_S,"DifX",tolua_AllToLua_cCuboid_DifX00); - tolua_function(tolua_S,"DifY",tolua_AllToLua_cCuboid_DifY00); - tolua_function(tolua_S,"DifZ",tolua_AllToLua_cCuboid_DifZ00); - tolua_function(tolua_S,"DoesIntersect",tolua_AllToLua_cCuboid_DoesIntersect00); - tolua_function(tolua_S,"IsInside",tolua_AllToLua_cCuboid_IsInside00); - tolua_function(tolua_S,"IsInside",tolua_AllToLua_cCuboid_IsInside01); - tolua_function(tolua_S,"IsInside",tolua_AllToLua_cCuboid_IsInside02); - tolua_function(tolua_S,"IsCompletelyInside",tolua_AllToLua_cCuboid_IsCompletelyInside00); - tolua_function(tolua_S,"Move",tolua_AllToLua_cCuboid_Move00); - tolua_function(tolua_S,"IsSorted",tolua_AllToLua_cCuboid_IsSorted00); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"cBoundingBox","cBoundingBox","",tolua_collect_cBoundingBox); - #else - tolua_cclass(tolua_S,"cBoundingBox","cBoundingBox","",NULL); - #endif - tolua_beginmodule(tolua_S,"cBoundingBox"); - tolua_function(tolua_S,"new",tolua_AllToLua_cBoundingBox_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cBoundingBox_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cBoundingBox_new00_local); - tolua_function(tolua_S,"new",tolua_AllToLua_cBoundingBox_new01); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cBoundingBox_new01_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cBoundingBox_new01_local); - tolua_function(tolua_S,"new",tolua_AllToLua_cBoundingBox_new02); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cBoundingBox_new02_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cBoundingBox_new02_local); - tolua_function(tolua_S,"new",tolua_AllToLua_cBoundingBox_new03); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cBoundingBox_new03_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cBoundingBox_new03_local); - tolua_function(tolua_S,"Move",tolua_AllToLua_cBoundingBox_Move00); - tolua_function(tolua_S,"Move",tolua_AllToLua_cBoundingBox_Move01); - tolua_function(tolua_S,"Expand",tolua_AllToLua_cBoundingBox_Expand00); - tolua_function(tolua_S,"DoesIntersect",tolua_AllToLua_cBoundingBox_DoesIntersect00); - tolua_function(tolua_S,"Union",tolua_AllToLua_cBoundingBox_Union00); - tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside00); - tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside01); - tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside02); - tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside03); - tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside04); - tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside05); - tolua_function(tolua_S,"CalcLineIntersection",tolua_AllToLua_cBoundingBox_CalcLineIntersection00); - tolua_function(tolua_S,"CalcLineIntersection",tolua_AllToLua_cBoundingBox_CalcLineIntersection01); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"cTracer","cTracer","",tolua_collect_cTracer); - #else - tolua_cclass(tolua_S,"cTracer","cTracer","",NULL); - #endif - tolua_beginmodule(tolua_S,"cTracer"); - tolua_variable(tolua_S,"BlockHitPosition",tolua_get_cTracer_BlockHitPosition,tolua_set_cTracer_BlockHitPosition); - tolua_variable(tolua_S,"HitNormal",tolua_get_cTracer_HitNormal,tolua_set_cTracer_HitNormal); - tolua_variable(tolua_S,"RealHit",tolua_get_cTracer_RealHit,tolua_set_cTracer_RealHit); - tolua_function(tolua_S,"new",tolua_AllToLua_cTracer_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cTracer_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cTracer_new00_local); - tolua_function(tolua_S,"delete",tolua_AllToLua_cTracer_delete00); - tolua_function(tolua_S,"Trace",tolua_AllToLua_cTracer_Trace00); - tolua_function(tolua_S,"Trace",tolua_AllToLua_cTracer_Trace01); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cGroup","cGroup","",NULL); - tolua_beginmodule(tolua_S,"cGroup"); - tolua_function(tolua_S,"SetName",tolua_AllToLua_cGroup_SetName00); - tolua_function(tolua_S,"GetName",tolua_AllToLua_cGroup_GetName00); - tolua_function(tolua_S,"SetColor",tolua_AllToLua_cGroup_SetColor00); - tolua_function(tolua_S,"AddCommand",tolua_AllToLua_cGroup_AddCommand00); - tolua_function(tolua_S,"AddPermission",tolua_AllToLua_cGroup_AddPermission00); - tolua_function(tolua_S,"InheritFrom",tolua_AllToLua_cGroup_InheritFrom00); - tolua_function(tolua_S,"HasCommand",tolua_AllToLua_cGroup_HasCommand00); - tolua_function(tolua_S,"GetColor",tolua_AllToLua_cGroup_GetColor00); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"cBlockArea","cBlockArea","",tolua_collect_cBlockArea); - #else - tolua_cclass(tolua_S,"cBlockArea","cBlockArea","",NULL); - #endif - tolua_beginmodule(tolua_S,"cBlockArea"); - tolua_constant(tolua_S,"baTypes",cBlockArea::baTypes); - tolua_constant(tolua_S,"baMetas",cBlockArea::baMetas); - tolua_constant(tolua_S,"baLight",cBlockArea::baLight); - tolua_constant(tolua_S,"baSkyLight",cBlockArea::baSkyLight); - tolua_constant(tolua_S,"msOverwrite",cBlockArea::msOverwrite); - tolua_constant(tolua_S,"msFillAir",cBlockArea::msFillAir); - tolua_constant(tolua_S,"msImprint",cBlockArea::msImprint); - tolua_constant(tolua_S,"msLake",cBlockArea::msLake); - tolua_function(tolua_S,"new",tolua_AllToLua_cBlockArea_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cBlockArea_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cBlockArea_new00_local); - tolua_function(tolua_S,"delete",tolua_AllToLua_cBlockArea_delete00); - tolua_function(tolua_S,"Clear",tolua_AllToLua_cBlockArea_Clear00); - tolua_function(tolua_S,"Create",tolua_AllToLua_cBlockArea_Create00); - tolua_function(tolua_S,"Create",tolua_AllToLua_cBlockArea_Create01); - tolua_function(tolua_S,"SetOrigin",tolua_AllToLua_cBlockArea_SetOrigin00); - tolua_function(tolua_S,"Read",tolua_AllToLua_cBlockArea_Read00); - tolua_function(tolua_S,"Read",tolua_AllToLua_cBlockArea_Read01); - tolua_function(tolua_S,"Write",tolua_AllToLua_cBlockArea_Write00); - tolua_function(tolua_S,"Write",tolua_AllToLua_cBlockArea_Write01); - tolua_function(tolua_S,"CopyTo",tolua_AllToLua_cBlockArea_CopyTo00); - tolua_function(tolua_S,"CopyFrom",tolua_AllToLua_cBlockArea_CopyFrom00); - tolua_function(tolua_S,"DumpToRawFile",tolua_AllToLua_cBlockArea_DumpToRawFile00); - tolua_function(tolua_S,"LoadFromSchematicFile",tolua_AllToLua_cBlockArea_LoadFromSchematicFile00); - tolua_function(tolua_S,"SaveToSchematicFile",tolua_AllToLua_cBlockArea_SaveToSchematicFile00); - tolua_function(tolua_S,"Crop",tolua_AllToLua_cBlockArea_Crop00); - tolua_function(tolua_S,"Expand",tolua_AllToLua_cBlockArea_Expand00); - tolua_function(tolua_S,"Merge",tolua_AllToLua_cBlockArea_Merge00); - tolua_function(tolua_S,"Fill",tolua_AllToLua_cBlockArea_Fill00); - tolua_function(tolua_S,"FillRelCuboid",tolua_AllToLua_cBlockArea_FillRelCuboid00); - tolua_function(tolua_S,"RelLine",tolua_AllToLua_cBlockArea_RelLine00); - tolua_function(tolua_S,"RotateCCW",tolua_AllToLua_cBlockArea_RotateCCW00); - tolua_function(tolua_S,"RotateCW",tolua_AllToLua_cBlockArea_RotateCW00); - tolua_function(tolua_S,"MirrorXY",tolua_AllToLua_cBlockArea_MirrorXY00); - tolua_function(tolua_S,"MirrorXZ",tolua_AllToLua_cBlockArea_MirrorXZ00); - tolua_function(tolua_S,"MirrorYZ",tolua_AllToLua_cBlockArea_MirrorYZ00); - tolua_function(tolua_S,"RotateCCWNoMeta",tolua_AllToLua_cBlockArea_RotateCCWNoMeta00); - tolua_function(tolua_S,"RotateCWNoMeta",tolua_AllToLua_cBlockArea_RotateCWNoMeta00); - tolua_function(tolua_S,"MirrorXYNoMeta",tolua_AllToLua_cBlockArea_MirrorXYNoMeta00); - tolua_function(tolua_S,"MirrorXZNoMeta",tolua_AllToLua_cBlockArea_MirrorXZNoMeta00); - tolua_function(tolua_S,"MirrorYZNoMeta",tolua_AllToLua_cBlockArea_MirrorYZNoMeta00); - tolua_function(tolua_S,"SetRelBlockType",tolua_AllToLua_cBlockArea_SetRelBlockType00); - tolua_function(tolua_S,"SetBlockType",tolua_AllToLua_cBlockArea_SetBlockType00); - tolua_function(tolua_S,"SetRelBlockMeta",tolua_AllToLua_cBlockArea_SetRelBlockMeta00); - tolua_function(tolua_S,"SetBlockMeta",tolua_AllToLua_cBlockArea_SetBlockMeta00); - tolua_function(tolua_S,"SetRelBlockLight",tolua_AllToLua_cBlockArea_SetRelBlockLight00); - tolua_function(tolua_S,"SetBlockLight",tolua_AllToLua_cBlockArea_SetBlockLight00); - tolua_function(tolua_S,"SetRelBlockSkyLight",tolua_AllToLua_cBlockArea_SetRelBlockSkyLight00); - tolua_function(tolua_S,"SetBlockSkyLight",tolua_AllToLua_cBlockArea_SetBlockSkyLight00); - tolua_function(tolua_S,"GetRelBlockType",tolua_AllToLua_cBlockArea_GetRelBlockType00); - tolua_function(tolua_S,"GetBlockType",tolua_AllToLua_cBlockArea_GetBlockType00); - tolua_function(tolua_S,"GetRelBlockMeta",tolua_AllToLua_cBlockArea_GetRelBlockMeta00); - tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cBlockArea_GetBlockMeta00); - tolua_function(tolua_S,"GetRelBlockLight",tolua_AllToLua_cBlockArea_GetRelBlockLight00); - tolua_function(tolua_S,"GetBlockLight",tolua_AllToLua_cBlockArea_GetBlockLight00); - tolua_function(tolua_S,"GetRelBlockSkyLight",tolua_AllToLua_cBlockArea_GetRelBlockSkyLight00); - tolua_function(tolua_S,"GetBlockSkyLight",tolua_AllToLua_cBlockArea_GetBlockSkyLight00); - tolua_function(tolua_S,"SetBlockTypeMeta",tolua_AllToLua_cBlockArea_SetBlockTypeMeta00); - tolua_function(tolua_S,"SetRelBlockTypeMeta",tolua_AllToLua_cBlockArea_SetRelBlockTypeMeta00); - tolua_function(tolua_S,"GetBlockTypeMeta",tolua_AllToLua_cBlockArea_GetBlockTypeMeta00); - tolua_function(tolua_S,"GetRelBlockTypeMeta",tolua_AllToLua_cBlockArea_GetRelBlockTypeMeta00); - tolua_function(tolua_S,"GetSizeX",tolua_AllToLua_cBlockArea_GetSizeX00); - tolua_function(tolua_S,"GetSizeY",tolua_AllToLua_cBlockArea_GetSizeY00); - tolua_function(tolua_S,"GetSizeZ",tolua_AllToLua_cBlockArea_GetSizeZ00); - tolua_function(tolua_S,"GetOriginX",tolua_AllToLua_cBlockArea_GetOriginX00); - tolua_function(tolua_S,"GetOriginY",tolua_AllToLua_cBlockArea_GetOriginY00); - tolua_function(tolua_S,"GetOriginZ",tolua_AllToLua_cBlockArea_GetOriginZ00); - tolua_function(tolua_S,"GetDataTypes",tolua_AllToLua_cBlockArea_GetDataTypes00); - tolua_function(tolua_S,"HasBlockTypes",tolua_AllToLua_cBlockArea_HasBlockTypes00); - tolua_function(tolua_S,"HasBlockMetas",tolua_AllToLua_cBlockArea_HasBlockMetas00); - tolua_function(tolua_S,"HasBlockLights",tolua_AllToLua_cBlockArea_HasBlockLights00); - tolua_function(tolua_S,"HasBlockSkyLights",tolua_AllToLua_cBlockArea_HasBlockSkyLights00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cChunkDesc","cChunkDesc","",NULL); - tolua_beginmodule(tolua_S,"cChunkDesc"); - tolua_function(tolua_S,"GetChunkX",tolua_AllToLua_cChunkDesc_GetChunkX00); - tolua_function(tolua_S,"GetChunkZ",tolua_AllToLua_cChunkDesc_GetChunkZ00); - tolua_function(tolua_S,"FillBlocks",tolua_AllToLua_cChunkDesc_FillBlocks00); - tolua_function(tolua_S,"SetBlockTypeMeta",tolua_AllToLua_cChunkDesc_SetBlockTypeMeta00); - tolua_function(tolua_S,"GetBlockTypeMeta",tolua_AllToLua_cChunkDesc_GetBlockTypeMeta00); - tolua_function(tolua_S,"SetBlockType",tolua_AllToLua_cChunkDesc_SetBlockType00); - tolua_function(tolua_S,"GetBlockType",tolua_AllToLua_cChunkDesc_GetBlockType00); - tolua_function(tolua_S,"SetBlockMeta",tolua_AllToLua_cChunkDesc_SetBlockMeta00); - tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cChunkDesc_GetBlockMeta00); - tolua_function(tolua_S,"SetBiome",tolua_AllToLua_cChunkDesc_SetBiome00); - tolua_function(tolua_S,"GetBiome",tolua_AllToLua_cChunkDesc_GetBiome00); - tolua_function(tolua_S,"SetHeight",tolua_AllToLua_cChunkDesc_SetHeight00); - tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cChunkDesc_GetHeight00); - tolua_function(tolua_S,"SetUseDefaultBiomes",tolua_AllToLua_cChunkDesc_SetUseDefaultBiomes00); - tolua_function(tolua_S,"IsUsingDefaultBiomes",tolua_AllToLua_cChunkDesc_IsUsingDefaultBiomes00); - tolua_function(tolua_S,"SetUseDefaultHeight",tolua_AllToLua_cChunkDesc_SetUseDefaultHeight00); - tolua_function(tolua_S,"IsUsingDefaultHeight",tolua_AllToLua_cChunkDesc_IsUsingDefaultHeight00); - tolua_function(tolua_S,"SetUseDefaultComposition",tolua_AllToLua_cChunkDesc_SetUseDefaultComposition00); - tolua_function(tolua_S,"IsUsingDefaultComposition",tolua_AllToLua_cChunkDesc_IsUsingDefaultComposition00); - tolua_function(tolua_S,"SetUseDefaultStructures",tolua_AllToLua_cChunkDesc_SetUseDefaultStructures00); - tolua_function(tolua_S,"IsUsingDefaultStructures",tolua_AllToLua_cChunkDesc_IsUsingDefaultStructures00); - tolua_function(tolua_S,"SetUseDefaultFinish",tolua_AllToLua_cChunkDesc_SetUseDefaultFinish00); - tolua_function(tolua_S,"IsUsingDefaultFinish",tolua_AllToLua_cChunkDesc_IsUsingDefaultFinish00); - tolua_function(tolua_S,"WriteBlockArea",tolua_AllToLua_cChunkDesc_WriteBlockArea00); - tolua_function(tolua_S,"ReadBlockArea",tolua_AllToLua_cChunkDesc_ReadBlockArea00); - tolua_function(tolua_S,"GetMaxHeight",tolua_AllToLua_cChunkDesc_GetMaxHeight00); - tolua_function(tolua_S,"FillRelCuboid",tolua_AllToLua_cChunkDesc_FillRelCuboid00); - tolua_function(tolua_S,"FillRelCuboid",tolua_AllToLua_cChunkDesc_FillRelCuboid01); - tolua_function(tolua_S,"ReplaceRelCuboid",tolua_AllToLua_cChunkDesc_ReplaceRelCuboid00); - tolua_function(tolua_S,"ReplaceRelCuboid",tolua_AllToLua_cChunkDesc_ReplaceRelCuboid01); - tolua_function(tolua_S,"FloorRelCuboid",tolua_AllToLua_cChunkDesc_FloorRelCuboid00); - tolua_function(tolua_S,"FloorRelCuboid",tolua_AllToLua_cChunkDesc_FloorRelCuboid01); - tolua_function(tolua_S,"RandomFillRelCuboid",tolua_AllToLua_cChunkDesc_RandomFillRelCuboid00); - tolua_function(tolua_S,"RandomFillRelCuboid",tolua_AllToLua_cChunkDesc_RandomFillRelCuboid01); - tolua_function(tolua_S,"GetBlockEntity",tolua_AllToLua_cChunkDesc_GetBlockEntity00); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"cCraftingGrid","cCraftingGrid","",tolua_collect_cCraftingGrid); - #else - tolua_cclass(tolua_S,"cCraftingGrid","cCraftingGrid","",NULL); - #endif - tolua_beginmodule(tolua_S,"cCraftingGrid"); - tolua_function(tolua_S,"new",tolua_AllToLua_cCraftingGrid_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cCraftingGrid_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cCraftingGrid_new00_local); - tolua_function(tolua_S,"GetWidth",tolua_AllToLua_cCraftingGrid_GetWidth00); - tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cCraftingGrid_GetHeight00); - tolua_function(tolua_S,"GetItem",tolua_AllToLua_cCraftingGrid_GetItem00); - tolua_function(tolua_S,"SetItem",tolua_AllToLua_cCraftingGrid_SetItem00); - tolua_function(tolua_S,"SetItem",tolua_AllToLua_cCraftingGrid_SetItem01); - tolua_function(tolua_S,"Clear",tolua_AllToLua_cCraftingGrid_Clear00); - tolua_function(tolua_S,"ConsumeGrid",tolua_AllToLua_cCraftingGrid_ConsumeGrid00); - tolua_function(tolua_S,"Dump",tolua_AllToLua_cCraftingGrid_Dump00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cCraftingRecipe","cCraftingRecipe","",NULL); - tolua_beginmodule(tolua_S,"cCraftingRecipe"); - tolua_function(tolua_S,"Clear",tolua_AllToLua_cCraftingRecipe_Clear00); - tolua_function(tolua_S,"GetIngredientsWidth",tolua_AllToLua_cCraftingRecipe_GetIngredientsWidth00); - tolua_function(tolua_S,"GetIngredientsHeight",tolua_AllToLua_cCraftingRecipe_GetIngredientsHeight00); - tolua_function(tolua_S,"GetIngredient",tolua_AllToLua_cCraftingRecipe_GetIngredient00); - tolua_function(tolua_S,"GetResult",tolua_AllToLua_cCraftingRecipe_GetResult00); - tolua_function(tolua_S,"SetResult",tolua_AllToLua_cCraftingRecipe_SetResult00); - tolua_function(tolua_S,"SetResult",tolua_AllToLua_cCraftingRecipe_SetResult01); - tolua_function(tolua_S,"SetIngredient",tolua_AllToLua_cCraftingRecipe_SetIngredient00); - tolua_function(tolua_S,"SetIngredient",tolua_AllToLua_cCraftingRecipe_SetIngredient01); - tolua_function(tolua_S,"ConsumeIngredients",tolua_AllToLua_cCraftingRecipe_ConsumeIngredients00); - tolua_function(tolua_S,"Dump",tolua_AllToLua_cCraftingRecipe_Dump00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cWindow","cWindow","",NULL); - tolua_beginmodule(tolua_S,"cWindow"); - tolua_constant(tolua_S,"wtInventory",cWindow::wtInventory); - tolua_constant(tolua_S,"wtChest",cWindow::wtChest); - tolua_constant(tolua_S,"wtWorkbench",cWindow::wtWorkbench); - tolua_constant(tolua_S,"wtFurnace",cWindow::wtFurnace); - tolua_constant(tolua_S,"wtDropSpenser",cWindow::wtDropSpenser); - tolua_constant(tolua_S,"wtEnchantment",cWindow::wtEnchantment); - tolua_constant(tolua_S,"wtBrewery",cWindow::wtBrewery); - tolua_constant(tolua_S,"wtNPCTrade",cWindow::wtNPCTrade); - tolua_constant(tolua_S,"wtBeacon",cWindow::wtBeacon); - tolua_constant(tolua_S,"wtAnvil",cWindow::wtAnvil); - tolua_constant(tolua_S,"wtHopper",cWindow::wtHopper); - tolua_constant(tolua_S,"wtAnimalChest",cWindow::wtAnimalChest); - tolua_function(tolua_S,"GetWindowID",tolua_AllToLua_cWindow_GetWindowID00); - tolua_function(tolua_S,"GetWindowType",tolua_AllToLua_cWindow_GetWindowType00); - tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cWindow_GetSlot00); - tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cWindow_SetSlot00); - tolua_function(tolua_S,"IsSlotInPlayerMainInventory",tolua_AllToLua_cWindow_IsSlotInPlayerMainInventory00); - tolua_function(tolua_S,"IsSlotInPlayerHotbar",tolua_AllToLua_cWindow_IsSlotInPlayerHotbar00); - tolua_function(tolua_S,"IsSlotInPlayerInventory",tolua_AllToLua_cWindow_IsSlotInPlayerInventory00); - tolua_function(tolua_S,"GetWindowTitle",tolua_AllToLua_cWindow_GetWindowTitle00); - tolua_function(tolua_S,"SetWindowTitle",tolua_AllToLua_cWindow_SetWindowTitle00); - tolua_function(tolua_S,"SetProperty",tolua_AllToLua_cWindow_SetProperty00); - tolua_function(tolua_S,"SetProperty",tolua_AllToLua_cWindow_SetProperty01); - tolua_endmodule(tolua_S); - #ifdef __cplusplus - tolua_cclass(tolua_S,"cLuaWindow","cLuaWindow","cWindow",tolua_collect_cLuaWindow); - #else - tolua_cclass(tolua_S,"cLuaWindow","cLuaWindow","cWindow",NULL); - #endif - tolua_beginmodule(tolua_S,"cLuaWindow"); - tolua_function(tolua_S,"new",tolua_AllToLua_cLuaWindow_new00); - tolua_function(tolua_S,"new_local",tolua_AllToLua_cLuaWindow_new00_local); - tolua_function(tolua_S,".call",tolua_AllToLua_cLuaWindow_new00_local); - tolua_function(tolua_S,"delete",tolua_AllToLua_cLuaWindow_delete00); - tolua_function(tolua_S,"GetContents",tolua_AllToLua_cLuaWindow_GetContents00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cMonster","cMonster","cPawn",NULL); - tolua_beginmodule(tolua_S,"cMonster"); - tolua_constant(tolua_S,"mtInvalidType",cMonster::mtInvalidType); - tolua_constant(tolua_S,"mtBat",cMonster::mtBat); - tolua_constant(tolua_S,"mtBlaze",cMonster::mtBlaze); - tolua_constant(tolua_S,"mtCaveSpider",cMonster::mtCaveSpider); - tolua_constant(tolua_S,"mtChicken",cMonster::mtChicken); - tolua_constant(tolua_S,"mtCow",cMonster::mtCow); - tolua_constant(tolua_S,"mtCreeper",cMonster::mtCreeper); - tolua_constant(tolua_S,"mtEnderDragon",cMonster::mtEnderDragon); - tolua_constant(tolua_S,"mtEnderman",cMonster::mtEnderman); - tolua_constant(tolua_S,"mtGhast",cMonster::mtGhast); - tolua_constant(tolua_S,"mtGiant",cMonster::mtGiant); - tolua_constant(tolua_S,"mtHorse",cMonster::mtHorse); - tolua_constant(tolua_S,"mtIronGolem",cMonster::mtIronGolem); - tolua_constant(tolua_S,"mtMagmaCube",cMonster::mtMagmaCube); - tolua_constant(tolua_S,"mtMooshroom",cMonster::mtMooshroom); - tolua_constant(tolua_S,"mtOcelot",cMonster::mtOcelot); - tolua_constant(tolua_S,"mtPig",cMonster::mtPig); - tolua_constant(tolua_S,"mtSheep",cMonster::mtSheep); - tolua_constant(tolua_S,"mtSilverfish",cMonster::mtSilverfish); - tolua_constant(tolua_S,"mtSkeleton",cMonster::mtSkeleton); - tolua_constant(tolua_S,"mtSlime",cMonster::mtSlime); - tolua_constant(tolua_S,"mtSnowGolem",cMonster::mtSnowGolem); - tolua_constant(tolua_S,"mtSpider",cMonster::mtSpider); - tolua_constant(tolua_S,"mtSquid",cMonster::mtSquid); - tolua_constant(tolua_S,"mtVillager",cMonster::mtVillager); - tolua_constant(tolua_S,"mtWitch",cMonster::mtWitch); - tolua_constant(tolua_S,"mtWither",cMonster::mtWither); - tolua_constant(tolua_S,"mtWolf",cMonster::mtWolf); - tolua_constant(tolua_S,"mtZombie",cMonster::mtZombie); - tolua_constant(tolua_S,"mtZombiePigman",cMonster::mtZombiePigman); - tolua_constant(tolua_S,"mfHostile",cMonster::mfHostile); - tolua_constant(tolua_S,"mfPassive",cMonster::mfPassive); - tolua_constant(tolua_S,"mfAmbient",cMonster::mfAmbient); - tolua_constant(tolua_S,"mfWater",cMonster::mfWater); - tolua_constant(tolua_S,"mfMaxplusone",cMonster::mfMaxplusone); - tolua_function(tolua_S,"GetMobType",tolua_AllToLua_cMonster_GetMobType00); - tolua_function(tolua_S,"GetMobFamily",tolua_AllToLua_cMonster_GetMobFamily00); - tolua_function(tolua_S,"MobTypeToString",tolua_AllToLua_cMonster_MobTypeToString00); - tolua_function(tolua_S,"StringToMobType",tolua_AllToLua_cMonster_StringToMobType00); - tolua_function(tolua_S,"FamilyFromType",tolua_AllToLua_cMonster_FamilyFromType00); - tolua_function(tolua_S,"GetSpawnDelay",tolua_AllToLua_cMonster_GetSpawnDelay00); - tolua_endmodule(tolua_S); - tolua_cclass(tolua_S,"cLineBlockTracer","cLineBlockTracer","",NULL); - tolua_beginmodule(tolua_S,"cLineBlockTracer"); - tolua_endmodule(tolua_S); - tolua_endmodule(tolua_S); - return 1; -} - - -#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 - TOLUA_API int luaopen_AllToLua (lua_State* tolua_S) { - return tolua_AllToLua_open(tolua_S); -}; -#endif - diff --git a/source/Bindings.h b/source/Bindings.h deleted file mode 100644 index 240ceec30..000000000 --- a/source/Bindings.h +++ /dev/null @@ -1,8 +0,0 @@ -/* -** Lua binding: AllToLua -** Generated automatically by tolua++-1.0.92 on 11/26/13 15:29:20. -*/ - -/* Exported function */ -TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S); - diff --git a/source/BlockEntities/ChestEntity.cpp b/source/BlockEntities/ChestEntity.cpp deleted file mode 100644 index ca2626bc9..000000000 --- a/source/BlockEntities/ChestEntity.cpp +++ /dev/null @@ -1,172 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "ChestEntity.h" -#include "../Item.h" -#include "../Entities/Player.h" -#include "../UI/Window.h" -#include <json/json.h> - - - - - -cChestEntity::cChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) : - super(E_BLOCK_CHEST, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World) -{ - cBlockEntityWindowOwner::SetBlockEntity(this); -} - - - - - -cChestEntity::~cChestEntity() -{ - cWindow * Window = GetWindow(); - if (Window != NULL) - { - Window->OwnerDestroyed(); - } -} - - - - - -bool cChestEntity::LoadFromJson(const Json::Value & a_Value) -{ - m_PosX = a_Value.get("x", 0).asInt(); - m_PosY = a_Value.get("y", 0).asInt(); - m_PosZ = a_Value.get("z", 0).asInt(); - - Json::Value AllSlots = a_Value.get("Slots", 0); - int SlotIdx = 0; - for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr) - { - cItem Item; - Item.FromJson(*itr); - SetSlot(SlotIdx, Item); - SlotIdx++; - } - return true; -} - - - - - -void cChestEntity::SaveToJson(Json::Value & a_Value) -{ - a_Value["x"] = m_PosX; - a_Value["y"] = m_PosY; - a_Value["z"] = m_PosZ; - - Json::Value AllSlots; - for (int i = m_Contents.GetNumSlots() - 1; i >= 0; i--) - { - Json::Value Slot; - m_Contents.GetSlot(i).GetJson(Slot); - AllSlots.append(Slot); - } - a_Value["Slots"] = AllSlots; -} - - - - - -void cChestEntity::SendTo(cClientHandle & a_Client) -{ - // The chest entity doesn't need anything sent to the client when it's created / gets in the viewdistance - // All the actual handling is in the cWindow UI code that gets called when the chest is rclked - - UNUSED(a_Client); -} - - - - - -void cChestEntity::UsedBy(cPlayer * a_Player) -{ - // If the window is not created, open it anew: - cWindow * Window = GetWindow(); - if (Window == NULL) - { - OpenNewWindow(); - Window = GetWindow(); - } - - // Open the window for the player: - if (Window != NULL) - { - if (a_Player->GetWindow() != Window) - { - a_Player->OpenWindow(Window); - } - } - - // This is rather a hack - // Instead of marking the chunk as dirty upon chest contents change, we mark it dirty now - // We cannot properly detect contents change, but such a change doesn't happen without a player opening the chest first. - // The few false positives aren't much to worry about - int ChunkX, ChunkZ; - cChunkDef::BlockToChunk(m_PosX, m_PosZ, ChunkX, ChunkZ); - m_World->MarkChunkDirty(ChunkX, ChunkZ); -} - - - - - -void cChestEntity::OpenNewWindow(void) -{ - // Callback for opening together with neighbor chest: - class cOpenDouble : - public cChestCallback - { - cChestEntity * m_ThisChest; - public: - cOpenDouble(cChestEntity * a_ThisChest) : - m_ThisChest(a_ThisChest) - { - } - - virtual bool Item(cChestEntity * a_Chest) override - { - // The primary chest should eb the one with lesser X or Z coord: - cChestEntity * Primary = a_Chest; - cChestEntity * Secondary = m_ThisChest; - if ( - (Primary->GetPosX() > Secondary->GetPosX()) || - (Primary->GetPosZ() > Secondary->GetPosZ()) - ) - { - std::swap(Primary, Secondary); - } - m_ThisChest->OpenWindow(new cChestWindow(Primary, Secondary)); - return false; - } - } ; - - // Scan neighbors for adjacent chests: - cOpenDouble OpenDbl(this); - if ( - m_World->DoWithChestAt(m_PosX - 1, m_PosY, m_PosZ, OpenDbl) || - m_World->DoWithChestAt(m_PosX + 1, m_PosY, m_PosZ, OpenDbl) || - m_World->DoWithChestAt(m_PosX , m_PosY, m_PosZ - 1, OpenDbl) || - m_World->DoWithChestAt(m_PosX , m_PosY, m_PosZ + 1, OpenDbl) - ) - { - // The double-chest window has been opened in the callback - return; - } - - // There is no chest neighbor, open a single-chest window: - OpenWindow(new cChestWindow(this)); -} - - - - diff --git a/source/BlockEntities/FurnaceEntity.cpp b/source/BlockEntities/FurnaceEntity.cpp deleted file mode 100644 index ec5ebe8b9..000000000 --- a/source/BlockEntities/FurnaceEntity.cpp +++ /dev/null @@ -1,479 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "FurnaceEntity.h" -#include "../UI/Window.h" -#include "../Entities/Player.h" -#include "../Root.h" -#include "../Chunk.h" -#include <json/json.h> - - - - - - -enum -{ - PROGRESSBAR_SMELTING = 0, - PROGRESSBAR_FUEL = 1, -} ; - - - - - -cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cWorld * a_World) : - super(E_BLOCK_FURNACE, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World), - m_BlockType(a_BlockType), - m_BlockMeta(a_BlockMeta), - m_CurrentRecipe(NULL), - m_IsCooking((a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_LIT_FURNACE)), - m_NeedCookTime(0), - m_TimeCooked(0), - m_FuelBurnTime(0), - m_TimeBurned(0), - m_LastProgressFuel(0), - m_LastProgressCook(0) -{ - cBlockEntityWindowOwner::SetBlockEntity(this); - m_Contents.AddListener(*this); -} - - - - - -cFurnaceEntity::~cFurnaceEntity() -{ - // Tell window its owner is destroyed - cWindow * Window = GetWindow(); - if (Window != NULL) - { - Window->OwnerDestroyed(); - } -} - - - - - -void cFurnaceEntity::UsedBy(cPlayer * a_Player) -{ - if (GetWindow() == NULL) - { - OpenWindow(new cFurnaceWindow(m_PosX, m_PosY, m_PosZ, this)); - } - cWindow * Window = GetWindow(); - if (Window != NULL) - { - if (a_Player->GetWindow() != Window) - { - a_Player->OpenWindow(Window); - BroadcastProgress(PROGRESSBAR_FUEL, m_LastProgressFuel); - BroadcastProgress(PROGRESSBAR_SMELTING, m_LastProgressCook); - } - } -} - - - - - -/// Restarts cooking. Used after the furnace is loaded from storage to set up the internal variables so that cooking continues, if it was active. Returns true if cooking. -bool cFurnaceEntity::ContinueCooking(void) -{ - UpdateInput(); - UpdateFuel(); - return m_IsCooking; -} - - - - - -bool cFurnaceEntity::Tick(float a_Dt, cChunk & a_Chunk) -{ - if (m_FuelBurnTime <= 0) - { - // No fuel is burning, reset progressbars and bail out - if ((m_LastProgressCook > 0) || (m_LastProgressFuel > 0)) - { - UpdateProgressBars(); - } - return false; - } - - if (m_IsCooking) - { - m_TimeCooked++; - if (m_TimeCooked >= m_NeedCookTime) - { - // Finished smelting one item - FinishOne(a_Chunk); - } - } - - m_TimeBurned++; - if (m_TimeBurned >= m_FuelBurnTime) - { - // The current fuel has been exhausted, use another one, if possible - BurnNewFuel(); - } - - UpdateProgressBars(); - - return true; -} - - - - - -bool cFurnaceEntity::LoadFromJson(const Json::Value & a_Value) -{ - m_PosX = a_Value.get("x", 0).asInt(); - m_PosY = a_Value.get("y", 0).asInt(); - m_PosZ = a_Value.get("z", 0).asInt(); - - Json::Value AllSlots = a_Value.get("Slots", 0); - int SlotIdx = 0; - for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr) - { - cItem Item; - Item.FromJson(*itr); - SetSlot(SlotIdx, Item); - SlotIdx++; - } - - m_NeedCookTime = (int)(a_Value.get("CookTime", 0).asDouble() / 50); - m_TimeCooked = (int)(a_Value.get("TimeCooked", 0).asDouble() / 50); - m_FuelBurnTime = (int)(a_Value.get("BurnTime", 0).asDouble() / 50); - m_TimeBurned = (int)(a_Value.get("TimeBurned", 0).asDouble() / 50); - - return true; -} - - - - - -void cFurnaceEntity::SaveToJson( Json::Value& a_Value ) -{ - a_Value["x"] = m_PosX; - a_Value["y"] = m_PosY; - a_Value["z"] = m_PosZ; - - Json::Value AllSlots; - int NumSlots = m_Contents.GetNumSlots(); - for (int i = 0; i < NumSlots; i++) - { - Json::Value Slot; - m_Contents.GetSlot(i).GetJson(Slot); - AllSlots.append(Slot); - } - a_Value["Slots"] = AllSlots; - - a_Value["CookTime"] = m_NeedCookTime * 50; - a_Value["TimeCooked"] = m_TimeCooked * 50; - a_Value["BurnTime"] = m_FuelBurnTime * 50; - a_Value["TimeBurned"] = m_TimeBurned * 50; -} - - - - - -void cFurnaceEntity::SendTo(cClientHandle & a_Client) -{ - // Nothing needs to be sent - UNUSED(a_Client); -} - - - - - -void cFurnaceEntity::BroadcastProgress(int a_ProgressbarID, short a_Value) -{ - cWindow * Window = GetWindow(); - if (Window != NULL) - { - Window->BroadcastProgress(a_ProgressbarID, a_Value); - } -} - - - - - -/// One item finished cooking -void cFurnaceEntity::FinishOne(cChunk & a_Chunk) -{ - m_TimeCooked = 0; - - if (m_Contents.GetSlot(fsOutput).IsEmpty()) - { - m_Contents.SetSlot(fsOutput, *m_CurrentRecipe->Out); - } - else - { - m_Contents.ChangeSlotCount(fsOutput, m_CurrentRecipe->Out->m_ItemCount); - } - m_Contents.ChangeSlotCount(fsInput, -m_CurrentRecipe->In->m_ItemCount); - - UpdateIsCooking(); -} - - - - - -void cFurnaceEntity::BurnNewFuel(void) -{ - cFurnaceRecipe * FR = cRoot::Get()->GetFurnaceRecipe(); - int NewTime = FR->GetBurnTime(m_Contents.GetSlot(fsFuel)); - if (NewTime == 0) - { - // The item in the fuel slot is not suitable - m_FuelBurnTime = 0; - m_TimeBurned = 0; - SetIsCooking(false); - return; - } - - // Is the input and output ready for cooking? - if (!CanCookInputToOutput()) - { - return; - } - - // Burn one new fuel: - m_FuelBurnTime = NewTime; - m_TimeBurned = 0; - SetIsCooking(true); - if (m_Contents.GetSlot(fsFuel).m_ItemType == E_ITEM_LAVA_BUCKET) - { - m_Contents.SetSlot(fsFuel, cItem(E_ITEM_BUCKET)); - } - else - { - m_Contents.ChangeSlotCount(fsFuel, -1); - } -} - - - - - -void cFurnaceEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) -{ - super::OnSlotChanged(a_ItemGrid, a_SlotNum); - - if (m_World == NULL) - { - // The furnace isn't initialized yet, do no processing - return; - } - - ASSERT(a_ItemGrid == &m_Contents); - switch (a_SlotNum) - { - case fsInput: - { - UpdateInput(); - break; - } - - case fsFuel: - { - UpdateFuel(); - break; - } - - case fsOutput: - { - UpdateOutput(); - break; - } - } -} - - - - - - -/// Updates the current recipe, based on the current input -void cFurnaceEntity::UpdateInput(void) -{ - if (!m_Contents.GetSlot(fsInput).IsStackableWith(m_LastInput)) - { - // The input is different from what we had before, reset the cooking time - m_TimeCooked = 0; - } - m_LastInput = m_Contents.GetSlot(fsInput); - - cFurnaceRecipe * FR = cRoot::Get()->GetFurnaceRecipe(); - m_CurrentRecipe = FR->GetRecipeFrom(m_Contents.GetSlot(fsInput)); - if (!CanCookInputToOutput()) - { - // This input cannot be cooked - m_NeedCookTime = 0; - SetIsCooking(false); - } - else - { - m_NeedCookTime = m_CurrentRecipe->CookTime; - SetIsCooking(true); - - // Start burning new fuel if there's no flame now: - if (GetFuelBurnTimeLeft() <= 0) - { - BurnNewFuel(); - } - } -} - - - - - -/// Called when the fuel slot changes or when the fuel is spent, burns another piece of fuel if appropriate -void cFurnaceEntity::UpdateFuel(void) -{ - if (m_FuelBurnTime > m_TimeBurned) - { - // The current fuel is still burning, don't modify anything: - return; - } - - // The current fuel is spent, try to burn some more: - BurnNewFuel(); -} - - - - - -/// Called when the output slot changes; starts burning if space became available -void cFurnaceEntity::UpdateOutput(void) -{ - if (!CanCookInputToOutput()) - { - // Cannot cook anymore: - m_TimeCooked = 0; - m_NeedCookTime = 0; - SetIsCooking(false); - return; - } - - // No need to burn new fuel, the Tick() function will take care of that - - // Can cook, start cooking if not already underway: - m_NeedCookTime = m_CurrentRecipe->CookTime; - SetIsCooking(m_FuelBurnTime > 0); -} - - - - - -/// Updates the m_IsCooking, based on the input slot, output slot and m_FuelBurnTime / m_TimeBurned -void cFurnaceEntity::UpdateIsCooking(void) -{ - if ( - !CanCookInputToOutput() || // Cannot cook this - (m_FuelBurnTime <= 0) || // No fuel - (m_TimeBurned >= m_FuelBurnTime) // Fuel burnt out - ) - { - // Reset everything - SetIsCooking(false); - m_TimeCooked = 0; - m_NeedCookTime = 0; - return; - } - - SetIsCooking(true); -} - - - - - -/// Returns true if the input can be cooked into output and the item counts allow for another cooking operation -bool cFurnaceEntity::CanCookInputToOutput(void) const -{ - if (m_CurrentRecipe == NULL) - { - // This input cannot be cooked - return false; - } - - if (m_Contents.GetSlot(fsOutput).IsEmpty()) - { - // The output is empty, can cook - return true; - } - - if (!m_Contents.GetSlot(fsOutput).IsStackableWith(*m_CurrentRecipe->Out)) - { - // The output slot is blocked with something that cannot be stacked with the recipe's output - return false; - } - - if (m_Contents.GetSlot(fsOutput).IsFullStack()) - { - // Cannot add any more items to the output slot - return false; - } - - return true; -} - - - - - -/// Broadcasts progressbar updates, if needed -void cFurnaceEntity::UpdateProgressBars(void) -{ - // In order to preserve bandwidth, an update is sent only every 10th tick - // That's why the comparisons use the division by eight - - int CurFuel = (m_FuelBurnTime > 0) ? (200 - 200 * m_TimeBurned / m_FuelBurnTime) : 0; - if ((CurFuel / 8) != (m_LastProgressFuel / 8)) - { - BroadcastProgress(PROGRESSBAR_FUEL, CurFuel); - m_LastProgressFuel = CurFuel; - } - - int CurCook = (m_NeedCookTime > 0) ? (200 * m_TimeCooked / m_NeedCookTime) : 0; - if ((CurCook / 8) != (m_LastProgressCook / 8)) - { - BroadcastProgress(PROGRESSBAR_SMELTING, CurCook); - m_LastProgressCook = CurCook; - } -} - - - - - -void cFurnaceEntity::SetIsCooking(bool a_IsCooking) -{ - if (a_IsCooking == m_IsCooking) - { - return; - } - - m_IsCooking = a_IsCooking; - - // Light or extinguish the furnace: - m_World->FastSetBlock(m_PosX, m_PosY, m_PosZ, m_IsCooking ? E_BLOCK_LIT_FURNACE : E_BLOCK_FURNACE, m_BlockMeta); -} - - - - diff --git a/source/BlockEntities/JukeboxEntity.cpp b/source/BlockEntities/JukeboxEntity.cpp deleted file mode 100644 index aca376dd3..000000000 --- a/source/BlockEntities/JukeboxEntity.cpp +++ /dev/null @@ -1,125 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "JukeboxEntity.h" -#include "../World.h" -#include <json/json.h> - - - - - -cJukeboxEntity::cJukeboxEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) : - super(E_BLOCK_JUKEBOX, a_BlockX, a_BlockY, a_BlockZ, a_World), - m_Record(0) -{ -} - - - - - -cJukeboxEntity::~cJukeboxEntity() -{ - EjectRecord(); -} - - - - - -void cJukeboxEntity::UsedBy(cPlayer * a_Player) -{ - if (m_Record == 0) - { - const cItem & HeldItem = a_Player->GetEquippedItem(); - if (HeldItem.m_ItemType >= 2256 && HeldItem.m_ItemType <= 2267) - { - m_Record = HeldItem.m_ItemType; - a_Player->GetInventory().RemoveOneEquippedItem(); - PlayRecord(); - } - } - else - { - EjectRecord(); - } -} - - - - - -void cJukeboxEntity::PlayRecord(void) -{ - m_World->BroadcastSoundParticleEffect(1005, m_PosX, m_PosY, m_PosZ, m_Record); -} - - - - - -void cJukeboxEntity::EjectRecord(void) -{ - if ((m_Record < E_ITEM_FIRST_DISC) || (m_Record > E_ITEM_LAST_DISC)) - { - // There's no record here - return; - } - - cItems Drops; - Drops.push_back(cItem(m_Record, 1, 0)); - m_World->SpawnItemPickups(Drops, m_PosX + 0.5, m_PosY + 1, m_PosZ + 0.5, 8); - m_World->BroadcastSoundParticleEffect(1005, m_PosX, m_PosY, m_PosZ, 0); - m_Record = 0; -} - - - - - -int cJukeboxEntity::GetRecord(void) -{ - return m_Record; -} - - - - - -void cJukeboxEntity::SetRecord(int a_Record) -{ - m_Record = a_Record; -} - - - - - -bool cJukeboxEntity::LoadFromJson(const Json::Value & a_Value) -{ - m_PosX = a_Value.get("x", 0).asInt(); - m_PosY = a_Value.get("y", 0).asInt(); - m_PosZ = a_Value.get("z", 0).asInt(); - - m_Record = a_Value.get("Record", 0).asInt(); - - return true; -} - - - - - -void cJukeboxEntity::SaveToJson(Json::Value & a_Value) -{ - a_Value["x"] = m_PosX; - a_Value["y"] = m_PosY; - a_Value["z"] = m_PosZ; - - a_Value["Record"] = m_Record; -} - - - - diff --git a/source/BlockEntities/NoteEntity.cpp b/source/BlockEntities/NoteEntity.cpp deleted file mode 100644 index 1b0620299..000000000 --- a/source/BlockEntities/NoteEntity.cpp +++ /dev/null @@ -1,154 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "NoteEntity.h" -#include "../World.h" -#include <json/json.h> - - - - - -cNoteEntity::cNoteEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) : - super(E_BLOCK_NOTE_BLOCK, a_BlockX, a_BlockY, a_BlockZ, a_World), - m_Pitch(0) -{ -} - - - - - -void cNoteEntity::UsedBy(cPlayer * a_Player) -{ - IncrementPitch(); - MakeSound(); -} - - - - - -void cNoteEntity::MakeSound(void) -{ - char instrument; - AString sampleName; - - switch (m_World->GetBlock(m_PosX, m_PosY - 1, m_PosZ)) - { - case E_BLOCK_PLANKS: - case E_BLOCK_LOG: - case E_BLOCK_NOTE_BLOCK: - { - // TODO: add other wood-based blocks if needed - instrument = E_INST_DOUBLE_BASS; - sampleName = "note.db"; - break; - } - - case E_BLOCK_SAND: - case E_BLOCK_GRAVEL: - case E_BLOCK_SOULSAND: - { - instrument = E_INST_SNARE_DRUM; - sampleName = "note.snare"; - break; - } - - case E_BLOCK_GLASS: - case E_BLOCK_GLASS_PANE: - case E_BLOCK_GLOWSTONE: - { - instrument = E_INST_CLICKS; - sampleName = "note.hat"; - break; - } - - case E_BLOCK_STONE: - case E_BLOCK_STONE_BRICKS: - case E_BLOCK_COBBLESTONE: - case E_BLOCK_OBSIDIAN: - case E_BLOCK_NETHERRACK: - case E_BLOCK_BRICK: - case E_BLOCK_NETHER_BRICK: - { - // TODO: add other stone-based blocks if needed - instrument = E_INST_BASS_DRUM; - sampleName = "note.bassattack"; - break; - } - - default: - { - instrument = E_INST_HARP_PIANO; - sampleName = "note.harp"; - break; - } - } - - m_World->BroadcastBlockAction(m_PosX, m_PosY, m_PosZ, instrument, m_Pitch, E_BLOCK_NOTE_BLOCK); - - // TODO: instead of calculating the power function over and over, make a precalculated table - there's only 24 pitches after all - float calcPitch = pow(2.0f, ((float)m_Pitch - 12.0f) / 12.0f); - m_World->BroadcastSoundEffect(sampleName, m_PosX * 8, m_PosY * 8, m_PosZ * 8, 3.0f, calcPitch); -} - - - - - -char cNoteEntity::GetPitch(void) -{ - return m_Pitch; -} - - - - - -void cNoteEntity::SetPitch(char a_Pitch) -{ - m_Pitch = a_Pitch % 25; -} - - - - - -void cNoteEntity::IncrementPitch(void) -{ - SetPitch(m_Pitch + 1); -} - - - - - -bool cNoteEntity::LoadFromJson(const Json::Value & a_Value) -{ - - m_PosX = a_Value.get("x", 0).asInt(); - m_PosY = a_Value.get("y", 0).asInt(); - m_PosZ = a_Value.get("z", 0).asInt(); - - m_Pitch = (char)a_Value.get("p", 0).asInt(); - - return true; -} - - - - - -void cNoteEntity::SaveToJson(Json::Value & a_Value) -{ - a_Value["x"] = m_PosX; - a_Value["y"] = m_PosY; - a_Value["z"] = m_PosZ; - - a_Value["p"] = m_Pitch; -} - - - - diff --git a/source/BlockEntities/SignEntity.cpp b/source/BlockEntities/SignEntity.cpp deleted file mode 100644 index 81f6f6d77..000000000 --- a/source/BlockEntities/SignEntity.cpp +++ /dev/null @@ -1,115 +0,0 @@ - -// SignEntity.cpp - -// Implements the cSignEntity class representing a single sign in the world - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules -#include <json/json.h> -#include "SignEntity.h" -#include "../Entities/Player.h" - - - - - -cSignEntity::cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World) : - super(a_BlockType, a_X, a_Y, a_Z, a_World) -{ -} - - - - - -// It don't do anything when 'used' -void cSignEntity::UsedBy(cPlayer * a_Player) -{ - UNUSED(a_Player); -} - - - - - -void cSignEntity::SetLines(const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) -{ - m_Line[0] = a_Line1; - m_Line[1] = a_Line2; - m_Line[2] = a_Line3; - m_Line[3] = a_Line4; -} - - - - - -void cSignEntity::SetLine(int a_Index, const AString & a_Line) -{ - if ((a_Index < 0) || (a_Index >= ARRAYCOUNT(m_Line))) - { - LOGWARNING("%s: setting a non-existent line %d (value \"%s\"", __FUNCTION__, a_Index, a_Line.c_str()); - return; - } - m_Line[a_Index] = a_Line; -} - - - - - -AString cSignEntity::GetLine(int a_Index) const -{ - if ((a_Index < 0) || (a_Index >= ARRAYCOUNT(m_Line))) - { - LOGWARNING("%s: requesting a non-existent line %d", __FUNCTION__, a_Index); - return ""; - } - return m_Line[a_Index]; -} - - - - - -void cSignEntity::SendTo(cClientHandle & a_Client) -{ - a_Client.SendUpdateSign(m_PosX, m_PosY, m_PosZ, m_Line[0], m_Line[1], m_Line[2], m_Line[3]); -} - - - - - -bool cSignEntity::LoadFromJson(const Json::Value & a_Value) -{ - m_PosX = a_Value.get("x", 0).asInt(); - m_PosY = a_Value.get("y", 0).asInt(); - m_PosZ = a_Value.get("z", 0).asInt(); - - m_Line[0] = a_Value.get("Line1", "").asString(); - m_Line[1] = a_Value.get("Line2", "").asString(); - m_Line[2] = a_Value.get("Line3", "").asString(); - m_Line[3] = a_Value.get("Line4", "").asString(); - - return true; -} - - - - - -void cSignEntity::SaveToJson(Json::Value & a_Value) -{ - a_Value["x"] = m_PosX; - a_Value["y"] = m_PosY; - a_Value["z"] = m_PosZ; - - a_Value["Line1"] = m_Line[0]; - a_Value["Line2"] = m_Line[1]; - a_Value["Line3"] = m_Line[2]; - a_Value["Line4"] = m_Line[3]; -} - - - - diff --git a/source/BlockID.cpp b/source/BlockID.cpp deleted file mode 100644 index a4a1ab2d8..000000000 --- a/source/BlockID.cpp +++ /dev/null @@ -1,958 +0,0 @@ -// BlockID.cpp - -// Implements the helper functions for converting Block ID string to int etc. - -#include "Globals.h" -#include "BlockID.h" -#include "../iniFile/iniFile.h" -#include "Item.h" -#include "Mobs/Monster.h" - - - - - -NIBBLETYPE g_BlockLightValue[256]; -NIBBLETYPE g_BlockSpreadLightFalloff[256]; -bool g_BlockTransparent[256]; -bool g_BlockOneHitDig[256]; -bool g_BlockPistonBreakable[256]; -bool g_BlockIsSnowable[256]; -bool g_BlockRequiresSpecialTool[256]; -bool g_BlockIsSolid[256]; -bool g_BlockIsTorchPlaceable[256]; - - - - - -class cBlockIDMap -{ - // Making the map case-insensitive: - struct Comparator - { - bool operator()(const AString & a_Item1, const AString & a_Item2) const - { - return (NoCaseCompare(a_Item1, a_Item2) > 0); - } - } ; - - typedef std::map<AString, std::pair<short, short>, Comparator> ItemMap; - -public: - cBlockIDMap(void) - { - cIniFile Ini; - if (!Ini.ReadFile("items.ini")) - { - return; - } - int KeyID = Ini.FindKey("Items"); - if (KeyID == cIniFile::noID) - { - return; - } - int NumValues = Ini.GetNumValues(KeyID); - for (int i = 0; i < NumValues; i++) - { - AString Name = Ini.GetValueName(KeyID, i); - if (Name.empty()) - { - continue; - } - AString Value = Ini.GetValue(KeyID, i); - AddToMap(Name, Value); - } // for i - Ini.Values[] - } - - - int Resolve(const AString & a_ItemName) - { - ItemMap::iterator itr = m_Map.find(a_ItemName); - if (itr == m_Map.end()) - { - return -1; - } - return itr->second.first; - } - - - bool ResolveItem(const AString & a_ItemName, cItem & a_Item) - { - // Split into parts divided by either ':' or '^' - AStringVector Split = StringSplitAndTrim(a_ItemName, ":^"); - if (Split.empty()) - { - return false; - } - - ItemMap::iterator itr = m_Map.find(Split[0]); - if (itr != m_Map.end()) - { - // Resolved as a string, assign the type and the default damage / count - a_Item.m_ItemType = itr->second.first; - a_Item.m_ItemDamage = itr->second.second; - if (a_Item.m_ItemDamage == -1) - { - a_Item.m_ItemDamage = 0; - } - } - else - { - // Not a resolvable string, try pure numbers: "45:6", "45^6" etc. - a_Item.m_ItemType = (short)atoi(Split[0].c_str()); - if ((a_Item.m_ItemType == 0) && (Split[0] != "0")) - { - // Parsing the number failed - return false; - } - } - - // Parse the damage, if present: - if (Split.size() < 2) - { - // Not present, set the item as valid and return success: - a_Item.m_ItemCount = 1; - return true; - } - - a_Item.m_ItemDamage = atoi(Split[1].c_str()); - if ((a_Item.m_ItemDamage == 0) && (Split[1] != "0")) - { - // Parsing the number failed - return false; - } - a_Item.m_ItemCount = 1; - return true; - } - - - AString Desolve(short a_ItemType, short a_ItemDamage) - { - // First try an exact match, both ItemType and ItemDamage ("birchplanks=5:2"): - for (ItemMap::iterator itr = m_Map.begin(), end = m_Map.end(); itr != end; ++itr) - { - if ((itr->second.first == a_ItemType) && (itr->second.second == a_ItemDamage)) - { - return itr->first; - } - } // for itr - m_Map[] - - // There is no exact match, try matching ItemType only ("planks=5"): - if (a_ItemDamage == 0) - { - for (ItemMap::iterator itr = m_Map.begin(), end = m_Map.end(); itr != end; ++itr) - { - if ((itr->second.first == a_ItemType) && (itr->second.second == -1)) - { - return itr->first; - } - } // for itr - m_Map[] - } - - // No match at all, synthesize a string ("5:1"): - AString res; - if (a_ItemDamage == -1) - { - Printf(res, "%d", a_ItemType); - } - else - { - Printf(res, "%d:%d", a_ItemType, a_ItemDamage); - } - return res; - } - - -protected: - ItemMap m_Map; - - - void AddToMap(const AString & a_Name, const AString & a_Value) - { - AStringVector Split = StringSplit(a_Value, ":"); - if (Split.size() == 1) - { - Split = StringSplit(a_Value, "^"); - } - if (Split.empty()) - { - return; - } - short ItemType = (short)atoi(Split[0].c_str()); - short ItemDamage = (Split.size() > 1) ? (short)atoi(Split[1].c_str()) : -1; - m_Map[a_Name] = std::make_pair(ItemType, ItemDamage); - } -} ; - - - - - -static cBlockIDMap gsBlockIDMap; - - - - - -/* -// Quick self-test: -class Tester -{ -public: - Tester(void) - { - cItem Item; - gsBlockIDMap.ResolveItem("charcoal", Item); - AString Charcoal = gsBlockIDMap.Desolve(Item.m_ItemType, Item.m_ItemDamage); - ASSERT(Charcoal == "charcoal"); - } -} test; -//*/ - - - - - -BLOCKTYPE BlockStringToType(const AString & a_BlockTypeString) -{ - int res = atoi(a_BlockTypeString.c_str()); - if ((res != 0) || (a_BlockTypeString.compare("0") == 0)) - { - // It was a valid number, return that - return res; - } - - return gsBlockIDMap.Resolve(TrimString(a_BlockTypeString)); -} - - - - -bool StringToItem(const AString & a_ItemTypeString, cItem & a_Item) -{ - return gsBlockIDMap.ResolveItem(TrimString(a_ItemTypeString), a_Item); -} - - - - - -AString ItemToString(const cItem & a_Item) -{ - return gsBlockIDMap.Desolve(a_Item.m_ItemType, a_Item.m_ItemDamage); -} - - - - - -AString ItemTypeToString(short a_ItemType) -{ - return gsBlockIDMap.Desolve(a_ItemType, -1); -} - - - - - -AString ItemToFullString(const cItem & a_Item) -{ - AString res; - Printf(res, "%s:%d * %d", ItemToString(a_Item).c_str(), a_Item.m_ItemDamage, a_Item.m_ItemCount); - return res; -} - - - - - -EMCSBiome StringToBiome(const AString & a_BiomeString) -{ - // If it is a number, return it: - int res = atoi(a_BiomeString.c_str()); - if ((res != 0) || (a_BiomeString.compare("0") == 0)) - { - // It was a valid number - return (EMCSBiome)res; - } - - // Convert using the built-in map: - static struct { - EMCSBiome m_Biome; - const char * m_String; - } BiomeMap[] = - { - {biOcean, "Ocean"} , - {biPlains, "Plains"}, - {biDesert, "Desert"}, - {biExtremeHills, "ExtremeHills"}, - {biForest, "Forest"}, - {biTaiga, "Taiga"}, - {biSwampland, "Swampland"}, - {biRiver, "River"}, - {biNether, "Hell"}, - {biNether, "Nether"}, - {biEnd, "Sky"}, - {biEnd, "End"}, - {biFrozenOcean, "FrozenOcean"}, - {biFrozenRiver, "FrozenRiver"}, - {biIcePlains, "IcePlains"}, - {biIcePlains, "Tundra"}, - {biIceMountains, "IceMountains"}, - {biMushroomIsland, "MushroomIsland"}, - {biMushroomShore, "MushroomShore"}, - {biBeach, "Beach"}, - {biDesertHills, "DesertHills"}, - {biForestHills, "ForestHills"}, - {biTaigaHills, "TaigaHills"}, - {biExtremeHillsEdge, "ExtremeHillsEdge"}, - {biJungle, "Jungle"}, - {biJungleHills, "JungleHills"}, - - // Release 1.7 biomes: - {biJungleEdge, "JungleEdge"}, - {biDeepOcean, "DeepOcean"}, - {biStoneBeach, "StoneBeach"}, - {biColdBeach, "ColdBeach"}, - {biBirchForest, "BirchForest"}, - {biBirchForestHills, "BirchForestHills"}, - {biRoofedForest, "RoofedForest"}, - {biColdTaiga, "ColdTaiga"}, - {biColdTaigaHills, "ColdTaigaHills"}, - {biMegaTaiga, "MegaTaiga"}, - {biMegaTaigaHills, "MegaTaigaHills"}, - {biExtremeHillsPlus, "ExtremeHillsPlus"}, - {biSavanna, "Savanna"}, - {biSavannaPlateau, "SavannaPlateau"}, - {biMesa, "Mesa"}, - {biMesaPlateauF, "MesaPlateauF"}, - {biMesaPlateau, "MesaPlateau"}, - - // Release 1.7 variants: - {biSunflowerPlains, "SunflowerPlains"}, - {biDesertM, "DesertM"}, - {biExtremeHillsM, "ExtremeHillsM"}, - {biFlowerForest, "FlowerForest"}, - {biTaigaM, "TaigaM"}, - {biSwamplandM, "SwamplandM"}, - {biIcePlainsSpikes, "IcePlainsSpikes"}, - {biJungleM, "JungleM"}, - {biJungleEdgeM, "JungleEdgeM"}, - {biBirchForestM, "BirchForestM"}, - {biBirchForestHillsM, "BirchForestHillsM"}, - {biRoofedForestM, "RoofedForestM"}, - {biColdTaigaM, "ColdTaigaM"}, - {biMegaSpruceTaiga, "MegaSpruceTaiga"}, - {biMegaSpruceTaigaHills, "MegaSpruceTaigaHills"}, - {biExtremeHillsPlusM, "ExtremeHillsPlusM"}, - {biSavannaM, "SavannaM"}, - {biSavannaPlateauM, "SavannaPlateauM"}, - {biMesaBryce, "MesaBryce"}, - {biMesaPlateauFM, "MesaPlateauFM"}, - {biMesaPlateauM, "MesaPlateauM"}, - } ; - - for (int i = 0; i < ARRAYCOUNT(BiomeMap); i++) - { - if (NoCaseCompare(BiomeMap[i].m_String, a_BiomeString) == 0) - { - return BiomeMap[i].m_Biome; - } - } // for i - BiomeMap[] - return (EMCSBiome)-1; -} - - - - - -int StringToMobType(const AString & a_MobString) -{ - static struct { - int m_MobType; - const char * m_String; - } MobMap [] = - { - {cMonster::mtCreeper, "Creeper"}, - {cMonster::mtSkeleton, "Skeleton"}, - {cMonster::mtSpider, "Spider"}, - {cMonster::mtGiant, "Giant"}, - {cMonster::mtZombie, "Zombie"}, - {cMonster::mtSlime, "Slime"}, - {cMonster::mtGhast, "Ghast"}, - {cMonster::mtZombiePigman, "ZombiePigman"}, - {cMonster::mtEnderman, "Enderman"}, - {cMonster::mtCaveSpider, "CaveSpider"}, - {cMonster::mtSilverfish, "SilverFish"}, - {cMonster::mtBlaze, "Blaze"}, - {cMonster::mtMagmaCube, "MagmaCube"}, - {cMonster::mtEnderDragon, "EnderDragon"}, - {cMonster::mtWither, "Wither"}, - {cMonster::mtBat, "Bat"}, - {cMonster::mtWitch, "Witch"}, - {cMonster::mtPig, "Pig"}, - {cMonster::mtSheep, "Sheep"}, - {cMonster::mtCow, "Cow"}, - {cMonster::mtChicken, "Chicken"}, - {cMonster::mtSquid, "Squid"}, - {cMonster::mtWolf, "Wolf"}, - {cMonster::mtMooshroom, "Mooshroom"}, - {cMonster::mtSnowGolem, "SnowGolem"}, - {cMonster::mtOcelot, "Ocelot"}, - {cMonster::mtIronGolem, "IronGolem"}, - {cMonster::mtVillager, "Villager"}, - }; - for (int i = 0; i < ARRAYCOUNT(MobMap); i++) - { - if (NoCaseCompare(MobMap[i].m_String, a_MobString) == 0) - { - return MobMap[i].m_MobType; - } - } // for i - MobMap[] - return -1; -} - - - - - -eDimension StringToDimension(const AString & a_DimensionString) -{ - // First try decoding as a number - int res = atoi(a_DimensionString.c_str()); - if ((res != 0) || (a_DimensionString == "0")) - { - // It was a valid number - return (eDimension)res; - } - - // Decode using a built-in map: - static struct - { - eDimension m_Dimension; - const char * m_String; - } DimensionMap [] = - { - { dimOverworld, "Overworld"}, - { dimOverworld, "Normal"}, - { dimOverworld, "World"}, - { dimNether, "Nether"}, - { dimNether, "Hell"}, // Alternate name for End - { dimEnd, "End"}, - { dimEnd, "Sky"}, // Old name for End - } ; - for (int i = 0; i < ARRAYCOUNT(DimensionMap); i++) - { - if (NoCaseCompare(DimensionMap[i].m_String, a_DimensionString) == 0) - { - return DimensionMap[i].m_Dimension; - } - } // for i - DimensionMap[] - - // Not found - return (eDimension)-1000; -} - - - - - -/// Translates damage type constant to a string representation (built-in). -AString DamageTypeToString(eDamageType a_DamageType) -{ - // Make sure to keep this alpha-sorted. - switch (a_DamageType) - { - case dtAdmin: return "dtAdmin"; - case dtAttack: return "dtAttack"; - case dtCactusContact: return "dtCactusContact"; - case dtDrowning: return "dtDrowning"; - case dtEnderPearl: return "dtEnderPearl"; - case dtFalling: return "dtFalling"; - case dtFireContact: return "dtFireContact"; - case dtInVoid: return "dtInVoid"; - case dtLavaContact: return "dtLavaContact"; - case dtLightning: return "dtLightning"; - case dtOnFire: return "dtOnFire"; - case dtPoisoning: return "dtPoisoning"; - case dtPotionOfHarming: return "dtPotionOfHarming"; - case dtRangedAttack: return "dtRangedAttack"; - case dtStarving: return "dtStarving"; - case dtSuffocating: return "dtSuffocation"; - - } - - // Unknown damage type: - ASSERT(!"Unknown DamageType"); - return Printf("dtUnknown_%d", (int)a_DamageType); -} - - - - - -/// Translates a damage type string to damage type. Takes either a number or a damage type alias (built-in). Returns -1 on failure -eDamageType StringToDamageType(const AString & a_DamageTypeString) -{ - // First try decoding as a number: - int res = atoi(a_DamageTypeString.c_str()); - if ((res != 0) || (a_DamageTypeString == "0")) - { - // It was a valid number - return (eDamageType)res; - } - - // Decode using a built-in map: - static struct - { - eDamageType m_DamageType; - const char * m_String; - } DamageTypeMap [] = - { - // Cannonical names: - { dtAttack, "dtAttack"}, - { dtRangedAttack, "dtRangedAttack"}, - { dtLightning, "dtLightning"}, - { dtFalling, "dtFalling"}, - { dtDrowning, "dtDrowning"}, - { dtSuffocating, "dtSuffocation"}, - { dtStarving, "dtStarving"}, - { dtCactusContact, "dtCactusContact"}, - { dtLavaContact, "dtLavaContact"}, - { dtPoisoning, "dtPoisoning"}, - { dtOnFire, "dtOnFire"}, - { dtFireContact, "dtFireContact"}, - { dtInVoid, "dtInVoid"}, - { dtPotionOfHarming, "dtPotionOfHarming"}, - { dtAdmin, "dtAdmin"}, - - // Common synonyms: - { dtAttack, "dtPawnAttack"}, - { dtAttack, "dtEntityAttack"}, - { dtAttack, "dtMob"}, - { dtAttack, "dtMobAttack"}, - { dtRangedAttack, "dtArrowAttack"}, - { dtRangedAttack, "dtArrow"}, - { dtRangedAttack, "dtProjectile"}, - { dtFalling, "dtFall"}, - { dtDrowning, "dtDrown"}, - { dtSuffocating, "dtSuffocation"}, - { dtStarving, "dtStarvation"}, - { dtStarving, "dtHunger"}, - { dtCactusContact, "dtCactus"}, - { dtCactusContact, "dtCactuses"}, - { dtCactusContact, "dtCacti"}, - { dtLavaContact, "dtLava"}, - { dtPoisoning, "dtPoison"}, - { dtOnFire, "dtBurning"}, - { dtFireContact, "dtInFire"}, - { dtAdmin, "dtPlugin"}, - } ; - for (int i = 0; i < ARRAYCOUNT(DamageTypeMap); i++) - { - if (NoCaseCompare(DamageTypeMap[i].m_String, a_DamageTypeString) == 0) - { - return DamageTypeMap[i].m_DamageType; - } - } // for i - DamageTypeMap[] - - // Not found: - return (eDamageType)-1; -} - - - - - -cItem GetIniItemSet(cIniFile & a_IniFile, const char * a_Section, const char * a_Key, const char * a_Default) -{ - AString ItemStr = a_IniFile.GetValueSet(a_Section, a_Key, a_Default); - cItem res; - if (!StringToItem(ItemStr, res)) - { - res.Empty(); - } - return res; -} - - - - - -// This is actually just some code that needs to run at program startup, so it is wrapped into a global var's constructor: -class cBlockPropertiesInitializer -{ -public: - cBlockPropertiesInitializer(void) - { - memset(g_BlockLightValue, 0x00, sizeof(g_BlockLightValue)); - memset(g_BlockSpreadLightFalloff, 0x0f, sizeof(g_BlockSpreadLightFalloff)); // 0x0f means total falloff - memset(g_BlockTransparent, 0x00, sizeof(g_BlockTransparent)); - memset(g_BlockOneHitDig, 0x00, sizeof(g_BlockOneHitDig)); - memset(g_BlockPistonBreakable, 0x00, sizeof(g_BlockPistonBreakable)); - memset(g_BlockIsTorchPlaceable, 0x00, sizeof(g_BlockIsTorchPlaceable)); - - // Setting bools to true must be done manually, see http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415 - for (int i = 0; i < ARRAYCOUNT(g_BlockIsSnowable); i++) - { - g_BlockIsSnowable[i] = true; - } - memset(g_BlockRequiresSpecialTool, 0x00, sizeof(g_BlockRequiresSpecialTool)); // Set all blocks to false - - // Setting bools to true must be done manually, see http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415 - for (int i = 0; i < ARRAYCOUNT(g_BlockIsSolid); i++) - { - g_BlockIsSolid[i] = true; - } - - // Emissive blocks - g_BlockLightValue[E_BLOCK_FIRE] = 15; - g_BlockLightValue[E_BLOCK_GLOWSTONE] = 15; - g_BlockLightValue[E_BLOCK_JACK_O_LANTERN] = 15; - g_BlockLightValue[E_BLOCK_LAVA] = 15; - g_BlockLightValue[E_BLOCK_STATIONARY_LAVA] = 15; - g_BlockLightValue[E_BLOCK_END_PORTAL] = 15; - g_BlockLightValue[E_BLOCK_REDSTONE_LAMP_ON] = 15; - g_BlockLightValue[E_BLOCK_TORCH] = 14; - g_BlockLightValue[E_BLOCK_BURNING_FURNACE] = 13; - g_BlockLightValue[E_BLOCK_NETHER_PORTAL] = 11; - g_BlockLightValue[E_BLOCK_REDSTONE_ORE_GLOWING] = 9; - g_BlockLightValue[E_BLOCK_REDSTONE_REPEATER_ON] = 9; - g_BlockLightValue[E_BLOCK_REDSTONE_TORCH_ON] = 7; - g_BlockLightValue[E_BLOCK_BREWING_STAND] = 1; - g_BlockLightValue[E_BLOCK_BROWN_MUSHROOM] = 1; - g_BlockLightValue[E_BLOCK_DRAGON_EGG] = 1; - - // Spread blocks - g_BlockSpreadLightFalloff[E_BLOCK_AIR] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_CAKE] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_CHEST] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_COBWEB] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_CROPS] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_FENCE] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_FENCE_GATE] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_FIRE] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_GLASS] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_GLASS_PANE] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_GLOWSTONE] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_IRON_BARS] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_IRON_DOOR] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_LEAVES] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_SIGN_POST] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_TORCH] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_VINES] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_WALLSIGN] = 1; - g_BlockSpreadLightFalloff[E_BLOCK_WOODEN_DOOR] = 1; - - // Light in water and lava dissapears faster: - g_BlockSpreadLightFalloff[E_BLOCK_LAVA] = 3; - g_BlockSpreadLightFalloff[E_BLOCK_STATIONARY_LAVA] = 3; - g_BlockSpreadLightFalloff[E_BLOCK_STATIONARY_WATER] = 3; - g_BlockSpreadLightFalloff[E_BLOCK_WATER] = 3; - - // Transparent blocks - g_BlockTransparent[E_BLOCK_ACTIVATOR_RAIL] = true; - g_BlockTransparent[E_BLOCK_AIR] = true; - g_BlockTransparent[E_BLOCK_BIG_FLOWER] = true; - g_BlockTransparent[E_BLOCK_BROWN_MUSHROOM] = true; - g_BlockTransparent[E_BLOCK_CARROTS] = true; - g_BlockTransparent[E_BLOCK_CHEST] = true; - g_BlockTransparent[E_BLOCK_COBWEB] = true; - g_BlockTransparent[E_BLOCK_CROPS] = true; - g_BlockTransparent[E_BLOCK_DANDELION] = true; - g_BlockTransparent[E_BLOCK_DETECTOR_RAIL] = true; - g_BlockTransparent[E_BLOCK_FENCE] = true; - g_BlockTransparent[E_BLOCK_FENCE_GATE] = true; - g_BlockTransparent[E_BLOCK_FIRE] = true; - g_BlockTransparent[E_BLOCK_FLOWER] = true; - g_BlockTransparent[E_BLOCK_FLOWER_POT] = true; - g_BlockTransparent[E_BLOCK_GLASS] = true; - g_BlockTransparent[E_BLOCK_GLASS_PANE] = true; - g_BlockTransparent[E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE] = true; - g_BlockTransparent[E_BLOCK_ICE] = true; - g_BlockTransparent[E_BLOCK_IRON_DOOR] = true; - g_BlockTransparent[E_BLOCK_LAVA] = true; - g_BlockTransparent[E_BLOCK_LEAVES] = true; - g_BlockTransparent[E_BLOCK_LEVER] = true; - g_BlockTransparent[E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE] = true; - g_BlockTransparent[E_BLOCK_MELON_STEM] = true; - g_BlockTransparent[E_BLOCK_NETHER_BRICK_FENCE] = true; - g_BlockTransparent[E_BLOCK_NEW_LEAVES] = true; - g_BlockTransparent[E_BLOCK_POTATOES] = true; - g_BlockTransparent[E_BLOCK_POWERED_RAIL] = true; - g_BlockTransparent[E_BLOCK_PISTON_EXTENSION] = true; - g_BlockTransparent[E_BLOCK_PUMPKIN_STEM] = true; - g_BlockTransparent[E_BLOCK_RAIL] = true; - g_BlockTransparent[E_BLOCK_RED_MUSHROOM] = true; - g_BlockTransparent[E_BLOCK_SIGN_POST] = true; - g_BlockTransparent[E_BLOCK_SNOW] = true; - g_BlockTransparent[E_BLOCK_STAINED_GLASS] = true; - g_BlockTransparent[E_BLOCK_STAINED_GLASS_PANE] = true; - g_BlockTransparent[E_BLOCK_STATIONARY_LAVA] = true; - g_BlockTransparent[E_BLOCK_STATIONARY_WATER] = true; - g_BlockTransparent[E_BLOCK_STONE_PRESSURE_PLATE] = true; - g_BlockTransparent[E_BLOCK_TALL_GRASS] = true; - g_BlockTransparent[E_BLOCK_TORCH] = true; - g_BlockTransparent[E_BLOCK_VINES] = true; - g_BlockTransparent[E_BLOCK_WALLSIGN] = true; - g_BlockTransparent[E_BLOCK_WATER] = true; - g_BlockTransparent[E_BLOCK_WOODEN_DOOR] = true; - g_BlockTransparent[E_BLOCK_WOODEN_PRESSURE_PLATE] = true; - - // TODO: Any other transparent blocks? - - // One hit break blocks: - g_BlockOneHitDig[E_BLOCK_ACTIVE_COMPARATOR] = true; - g_BlockOneHitDig[E_BLOCK_BIG_FLOWER] = true; - g_BlockOneHitDig[E_BLOCK_BROWN_MUSHROOM] = true; - g_BlockOneHitDig[E_BLOCK_CARROTS] = true; - g_BlockOneHitDig[E_BLOCK_CROPS] = true; - g_BlockOneHitDig[E_BLOCK_DANDELION] = true; - g_BlockOneHitDig[E_BLOCK_FIRE] = true; - g_BlockOneHitDig[E_BLOCK_FLOWER] = true; - g_BlockOneHitDig[E_BLOCK_FLOWER_POT] = true; - g_BlockOneHitDig[E_BLOCK_INACTIVE_COMPARATOR] = true; - g_BlockOneHitDig[E_BLOCK_MELON_STEM] = true; - g_BlockOneHitDig[E_BLOCK_POTATOES] = true; - g_BlockOneHitDig[E_BLOCK_PUMPKIN_STEM] = true; - g_BlockOneHitDig[E_BLOCK_REDSTONE_REPEATER_OFF] = true; - g_BlockOneHitDig[E_BLOCK_REDSTONE_REPEATER_ON] = true; - g_BlockOneHitDig[E_BLOCK_REDSTONE_TORCH_OFF] = true; - g_BlockOneHitDig[E_BLOCK_REDSTONE_TORCH_ON] = true; - g_BlockOneHitDig[E_BLOCK_REDSTONE_WIRE] = true; - g_BlockOneHitDig[E_BLOCK_RED_MUSHROOM] = true; - g_BlockOneHitDig[E_BLOCK_REEDS] = true; - g_BlockOneHitDig[E_BLOCK_SAPLING] = true; - g_BlockOneHitDig[E_BLOCK_TNT] = true; - g_BlockOneHitDig[E_BLOCK_TALL_GRASS] = true; - g_BlockOneHitDig[E_BLOCK_TORCH] = true; - - // Blocks that break when pushed by piston: - g_BlockPistonBreakable[E_BLOCK_ACTIVE_COMPARATOR] = true; - g_BlockPistonBreakable[E_BLOCK_AIR] = true; - g_BlockPistonBreakable[E_BLOCK_BED] = true; - g_BlockPistonBreakable[E_BLOCK_BIG_FLOWER] = true; - g_BlockPistonBreakable[E_BLOCK_BROWN_MUSHROOM] = true; - g_BlockPistonBreakable[E_BLOCK_COBWEB] = true; - g_BlockPistonBreakable[E_BLOCK_CROPS] = true; - g_BlockPistonBreakable[E_BLOCK_DANDELION] = true; - g_BlockPistonBreakable[E_BLOCK_DEAD_BUSH] = true; - g_BlockPistonBreakable[E_BLOCK_FIRE] = true; - g_BlockPistonBreakable[E_BLOCK_FLOWER] = true; - g_BlockPistonBreakable[E_BLOCK_INACTIVE_COMPARATOR] = true; - g_BlockPistonBreakable[E_BLOCK_IRON_DOOR] = true; - g_BlockPistonBreakable[E_BLOCK_JACK_O_LANTERN] = true; - g_BlockPistonBreakable[E_BLOCK_LADDER] = true; - g_BlockPistonBreakable[E_BLOCK_LAVA] = true; - g_BlockPistonBreakable[E_BLOCK_LEVER] = true; - g_BlockPistonBreakable[E_BLOCK_MELON] = true; - g_BlockPistonBreakable[E_BLOCK_MELON_STEM] = true; - g_BlockPistonBreakable[E_BLOCK_PUMPKIN] = true; - g_BlockPistonBreakable[E_BLOCK_PUMPKIN_STEM] = true; - g_BlockPistonBreakable[E_BLOCK_REDSTONE_REPEATER_OFF] = true; - g_BlockPistonBreakable[E_BLOCK_REDSTONE_REPEATER_ON] = true; - g_BlockPistonBreakable[E_BLOCK_REDSTONE_TORCH_OFF] = true; - g_BlockPistonBreakable[E_BLOCK_REDSTONE_TORCH_ON] = true; - g_BlockPistonBreakable[E_BLOCK_REDSTONE_WIRE] = true; - g_BlockPistonBreakable[E_BLOCK_RED_MUSHROOM] = true; - g_BlockPistonBreakable[E_BLOCK_REEDS] = true; - g_BlockPistonBreakable[E_BLOCK_SNOW] = true; - g_BlockPistonBreakable[E_BLOCK_STATIONARY_LAVA] = true; - g_BlockPistonBreakable[E_BLOCK_STATIONARY_WATER] = true; - g_BlockPistonBreakable[E_BLOCK_STONE_BUTTON] = true; - g_BlockPistonBreakable[E_BLOCK_STONE_PRESSURE_PLATE] = true; - g_BlockPistonBreakable[E_BLOCK_TALL_GRASS] = true; - g_BlockPistonBreakable[E_BLOCK_TORCH] = true; - g_BlockPistonBreakable[E_BLOCK_VINES] = true; - g_BlockPistonBreakable[E_BLOCK_WATER] = true; - g_BlockPistonBreakable[E_BLOCK_WOODEN_BUTTON] = true; - g_BlockPistonBreakable[E_BLOCK_WOODEN_DOOR] = true; - g_BlockPistonBreakable[E_BLOCK_WOODEN_PRESSURE_PLATE] = true; - - - // Blocks that cannot be snowed over: - g_BlockIsSnowable[E_BLOCK_ACTIVE_COMPARATOR] = false; - g_BlockIsSnowable[E_BLOCK_AIR] = false; - g_BlockIsSnowable[E_BLOCK_BIG_FLOWER] = false; - g_BlockIsSnowable[E_BLOCK_BROWN_MUSHROOM] = false; - g_BlockIsSnowable[E_BLOCK_CACTUS] = false; - g_BlockIsSnowable[E_BLOCK_CHEST] = false; - g_BlockIsSnowable[E_BLOCK_CROPS] = false; - g_BlockIsSnowable[E_BLOCK_DANDELION] = false; - g_BlockIsSnowable[E_BLOCK_FIRE] = false; - g_BlockIsSnowable[E_BLOCK_FLOWER] = false; - g_BlockIsSnowable[E_BLOCK_GLASS] = false; - g_BlockIsSnowable[E_BLOCK_ICE] = false; - g_BlockIsSnowable[E_BLOCK_INACTIVE_COMPARATOR] = false; - g_BlockIsSnowable[E_BLOCK_LAVA] = false; - g_BlockIsSnowable[E_BLOCK_LILY_PAD] = false; - g_BlockIsSnowable[E_BLOCK_REDSTONE_REPEATER_OFF] = false; - g_BlockIsSnowable[E_BLOCK_REDSTONE_REPEATER_ON] = false; - g_BlockIsSnowable[E_BLOCK_REDSTONE_TORCH_OFF] = false; - g_BlockIsSnowable[E_BLOCK_REDSTONE_TORCH_ON] = false; - g_BlockIsSnowable[E_BLOCK_REDSTONE_WIRE] = false; - g_BlockIsSnowable[E_BLOCK_RED_MUSHROOM] = false; - g_BlockIsSnowable[E_BLOCK_REEDS] = false; - g_BlockIsSnowable[E_BLOCK_SAPLING] = false; - g_BlockIsSnowable[E_BLOCK_SIGN_POST] = false; - g_BlockIsSnowable[E_BLOCK_SNOW] = false; - g_BlockIsSnowable[E_BLOCK_STAINED_GLASS] = false; - g_BlockIsSnowable[E_BLOCK_STAINED_GLASS_PANE] = false; - g_BlockIsSnowable[E_BLOCK_STATIONARY_LAVA] = false; - g_BlockIsSnowable[E_BLOCK_STATIONARY_WATER] = false; - g_BlockIsSnowable[E_BLOCK_TALL_GRASS] = false; - g_BlockIsSnowable[E_BLOCK_TNT] = false; - g_BlockIsSnowable[E_BLOCK_TORCH] = false; - g_BlockIsSnowable[E_BLOCK_VINES] = false; - g_BlockIsSnowable[E_BLOCK_WALLSIGN] = false; - g_BlockIsSnowable[E_BLOCK_WATER] = false; - - - // Blocks that don't drop without a special tool: - g_BlockRequiresSpecialTool[E_BLOCK_BRICK] = true; - g_BlockRequiresSpecialTool[E_BLOCK_CAULDRON] = true; - g_BlockRequiresSpecialTool[E_BLOCK_COAL_ORE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_COBBLESTONE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_COBBLESTONE_STAIRS] = true; - g_BlockRequiresSpecialTool[E_BLOCK_COBWEB] = true; - g_BlockRequiresSpecialTool[E_BLOCK_DIAMOND_BLOCK] = true; - g_BlockRequiresSpecialTool[E_BLOCK_DIAMOND_ORE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_DOUBLE_STONE_SLAB] = true; - g_BlockRequiresSpecialTool[E_BLOCK_EMERALD_ORE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_END_STONE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_GOLD_BLOCK] = true; - g_BlockRequiresSpecialTool[E_BLOCK_GOLD_ORE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_IRON_BLOCK] = true; - g_BlockRequiresSpecialTool[E_BLOCK_IRON_ORE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_LAPIS_BLOCK] = true; - g_BlockRequiresSpecialTool[E_BLOCK_LAPIS_ORE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_MOSSY_COBBLESTONE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_NETHERRACK] = true; - g_BlockRequiresSpecialTool[E_BLOCK_NETHER_BRICK] = true; - g_BlockRequiresSpecialTool[E_BLOCK_NETHER_BRICK_STAIRS] = true; - g_BlockRequiresSpecialTool[E_BLOCK_OBSIDIAN] = true; - g_BlockRequiresSpecialTool[E_BLOCK_REDSTONE_ORE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_REDSTONE_ORE_GLOWING] = true; - g_BlockRequiresSpecialTool[E_BLOCK_SANDSTONE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_SANDSTONE_STAIRS] = true; - g_BlockRequiresSpecialTool[E_BLOCK_SNOW] = true; - g_BlockRequiresSpecialTool[E_BLOCK_STONE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_STONE_BRICKS] = true; - g_BlockRequiresSpecialTool[E_BLOCK_STONE_BRICK_STAIRS] = true; - g_BlockRequiresSpecialTool[E_BLOCK_STONE_PRESSURE_PLATE] = true; - g_BlockRequiresSpecialTool[E_BLOCK_STONE_SLAB] = true; - g_BlockRequiresSpecialTool[E_BLOCK_VINES] = true; - - // Nonsolid blocks: - g_BlockIsSolid[E_BLOCK_ACTIVATOR_RAIL] = false; - g_BlockIsSolid[E_BLOCK_AIR] = false; - g_BlockIsSolid[E_BLOCK_BIG_FLOWER] = false; - g_BlockIsSolid[E_BLOCK_BROWN_MUSHROOM] = false; - g_BlockIsSolid[E_BLOCK_CARROTS] = false; - g_BlockIsSolid[E_BLOCK_COBWEB] = false; - g_BlockIsSolid[E_BLOCK_CROPS] = false; - g_BlockIsSolid[E_BLOCK_DANDELION] = false; - g_BlockIsSolid[E_BLOCK_DETECTOR_RAIL] = false; - g_BlockIsSolid[E_BLOCK_END_PORTAL] = false; - g_BlockIsSolid[E_BLOCK_FIRE] = false; - g_BlockIsSolid[E_BLOCK_FLOWER] = false; - g_BlockIsSolid[E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE] = false; - g_BlockIsSolid[E_BLOCK_LAVA] = false; - g_BlockIsSolid[E_BLOCK_LEVER] = false; - g_BlockIsSolid[E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE] = false; - g_BlockIsSolid[E_BLOCK_MELON_STEM] = false; - g_BlockIsSolid[E_BLOCK_NETHER_PORTAL] = false; - g_BlockIsSolid[E_BLOCK_PISTON_EXTENSION] = false; - g_BlockIsSolid[E_BLOCK_RAIL] = false; - g_BlockIsSolid[E_BLOCK_REDSTONE_TORCH_OFF] = false; - g_BlockIsSolid[E_BLOCK_REDSTONE_TORCH_ON] = false; - g_BlockIsSolid[E_BLOCK_REDSTONE_WIRE] = false; - g_BlockIsSolid[E_BLOCK_RED_MUSHROOM] = false; - g_BlockIsSolid[E_BLOCK_REEDS] = false; - g_BlockIsSolid[E_BLOCK_SAPLING] = false; - g_BlockIsSolid[E_BLOCK_SIGN_POST] = false; - g_BlockIsSolid[E_BLOCK_SNOW] = false; - g_BlockIsSolid[E_BLOCK_STATIONARY_LAVA] = false; - g_BlockIsSolid[E_BLOCK_STATIONARY_WATER] = false; - g_BlockIsSolid[E_BLOCK_STONE_BUTTON] = false; - g_BlockIsSolid[E_BLOCK_STONE_PRESSURE_PLATE] = false; - g_BlockIsSolid[E_BLOCK_TALL_GRASS] = false; - g_BlockIsSolid[E_BLOCK_TORCH] = false; - g_BlockIsSolid[E_BLOCK_TRIPWIRE] = false; - g_BlockIsSolid[E_BLOCK_VINES] = false; - g_BlockIsSolid[E_BLOCK_WALLSIGN] = false; - g_BlockIsSolid[E_BLOCK_WATER] = false; - g_BlockIsSolid[E_BLOCK_WOODEN_BUTTON] = false; - g_BlockIsSolid[E_BLOCK_WOODEN_PRESSURE_PLATE] = false; - g_BlockIsSolid[E_BLOCK_WOODEN_SLAB] = false; - - // Torch placeable blocks: - g_BlockIsTorchPlaceable[E_BLOCK_BEDROCK] = true; - g_BlockIsTorchPlaceable[E_BLOCK_BLOCK_OF_COAL] = true; - g_BlockIsTorchPlaceable[E_BLOCK_BLOCK_OF_REDSTONE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_BOOKCASE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_BRICK] = true; - g_BlockIsTorchPlaceable[E_BLOCK_CLAY] = true; - g_BlockIsTorchPlaceable[E_BLOCK_COAL_ORE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_COBBLESTONE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_COMMAND_BLOCK] = true; - g_BlockIsTorchPlaceable[E_BLOCK_CRAFTING_TABLE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_DIAMOND_BLOCK] = true; - g_BlockIsTorchPlaceable[E_BLOCK_DIAMOND_ORE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_DIRT] = true; - g_BlockIsTorchPlaceable[E_BLOCK_DISPENSER] = true; - g_BlockIsTorchPlaceable[E_BLOCK_DOUBLE_STONE_SLAB] = true; - g_BlockIsTorchPlaceable[E_BLOCK_DOUBLE_WOODEN_SLAB] = true; - g_BlockIsTorchPlaceable[E_BLOCK_DROPPER] = true; - g_BlockIsTorchPlaceable[E_BLOCK_EMERALD_BLOCK] = true; - g_BlockIsTorchPlaceable[E_BLOCK_EMERALD_ORE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_END_STONE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_FURNACE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_GLOWSTONE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_GOLD_BLOCK] = true; - g_BlockIsTorchPlaceable[E_BLOCK_GOLD_ORE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_GRASS] = true; - g_BlockIsTorchPlaceable[E_BLOCK_GRAVEL] = true; - g_BlockIsTorchPlaceable[E_BLOCK_HARDENED_CLAY] = true; - g_BlockIsTorchPlaceable[E_BLOCK_HAY_BALE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_HUGE_BROWN_MUSHROOM] = true; - g_BlockIsTorchPlaceable[E_BLOCK_HUGE_RED_MUSHROOM] = true; - g_BlockIsTorchPlaceable[E_BLOCK_IRON_BLOCK] = true; - g_BlockIsTorchPlaceable[E_BLOCK_IRON_ORE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_JACK_O_LANTERN] = true; - g_BlockIsTorchPlaceable[E_BLOCK_JUKEBOX] = true; - g_BlockIsTorchPlaceable[E_BLOCK_LAPIS_BLOCK] = true; - g_BlockIsTorchPlaceable[E_BLOCK_LAPIS_ORE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_LOG] = true; - g_BlockIsTorchPlaceable[E_BLOCK_MELON] = true; - g_BlockIsTorchPlaceable[E_BLOCK_MOSSY_COBBLESTONE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_MYCELIUM] = true; - g_BlockIsTorchPlaceable[E_BLOCK_NETHERRACK] = true; - g_BlockIsTorchPlaceable[E_BLOCK_NETHER_BRICK] = true; - g_BlockIsTorchPlaceable[E_BLOCK_NETHER_QUARTZ_ORE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_NOTE_BLOCK] = true; - g_BlockIsTorchPlaceable[E_BLOCK_OBSIDIAN] = true; - g_BlockIsTorchPlaceable[E_BLOCK_PACKED_ICE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_PLANKS] = true; - g_BlockIsTorchPlaceable[E_BLOCK_PUMPKIN] = true; - g_BlockIsTorchPlaceable[E_BLOCK_QUARTZ_BLOCK] = true; - g_BlockIsTorchPlaceable[E_BLOCK_REDSTONE_LAMP_OFF] = true; - g_BlockIsTorchPlaceable[E_BLOCK_REDSTONE_LAMP_ON] = true; - g_BlockIsTorchPlaceable[E_BLOCK_REDSTONE_ORE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_REDSTONE_ORE_GLOWING] = true; - g_BlockIsTorchPlaceable[E_BLOCK_SANDSTONE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_SAND] = true; - g_BlockIsTorchPlaceable[E_BLOCK_SILVERFISH_EGG] = true; - g_BlockIsTorchPlaceable[E_BLOCK_SPONGE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_STAINED_CLAY] = true; - g_BlockIsTorchPlaceable[E_BLOCK_WOOL] = true; - g_BlockIsTorchPlaceable[E_BLOCK_STONE] = true; - g_BlockIsTorchPlaceable[E_BLOCK_STONE_BRICKS] = true; - } -} BlockPropertiesInitializer; - - - - - diff --git a/source/Chunk.cpp b/source/Chunk.cpp deleted file mode 100644 index 7e71e9ea7..000000000 --- a/source/Chunk.cpp +++ /dev/null @@ -1,2776 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#ifndef _WIN32 - #include <cstdlib> -#endif - - -#include "Chunk.h" -#include "World.h" -#include "ClientHandle.h" -#include "Server.h" -#include "zlib.h" -#include "Defines.h" -#include "BlockEntities/ChestEntity.h" -#include "BlockEntities/DispenserEntity.h" -#include "BlockEntities/DropperEntity.h" -#include "BlockEntities/FurnaceEntity.h" -#include "BlockEntities/HopperEntity.h" -#include "BlockEntities/JukeboxEntity.h" -#include "BlockEntities/NoteEntity.h" -#include "BlockEntities/SignEntity.h" -#include "Entities/Pickup.h" -#include "Item.h" -#include "Noise.h" -#include "Root.h" -#include "MersenneTwister.h" -#include "Entities/Player.h" -#include "BlockArea.h" -#include "PluginManager.h" -#include "Blocks/BlockHandler.h" -#include "Simulator/FluidSimulator.h" -#include "MobCensus.h" -#include "MobSpawner.h" - - -#include <json/json.h> - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// sSetBlock: - -sSetBlock::sSetBlock( int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta ) // absolute block position - : x( a_BlockX ) - , y( a_BlockY ) - , z( a_BlockZ ) - , BlockType( a_BlockType ) - , BlockMeta( a_BlockMeta ) -{ - cChunkDef::AbsoluteToRelative(x, y, z, ChunkX, ChunkZ); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cChunk: - -cChunk::cChunk( - int a_ChunkX, int a_ChunkY, int a_ChunkZ, - cChunkMap * a_ChunkMap, cWorld * a_World, - cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP -) - : m_PosX( a_ChunkX ) - , m_PosY( a_ChunkY ) - , m_PosZ( a_ChunkZ ) - , m_BlockTickX( 0 ) - , m_BlockTickY( 0 ) - , m_BlockTickZ( 0 ) - , m_World( a_World ) - , m_ChunkMap(a_ChunkMap) - , m_IsValid(false) - , m_IsLightValid(false) - , m_IsDirty(false) - , m_IsSaving(false) - , m_StayCount(0) - , m_NeighborXM(a_NeighborXM) - , m_NeighborXP(a_NeighborXP) - , m_NeighborZM(a_NeighborZM) - , m_NeighborZP(a_NeighborZP) - , m_WaterSimulatorData(a_World->GetWaterSimulator()->CreateChunkData()) - , m_LavaSimulatorData (a_World->GetLavaSimulator ()->CreateChunkData()) -{ - if (a_NeighborXM != NULL) - { - a_NeighborXM->m_NeighborXP = this; - } - if (a_NeighborXP != NULL) - { - a_NeighborXP->m_NeighborXM = this; - } - if (a_NeighborZM != NULL) - { - a_NeighborZM->m_NeighborZP = this; - } - if (a_NeighborZP != NULL) - { - a_NeighborZP->m_NeighborZM = this; - } -} - - - - - -cChunk::~cChunk() -{ - cPluginManager::Get()->CallHookChunkUnloaded(m_World, m_PosX, m_PosZ); - - // LOGINFO("### delete cChunk() (%i, %i) from %p, thread 0x%x ###", m_PosX, m_PosZ, this, GetCurrentThreadId() ); - - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) - { - delete *itr; - } - m_BlockEntities.clear(); - - // Remove and destroy all entities that are not players: - cEntityList Entities; - std::swap(Entities, m_Entities); // Need another list because cEntity destructors check if they've been removed from chunk - for (cEntityList::const_iterator itr = Entities.begin(); itr != Entities.end(); ++itr) - { - if (!(*itr)->IsPlayer()) - { - (*itr)->Destroy(false); - delete *itr; - } - } - - if (m_NeighborXM != NULL) - { - m_NeighborXM->m_NeighborXP = NULL; - } - if (m_NeighborXP != NULL) - { - m_NeighborXP->m_NeighborXM = NULL; - } - if (m_NeighborZM != NULL) - { - m_NeighborZM->m_NeighborZP = NULL; - } - if (m_NeighborZP != NULL) - { - m_NeighborZP->m_NeighborZM = NULL; - } - delete m_WaterSimulatorData; - delete m_LavaSimulatorData; -} - - - - - -void cChunk::SetValid(void) -{ - m_IsValid = true; - - m_World->GetChunkMap()->ChunkValidated(); -} - - - - - -void cChunk::MarkRegenerating(void) -{ - // Tell all clients attached to this chunk that they want this chunk: - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - (*itr)->AddWantedChunk(m_PosX, m_PosZ); - } // for itr - m_LoadedByClient[] -} - - - - - -bool cChunk::CanUnload(void) -{ - return m_LoadedByClient.empty() && !m_IsDirty && (m_StayCount == 0); -} - - - - - -void cChunk::MarkSaving(void) -{ - m_IsSaving = true; -} - - - - - -void cChunk::MarkSaved(void) -{ - if (!m_IsSaving) - { - return; - } - m_IsDirty = false; -} - - - - - -void cChunk::MarkLoaded(void) -{ - m_IsDirty = false; - SetValid(); -} - - - - - -void cChunk::MarkLoadFailed(void) -{ - if (m_IsValid) - { - return; - } - - m_HasLoadFailed = true; -} - - - - - -void cChunk::GetAllData(cChunkDataCallback & a_Callback) -{ - a_Callback.HeightMap (&m_HeightMap); - a_Callback.BiomeData (&m_BiomeMap); - a_Callback.BlockTypes (m_BlockTypes); - a_Callback.BlockMeta (m_BlockMeta); - a_Callback.LightIsValid (m_IsLightValid); - a_Callback.BlockLight (m_BlockLight); - a_Callback.BlockSkyLight(m_BlockSkyLight); - - for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr) - { - a_Callback.Entity(*itr); - } - - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) - { - a_Callback.BlockEntity(*itr); - } -} - - - - - -void cChunk::SetAllData( - const BLOCKTYPE * a_BlockTypes, - const NIBBLETYPE * a_BlockMeta, - const NIBBLETYPE * a_BlockLight, - const NIBBLETYPE * a_BlockSkyLight, - const HeightMap * a_HeightMap, - const BiomeMap & a_BiomeMap, - cBlockEntityList & a_BlockEntities -) -{ - memcpy(m_BiomeMap, a_BiomeMap, sizeof(m_BiomeMap)); - - if (a_HeightMap != NULL) - { - memcpy(m_HeightMap, a_HeightMap, sizeof(m_HeightMap)); - } - - memcpy(m_BlockTypes, a_BlockTypes, sizeof(m_BlockTypes)); - memcpy(m_BlockMeta, a_BlockMeta, sizeof(m_BlockMeta)); - if (a_BlockLight != NULL) - { - memcpy(m_BlockLight, a_BlockLight, sizeof(m_BlockLight)); - } - if (a_BlockSkyLight != NULL) - { - memcpy(m_BlockSkyLight, a_BlockSkyLight, sizeof(m_BlockSkyLight)); - } - - m_IsLightValid = (a_BlockLight != NULL) && (a_BlockSkyLight != NULL); - - if (a_HeightMap == NULL) - { - CalculateHeightmap(); - } - - // Clear the block entities present - either the loader / saver has better, or we'll create empty ones: - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) - { - delete *itr; - } - std::swap(a_BlockEntities, m_BlockEntities); - - // Set all block entities' World variable: - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) - { - (*itr)->SetWorld(m_World); - } - - // Create block entities that the loader didn't load; fill them with defaults - CreateBlockEntities(); - - // Set the chunk data as valid. This may be needed for some simulators that perform actions upon block adding (Vaporize) - SetValid(); - - // Wake up all simulators for their respective blocks: - WakeUpSimulators(); - - m_HasLoadFailed = false; -} - - - - - -void cChunk::SetLight( - const cChunkDef::BlockNibbles & a_BlockLight, - const cChunkDef::BlockNibbles & a_SkyLight -) -{ - // TODO: We might get cases of wrong lighting when a chunk changes in the middle of a lighting calculation. - // Postponing until we see how bad it is :) - memcpy(m_BlockLight, a_BlockLight, sizeof(m_BlockLight)); - memcpy(m_BlockSkyLight, a_SkyLight, sizeof(m_BlockSkyLight)); - m_IsLightValid = true; -} - - - - - -void cChunk::GetBlockTypes(BLOCKTYPE * a_BlockTypes) -{ - memcpy(a_BlockTypes, m_BlockTypes, NumBlocks); -} - - - - - -void cChunk::WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) -{ - if ((a_DataTypes & (cBlockArea::baTypes | cBlockArea::baMetas)) != (cBlockArea::baTypes | cBlockArea::baMetas)) - { - LOGWARNING("cChunk::WriteBlockArea(): unsupported datatype request, can write only types + metas (0x%x), requested 0x%x. Ignoring.", - (cBlockArea::baTypes | cBlockArea::baMetas), a_DataTypes & (cBlockArea::baTypes | cBlockArea::baMetas) - ); - return; - } - - // SizeX, SizeZ are the dimensions of the block data to copy to the chunk (size of the geometric union) - - int BlockStartX = std::max(a_MinBlockX, m_PosX * cChunkDef::Width); - int BlockEndX = std::min(a_MinBlockX + a_Area.GetSizeX(), (m_PosX + 1) * cChunkDef::Width); - int BlockStartZ = std::max(a_MinBlockZ, m_PosZ * cChunkDef::Width); - int BlockEndZ = std::min(a_MinBlockZ + a_Area.GetSizeZ(), (m_PosZ + 1) * cChunkDef::Width); - int SizeX = BlockEndX - BlockStartX; - int SizeZ = BlockEndZ - BlockStartZ; - int OffX = BlockStartX - m_PosX * cChunkDef::Width; - int OffZ = BlockStartZ - m_PosZ * cChunkDef::Width; - int BaseX = BlockStartX - a_MinBlockX; - int BaseZ = BlockStartZ - a_MinBlockZ; - int SizeY = a_Area.GetSizeY(); - - // TODO: Improve this by not calling FastSetBlock() and doing the processing here - // so that the heightmap is touched only once for each column. - BLOCKTYPE * AreaBlockTypes = a_Area.GetBlockTypes(); - NIBBLETYPE * AreaBlockMetas = a_Area.GetBlockMetas(); - for (int y = 0; y < SizeY; y++) - { - int ChunkY = a_MinBlockY + y; - int AreaY = y; - for (int z = 0; z < SizeZ; z++) - { - int ChunkZ = OffZ + z; - int AreaZ = BaseZ + z; - for (int x = 0; x < SizeX; x++) - { - int ChunkX = OffX + x; - int AreaX = BaseX + x; - int idx = a_Area.MakeIndex(AreaX, AreaY, AreaZ); - BLOCKTYPE BlockType = AreaBlockTypes[idx]; - NIBBLETYPE BlockMeta = AreaBlockMetas[idx]; - FastSetBlock(ChunkX, ChunkY, ChunkZ, BlockType, BlockMeta); - } // for x - } // for z - } // for y -} - - - - - -/// Returns true if there is a block entity at the coords specified -bool cChunk::HasBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) - { - if ( - ((*itr)->GetPosX() == a_BlockX) && - ((*itr)->GetPosY() == a_BlockY) && - ((*itr)->GetPosZ() == a_BlockZ) - ) - { - return true; - } - } // for itr - m_BlockEntities[] - return false; -} - - - - - -/// Sets or resets the internal flag that prevents chunk from being unloaded -void cChunk::Stay(bool a_Stay) -{ - m_StayCount += (a_Stay ? 1 : -1); - ASSERT(m_StayCount >= 0); -} - - - - -void cChunk::CollectMobCensus(cMobCensus& toFill) -{ - toFill.CollectSpawnableChunk(*this); - std::list<const Vector3d*> playerPositions; - cPlayer* currentPlayer; - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr) - { - currentPlayer = (*itr)->GetPlayer(); - playerPositions.push_back(&(currentPlayer->GetPosition())); - } - - Vector3d currentPosition; - for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr) - { - //LOGD("Counting entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass()); - if ((*itr)->IsMob()) - { - cMonster& Monster = (cMonster&)(**itr); - currentPosition = Monster.GetPosition(); - for (std::list<const Vector3d*>::const_iterator itr2 = playerPositions.begin(); itr2 != playerPositions.end(); itr2 ++) - { - toFill.CollectMob(Monster,*this,(currentPosition-**itr2).SqrLength()); - } - } - } // for itr - m_Entitites[] -} - - - - -void cChunk::getThreeRandomNumber(int& a_X, int& a_Y, int& a_Z,int a_MaxX, int a_MaxY, int a_MaxZ) -{ - ASSERT(a_MaxX * a_MaxY * a_MaxZ * 8 < 0x00ffffff); - int Random = m_World->GetTickRandomNumber(0x00ffffff); - a_X = Random % (a_MaxX * 2); - a_Y = (Random / (a_MaxX * 2)) % (a_MaxY * 2); - a_Z = ((Random / (a_MaxX * 2)) / (a_MaxY * 2)) % (a_MaxZ * 2); - a_X /= 2; - a_Y /= 2; - a_Z /= 2; -} - - - - - -void cChunk::getRandomBlockCoords(int& a_X, int& a_Y, int& a_Z) -{ - // MG TODO : check if this kind of optimization (only one random call) is still needed - // MG TODO : if so propagate it - - getThreeRandomNumber(a_X, a_Y, a_Z, Width, Height-2, Width); - a_Y++; -} - - - - - -void cChunk::SpawnMobs(cMobSpawner& a_MobSpawner) -{ - int Center_X,Center_Y,Center_Z; - getRandomBlockCoords(Center_X,Center_Y,Center_Z); - - BLOCKTYPE PackCenterBlock = GetBlock(Center_X, Center_Y, Center_Z); - if (a_MobSpawner.CheckPackCenter(PackCenterBlock)) - { - a_MobSpawner.NewPack(); - int NumberOfTries = 0; - int NumberOfSuccess = 0; - int MaxNbOfSuccess = 4; // this can be changed during the process for Wolves and Ghass - while (NumberOfTries < 12 && NumberOfSuccess < MaxNbOfSuccess) - { - const int HorizontalRange = 20; // MG TODO : relocate - const int VerticalRange = 0; // MG TODO : relocate - int Try_X, Try_Y, Try_Z; - getThreeRandomNumber(Try_X, Try_Y, Try_Z, 2*HorizontalRange+1 , 2*VerticalRange+1 , 2*HorizontalRange+1); - Try_X -= HorizontalRange; - Try_Y -= VerticalRange; - Try_Z -= HorizontalRange; - Try_X += Center_X; - Try_Y += Center_Y; - Try_Z += Center_Z; - - ASSERT(Try_Y > 0); - ASSERT(Try_Y < cChunkDef::Height-1); - - EMCSBiome Biome = m_ChunkMap->GetBiomeAt (Try_X, Try_Z); - // MG TODO : - // Moon cycle (for slime) - // check player and playerspawn presence < 24 blocks - // check mobs presence on the block - - // MG TODO : check that "Level" really means Y - - NIBBLETYPE SkyLight = 0; - - NIBBLETYPE BlockLight = 0; - - if (IsLightValid()) - { - cEntity* newMob = a_MobSpawner.TryToSpawnHere(this, Try_X, Try_Y, Try_Z, Biome, MaxNbOfSuccess); - if (newMob) - { - int WorldX, WorldY, WorldZ; - PositionToWorldPosition(Try_X, Try_Y, Try_Z, WorldX, WorldY, WorldZ); - double ActualX = WorldX + 0.5; - double ActualZ = WorldZ + 0.5; - newMob->SetPosition(ActualX, WorldY, ActualZ); - LOGD("Spawning %s #%i at %d,%d,%d",newMob->GetClass(),newMob->GetUniqueID(),WorldX, WorldY, WorldZ); - NumberOfSuccess++; - } - } - - NumberOfTries++; - } - } - -} - - - - - -void cChunk::Tick(float a_Dt) -{ - BroadcastPendingBlockChanges(); - - // Unload the chunk from all clients that have queued unloading: - for (cClientHandleList::iterator itr = m_UnloadQuery.begin(), end = m_UnloadQuery.end(); itr != end; ++itr) - { - (*itr)->SendUnloadChunk(m_PosX, m_PosZ); - } - m_UnloadQuery.clear(); - - // Set all blocks that have been queued for setting later: - ProcessQueuedSetBlocks(); - - CheckBlocks(); - - // Tick simulators: - m_World->GetSimulatorManager()->SimulateChunk(a_Dt, m_PosX, m_PosZ, this); - - TickBlocks(); - - // Tick all block entities in this chunk: - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) - { - m_IsDirty = (*itr)->Tick(a_Dt, *this) | m_IsDirty; - } - - // Tick all entities in this chunk (except mobs): - for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr) - { - // Mobs are tickes inside MobTick (as we don't have to tick them if they are far away from players) - if (!((*itr)->IsMob())) - { - (*itr)->Tick(a_Dt, *this); - } - } // for itr - m_Entitites[] - - // Remove all entities that were scheduled for removal: - for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end();) - { - if ((*itr)->IsDestroyed()) - { - LOGD("Destroying entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass()); - cEntity * ToDelete = *itr; - itr = m_Entities.erase(itr); - delete ToDelete; - continue; - } - itr++; - } // for itr - m_Entitites[] - - // If any entity moved out of the chunk, move it to the neighbor: - for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end();) - { - if ( - ((*itr)->GetChunkX() != m_PosX) || - ((*itr)->GetChunkZ() != m_PosZ) - ) - { - MoveEntityToNewChunk(*itr); - itr = m_Entities.erase(itr); - } - else - { - ++itr; - } - } - - ApplyWeatherToTop(); -} - - - - - -void cChunk::MoveEntityToNewChunk(cEntity * a_Entity) -{ - cChunk * Neighbor = GetNeighborChunk(a_Entity->GetChunkX() * cChunkDef::Width, a_Entity->GetChunkZ() * cChunkDef::Width); - if (Neighbor == NULL) - { - Neighbor = m_ChunkMap->GetChunkNoLoad(a_Entity->GetChunkX(), ZERO_CHUNK_Y, a_Entity->GetChunkZ()); - if (Neighbor == NULL) - { - // TODO: What to do with this? - LOGWARNING("%s: Failed to move entity, destination chunk unreachable. Entity lost", __FUNCTION__); - return; - } - } - - ASSERT(Neighbor != this); // Moving into the same chunk? wtf? - - Neighbor->AddEntity(a_Entity); - - class cMover : - public cClientDiffCallback - { - virtual void Removed(cClientHandle * a_Client) override - { - a_Client->SendDestroyEntity(*m_Entity); - } - - virtual void Added(cClientHandle * a_Client) override - { - m_Entity->SpawnOn(*a_Client); - } - - cEntity * m_Entity; - - public: - cMover(cEntity * a_Entity) : - m_Entity(a_Entity) - {} - } Mover(a_Entity); - - m_ChunkMap->CompareChunkClients(this, Neighbor, Mover); -} - - - - - -void cChunk::ProcessQueuedSetBlocks(void) -{ - Int64 CurrTick = m_World->GetWorldAge(); - for (sSetBlockQueueVector::iterator itr = m_SetBlockQueue.begin(); itr != m_SetBlockQueue.end();) - { - if (itr->m_Tick <= CurrTick) - { - // Current world age is bigger than/equal to target world age - delay time reached - SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta); - itr = m_SetBlockQueue.erase(itr); - } - else - { - // Not yet - ++itr; - continue; - } - } // for itr - m_SetBlockQueue[] -} - - - - - -void cChunk::BroadcastPendingBlockChanges(void) -{ - if (m_PendingSendBlocks.empty()) - { - return; - } - - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr) - { - (*itr)->SendBlockChanges(m_PosX, m_PosZ, m_PendingSendBlocks); - } - m_PendingSendBlocks.clear(); -} - - - - - -void cChunk::CheckBlocks(void) -{ - if (m_ToTickBlocks.size() == 0) - { - return; - } - std::vector<unsigned int> ToTickBlocks; - std::swap(m_ToTickBlocks, ToTickBlocks); - - for (std::vector<unsigned int>::const_iterator itr = ToTickBlocks.begin(), end = ToTickBlocks.end(); itr != end; ++itr) - { - unsigned int index = (*itr); - Vector3i BlockPos = IndexToCoordinate(index); - - cBlockHandler * Handler = BlockHandler(GetBlock(index)); - Handler->Check(BlockPos.x, BlockPos.y, BlockPos.z, *this); - } // for itr - ToTickBlocks[] -} - - - - - -void cChunk::TickBlocks(void) -{ - // Tick dem blocks - // _X: We must limit the random number or else we get a nasty int overflow bug ( http://forum.mc-server.org/showthread.php?tid=457 ) - int RandomX = m_World->GetTickRandomNumber(0x00ffffff); - int RandomY = m_World->GetTickRandomNumber(0x00ffffff); - int RandomZ = m_World->GetTickRandomNumber(0x00ffffff); - int TickX = m_BlockTickX; - int TickY = m_BlockTickY; - int TickZ = m_BlockTickZ; - - // This for loop looks disgusting, but it actually does a simple thing - first processes m_BlockTick, then adds random to it - // This is so that SetNextBlockTick() works - for (int i = 0; i < 50; i++, - - // This weird construct (*2, then /2) is needed, - // otherwise the blocktick distribution is too biased towards even coords! - - TickX = (TickX + RandomX) % (Width * 2), - TickY = (TickY + RandomY) % (Height * 2), - TickZ = (TickZ + RandomZ) % (Width * 2), - m_BlockTickX = TickX / 2, - m_BlockTickY = TickY / 2, - m_BlockTickZ = TickZ / 2 - ) - { - - if (m_BlockTickY > cChunkDef::GetHeight(m_HeightMap, m_BlockTickX, m_BlockTickZ)) - { - continue; // It's all air up here - } - - unsigned int Index = MakeIndexNoCheck(m_BlockTickX, m_BlockTickY, m_BlockTickZ); - cBlockHandler * Handler = BlockHandler(m_BlockTypes[Index]); - ASSERT(Handler != NULL); // Happenned on server restart, FS #243 - Handler->OnUpdate(m_World, m_BlockTickX + m_PosX * Width, m_BlockTickY, m_BlockTickZ + m_PosZ * Width); - } // for i - tickblocks -} - - - - - -void cChunk::ApplyWeatherToTop() -{ - if ( - (m_World->GetTickRandomNumber(100) != 0) || - ( - (m_World->GetWeather() != eWeather_Rain) && - (m_World->GetWeather() != eWeather_ThunderStorm) - ) - ) - { - // Not the right weather, or not at this tick; bail out - return; - } - - int X = m_World->GetTickRandomNumber(15); - int Z = m_World->GetTickRandomNumber(15); - switch (GetBiomeAt(X, Z)) - { - case biTaiga: - case biFrozenOcean: - case biFrozenRiver: - case biIcePlains: - case biIceMountains: - case biTaigaHills: - { - // TODO: Check light levels, don't snow over when the BlockLight is higher than (7?) - int Height = GetHeight(X, Z); - BLOCKTYPE TopBlock = GetBlock(X, Height, Z); - NIBBLETYPE TopMeta = GetMeta (X, Height, Z); - if (m_World->IsDeepSnowEnabled() && (TopBlock == E_BLOCK_SNOW)) - { - int MaxSize = 7; - BLOCKTYPE BlockType[4]; - NIBBLETYPE BlockMeta[4]; - UnboundedRelGetBlock(X - 1, Height, Z, BlockType[0], BlockMeta[0]); - UnboundedRelGetBlock(X + 1, Height, Z, BlockType[1], BlockMeta[1]); - UnboundedRelGetBlock(X, Height, Z - 1, BlockType[2], BlockMeta[2]); - UnboundedRelGetBlock(X, Height, Z + 1, BlockType[3], BlockMeta[3]); - for (int i = 0; i < 4; i++) - { - switch (BlockType[i]) - { - case E_BLOCK_AIR: - { - MaxSize = 0; - break; - } - case E_BLOCK_SNOW: - { - MaxSize = std::min(BlockMeta[i] + 1, MaxSize); - break; - } - } - } - if (TopMeta < MaxSize) - { - FastSetBlock(X, Height, Z, E_BLOCK_SNOW, TopMeta + 1); - } - else if (TopMeta > MaxSize) - { - FastSetBlock(X, Height, Z, E_BLOCK_SNOW, TopMeta - 1); - } - } - else if (g_BlockIsSnowable[TopBlock]) - { - SetBlock(X, Height + 1, Z, E_BLOCK_SNOW, 0); - } - else if ((TopBlock == E_BLOCK_WATER) || (TopBlock == E_BLOCK_STATIONARY_WATER)) - { - SetBlock(X, Height, Z, E_BLOCK_ICE, 0); - } - else if ( - (m_World->IsDeepSnowEnabled()) && - ( - (TopBlock == E_BLOCK_RED_ROSE) || - (TopBlock == E_BLOCK_YELLOW_FLOWER) || - (TopBlock == E_BLOCK_RED_MUSHROOM) || - (TopBlock == E_BLOCK_BROWN_MUSHROOM) - ) - ) - { - SetBlock(X, Height, Z, E_BLOCK_SNOW, 0); - } - break; - } // case (snowy biomes) - - // TODO: Rainy biomes should check for farmland and cauldrons - } // switch (biome) -} - - - - - -void cChunk::GrowMelonPumpkin(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, MTRand & a_TickRandom) -{ - // Convert the stem BlockType into produce BlockType - BLOCKTYPE ProduceType; - switch (a_BlockType) - { - case E_BLOCK_MELON_STEM: ProduceType = E_BLOCK_MELON; break; - case E_BLOCK_PUMPKIN_STEM: ProduceType = E_BLOCK_PUMPKIN; break; - default: - { - ASSERT(!"Unhandled blocktype in TickMelonPumpkin()"); - return; - } - } - - // Check if there's another melon / pumpkin around that stem, if so, abort: - bool IsValid; - BLOCKTYPE BlockType[4]; - NIBBLETYPE BlockMeta; // unused - IsValid = UnboundedRelGetBlock(a_RelX + 1, a_RelY, a_RelZ, BlockType[0], BlockMeta); - IsValid = IsValid && UnboundedRelGetBlock(a_RelX - 1, a_RelY, a_RelZ, BlockType[1], BlockMeta); - IsValid = IsValid && UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ + 1, BlockType[2], BlockMeta); - IsValid = IsValid && UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ - 1, BlockType[3], BlockMeta); - if ( - !IsValid || - (BlockType[0] == ProduceType) || - (BlockType[1] == ProduceType) || - (BlockType[2] == ProduceType) || - (BlockType[3] == ProduceType) - ) - { - // Neighbors not valid or already taken by the same produce - return; - } - - // Pick a direction in which to place the produce: - int x = 0, z = 0; - int CheckType = a_TickRandom.randInt(3); // The index to the neighbors array which should be checked for emptiness - switch (CheckType) - { - case 0: x = 1; break; - case 1: x = -1; break; - case 2: z = 1; break; - case 3: z = -1; break; - } - - // Check that the block in that direction is empty: - switch (BlockType[CheckType]) - { - case E_BLOCK_AIR: - case E_BLOCK_SNOW: - case E_BLOCK_TALL_GRASS: - case E_BLOCK_DEAD_BUSH: - { - break; - } - default: return; - } - - // Check if there's soil under the neighbor. We already know the neighbors are valid. Place produce if ok - BLOCKTYPE Soil; - UnboundedRelGetBlock(a_RelX + x, a_RelY - 1, a_RelZ + z, Soil, BlockMeta); - switch (Soil) - { - case E_BLOCK_DIRT: - case E_BLOCK_GRASS: - case E_BLOCK_FARMLAND: - { - // DEBUG: This is here to catch FS #349 - melons growing over other crops. - LOG("Growing melon/pumpkin overwriting %s, growing on %s", - ItemTypeToString(BlockType[CheckType]).c_str(), - ItemTypeToString(Soil).c_str() - ); - // Place a randomly-facing produce: - UnboundedRelFastSetBlock(a_RelX + x, a_RelY, a_RelZ + z, ProduceType, (NIBBLETYPE)(a_TickRandom.randInt(4) % 4)); - break; - } - } -} - - - - - -void cChunk::GrowSugarcane(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks) -{ - // Check the total height of the sugarcane blocks here: - int Top = a_RelY + 1; - while ( - (Top < cChunkDef::Height) && - (GetBlock(a_RelX, Top, a_RelZ) == E_BLOCK_SUGARCANE) - ) - { - ++Top; - } - int Bottom = a_RelY - 1; - while ( - (Bottom > 0) && - (GetBlock(a_RelX, Bottom, a_RelZ) == E_BLOCK_SUGARCANE) - ) - { - --Bottom; - } - - // Grow by at most a_NumBlocks, but no more than max height: - int ToGrow = std::min(a_NumBlocks, m_World->GetMaxSugarcaneHeight() + 1 - (Top - Bottom)); - for (int i = 0; i < ToGrow; i++) - { - BLOCKTYPE BlockType; - NIBBLETYPE BlockMeta; - if (UnboundedRelGetBlock(a_RelX, Top + i, a_RelZ, BlockType, BlockMeta) && (BlockType == E_BLOCK_AIR)) - { - UnboundedRelFastSetBlock(a_RelX, Top + i, a_RelZ, E_BLOCK_SUGARCANE, 0); - } - else - { - break; - } - } // for i -} - - - - - -void cChunk::GrowCactus(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks) -{ - // Check the total height of the sugarcane blocks here: - int Top = a_RelY + 1; - while ( - (Top < cChunkDef::Height) && - (GetBlock(a_RelX, Top, a_RelZ) == E_BLOCK_CACTUS) - ) - { - ++Top; - } - int Bottom = a_RelY - 1; - while ( - (Bottom > 0) && - (GetBlock(a_RelX, Bottom, a_RelZ) == E_BLOCK_CACTUS) - ) - { - --Bottom; - } - - // Grow by at most a_NumBlocks, but no more than max height: - int ToGrow = std::min(a_NumBlocks, m_World->GetMaxCactusHeight() + 1 - (Top - Bottom)); - for (int i = 0; i < ToGrow; i++) - { - BLOCKTYPE BlockType; - NIBBLETYPE BlockMeta; - if (UnboundedRelGetBlock(a_RelX, Top + i, a_RelZ, BlockType, BlockMeta) && (BlockType == E_BLOCK_AIR)) - { - // TODO: Check the surrounding blocks, if they aren't air, break the cactus block into pickups (and continue breaking blocks above in the next loop iterations) - UnboundedRelFastSetBlock(a_RelX, Top + i, a_RelZ, E_BLOCK_CACTUS, 0); - } - else - { - break; - } - } // for i -} - - - - - -bool cChunk::UnboundedRelGetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const -{ - if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) - { - LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); - return false; - } - cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - // The chunk is not available, bail out - return false; - } - Chunk->GetBlockTypeMeta(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta); - return true; -} - - - - - -bool cChunk::UnboundedRelGetBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType) const -{ - if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) - { - LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); - return false; - } - cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - // The chunk is not available, bail out - return false; - } - a_BlockType = Chunk->GetBlock(a_RelX, a_RelY, a_RelZ); - return true; -} - - - - - -bool cChunk::UnboundedRelGetBlockMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockMeta) const -{ - if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) - { - LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); - return false; - } - cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - // The chunk is not available, bail out - return false; - } - a_BlockMeta = Chunk->GetMeta(a_RelX, a_RelY, a_RelZ); - return true; -} - - - - - -bool cChunk::UnboundedRelGetBlockBlockLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockBlockLight) const -{ - if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) - { - LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); - return false; - } - cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - // The chunk is not available, bail out - return false; - } - a_BlockBlockLight = Chunk->GetBlockLight(a_RelX, a_RelY, a_RelZ); - return true; -} - - - - - -bool cChunk::UnboundedRelGetBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockSkyLight) const -{ - if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) - { - LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); - return false; - } - cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - // The chunk is not available, bail out - return false; - } - a_BlockSkyLight = Chunk->GetSkyLight(a_RelX, a_RelY, a_RelZ); - return true; -} - - - - - -bool cChunk::UnboundedRelGetBlockLights(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockLight, NIBBLETYPE & a_SkyLight) const -{ - if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) - { - LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); - return false; - } - cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - // The chunk is not available, bail out - return false; - } - int idx = Chunk->MakeIndex(a_RelX, a_RelY, a_RelZ); - a_BlockLight = Chunk->GetBlockLight(idx); - a_SkyLight = Chunk->GetSkyLight(idx); - return true; -} - - - - - -bool cChunk::UnboundedRelSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - if ((a_RelY < 0) || (a_RelY > cChunkDef::Height)) - { - LOGWARNING("UnboundedRelSetBlock(): requesting a block with a_RelY out of range: %d", a_RelY); - return false; - } - cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - // The chunk is not available, bail out - return false; - } - Chunk->SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta); - return true; -} - - - - - -bool cChunk::UnboundedRelFastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - if ((a_RelY < 0) || (a_RelY > cChunkDef::Height)) - { - LOGWARNING("UnboundedRelFastSetBlock(): requesting a block with a_RelY out of range: %d", a_RelY); - return false; - } - cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - // The chunk is not available, bail out - return false; - } - Chunk->FastSetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta); - return true; -} - - - - - -void cChunk::UnboundedQueueTickBlock(int a_RelX, int a_RelY, int a_RelZ) -{ - if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) - { - // Outside of chunkmap - return; - } - cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); - if ((Chunk != NULL) && Chunk->IsValid()) - { - Chunk->QueueTickBlock(a_RelX, a_RelY, a_RelZ); - } -} - - - - - -int cChunk::GetHeight(int a_X, int a_Z) -{ - ASSERT((a_X >= 0) && (a_X < Width) && (a_Z >= 0) && (a_Z < Width)); - - if ((a_X >= 0) && (a_X < Width) && (a_Z >= 0) && (a_Z < Width)) - { - return m_HeightMap[a_X + a_Z * Width]; - } - return 0; -} - - - - - -void cChunk::CreateBlockEntities(void) -{ - for (int x = 0; x < Width; x++) - { - for (int z = 0; z < Width; z++) - { - for (int y = 0; y < Height; y++) - { - BLOCKTYPE BlockType = cChunkDef::GetBlock(m_BlockTypes, x, y, z); - switch (BlockType) - { - case E_BLOCK_CHEST: - case E_BLOCK_DISPENSER: - case E_BLOCK_DROPPER: - case E_BLOCK_LIT_FURNACE: - case E_BLOCK_FURNACE: - case E_BLOCK_HOPPER: - case E_BLOCK_SIGN_POST: - case E_BLOCK_WALLSIGN: - case E_BLOCK_NOTE_BLOCK: - case E_BLOCK_JUKEBOX: - { - if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width)) - { - m_BlockEntities.push_back(cBlockEntity::CreateByBlockType( - BlockType, GetMeta(x, y, z), - x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World - )); - } - break; - } - } // switch (BlockType) - } // for y - } // for z - } // for x -} - - - - - -void cChunk::WakeUpSimulators(void) -{ - cSimulator * WaterSimulator = m_World->GetWaterSimulator(); - cSimulator * LavaSimulator = m_World->GetLavaSimulator(); - int BaseX = m_PosX * cChunkDef::Width; - int BaseZ = m_PosZ * cChunkDef::Width; - for (int x = 0; x < Width; x++) - { - int BlockX = x + BaseX; - for (int z = 0; z < Width; z++) - { - int BlockZ = z + BaseZ; - for (int y = GetHeight(x, z); y >= 0; y--) - { - switch (cChunkDef::GetBlock(m_BlockTypes, x, y, z)) - { - case E_BLOCK_WATER: - { - WaterSimulator->AddBlock(BlockX, y, BlockZ, this); - break; - } - case E_BLOCK_LAVA: - { - LavaSimulator->AddBlock(BlockX, y, BlockZ, this); - break; - } - } // switch (BlockType) - } // for y - } // for z - } // for x -} - - - - - -void cChunk::CalculateHeightmap() -{ - for (int x = 0; x < Width; x++) - { - for (int z = 0; z < Width; z++) - { - for (int y = Height - 1; y > -1; y--) - { - int index = MakeIndex( x, y, z ); - if (m_BlockTypes[index] != E_BLOCK_AIR) - { - m_HeightMap[x + z * Width] = (unsigned char)y; - break; - } - } // for y - } // for z - } // for x -} - - - - - -void cChunk::SetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - FastSetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta); - - const int index = MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ); - - // Tick this block and its neighbors: - m_ToTickBlocks.push_back(index); - QueueTickBlockNeighbors(a_RelX, a_RelY, a_RelZ); - - // If there was a block entity, remove it: - Vector3i WorldPos = PositionToWorldPosition(a_RelX, a_RelY, a_RelZ); - cBlockEntity * BlockEntity = GetBlockEntity(WorldPos); - if (BlockEntity != NULL) - { - BlockEntity->Destroy(); - RemoveBlockEntity(BlockEntity); - delete BlockEntity; - } - - // If the new block is a block entity, create the entity object: - switch (a_BlockType) - { - case E_BLOCK_CHEST: - case E_BLOCK_DISPENSER: - case E_BLOCK_DROPPER: - case E_BLOCK_LIT_FURNACE: - case E_BLOCK_FURNACE: - case E_BLOCK_HOPPER: - case E_BLOCK_SIGN_POST: - case E_BLOCK_WALLSIGN: - case E_BLOCK_NOTE_BLOCK: - case E_BLOCK_JUKEBOX: - { - AddBlockEntity(cBlockEntity::CreateByBlockType(a_BlockType, a_BlockMeta, WorldPos.x, WorldPos.y, WorldPos.z, m_World)); - break; - } - } // switch (a_BlockType) -} - - - - - -void cChunk::QueueSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick) -{ - m_SetBlockQueue.push_back(sSetBlockQueueItem(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta, a_Tick)); -} - - - - - -void cChunk::QueueTickBlock(int a_RelX, int a_RelY, int a_RelZ) -{ - ASSERT ( - (a_RelX >= 0) && (a_RelX < Width) && - (a_RelY >= 0) && (a_RelY < Height) && - (a_RelZ >= 0) && (a_RelZ < Width) - ); // Coords need to be valid - - if (!IsValid()) - { - return; - } - - m_ToTickBlocks.push_back(MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ)); -} - - - - - -void cChunk::QueueTickBlockNeighbors(int a_RelX, int a_RelY, int a_RelZ) -{ - struct - { - int x, y, z; - } - Coords[] = - { - { 1, 0, 0}, - {-1, 0, 0}, - { 0, 1, 0}, - { 0, -1, 0}, - { 0, 0, 1}, - { 0, 0, -1}, - } ; - for (int i = 0; i < ARRAYCOUNT(Coords); i++) - { - UnboundedQueueTickBlock(a_RelX + Coords[i].x, a_RelY + Coords[i].y, a_RelZ + Coords[i].z); - } // for i - Coords[] -} - - - - - -void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta) -{ - ASSERT(!((a_RelX < 0) || (a_RelX >= Width) || (a_RelY < 0) || (a_RelY >= Height) || (a_RelZ < 0) || (a_RelZ >= Width))); - - ASSERT(IsValid()); - - const int index = MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ); - const BLOCKTYPE OldBlockType = cChunkDef::GetBlock(m_BlockTypes, index); - const BLOCKTYPE OldBlockMeta = GetNibble(m_BlockMeta, index); - if ((OldBlockType == a_BlockType) && (OldBlockMeta == a_BlockMeta)) - { - return; - } - - MarkDirty(); - - m_BlockTypes[index] = a_BlockType; - - // The client doesn't need to distinguish between stationary and nonstationary fluids: - if ( - (OldBlockMeta != a_BlockMeta) || // Different meta always gets sent to the client - !( - ((OldBlockType == E_BLOCK_STATIONARY_WATER) && (a_BlockType == E_BLOCK_WATER)) || // Replacing stationary water with water - ((OldBlockType == E_BLOCK_WATER) && (a_BlockType == E_BLOCK_STATIONARY_WATER)) || // Replacing water with stationary water - ((OldBlockType == E_BLOCK_STATIONARY_LAVA) && (a_BlockType == E_BLOCK_LAVA)) || // Replacing stationary water with water - ((OldBlockType == E_BLOCK_LAVA) && (a_BlockType == E_BLOCK_STATIONARY_LAVA)) // Replacing water with stationary water - ) - ) - { - m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta)); - } - - SetNibble(m_BlockMeta, index, a_BlockMeta); - - // ONLY recalculate lighting if it's necessary! - if( - (g_BlockLightValue[OldBlockType ] != g_BlockLightValue[a_BlockType]) || - (g_BlockSpreadLightFalloff[OldBlockType] != g_BlockSpreadLightFalloff[a_BlockType]) || - (g_BlockTransparent[OldBlockType] != g_BlockTransparent[a_BlockType]) - ) - { - m_IsLightValid = false; - } - - // Update heightmap, if needed: - if (a_RelY >= m_HeightMap[a_RelX + a_RelZ * Width]) - { - if (a_BlockType != E_BLOCK_AIR) - { - m_HeightMap[a_RelX + a_RelZ * Width] = (unsigned char)a_RelY; - } - else - { - for (int y = a_RelY - 1; y > 0; --y) - { - if (m_BlockTypes[MakeIndexNoCheck(a_RelX, y, a_RelZ)] != E_BLOCK_AIR) - { - m_HeightMap[a_RelX + a_RelZ * Width] = (unsigned char)y; - break; - } - } // for y - column in m_BlockData - } - } -} - - - - - -void cChunk::SendBlockTo(int a_RelX, int a_RelY, int a_RelZ, cClientHandle * a_Client) -{ - // The coords must be valid, because the upper level already does chunk lookup. No need to check them again. - // There's an debug-time assert in MakeIndexNoCheck anyway - unsigned int index = MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ); - - if (a_Client == NULL) - { - // Queue the block for all clients in the chunk (will be sent in Tick()) - m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, GetBlock(index), GetMeta(index))); - return; - } - - Vector3i wp = PositionToWorldPosition(a_RelX, a_RelY, a_RelZ); - a_Client->SendBlockChange(wp.x, wp.y, wp.z, GetBlock(index), GetMeta(index)); - - // FS #268 - if a BlockEntity digging is cancelled by a plugin, the entire block entity must be re-sent to the client: - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), end = m_BlockEntities.end(); itr != end; ++itr) - { - if (((*itr)->GetPosX() == wp.x) && ((*itr)->GetPosY() == wp.y) && ((*itr)->GetPosZ() == wp.z)) - { - (*itr)->SendTo(*a_Client); - } - } // for itr - m_BlockEntities -} - - - - - -void cChunk::AddBlockEntity(cBlockEntity * a_BlockEntity) -{ - MarkDirty(); - m_BlockEntities.push_back(a_BlockEntity); -} - - - - - -cBlockEntity * cChunk::GetBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) - { - if ( - ((*itr)->GetPosX() == a_BlockX) && - ((*itr)->GetPosY() == a_BlockY) && - ((*itr)->GetPosZ() == a_BlockZ) - ) - { - return *itr; - } - } // for itr - m_BlockEntities[] - - return NULL; -} - - - - - -void cChunk::UseBlockEntity(cPlayer * a_Player, int a_X, int a_Y, int a_Z) -{ - cBlockEntity * be = GetBlockEntity(a_X, a_Y, a_Z); - if (be != NULL) - { - be->UsedBy(a_Player); - } -} - - - - - -void cChunk::CollectPickupsByPlayer(cPlayer * a_Player) -{ - double PosX = a_Player->GetPosX(); - double PosY = a_Player->GetPosY(); - double PosZ = a_Player->GetPosZ(); - - for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr) - { - if ((!(*itr)->IsPickup()) && (!(*itr)->IsProjectile())) - { - continue; // Only pickups and projectiles - } - float DiffX = (float)((*itr)->GetPosX() - PosX ); - float DiffY = (float)((*itr)->GetPosY() - PosY ); - float DiffZ = (float)((*itr)->GetPosZ() - PosZ ); - float SqrDist = DiffX * DiffX + DiffY * DiffY + DiffZ * DiffZ; - if (SqrDist < 1.5f * 1.5f) // 1.5 block - { - /* - LOG("Pickup %d being collected by player \"%s\", distance %f", - (*itr)->GetUniqueID(), a_Player->GetName().c_str(), SqrDist - ); - */ - MarkDirty(); - if ((*itr)->IsPickup()) - { - (reinterpret_cast<cPickup *>(*itr))->CollectedBy(a_Player); - } - else - { - (reinterpret_cast<cProjectileEntity *>(*itr))->CollectedBy(a_Player); - } - } - else if (SqrDist < 5 * 5) - { - /* - LOG("Pickup %d close to player \"%s\", but still too far to collect: %f", - (*itr)->GetUniqueID(), a_Player->GetName().c_str(), SqrDist - ); - */ - } - } -} - - - - - -bool cChunk::SetSignLines(int a_PosX, int a_PosY, int a_PosZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) -{ - // Also sends update packets to all clients in the chunk - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) - { - if ( - ((*itr)->GetPosX() == a_PosX) && - ((*itr)->GetPosY() == a_PosY) && - ((*itr)->GetPosZ() == a_PosZ) && - ( - ((*itr)->GetBlockType() == E_BLOCK_WALLSIGN) || - ((*itr)->GetBlockType() == E_BLOCK_SIGN_POST) - ) - ) - { - MarkDirty(); - (reinterpret_cast<cSignEntity *>(*itr))->SetLines(a_Line1, a_Line2, a_Line3, a_Line4); - m_World->BroadcastBlockEntity(a_PosX, a_PosY, a_PosZ); - return true; - } - } // for itr - m_BlockEntities[] - return false; -} - - - - - -void cChunk::RemoveBlockEntity( cBlockEntity* a_BlockEntity ) -{ - MarkDirty(); - m_BlockEntities.remove(a_BlockEntity); -} - - - - - -bool cChunk::AddClient(cClientHandle* a_Client) -{ - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (a_Client == *itr) - { - // Already there, nothing needed - return false; - } - } - m_LoadedByClient.push_back( a_Client ); - - for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr ) - { - LOGD("cChunk: Entity #%d (%s) at [%i, %i, %i] spawning for player \"%s\"", (*itr)->GetUniqueID(), (*itr)->GetClass(), m_PosX, m_PosY, m_PosZ, a_Client->GetUsername().c_str()); - (*itr)->SpawnOn(*a_Client); - } - return true; -} - - - - - -void cChunk::RemoveClient( cClientHandle* a_Client ) -{ - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if (*itr != a_Client) - { - continue; - } - - m_LoadedByClient.erase(itr); - - if (!a_Client->IsDestroyed()) - { - for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr ) - { - LOGD("chunk [%i, %i] destroying entity #%i for player \"%s\"", m_PosX, m_PosZ, (*itr)->GetUniqueID(), a_Client->GetUsername().c_str() ); - a_Client->SendDestroyEntity(*(*itr)); - } - } - return; - } // for itr - m_LoadedByClient[] -} - - - - - -bool cChunk::HasClient( cClientHandle* a_Client ) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) - { - if ((*itr) == a_Client) - { - return true; - } - } - return false; -} - - - - - -bool cChunk::HasAnyClients(void) -{ - return !m_LoadedByClient.empty(); -} - - - - - -void cChunk::AddEntity(cEntity * a_Entity) -{ - if (!a_Entity->IsPlayer()) - { - MarkDirty(); - } - - ASSERT(std::find(m_Entities.begin(), m_Entities.end(), a_Entity) == m_Entities.end()); // Not there already - - m_Entities.push_back(a_Entity); -} - - - - - -void cChunk::RemoveEntity(cEntity * a_Entity) -{ - size_t SizeBefore = m_Entities.size(); - m_Entities.remove(a_Entity); - size_t SizeAfter = m_Entities.size(); - - if (SizeBefore != SizeAfter) - { - // Mark as dirty if it was a server-generated entity: - if (!a_Entity->IsPlayer()) - { - MarkDirty(); - } - } -} - - - - - -bool cChunk::HasEntity(int a_EntityID) -{ - for (cEntityList::const_iterator itr = m_Entities.begin(), end = m_Entities.end(); itr != end; ++itr) - { - if ((*itr)->GetUniqueID() == a_EntityID) - { - return true; - } - } // for itr - m_Entities[] - return false; -} - - - - - -bool cChunk::ForEachEntity(cEntityCallback & a_Callback) -{ - // The entity list is locked by the parent chunkmap's CS - for (cEntityList::iterator itr = m_Entities.begin(), itr2 = itr; itr != m_Entities.end(); itr = itr2) - { - ++itr2; - if (a_Callback.Item(*itr)) - { - return false; - } - } // for itr - m_Entitites[] - return true; -} - - - - - -bool cChunk::DoWithEntityByID(int a_EntityID, cEntityCallback & a_Callback, bool & a_CallbackResult) -{ - // The entity list is locked by the parent chunkmap's CS - for (cEntityList::iterator itr = m_Entities.begin(), end = m_Entities.end(); itr != end; ++itr) - { - if ((*itr)->GetUniqueID() == a_EntityID) - { - a_CallbackResult = a_Callback.Item(*itr); - return true; - } - } // for itr - m_Entitites[] - return false; -} - - - - - -bool cChunk::ForEachBlockEntity(cBlockEntityCallback & a_Callback) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) - { - ++itr2; - if (a_Callback.Item(*itr)) - { - return false; - } - } // for itr - m_BlockEntitites[] - return true; -} - - - - - -bool cChunk::ForEachChest(cChestCallback & a_Callback) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) - { - ++itr2; - if ((*itr)->GetBlockType() != E_BLOCK_CHEST) - { - continue; - } - if (a_Callback.Item((cChestEntity *)*itr)) - { - return false; - } - } // for itr - m_BlockEntitites[] - return true; -} - - - - - -bool cChunk::ForEachDispenser(cDispenserCallback & a_Callback) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) - { - ++itr2; - if ((*itr)->GetBlockType() != E_BLOCK_DISPENSER) - { - continue; - } - if (a_Callback.Item((cDispenserEntity *)*itr)) - { - return false; - } - } // for itr - m_BlockEntitites[] - return true; -} - - - - - -bool cChunk::ForEachDropper(cDropperCallback & a_Callback) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) - { - ++itr2; - if ((*itr)->GetBlockType() != E_BLOCK_DROPPER) - { - continue; - } - if (a_Callback.Item((cDropperEntity *)*itr)) - { - return false; - } - } // for itr - m_BlockEntitites[] - return true; -} - - - - - -bool cChunk::ForEachDropSpenser(cDropSpenserCallback & a_Callback) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) - { - ++itr2; - if (((*itr)->GetBlockType() != E_BLOCK_DISPENSER) && ((*itr)->GetBlockType() != E_BLOCK_DROPPER)) - { - continue; - } - if (a_Callback.Item((cDropSpenserEntity *)*itr)) - { - return false; - } - } // for itr - m_BlockEntitites[] - return true; -} - - - - - -bool cChunk::ForEachFurnace(cFurnaceCallback & a_Callback) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) - { - ++itr2; - switch ((*itr)->GetBlockType()) - { - case E_BLOCK_FURNACE: - case E_BLOCK_LIT_FURNACE: - { - break; - } - default: - { - continue; - } - } - if (a_Callback.Item((cFurnaceEntity *)*itr)) - { - return false; - } - } // for itr - m_BlockEntitites[] - return true; -} - - - - - -bool cChunk::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) - { - ++itr2; - if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) - { - continue; - } - - if (a_Callback.Item(*itr)) - { - return false; - } - return true; - } // for itr - m_BlockEntitites[] - - // Not found: - return false; -} - - - - - -bool cChunk::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) - { - ++itr2; - if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) - { - continue; - } - if ((*itr)->GetBlockType() != E_BLOCK_CHEST) - { - // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out - return false; - } - - // The correct block entity is here - if (a_Callback.Item((cChestEntity *)*itr)) - { - return false; - } - return true; - } // for itr - m_BlockEntitites[] - - // Not found: - return false; -} - - - - - -bool cChunk::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) - { - ++itr2; - if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) - { - continue; - } - if ((*itr)->GetBlockType() != E_BLOCK_DISPENSER) - { - // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out - return false; - } - - // The correct block entity is here - if (a_Callback.Item((cDispenserEntity *)*itr)) - { - return false; - } - return true; - } // for itr - m_BlockEntitites[] - - // Not found: - return false; -} - - - - - -bool cChunk::DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) - { - ++itr2; - if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) - { - continue; - } - if ((*itr)->GetBlockType() != E_BLOCK_DROPPER) - { - // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out - return false; - } - - // The correct block entity is here - if (a_Callback.Item((cDropperEntity *)*itr)) - { - return false; - } - return true; - } // for itr - m_BlockEntitites[] - - // Not found: - return false; -} - - - - - -bool cChunk::DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) - { - ++itr2; - if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) - { - continue; - } - if (((*itr)->GetBlockType() != E_BLOCK_DISPENSER) && ((*itr)->GetBlockType() != E_BLOCK_DROPPER)) - { - // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out - return false; - } - - // The correct block entity is here - if (a_Callback.Item((cDropSpenserEntity *)*itr)) - { - return false; - } - return true; - } // for itr - m_BlockEntitites[] - - // Not found: - return false; -} - - - - - -bool cChunk::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) - { - ++itr2; - if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) - { - continue; - } - switch ((*itr)->GetBlockType()) - { - case E_BLOCK_FURNACE: - case E_BLOCK_LIT_FURNACE: - { - break; - } - default: - { - // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out - return false; - } - } // switch (BlockType) - - // The correct block entity is here, - if (a_Callback.Item((cFurnaceEntity *)*itr)) - { - return false; - } - return true; - } // for itr - m_BlockEntitites[] - - // Not found: - return false; -} - - - - - -bool cChunk::GetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4) -{ - // The blockentity list is locked by the parent chunkmap's CS - for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) - { - if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) - { - continue; - } - switch ((*itr)->GetBlockType()) - { - case E_BLOCK_WALLSIGN: - case E_BLOCK_SIGN_POST: - { - a_Line1 = ((cSignEntity *)*itr)->GetLine(0); - a_Line2 = ((cSignEntity *)*itr)->GetLine(1); - a_Line3 = ((cSignEntity *)*itr)->GetLine(2); - a_Line4 = ((cSignEntity *)*itr)->GetLine(3); - return true; - } - } // switch (BlockType) - - // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out - return false; - } // for itr - m_BlockEntitites[] - - // Not found: - return false; -} - - - - - -BLOCKTYPE cChunk::GetBlock(int a_RelX, int a_RelY, int a_RelZ) const -{ - if ( - (a_RelX < 0) || (a_RelX >= Width) || - (a_RelY < 0) || (a_RelY >= Height) || - (a_RelZ < 0) || (a_RelZ >= Width) - ) - { - ASSERT(!"GetBlock(x, y, z) out of bounds!"); - return 0; // Clip - } - - return m_BlockTypes[MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ)]; -} - - - - - -BLOCKTYPE cChunk::GetBlock(int a_BlockIdx) const -{ - if ((a_BlockIdx < 0) || (a_BlockIdx >= NumBlocks)) - { - ASSERT(!"GetBlock(idx) out of bounds!"); - return 0; - } - - return m_BlockTypes[ a_BlockIdx ]; -} - - - - - -void cChunk::GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) -{ - int Idx = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ); - a_BlockType = cChunkDef::GetBlock (m_BlockTypes, a_RelX, a_RelY, a_RelZ); - a_BlockMeta = cChunkDef::GetNibble(m_BlockMeta, a_RelX, a_RelY, a_RelZ); -} - - - - - -void cChunk::GetBlockInfo(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight) -{ - int Idx = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ); - a_BlockType = cChunkDef::GetBlock (m_BlockTypes, Idx); - a_Meta = cChunkDef::GetNibble(m_BlockMeta, Idx); - a_SkyLight = cChunkDef::GetNibble(m_BlockSkyLight, Idx); - a_BlockLight = cChunkDef::GetNibble(m_BlockLight, Idx); -} - - - - - -cChunk * cChunk::GetNeighborChunk(int a_BlockX, int a_BlockZ) -{ - // Convert coords to relative, then call the relative version: - a_BlockX -= m_PosX * cChunkDef::Width; - a_BlockZ -= m_PosZ * cChunkDef::Width; - return GetRelNeighborChunk(a_BlockX, a_BlockZ); -} - - - - - -cChunk * cChunk::GetRelNeighborChunk(int a_RelX, int a_RelZ) -{ - bool ReturnThis = true; - if (a_RelX < 0) - { - if (m_NeighborXM != NULL) - { - cChunk * Candidate = m_NeighborXM->GetRelNeighborChunk(a_RelX + cChunkDef::Width, a_RelZ); - if (Candidate != NULL) - { - return Candidate; - } - } - // Going X first failed, but if the request is crossing Z as well, let's try the Z first later on. - ReturnThis = false; - } - else if (a_RelX >= cChunkDef::Width) - { - if (m_NeighborXP != NULL) - { - cChunk * Candidate = m_NeighborXP->GetRelNeighborChunk(a_RelX - cChunkDef::Width, a_RelZ); - if (Candidate != NULL) - { - return Candidate; - } - } - // Going X first failed, but if the request is crossing Z as well, let's try the Z first later on. - ReturnThis = false; - } - - if (a_RelZ < 0) - { - if (m_NeighborZM != NULL) - { - return m_NeighborZM->GetRelNeighborChunk(a_RelX, a_RelZ + cChunkDef::Width); - // For requests crossing both X and Z, the X-first way has been already tried - } - return NULL; - } - else if (a_RelZ >= cChunkDef::Width) - { - if (m_NeighborZP != NULL) - { - return m_NeighborZP->GetRelNeighborChunk(a_RelX, a_RelZ - cChunkDef::Width); - // For requests crossing both X and Z, the X-first way has been already tried - } - return NULL; - } - - return (ReturnThis ? this : NULL); -} - - - - - -cChunk * cChunk::GetRelNeighborChunkAdjustCoords(int & a_RelX, int & a_RelZ) const -{ - cChunk * ToReturn = const_cast<cChunk *>(this); - - // The most common case: inside this chunk: - if ( - (a_RelX >= 0) && (a_RelX < Width) && - (a_RelZ >= 0) && (a_RelZ < Width) - ) - { - return ToReturn; - } - - // Request for a different chunk, calculate chunk offset: - int RelX = a_RelX; // Make a local copy of the coords (faster access) - int RelZ = a_RelZ; - while ((RelX >= Width) && (ToReturn != NULL)) - { - RelX -= Width; - ToReturn = ToReturn->m_NeighborXP; - } - while ((RelX < 0) && (ToReturn != NULL)) - { - RelX += Width; - ToReturn = ToReturn->m_NeighborXM; - } - while ((RelZ >= Width) && (ToReturn != NULL)) - { - RelZ -= Width; - ToReturn = ToReturn->m_NeighborZP; - } - while ((RelZ < 0) && (ToReturn != NULL)) - { - RelZ += Width; - ToReturn = ToReturn->m_NeighborZM; - } - if (ToReturn != NULL) - { - a_RelX = RelX; - a_RelZ = RelZ; - return ToReturn; - } - - // The chunk cannot be walked through neighbors, find it through the chunkmap: - int AbsX = a_RelX + m_PosX * Width; - int AbsZ = a_RelZ + m_PosZ * Width; - int DstChunkX, DstChunkZ; - BlockToChunk(AbsX, AbsZ, DstChunkX, DstChunkZ); - ToReturn = m_ChunkMap->FindChunk(DstChunkX, DstChunkZ); - a_RelX = AbsX - DstChunkX * Width; - a_RelZ = AbsZ - DstChunkZ * Width; - return ToReturn; -} - - - - - -void cChunk::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity * a_Vehicle) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - (*itr)->SendAttachEntity(a_Entity, a_Vehicle); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendBlockAction(a_BlockX, a_BlockY, a_BlockZ, a_Byte1, a_Byte2, a_BlockType); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastBlockBreakAnimation(int a_entityID, int a_blockX, int a_blockY, int a_blockZ, char a_stage, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendBlockBreakAnim(a_entityID, a_blockX, a_blockY, a_blockZ, a_stage); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) -{ - // We can operate on entity pointers, we're inside the ChunkMap's CS lock which guards the list - cBlockEntity * Entity = GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ); - if (Entity == NULL) - { - return; - } - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - Entity->SendTo(*(*itr)); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastChunkData(cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendChunkData(m_PosX, m_PosZ, a_Serializer); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendCollectPickup(a_Pickup, a_Player); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendDestroyEntity(a_Entity); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityEquipment(a_Entity, a_SlotNum, a_Item); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityHeadLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityHeadLook(a_Entity); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityLook(a_Entity); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityMetadata(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityMetadata(a_Entity); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityRelMove(a_Entity, a_RelX, a_RelY, a_RelZ); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityRelMoveLook(a_Entity, a_RelX, a_RelY, a_RelZ); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityStatus(a_Entity, a_Status); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendEntityVelocity(a_Entity); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendPlayerAnimation(a_Player, a_Animation); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendSoundEffect(a_SoundName, a_SrcX, a_SrcY, a_SrcZ, a_Volume, a_Pitch); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendSoundParticleEffect(a_EffectID, a_SrcX, a_SrcY, a_SrcZ, a_Data); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - a_Entity.SpawnOn(*(*itr)); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) -{ - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - if (*itr == a_Exclude) - { - continue; - } - (*itr)->SendThunderbolt(a_BlockX, a_BlockY, a_BlockZ); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) -{ - for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) - { - (*itr)->SendUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ); - } // for itr - LoadedByClient[] -} - - - - - -void cChunk::SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client) -{ - cBlockEntity * Entity = GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ); - if (Entity == NULL) - { - return; - } - Entity->SendTo(a_Client); -} - - - - - -void cChunk::PositionToWorldPosition(int a_RelX, int a_RelY, int a_RelZ, int & a_BlockX, int & a_BlockY, int & a_BlockZ) -{ - a_BlockY = a_RelY; - a_BlockX = m_PosX * Width + a_RelX; - a_BlockZ = m_PosZ * Width + a_RelZ; -} - - - - - -Vector3i cChunk::PositionToWorldPosition(int a_RelX, int a_RelY, int a_RelZ) -{ - return Vector3i(m_PosX * Width + a_RelX, m_PosY * Height + a_RelY, m_PosZ * Width + a_RelZ); -} - - - - - -NIBBLETYPE cChunk::GetTimeAlteredLight(NIBBLETYPE a_Skylight) const -{ - a_Skylight -= m_World->GetSkyDarkness(); - // Because NIBBLETYPE is unsigned, we clamp it to 0 .. 15 by checking for values above 15 - return (a_Skylight < 16)? a_Skylight : 0; -} - - - - - -#if !C_CHUNK_USE_INLINE -# include "cChunk.inl.h" -#endif - - - - diff --git a/source/ChunkMap.cpp b/source/ChunkMap.cpp deleted file mode 100644 index 9d55917e5..000000000 --- a/source/ChunkMap.cpp +++ /dev/null @@ -1,2701 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "ChunkMap.h" -#include "World.h" -#include "Root.h" -#include "Entities/Player.h" -#include "Item.h" -#include "Entities/Pickup.h" -#include "Chunk.h" -#include "Generating/Trees.h" // used in cChunkMap::ReplaceTreeBlocks() for tree block discrimination -#include "BlockArea.h" -#include "PluginManager.h" -#include "Entities/TNTEntity.h" -#include "Blocks/BlockHandler.h" -#include "MobCensus.h" -#include "MobSpawner.h" - -#ifndef _WIN32 - #include <cstdlib> // abs -#endif - -#include "zlib.h" -#include <json/json.h> - - - - - -//////////////////////////////////////////////////////////////////////////////// -// cChunkMap: - -cChunkMap::cChunkMap(cWorld * a_World ) - : m_World( a_World ) -{ -} - - - - - -cChunkMap::~cChunkMap() -{ - cCSLock Lock(m_CSLayers); - while (!m_Layers.empty()) - { - delete m_Layers.back(); - m_Layers.pop_back(); // Must pop, because further chunk deletions query the chunkmap for entities and that would touch deleted data - } -} - - - - - -void cChunkMap::RemoveLayer( cChunkLayer* a_Layer ) -{ - cCSLock Lock(m_CSLayers); - m_Layers.remove(a_Layer); -} - - - - - -cChunkMap::cChunkLayer * cChunkMap::GetLayer(int a_LayerX, int a_LayerZ) -{ - cCSLock Lock(m_CSLayers); - for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - if (((*itr)->GetX() == a_LayerX) && ((*itr)->GetZ() == a_LayerZ)) - { - return *itr; - } - } - - // Not found, create new: - cChunkLayer * Layer = new cChunkLayer(a_LayerX, a_LayerZ, this); - if (Layer == NULL) - { - LOGERROR("cChunkMap: Cannot create new layer, server out of memory?"); - return NULL; - } - m_Layers.push_back(Layer); - return Layer; -} - - - - - -cChunkMap::cChunkLayer * cChunkMap::FindLayerForChunk(int a_ChunkX, int a_ChunkZ) -{ - const int LayerX = FAST_FLOOR_DIV(a_ChunkX, LAYER_SIZE); - const int LayerZ = FAST_FLOOR_DIV(a_ChunkZ, LAYER_SIZE); - return FindLayer(LayerX, LayerZ); -} - - - - - -cChunkMap::cChunkLayer * cChunkMap::FindLayer(int a_LayerX, int a_LayerZ) -{ - ASSERT(m_CSLayers.IsLockedByCurrentThread()); - - for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - if (((*itr)->GetX() == a_LayerX) && ((*itr)->GetZ() == a_LayerZ)) - { - return *itr; - } - } // for itr - m_Layers[] - - // Not found - return NULL; -} - - - - - -cChunkMap::cChunkLayer * cChunkMap::GetLayerForChunk(int a_ChunkX, int a_ChunkZ) -{ - const int LayerX = FAST_FLOOR_DIV(a_ChunkX, LAYER_SIZE); - const int LayerZ = FAST_FLOOR_DIV(a_ChunkZ, LAYER_SIZE); - return GetLayer(LayerX, LayerZ); -} - - - - - -cChunkPtr cChunkMap::GetChunk( int a_ChunkX, int a_ChunkY, int a_ChunkZ ) -{ - // No need to lock m_CSLayers, since it's already locked by the operation that called us - ASSERT(m_CSLayers.IsLockedByCurrentThread()); - - cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ ); - if (Layer == NULL) - { - // An error must have occurred, since layers are automatically created if they don't exist - return NULL; - } - - cChunkPtr Chunk = Layer->GetChunk(a_ChunkX, a_ChunkY, a_ChunkZ); - if (Chunk == NULL) - { - return NULL; - } - if (!(Chunk->IsValid())) - { - m_World->GetStorage().QueueLoadChunk(a_ChunkX, a_ChunkY, a_ChunkZ, true); - } - return Chunk; -} - - - - - -cChunkPtr cChunkMap::GetChunkNoGen( int a_ChunkX, int a_ChunkY, int a_ChunkZ ) -{ - // No need to lock m_CSLayers, since it's already locked by the operation that called us - cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ ); - if (Layer == NULL) - { - // An error must have occurred, since layers are automatically created if they don't exist - return NULL; - } - - cChunkPtr Chunk = Layer->GetChunk(a_ChunkX, a_ChunkY, a_ChunkZ); - if (Chunk == NULL) - { - return NULL; - } - if (!(Chunk->IsValid())) - { - m_World->GetStorage().QueueLoadChunk(a_ChunkX, a_ChunkY, a_ChunkZ, false); - } - - return Chunk; -} - - - - - -cChunkPtr cChunkMap::GetChunkNoLoad( int a_ChunkX, int a_ChunkY, int a_ChunkZ ) -{ - // No need to lock m_CSLayers, since it's already locked by the operation that called us - cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ ); - if (Layer == NULL) - { - // An error must have occurred, since layers are automatically created if they don't exist - return NULL; - } - - return Layer->GetChunk(a_ChunkX, a_ChunkY, a_ChunkZ); -} - - - - - -bool cChunkMap::LockedGetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) -{ - // We already have m_CSLayers locked since this can be called only from within the tick thread - ASSERT(m_CSLayers.IsLockedByCurrentThread()); - - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk == NULL) - { - return false; - } - - int Index = cChunkDef::MakeIndexNoCheck(a_BlockX, a_BlockY, a_BlockZ); - a_BlockType = Chunk->GetBlock(Index); - a_BlockMeta = Chunk->GetMeta(Index); - return true; -} - - - - - -bool cChunkMap::LockedGetBlockType(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType) -{ - // We already have m_CSLayers locked since this can be called only from within the tick thread - ASSERT(m_CSLayers.IsLockedByCurrentThread()); - - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk == NULL) - { - return false; - } - - int Index = cChunkDef::MakeIndexNoCheck(a_BlockX, a_BlockY, a_BlockZ); - a_BlockType = Chunk->GetBlock(Index); - return true; -} - - - - - -bool cChunkMap::LockedGetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE & a_BlockMeta) -{ - // We already have m_CSLayers locked since this can be called only from within the tick thread - ASSERT(m_CSLayers.IsLockedByCurrentThread()); - - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk == NULL) - { - return false; - } - - int Index = cChunkDef::MakeIndexNoCheck(a_BlockX, a_BlockY, a_BlockZ); - a_BlockMeta = Chunk->GetMeta(Index); - return true; -} - - - - - -bool cChunkMap::LockedSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - // We already have m_CSLayers locked since this can be called only from within the tick thread - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk == NULL) - { - return false; - } - - Chunk->SetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); - return true; -} - - - - - -bool cChunkMap::LockedFastSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - // We already have m_CSLayers locked since this can be called only from within the tick thread - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk == NULL) - { - return false; - } - - Chunk->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); - return true; -} - - - - - -cChunk * cChunkMap::FindChunk(int a_ChunkX, int a_ChunkZ) -{ - ASSERT(m_CSLayers.IsLockedByCurrentThread()); - - cChunkLayer * Layer = FindLayerForChunk(a_ChunkX, a_ChunkZ); - if (Layer == NULL) - { - return NULL; - } - return Layer->FindChunk(a_ChunkX, a_ChunkZ); -} - - - - - -void cChunkMap::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity * a_Vehicle) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastAttachEntity(a_Entity, a_Vehicle); -} - - - - - -void cChunkMap::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - int x, y, z, ChunkX, ChunkZ; - x = a_BlockX; - y = a_BlockY; - z = a_BlockZ; - cChunkDef::BlockToChunk(x, z, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastBlockAction(a_BlockX, a_BlockY, a_BlockZ, a_Byte1, a_Byte2, a_BlockType, a_Exclude); -} - - - - - -void cChunkMap::BroadcastBlockBreakAnimation(int a_entityID, int a_blockX, int a_blockY, int a_blockZ, char a_stage, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - int ChunkX, ChunkZ; - - cChunkDef::BlockToChunk(a_blockX, a_blockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastBlockBreakAnimation(a_entityID, a_blockX, a_blockY, a_blockZ, a_stage, a_Exclude); -} - - - - - -void cChunkMap::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - int ChunkX, ChunkZ; - cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - return; - } - Chunk->BroadcastBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Exclude); -} - - - - - -void cChunkMap::BroadcastChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, 0, a_ChunkZ); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastChunkData(a_Serializer, a_Exclude); -} - - - - - -void cChunkMap::BroadcastCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Pickup.GetChunkX(), ZERO_CHUNK_Y, a_Pickup.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastCollectPickup(a_Pickup, a_Player, a_Exclude); -} - - - - - -void cChunkMap::BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastDestroyEntity(a_Entity, a_Exclude); -} - - - - - -void cChunkMap::BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastEntityEquipment(a_Entity, a_SlotNum, a_Item, a_Exclude); -} - - - - - -void cChunkMap::BroadcastEntityHeadLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastEntityHeadLook(a_Entity, a_Exclude); -} - - - - - -void cChunkMap::BroadcastEntityLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastEntityLook(a_Entity, a_Exclude); -} - - - - - -void cChunkMap::BroadcastEntityMetadata(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastEntityMetadata(a_Entity, a_Exclude); -} - - - - - -void cChunkMap::BroadcastEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastEntityRelMove(a_Entity, a_RelX, a_RelY, a_RelZ, a_Exclude); -} - - - - - -void cChunkMap::BroadcastEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastEntityRelMoveLook(a_Entity, a_RelX, a_RelY, a_RelZ, a_Exclude); -} - - - - - -void cChunkMap::BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastEntityStatus(a_Entity, a_Status, a_Exclude); -} - - - - - -void cChunkMap::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastEntityVelocity(a_Entity, a_Exclude); -} - - - - - -void cChunkMap::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Player.GetChunkX(), ZERO_CHUNK_Y, a_Player.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastPlayerAnimation(a_Player, a_Animation, a_Exclude); -} - - - - - -void cChunkMap::BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - int ChunkX, ChunkZ; - - cChunkDef::BlockToChunk(a_SrcX / 8, a_SrcZ / 8, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastSoundEffect(a_SoundName, a_SrcX, a_SrcY, a_SrcZ, a_Volume, a_Pitch, a_Exclude); -} - - - - - -void cChunkMap::BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - int ChunkX, ChunkZ; - - cChunkDef::BlockToChunk(a_SrcX, a_SrcZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastSoundParticleEffect(a_EffectID, a_SrcX, a_SrcY, a_SrcZ, a_Data, a_Exclude); -} - - - - - -void cChunkMap::BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastSpawnEntity(a_Entity, a_Exclude); -} - - - - - -void cChunkMap::BroadcastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSLayers); - int ChunkX, ChunkZ; - cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastThunderbolt(a_BlockX, a_BlockY, a_BlockZ, a_Exclude); -} - - - - - -void cChunkMap::BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) -{ - cCSLock Lock(m_CSLayers); - int ChunkX, ChunkZ; - - cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); - if (Chunk == NULL) - { - return; - } - // It's perfectly legal to broadcast packets even to invalid chunks! - Chunk->BroadcastUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ); -} - - - - - -void cChunkMap::SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client) -{ - cCSLock Lock(m_CSLayers); - int ChunkX, ChunkZ; - cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - return; - } - Chunk->SendBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Client); -} - - - - - -void cChunkMap::UseBlockEntity(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) -{ - // a_Player rclked block entity at the coords specified, handle it - cCSLock Lock(m_CSLayers); - int ChunkX, ChunkZ; - cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - return; - } - Chunk->UseBlockEntity(a_Player, a_BlockX, a_BlockY, a_BlockZ); -} - - - - - -bool cChunkMap::DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback & a_Callback) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if (Chunk == NULL) - { - return false; - } - return a_Callback.Item(Chunk); -} - - - - - -void cChunkMap::WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - cCSLock Lock(m_CSLayers); - int ChunkX, ChunkZ; - cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - return; - } - m_World->GetSimulatorManager()->WakeUp(a_BlockX, a_BlockY, a_BlockZ, Chunk); -} - - - - - -/// Wakes up the simulators for the specified area of blocks -void cChunkMap::WakeUpSimulatorsInArea(int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ) -{ - cSimulatorManager * SimMgr = m_World->GetSimulatorManager(); - int MinChunkX, MinChunkZ, MaxChunkX, MaxChunkZ; - cChunkDef::BlockToChunk(a_MinBlockX, a_MinBlockZ, MinChunkX, MinChunkZ); - cChunkDef::BlockToChunk(a_MaxBlockX, a_MaxBlockZ, MaxChunkX, MaxChunkZ); - for (int z = MinChunkZ; z <= MaxChunkZ; z++) - { - int MinZ = std::max(a_MinBlockZ, z * cChunkDef::Width); - int MaxZ = std::min(a_MaxBlockZ, z * cChunkDef::Width + cChunkDef::Width - 1); - for (int x = MinChunkX; x <= MaxChunkX; x++) - { - cChunkPtr Chunk = GetChunkNoGen(x, 0, z); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - continue; - } - int MinX = std::max(a_MinBlockX, x * cChunkDef::Width); - int MaxX = std::min(a_MaxBlockX, x * cChunkDef::Width + cChunkDef::Width - 1); - for (int BlockY = a_MinBlockY; BlockY <= a_MaxBlockY; BlockY++) - { - for (int BlockZ = MinZ; BlockZ <= MaxZ; BlockZ++) - { - for (int BlockX = MinX; BlockX <= MaxX; BlockX++) - { - SimMgr->WakeUp(BlockX, BlockY, BlockZ, Chunk); - } // for BlockX - } // for BlockZ - } // for BlockY - } // for x - chunks - } // for z = chunks -} - - - - - -void cChunkMap::MarkChunkDirty (int a_ChunkX, int a_ChunkZ) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - return; - } - Chunk->MarkDirty(); -} - - - - - -void cChunkMap::MarkChunkSaving(int a_ChunkX, int a_ChunkZ) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - return; - } - Chunk->MarkSaving(); -} - - - - - -void cChunkMap::MarkChunkSaved (int a_ChunkX, int a_ChunkZ) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - return; - } - Chunk->MarkSaved(); -} - - - - - -void cChunkMap::SetChunkData( - int a_ChunkX, int a_ChunkZ, - const BLOCKTYPE * a_BlockTypes, - const NIBBLETYPE * a_BlockMeta, - const NIBBLETYPE * a_BlockLight, - const NIBBLETYPE * a_BlockSkyLight, - const cChunkDef::HeightMap * a_HeightMap, - const cChunkDef::BiomeMap & a_BiomeMap, - cBlockEntityList & a_BlockEntities, - bool a_MarkDirty -) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if (Chunk == NULL) - { - return; - } - Chunk->SetAllData(a_BlockTypes, a_BlockMeta, a_BlockLight, a_BlockSkyLight, a_HeightMap, a_BiomeMap, a_BlockEntities); - - if (a_MarkDirty) - { - Chunk->MarkDirty(); - } - - // Notify plugins of the chunk becoming available - cPluginManager::Get()->CallHookChunkAvailable(m_World, a_ChunkX, a_ChunkZ); -} - - - - - -void cChunkMap::ChunkLighted( - int a_ChunkX, int a_ChunkZ, - const cChunkDef::BlockNibbles & a_BlockLight, - const cChunkDef::BlockNibbles & a_SkyLight -) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if (Chunk == NULL) - { - return; - } - Chunk->SetLight(a_BlockLight, a_SkyLight); - Chunk->MarkDirty(); -} - - - - - -bool cChunkMap::GetChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataCallback & a_Callback) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - return false; - } - Chunk->GetAllData(a_Callback); - return true; -} - - - - - -bool cChunkMap::GetChunkBlockTypes(int a_ChunkX, int a_ChunkZ, BLOCKTYPE * a_BlockTypes) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - return false; - } - Chunk->GetBlockTypes(a_BlockTypes); - return true; -} - - - - - -bool cChunkMap::IsChunkValid(int a_ChunkX, int a_ChunkZ) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - return (Chunk != NULL) && Chunk->IsValid(); -} - - - - - -bool cChunkMap::HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - return (Chunk != NULL) && Chunk->HasAnyClients(); -} - - - - - -int cChunkMap::GetHeight(int a_BlockX, int a_BlockZ) -{ - while (true) - { - cCSLock Lock(m_CSLayers); - int ChunkX, ChunkZ, BlockY = 0; - cChunkDef::AbsoluteToRelative(a_BlockX, BlockY, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk == NULL) - { - return 0; - } - - if (Chunk->IsValid()) - { - return Chunk->GetHeight(a_BlockX, a_BlockZ); - } - - // The chunk is not valid, wait for it to become valid: - cCSUnlock Unlock(Lock); - m_evtChunkValid.Wait(); - } // while (true) -} - - - - - -bool cChunkMap::TryGetHeight(int a_BlockX, int a_BlockZ, int & a_Height) -{ - // Returns false if chunk not loaded / generated - cCSLock Lock(m_CSLayers); - int ChunkX, ChunkZ, BlockY = 0; - cChunkDef::AbsoluteToRelative(a_BlockX, BlockY, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - return false; - } - a_Height = Chunk->GetHeight(a_BlockX, a_BlockZ); - return true; -} - - - - - -void cChunkMap::FastSetBlocks(sSetBlockList & a_BlockList) -{ - sSetBlockList Failed; - - // Process all items from a_BlockList, either successfully or by placing into Failed - while (!a_BlockList.empty()) - { - int ChunkX = a_BlockList.front().ChunkX; - int ChunkZ = a_BlockList.front().ChunkZ; - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk != NULL) && Chunk->IsValid()) - { - for (sSetBlockList::iterator itr = a_BlockList.begin(); itr != a_BlockList.end();) - { - if ((itr->ChunkX == ChunkX) && (itr->ChunkZ == ChunkZ)) - { - Chunk->FastSetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta); - itr = a_BlockList.erase(itr); - } - else - { - ++itr; - } - } // for itr - a_BlockList[] - } - else - { - // The chunk is not valid, move all blocks within this chunk to Failed - for (sSetBlockList::iterator itr = a_BlockList.begin(); itr != a_BlockList.end();) - { - if ((itr->ChunkX == ChunkX) && (itr->ChunkZ == ChunkZ)) - { - Failed.push_back(*itr); - itr = a_BlockList.erase(itr); - } - else - { - ++itr; - } - } // for itr - a_BlockList[] - } - } - - // Return the failed: - std::swap(Failed, a_BlockList); -} - - - - - -void cChunkMap::CollectPickupsByPlayer(cPlayer * a_Player) -{ - int BlockX = (int)(a_Player->GetPosX()); // Truncating doesn't matter much; we're scanning entire chunks anyway - int BlockY = (int)(a_Player->GetPosY()); - int BlockZ = (int)(a_Player->GetPosZ()); - int ChunkX, ChunkZ, ChunkY = ZERO_CHUNK_Y; - cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); - int OtherChunkX = ChunkX + ((BlockX > 8) ? 1 : -1); - int OtherChunkZ = ChunkZ + ((BlockZ > 8) ? 1 : -1); - - // We suppose that each player keeps their chunks in memory, therefore it makes little sense to try to re-load or even generate them. - // The only time the chunks are not valid is when the player is downloading the initial world and they should not call this at that moment - - cCSLock Lock(m_CSLayers); - GetChunkNoLoad(ChunkX, ChunkY, ChunkZ)->CollectPickupsByPlayer(a_Player); - - // Check the neighboring chunks as well: - GetChunkNoLoad(OtherChunkX, ChunkY, ChunkZ )->CollectPickupsByPlayer(a_Player); - GetChunkNoLoad(OtherChunkX, ChunkY, OtherChunkZ)->CollectPickupsByPlayer(a_Player); - GetChunkNoLoad(ChunkX, ChunkY, ChunkZ )->CollectPickupsByPlayer(a_Player); - GetChunkNoLoad(ChunkX, ChunkY, OtherChunkZ)->CollectPickupsByPlayer(a_Player); -} - - - - - -BLOCKTYPE cChunkMap::GetBlock(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk != NULL) && Chunk->IsValid()) - { - return Chunk->GetBlock(a_BlockX, a_BlockY, a_BlockZ); - } - return 0; -} - - - - - -NIBBLETYPE cChunkMap::GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); - if ((Chunk != NULL) && Chunk->IsValid() ) - { - return Chunk->GetMeta(a_BlockX, a_BlockY, a_BlockZ); - } - return 0; -} - - - - - -NIBBLETYPE cChunkMap::GetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); - if ((Chunk != NULL) && Chunk->IsValid() ) - { - return Chunk->GetSkyLight(a_BlockX, a_BlockY, a_BlockZ); - } - return 0; -} - - - - - -NIBBLETYPE cChunkMap::GetBlockBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); - if ((Chunk != NULL) && Chunk->IsValid() ) - { - return Chunk->GetBlockLight(a_BlockX, a_BlockY, a_BlockZ); - } - return 0; -} - - - - - -void cChunkMap::SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockMeta) -{ - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); - // a_BlockXYZ now contains relative coords! - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk != NULL) && Chunk->IsValid()) - { - Chunk->SetMeta(a_BlockX, a_BlockY, a_BlockZ, a_BlockMeta); - Chunk->MarkDirty(); - Chunk->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, NULL); - } -} - - - - - -void cChunkMap::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta) -{ - int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ; - cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); - if ((Chunk != NULL) && Chunk->IsValid()) - { - Chunk->SetBlock(X, Y, Z, a_BlockType, a_BlockMeta ); - m_World->GetSimulatorManager()->WakeUp(a_BlockX, a_BlockY, a_BlockZ, Chunk); - } -} - - - - - -void cChunkMap::QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta, Int64 a_Tick) -{ - int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ; - cChunkDef::AbsoluteToRelative(X, Y, Z, ChunkX, ChunkZ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk != NULL) && Chunk->IsValid()) - { - Chunk->QueueSetBlock(X, Y, Z, a_BlockType, a_BlockMeta, a_Tick); - } -} - - - - - -bool cChunkMap::GetBlockTypeMeta(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) -{ - int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ; - cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); - if ((Chunk != NULL) && Chunk->IsValid()) - { - Chunk->GetBlockTypeMeta(X, Y, Z, a_BlockType, a_BlockMeta); - return true; - } - return false; -} - - - - - -bool cChunkMap::GetBlockInfo(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight) -{ - int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ; - cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); - if ((Chunk != NULL) && Chunk->IsValid()) - { - Chunk->GetBlockInfo(X, Y, Z, a_BlockType, a_Meta, a_SkyLight, a_BlockLight); - return true; - } - return false; -} - - - - - -void cChunkMap::ReplaceBlocks(const sSetBlockVector & a_Blocks, BLOCKTYPE a_FilterBlockType) -{ - cCSLock Lock(m_CSLayers); - for (sSetBlockVector::const_iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr) - { - cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - continue; - } - if (Chunk->GetBlock(itr->x, itr->y, itr->z) == a_FilterBlockType) - { - Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta); - } - } -} - - - - - -void cChunkMap::ReplaceTreeBlocks(const sSetBlockVector & a_Blocks) -{ - cCSLock Lock(m_CSLayers); - for (sSetBlockVector::const_iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr) - { - cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - continue; - } - switch (Chunk->GetBlock(itr->x, itr->y, itr->z)) - { - CASE_TREE_OVERWRITTEN_BLOCKS: - { - Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta); - break; - } - case E_BLOCK_LEAVES: - { - if (itr->BlockType == E_BLOCK_LOG) - { - Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta); - } - break; - } - } - } // for itr - a_Blocks[] -} - - - - - -EMCSBiome cChunkMap::GetBiomeAt (int a_BlockX, int a_BlockZ) -{ - int ChunkX, ChunkZ, X = a_BlockX, Y = 0, Z = a_BlockZ; - cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); - if ((Chunk != NULL) && Chunk->IsValid()) - { - return Chunk->GetBiomeAt(X, Z); - } - else - { - return m_World->GetGenerator().GetBiomeAt(a_BlockX, a_BlockZ); - } -} - - - - - -bool cChunkMap::GetBlocks(sSetBlockVector & a_Blocks, bool a_ContinueOnFailure) -{ - bool res = true; - cCSLock Lock(m_CSLayers); - for (sSetBlockVector::iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr) - { - cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - if (!a_ContinueOnFailure) - { - return false; - } - res = false; - continue; - } - int idx = cChunkDef::MakeIndexNoCheck(itr->x, itr->y, itr->z); - itr->BlockType = Chunk->GetBlock(idx); - itr->BlockMeta = Chunk->GetMeta(idx); - } - return res; -} - - - - - -bool cChunkMap::DigBlock(int a_X, int a_Y, int a_Z) -{ - int PosX = a_X, PosY = a_Y, PosZ = a_Z, ChunkX, ChunkZ; - - cChunkDef::AbsoluteToRelative( PosX, PosY, PosZ, ChunkX, ChunkZ ); - - { - cCSLock Lock(m_CSLayers); - cChunkPtr DestChunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); - if ((DestChunk == NULL) || !DestChunk->IsValid()) - { - return false; - } - - DestChunk->SetBlock(PosX, PosY, PosZ, E_BLOCK_AIR, 0 ); - m_World->GetSimulatorManager()->WakeUp(a_X, a_Y, a_Z, DestChunk); - } - - return true; -} - - - - - -void cChunkMap::SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer * a_Player) -{ - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_X, a_Y, a_Z, ChunkX, ChunkZ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk->IsValid()) - { - Chunk->SendBlockTo(a_X, a_Y, a_Z, a_Player->GetClientHandle()); - } -} - - - - - -void cChunkMap::CompareChunkClients(int a_ChunkX1, int a_ChunkZ1, int a_ChunkX2, int a_ChunkZ2, cClientDiffCallback & a_Callback) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk1 = GetChunkNoGen(a_ChunkX1, ZERO_CHUNK_Y, a_ChunkZ1); - if (Chunk1 == NULL) - { - return; - } - cChunkPtr Chunk2 = GetChunkNoGen(a_ChunkX2, ZERO_CHUNK_Y, a_ChunkZ2); - if (Chunk2 == NULL) - { - return; - } - - CompareChunkClients(Chunk1, Chunk2, a_Callback); -} - - - - - -void cChunkMap::CompareChunkClients(cChunk * a_Chunk1, cChunk * a_Chunk2, cClientDiffCallback & a_Callback) -{ - cClientHandleList Clients1(a_Chunk1->GetAllClients()); - cClientHandleList Clients2(a_Chunk2->GetAllClients()); - - // Find "removed" clients: - for (cClientHandleList::iterator itr1 = Clients1.begin(); itr1 != Clients1.end(); ++itr1) - { - bool Found = false; - for (cClientHandleList::iterator itr2 = Clients2.begin(); itr2 != Clients2.end(); ++itr2) - { - if (*itr1 == *itr2) - { - Found = true; - break; - } - } // for itr2 - Clients2[] - if (!Found) - { - a_Callback.Removed(*itr1); - } - } // for itr1 - Clients1[] - - // Find "added" clients: - for (cClientHandleList::iterator itr2 = Clients2.begin(); itr2 != Clients2.end(); ++itr2) - { - bool Found = false; - for (cClientHandleList::iterator itr1 = Clients1.begin(); itr1 != Clients1.end(); ++itr1) - { - if (*itr1 == *itr2) - { - Found = true; - break; - } - } // for itr1 - Clients1[] - if (!Found) - { - a_Callback.Added(*itr2); - } - } // for itr2 - Clients2[] -} - - - - - -bool cChunkMap::AddChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunk(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if (Chunk == NULL) - { - return false; - } - return Chunk->AddClient(a_Client); -} - - - - - -void cChunkMap::RemoveChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if (Chunk == NULL) - { - return; - } - Chunk->RemoveClient(a_Client); -} - - - - - -void cChunkMap::RemoveClientFromChunks(cClientHandle * a_Client) -{ - cCSLock Lock(m_CSLayers); - - for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - (*itr)->RemoveClient(a_Client); - } // for itr - m_Layers[] -} - - - - - -void cChunkMap::AddEntity(cEntity * a_Entity) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity->GetChunkX(), ZERO_CHUNK_Y, a_Entity->GetChunkZ()); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - LOGWARNING("Entity at %p (%s, ID %d) spawning in a non-existent chunk, the entity is lost.", - a_Entity, a_Entity->GetClass(), a_Entity->GetUniqueID() - ); - return; - } - Chunk->AddEntity(a_Entity); -} - - - - - -bool cChunkMap::HasEntity(int a_UniqueID) -{ - cCSLock Lock(m_CSLayers); - for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - if ((*itr)->HasEntity(a_UniqueID)) - { - return true; - } - } - return false; -} - - - - - -void cChunkMap::RemoveEntity(cEntity * a_Entity) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_Entity->GetChunkX(), ZERO_CHUNK_Y, a_Entity->GetChunkZ()); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return; - } - Chunk->RemoveEntity(a_Entity); -} - - - - - -bool cChunkMap::ForEachEntity(cEntityCallback & a_Callback) -{ - cCSLock Lock(m_CSLayers); - for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - if (!(*itr)->ForEachEntity(a_Callback)) - { - return false; - } - } - return true; -} - - - - - -bool cChunkMap::ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, cEntityCallback & a_Callback) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->ForEachEntity(a_Callback); -} - - - - - -void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, cVector3iArray & a_BlocksAffected) -{ - // Don't explode if outside of Y range (prevents the following test running into unallocated memory): - if ((a_BlockY < 0) || (a_BlockY > cChunkDef::Height - 1)) - { - return; - } - - // Don't explode if the explosion center is inside a liquid block: - switch (m_World->GetBlock((int)floor(a_BlockX), (int)floor(a_BlockY), (int)floor(a_BlockZ))) - { - case E_BLOCK_WATER: - case E_BLOCK_STATIONARY_WATER: - case E_BLOCK_LAVA: - case E_BLOCK_STATIONARY_LAVA: - { - return; - } - } - - cBlockArea area; - int bx = (int)floor(a_BlockX); - int by = (int)floor(a_BlockY); - int bz = (int)floor(a_BlockZ); - int ExplosionSizeInt = (int) ceil(a_ExplosionSize); - int ExplosionSizeSq = ExplosionSizeInt * ExplosionSizeInt; - a_BlocksAffected.reserve(8 * ExplosionSizeInt * ExplosionSizeInt * ExplosionSizeInt); - int MinY = std::max((int)floor(a_BlockY - ExplosionSizeInt), 0); - int MaxY = std::min((int)ceil(a_BlockY + ExplosionSizeInt), cChunkDef::Height - 1); - area.Read(m_World, bx - ExplosionSizeInt, (int)ceil(a_BlockX + ExplosionSizeInt), MinY, MaxY, bz - ExplosionSizeInt, (int)ceil(a_BlockZ + ExplosionSizeInt)); - for (int x = -ExplosionSizeInt; x < ExplosionSizeInt; x++) - { - for (int y = -ExplosionSizeInt; y < ExplosionSizeInt; y++) - { - if ((by + y >= cChunkDef::Height) || (by + y < 0)) - { - // Outside of the world - continue; - } - for (int z = -ExplosionSizeInt; z < ExplosionSizeInt; z++) - { - if ((x * x + y * y + z * z) > ExplosionSizeSq) - { - // Too far away - continue; - } - - BLOCKTYPE Block = area.GetBlockType(bx + x, by + y, bz + z); - switch (Block) - { - case E_BLOCK_TNT: - { - // Activate the TNT, with a random fuse between 10 to 30 game ticks - double FuseTime = (double)(10 + m_World->GetTickRandomNumber(20)) / 20; - m_World->SpawnPrimedTNT(a_BlockX + x + 0.5, a_BlockY + y + 0.5, a_BlockZ + z + 0.5, FuseTime); - area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_AIR); - a_BlocksAffected.push_back(Vector3i(bx + x, by + y, bz + z)); - break; - } - case E_BLOCK_OBSIDIAN: - case E_BLOCK_BEDROCK: - case E_BLOCK_WATER: - case E_BLOCK_LAVA: - { - // These blocks are not affected by explosions - break; - } - - case E_BLOCK_STATIONARY_WATER: - { - // Turn into simulated water: - area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_WATER); - break; - } - - case E_BLOCK_STATIONARY_LAVA: - { - // Turn into simulated lava: - area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_LAVA); - break; - } - - case E_BLOCK_AIR: - { - // No pickups for air - break; - } - - default: - { - if (m_World->GetTickRandomNumber(10) == 5) - { - cItems Drops; - cBlockHandler * Handler = BlockHandler(Block); - - Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); - m_World->SpawnItemPickups(Drops, bx + x, by + y, bz + z); - } - area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_AIR); - a_BlocksAffected.push_back(Vector3i(bx + x, by + y, bz + z)); - } - } // switch (BlockType) - } // for z - } // for y - } // for x - area.Write(m_World, bx - ExplosionSizeInt, MinY, bz - ExplosionSizeInt); - - // Wake up all simulators for the area, so that water and lava flows and sand falls into the blasted holes (FS #391): - WakeUpSimulatorsInArea( - bx - ExplosionSizeInt, bx + ExplosionSizeInt + 1, - MinY, MaxY, - bz - ExplosionSizeInt, bz + ExplosionSizeInt + 1 - ); -} - - - - - -bool cChunkMap::DoWithEntityByID(int a_UniqueID, cEntityCallback & a_Callback) -{ - cCSLock Lock(m_CSLayers); - bool res = false; - for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - if ((*itr)->DoWithEntityByID(a_UniqueID, a_Callback, res)) - { - return res; - } - } - return false; -} - - - - - -bool cChunkMap::ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, cBlockEntityCallback & a_Callback) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->ForEachBlockEntity(a_Callback); -} - - - - - -bool cChunkMap::ForEachChestInChunk(int a_ChunkX, int a_ChunkZ, cChestCallback & a_Callback) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->ForEachChest(a_Callback); -} - - - - - -bool cChunkMap::ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->ForEachDispenser(a_Callback); -} - - - - - -bool cChunkMap::ForEachDropperInChunk(int a_ChunkX, int a_ChunkZ, cDropperCallback & a_Callback) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->ForEachDropper(a_Callback); -} - - - - - -bool cChunkMap::ForEachDropSpenserInChunk(int a_ChunkX, int a_ChunkZ, cDropSpenserCallback & a_Callback) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->ForEachDropSpenser(a_Callback); -} - - - - - -bool cChunkMap::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->ForEachFurnace(a_Callback); -} - - - - - -bool cChunkMap::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback) -{ - int ChunkX, ChunkZ; - int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; - cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); -} - - - - - -bool cChunkMap::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback) -{ - int ChunkX, ChunkZ; - int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; - cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->DoWithChestAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); -} - - - - - -bool cChunkMap::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback) -{ - int ChunkX, ChunkZ; - int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; - cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->DoWithDispenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); -} - - - - - -bool cChunkMap::DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback) -{ - int ChunkX, ChunkZ; - int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; - cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->DoWithDropperAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); -} - - - - - -bool cChunkMap::DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback) -{ - int ChunkX, ChunkZ; - int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; - cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->DoWithDropSpenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); -} - - - - - -bool cChunkMap::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback) -{ - int ChunkX, ChunkZ; - int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; - cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->DoWithFurnaceAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); -} - - - - - -bool cChunkMap::GetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4) -{ - int ChunkX, ChunkZ; - int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; - cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk == NULL) && !Chunk->IsValid()) - { - return false; - } - return Chunk->GetSignLines(a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4); -} - - - - - -void cChunkMap::TouchChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) -{ - cCSLock Lock(m_CSLayers); - GetChunk(a_ChunkX, a_ChunkY, a_ChunkZ); -} - - - - - -/// Loads the chunk synchronously, if not already loaded. Doesn't generate. Returns true if chunk valid (even if already loaded before) -bool cChunkMap::LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) -{ - { - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, a_ChunkY, a_ChunkZ); - if (Chunk == NULL) - { - // Internal error - return false; - } - if (Chunk->IsValid()) - { - // Already loaded - return true; - } - if (Chunk->HasLoadFailed()) - { - // Already tried loading and it failed - return false; - } - } - return m_World->GetStorage().LoadChunk(a_ChunkX, a_ChunkY, a_ChunkZ); -} - - - - - -/// Loads the chunks specified. Doesn't report failure, other than chunks being !IsValid() -void cChunkMap::LoadChunks(const cChunkCoordsList & a_Chunks) -{ - for (cChunkCoordsList::const_iterator itr = a_Chunks.begin(); itr != a_Chunks.end(); ++itr) - { - LoadChunk(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ); - } // for itr - a_Chunks[] -} - - - - - -void cChunkMap::ChunkLoadFailed(int a_ChunkX, int a_ChunkY, int a_ChunkZ) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, a_ChunkY, a_ChunkZ); - if (Chunk == NULL) - { - return; - } - Chunk->MarkLoadFailed(); -} - - - - - -bool cChunkMap::SetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) -{ - cCSLock Lock(m_CSLayers); - int ChunkX, ChunkZ; - cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); - cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if ((Chunk == NULL) || !Chunk->IsValid()) - { - return false; - } - return Chunk->SetSignLines(a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4); -} - - - - - -void cChunkMap::ChunksStay(const cChunkCoordsList & a_Chunks, bool a_Stay) -{ - cCSLock Lock(m_CSLayers); - for (cChunkCoordsList::const_iterator itr = a_Chunks.begin(); itr != a_Chunks.end(); ++itr) - { - cChunkPtr Chunk = GetChunkNoLoad(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ); - if (Chunk == NULL) - { - continue; - } - Chunk->Stay(a_Stay); - } -} - - - - - -void cChunkMap::MarkChunkRegenerating(int a_ChunkX, int a_ChunkZ) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if (Chunk == NULL) - { - // Not present - return; - } - Chunk->MarkRegenerating(); -} - - - - - -bool cChunkMap::IsChunkLighted(int a_ChunkX, int a_ChunkZ) -{ - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); - if (Chunk == NULL) - { - // Not present - return false; - } - return Chunk->IsLightValid(); -} - - - - - -bool cChunkMap::ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) -{ - bool Result = true; - cCSLock Lock(m_CSLayers); - for (int z = a_MinChunkZ; z <= a_MaxChunkZ; z++) - { - for (int x = a_MinChunkX; x <= a_MaxChunkX; x++) - { - cChunkPtr Chunk = GetChunkNoLoad(x, ZERO_CHUNK_Y, z); - if ((Chunk == NULL) || (!Chunk->IsValid())) - { - // Not present / not valid - Result = false; - continue; - } - if (!a_Callback.Coords(x, z)) - { - continue; - } - Chunk->GetAllData(a_Callback); - } - } - return Result; -} - - - - - -bool cChunkMap::WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) -{ - // Convert block coords to chunks coords: - int MinChunkX, MaxChunkX; - int MinChunkZ, MaxChunkZ; - int MinBlockX = a_MinBlockX; - int MinBlockY = a_MinBlockY; - int MinBlockZ = a_MinBlockZ; - int MaxBlockX = a_MinBlockX + a_Area.GetSizeX(); - int MaxBlockY = a_MinBlockY + a_Area.GetSizeY(); - int MaxBlockZ = a_MinBlockZ + a_Area.GetSizeZ(); - cChunkDef::AbsoluteToRelative(MinBlockX, MinBlockY, MinBlockZ, MinChunkX, MinChunkZ); - cChunkDef::AbsoluteToRelative(MaxBlockX, MaxBlockY, MaxBlockZ, MaxChunkX, MaxChunkZ); - - // Iterate over chunks, write data into each: - bool Result = true; - cCSLock Lock(m_CSLayers); - for (int z = MinChunkZ; z <= MaxChunkZ; z++) - { - for (int x = MinChunkX; x <= MaxChunkX; x++) - { - cChunkPtr Chunk = GetChunkNoLoad(x, ZERO_CHUNK_Y, z); - if ((Chunk == NULL) || (!Chunk->IsValid())) - { - // Not present / not valid - Result = false; - continue; - } - Chunk->WriteBlockArea(a_Area, a_MinBlockX, a_MinBlockY, a_MinBlockZ, a_DataTypes); - } // for x - } // for z - return Result; -} - - - - - -void cChunkMap::GetChunkStats(int & a_NumChunksValid, int & a_NumChunksDirty) -{ - a_NumChunksValid = 0; - a_NumChunksDirty = 0; - cCSLock Lock(m_CSLayers); - for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - int NumValid = 0, NumDirty = 0; - (*itr)->GetChunkStats(NumValid, NumDirty); - a_NumChunksValid += NumValid; - a_NumChunksDirty += NumDirty; - } // for itr - m_Layers[] -} - - - - - -void cChunkMap::GrowMelonPumpkin(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, MTRand & a_Rand) -{ - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk != NULL) - { - Chunk->GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_Rand); - } -} - - - - - -void cChunkMap::GrowSugarcane(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow) -{ - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk != NULL) - { - Chunk->GrowSugarcane(a_BlockX, a_BlockY, a_BlockZ, a_NumBlocksToGrow); - } -} - - - - - -void cChunkMap::GrowCactus(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow) -{ - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk != NULL) - { - Chunk->GrowCactus(a_BlockX, a_BlockY, a_BlockZ, a_NumBlocksToGrow); - } -} - - - - - -void cChunkMap::SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk != NULL) - { - Chunk->SetNextBlockTick(a_BlockX, a_BlockY, a_BlockZ); - } -} - - - - -void cChunkMap::CollectMobCensus(cMobCensus& a_ToFill) -{ - cCSLock Lock(m_CSLayers); - for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - (*itr)->CollectMobCensus(a_ToFill); - } // for itr - m_Layers -} - - - - - - -void cChunkMap::SpawnMobs(cMobSpawner& a_MobSpawner) -{ - cCSLock Lock(m_CSLayers); - for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - (*itr)->SpawnMobs(a_MobSpawner); - } // for itr - m_Layers -} - - - - - -void cChunkMap::Tick(float a_Dt) -{ - cCSLock Lock(m_CSLayers); - for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - (*itr)->Tick(a_Dt); - } // for itr - m_Layers -} - - - - - -void cChunkMap::UnloadUnusedChunks() -{ - cCSLock Lock(m_CSLayers); - for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - (*itr)->UnloadUnusedChunks(); - } // for itr - m_Layers -} - - - - - -void cChunkMap::SaveAllChunks(void) -{ - cCSLock Lock(m_CSLayers); - for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - (*itr)->Save(); - } // for itr - m_Layers[] -} - - - - - -int cChunkMap::GetNumChunks(void) -{ - cCSLock Lock(m_CSLayers); - int NumChunks = 0; - for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) - { - NumChunks += (*itr)->GetNumChunksLoaded(); - } - return NumChunks; -} - - - - - -void cChunkMap::ChunkValidated(void) -{ - m_evtChunkValid.Set(); -} - - - - - -void cChunkMap::QueueTickBlock(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); - // a_BlockXYZ now contains relative coords! - - cCSLock Lock(m_CSLayers); - cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); - if (Chunk != NULL) - { - Chunk->QueueTickBlock(a_BlockX, a_BlockY, a_BlockZ); - } -} - - - - - -//////////////////////////////////////////////////////////////////////////////// -// cChunkMap::cChunkLayer: - -cChunkMap::cChunkLayer::cChunkLayer(int a_LayerX, int a_LayerZ, cChunkMap * a_Parent) - : m_LayerX( a_LayerX ) - , m_LayerZ( a_LayerZ ) - , m_Parent( a_Parent ) - , m_NumChunksLoaded( 0 ) -{ - memset(m_Chunks, 0, sizeof(m_Chunks)); -} - - - - - -cChunkMap::cChunkLayer::~cChunkLayer() -{ - for (int i = 0; i < ARRAYCOUNT(m_Chunks); ++i) - { - delete m_Chunks[i]; - m_Chunks[i] = NULL; // // Must zero out, because further chunk deletions query the chunkmap for entities and that would touch deleted data - } // for i - m_Chunks[] -} - - - - - -cChunkPtr cChunkMap::cChunkLayer::GetChunk( int a_ChunkX, int a_ChunkY, int a_ChunkZ ) -{ - // Always returns an assigned chunkptr, but the chunk needn't be valid (loaded / generated) - callers must check - - const int LocalX = a_ChunkX - m_LayerX * LAYER_SIZE; - const int LocalZ = a_ChunkZ - m_LayerZ * LAYER_SIZE; - - if (!((LocalX < LAYER_SIZE) && (LocalZ < LAYER_SIZE) && (LocalX > -1) && (LocalZ > -1))) - { - ASSERT(!"Asking a cChunkLayer for a chunk that doesn't belong to it!"); - return NULL; - } - - int Index = LocalX + LocalZ * LAYER_SIZE; - if (m_Chunks[Index] == NULL) - { - cChunk * neixm = (LocalX > 0) ? m_Chunks[Index - 1] : m_Parent->FindChunk(a_ChunkX - 1, a_ChunkZ); - cChunk * neixp = (LocalX < LAYER_SIZE - 1) ? m_Chunks[Index + 1] : m_Parent->FindChunk(a_ChunkX + 1, a_ChunkZ); - cChunk * neizm = (LocalZ > 0) ? m_Chunks[Index - LAYER_SIZE] : m_Parent->FindChunk(a_ChunkX , a_ChunkZ - 1); - cChunk * neizp = (LocalZ < LAYER_SIZE - 1) ? m_Chunks[Index + LAYER_SIZE] : m_Parent->FindChunk(a_ChunkX , a_ChunkZ + 1); - m_Chunks[Index] = new cChunk(a_ChunkX, 0, a_ChunkZ, m_Parent, m_Parent->GetWorld(), neixm, neixp, neizm, neizp); - } - return m_Chunks[Index]; -} - - - - - -cChunk * cChunkMap::cChunkLayer::FindChunk(int a_ChunkX, int a_ChunkZ) -{ - const int LocalX = a_ChunkX - m_LayerX * LAYER_SIZE; - const int LocalZ = a_ChunkZ - m_LayerZ * LAYER_SIZE; - - if (!((LocalX < LAYER_SIZE) && (LocalZ < LAYER_SIZE) && (LocalX > -1) && (LocalZ > -1))) - { - ASSERT(!"Asking a cChunkLayer for a chunk that doesn't belong to it!"); - return NULL; - } - - int Index = LocalX + LocalZ * LAYER_SIZE; - return m_Chunks[Index]; -} - - - - -void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus& a_ToFill) -{ - for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) - { - // We do count every Mobs in the world. But we are assuming that every chunk not loaded by any client - // doesn't affect us. Normally they should not have mobs because every "too far" mobs despawn - // If they have (f.i. when player disconnect) we assume we don't have to make them live or despawn - if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->HasAnyClients()) - { - m_Chunks[i]->CollectMobCensus(a_ToFill); - } - } // for i - m_Chunks[] -} - - - - - - -void cChunkMap::cChunkLayer::SpawnMobs(cMobSpawner& a_MobSpawner) -{ - for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) - { - // We only spawn close to players - if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->HasAnyClients()) - { - m_Chunks[i]->SpawnMobs(a_MobSpawner); - } - } // for i - m_Chunks[] -} - - - -void cChunkMap::cChunkLayer::Tick(float a_Dt) -{ - for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) - { - // Only tick chunks that are valid and have clients: - if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->HasAnyClients()) - { - m_Chunks[i]->Tick(a_Dt); - } - } // for i - m_Chunks[] -} - - - - - -void cChunkMap::cChunkLayer::RemoveClient(cClientHandle * a_Client) -{ - for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) - { - if (m_Chunks[i] != NULL) - { - m_Chunks[i]->RemoveClient(a_Client); - } - } // for i - m_Chunks[] -} - - - - - -bool cChunkMap::cChunkLayer::ForEachEntity(cEntityCallback & a_Callback) -{ - // Calls the callback for each entity in the entire world; returns true if all entities processed, false if the callback aborted by returning true - for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) - { - if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid()) - { - if (!m_Chunks[i]->ForEachEntity(a_Callback)) - { - return false; - } - } - } - return true; -} - - - - - -bool cChunkMap::cChunkLayer::DoWithEntityByID(int a_EntityID, cEntityCallback & a_Callback, bool & a_CallbackReturn) -{ - // Calls the callback if the entity with the specified ID is found, with the entity object as the callback param. Returns true if entity found. - for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) - { - if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid()) - { - if (m_Chunks[i]->DoWithEntityByID(a_EntityID, a_Callback, a_CallbackReturn)) - { - return true; - } - } - } - return false; -} - - - - - -bool cChunkMap::cChunkLayer::HasEntity(int a_EntityID) -{ - for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) - { - if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid()) - { - if (m_Chunks[i]->HasEntity(a_EntityID)) - { - return true; - } - } - } - return false; -} - - - - - -int cChunkMap::cChunkLayer::GetNumChunksLoaded(void) const -{ - int NumChunks = 0; - for ( int i = 0; i < ARRAYCOUNT(m_Chunks); ++i ) - { - if (m_Chunks[i] != NULL) - { - NumChunks++; - } - } // for i - m_Chunks[] - return NumChunks; -} - - - - - -void cChunkMap::cChunkLayer::GetChunkStats(int & a_NumChunksValid, int & a_NumChunksDirty) const -{ - int NumValid = 0; - int NumDirty = 0; - for ( int i = 0; i < ARRAYCOUNT(m_Chunks); ++i ) - { - if (m_Chunks[i] == NULL) - { - continue; - } - NumValid++; - if (m_Chunks[i]->IsDirty()) - { - NumDirty++; - } - } // for i - m_Chunks[] - a_NumChunksValid = NumValid; - a_NumChunksDirty = NumDirty; -} - - - - - -void cChunkMap::cChunkLayer::Save(void) -{ - cWorld * World = m_Parent->GetWorld(); - for (int i = 0; i < ARRAYCOUNT(m_Chunks); ++i) - { - if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->IsDirty()) - { - World->GetStorage().QueueSaveChunk(m_Chunks[i]->GetPosX(), m_Chunks[i]->GetPosY(), m_Chunks[i]->GetPosZ()); - } - } // for i - m_Chunks[] -} - - - - - -void cChunkMap::cChunkLayer::UnloadUnusedChunks(void) -{ - for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) - { - if ( - (m_Chunks[i] != NULL) && // Is valid - (m_Chunks[i]->CanUnload()) && // Can unload - !cPluginManager::Get()->CallHookChunkUnloading(m_Parent->GetWorld(), m_Chunks[i]->GetPosX(), m_Chunks[i]->GetPosZ()) // Plugins agree - ) - { - // The cChunk destructor calls our GetChunk() while removing its entities - // so we still need to be able to return the chunk. Therefore we first delete, then NULLify - // Doing otherwise results in bug http://forum.mc-server.org/showthread.php?tid=355 - delete m_Chunks[i]; - m_Chunks[i] = NULL; - } - } // for i - m_Chunks[] -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cChunkStay: - -cChunkStay::cChunkStay(cWorld * a_World) : - m_World(a_World), - m_IsEnabled(false) -{ -} - - - - - -cChunkStay::~cChunkStay() -{ - Clear(); -} - - - - - -void cChunkStay::Clear(void) -{ - if (m_IsEnabled) - { - Disable(); - } - m_Chunks.clear(); -} - - - - - -void cChunkStay::Add(int a_ChunkX, int a_ChunkY, int a_ChunkZ) -{ - ASSERT(!m_IsEnabled); - - for (cChunkCoordsList::const_iterator itr = m_Chunks.begin(); itr != m_Chunks.end(); ++itr) - { - if ((itr->m_ChunkX == a_ChunkX) && (itr->m_ChunkY == a_ChunkY) && (itr->m_ChunkZ == a_ChunkZ)) - { - // Already present - return; - } - } // for itr - Chunks[] - m_Chunks.push_back(cChunkCoords(a_ChunkX, a_ChunkY, a_ChunkZ)); -} - - - - - -void cChunkStay::Remove(int a_ChunkX, int a_ChunkY, int a_ChunkZ) -{ - ASSERT(!m_IsEnabled); - - for (cChunkCoordsList::iterator itr = m_Chunks.begin(); itr != m_Chunks.end(); ++itr) - { - if ((itr->m_ChunkX == a_ChunkX) && (itr->m_ChunkY == a_ChunkY) && (itr->m_ChunkZ == a_ChunkZ)) - { - // Found, un-"stay" - m_Chunks.erase(itr); - return; - } - } // for itr - m_Chunks[] -} - - - - - -void cChunkStay::Enable(void) -{ - ASSERT(!m_IsEnabled); - - m_World->ChunksStay(*this, true); - m_IsEnabled = true; -} - - - - - -void cChunkStay::Load(void) -{ - for (cChunkCoordsList::iterator itr = m_Chunks.begin(); itr != m_Chunks.end(); ++itr) - { - m_World->TouchChunk(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ); - } // for itr - m_Chunks[] -} - - - - - -void cChunkStay::Disable(void) -{ - ASSERT(m_IsEnabled); - - m_World->ChunksStay(*this, false); - m_IsEnabled = false; -} - - - - diff --git a/source/Entities/Player.cpp b/source/Entities/Player.cpp deleted file mode 100644 index f37a23f22..000000000 --- a/source/Entities/Player.cpp +++ /dev/null @@ -1,1765 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "Player.h" -#include "../Server.h" -#include "../ClientHandle.h" -#include "../UI/Window.h" -#include "../UI/WindowOwner.h" -#include "../World.h" -#include "Pickup.h" -#include "../PluginManager.h" -#include "../BlockEntities/BlockEntity.h" -#include "../GroupManager.h" -#include "../Group.h" -#include "../ChatColor.h" -#include "../Item.h" -#include "../Tracer.h" -#include "../Root.h" -#include "../OSSupport/Timer.h" -#include "../MersenneTwister.h" -#include "../Chunk.h" -#include "../Items/ItemHandler.h" - -#include "../Vector3d.h" -#include "../Vector3f.h" - -#include "../../iniFile/iniFile.h" -#include <json/json.h> - -#define float2int(x) ((x)<0 ? ((int)(x))-1 : (int)(x)) - - - - - - -cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) - : super(etPlayer, 0.6, 1.8) - , m_GameMode(eGameMode_NotSet) - , m_IP("") - , m_LastBlockActionTime( 0 ) - , m_LastBlockActionCnt( 0 ) - , m_AirLevel( MAX_AIR_LEVEL ) - , m_AirTickTimer( DROWNING_TICKS ) - , m_bVisible( true ) - , m_LastGroundHeight( 0 ) - , m_bTouchGround( false ) - , m_Stance( 0.0 ) - , m_Inventory(*this) - , m_CurrentWindow(NULL) - , m_InventoryWindow(NULL) - , m_TimeLastPickupCheck( 0.f ) - , m_Color('-') - , m_ClientHandle( a_Client ) - , m_FoodLevel(MAX_FOOD_LEVEL) - , m_FoodSaturationLevel(5) - , m_FoodTickTimer(0) - , m_FoodExhaustionLevel(0) - , m_FoodPoisonedTicksRemaining(0) - , m_NormalMaxSpeed(0.1) - , m_SprintingMaxSpeed(0.13) - , m_IsCrouched(false) - , m_IsSprinting(false) - , m_IsSwimming(false) - , m_IsSubmerged(false) - , m_EatingFinishTick(-1) - , m_IsChargingBow(false) - , m_BowCharge(0) - , m_CurrentXp(0) - , m_LifetimeTotalXp(0) - , m_bDirtyExperience(false) -{ - LOGD("Created a player object for \"%s\" @ \"%s\" at %p, ID %d", - a_PlayerName.c_str(), a_Client->GetIPString().c_str(), - this, GetUniqueID() - ); - - m_InventoryWindow = new cInventoryWindow(*this); - m_CurrentWindow = m_InventoryWindow; - m_InventoryWindow->OpenedByPlayer(*this); - - SetMaxHealth(MAX_HEALTH); - m_Health = MAX_HEALTH; - - cTimer t1; - m_LastPlayerListTime = t1.GetNowTime(); - - m_TimeLastTeleportPacket = 0; - m_TimeLastPickupCheck = 0; - - m_PlayerName = a_PlayerName; - m_bDirtyPosition = true; // So chunks are streamed to player at spawn - - if (!LoadFromDisk()) - { - m_Inventory.Clear(); - SetPosX(cRoot::Get()->GetDefaultWorld()->GetSpawnX()); - SetPosY(cRoot::Get()->GetDefaultWorld()->GetSpawnY()); - SetPosZ(cRoot::Get()->GetDefaultWorld()->GetSpawnZ()); - - LOGD("Player \"%s\" is connecting for the first time, spawning at default world spawn {%.2f, %.2f, %.2f}", - a_PlayerName.c_str(), GetPosX(), GetPosY(), GetPosZ() - ); - } - m_LastJumpHeight = (float)(GetPosY()); - m_LastGroundHeight = (float)(GetPosY()); - m_Stance = GetPosY() + 1.62; - - cRoot::Get()->GetServer()->PlayerCreated(this); -} - - - - - -cPlayer::~cPlayer(void) -{ - LOGD("Deleting cPlayer \"%s\" at %p, ID %d", m_PlayerName.c_str(), this, GetUniqueID()); - - // Notify the server that the player is being destroyed - cRoot::Get()->GetServer()->PlayerDestroying(this); - - SaveToDisk(); - - m_World->RemovePlayer( this ); - - m_ClientHandle = NULL; - - delete m_InventoryWindow; - - LOGD("Player %p deleted", this); -} - - - - - -bool cPlayer::Initialize(cWorld * a_World) -{ - ASSERT(a_World != NULL); - - if (super::Initialize(a_World)) - { - // Remove the client handle from the server, it will be ticked from this object from now on - if (m_ClientHandle != NULL) - { - cRoot::Get()->GetServer()->ClientMovedToWorld(m_ClientHandle); - } - - GetWorld()->AddPlayer(this); - return true; - } - return false; -} - - - - - -void cPlayer::Destroyed() -{ - CloseWindow(false); - - m_ClientHandle = NULL; -} - - - - - -void cPlayer::SpawnOn(cClientHandle & a_Client) -{ - if (!m_bVisible || (m_ClientHandle == (&a_Client))) - { - return; - } - a_Client.SendPlayerSpawn(*this); - a_Client.SendEntityHeadLook(*this); - a_Client.SendEntityEquipment(*this, 0, m_Inventory.GetEquippedItem() ); - a_Client.SendEntityEquipment(*this, 1, m_Inventory.GetEquippedBoots() ); - a_Client.SendEntityEquipment(*this, 2, m_Inventory.GetEquippedLeggings() ); - a_Client.SendEntityEquipment(*this, 3, m_Inventory.GetEquippedChestplate() ); - a_Client.SendEntityEquipment(*this, 4, m_Inventory.GetEquippedHelmet() ); -} - - - - - -void cPlayer::Tick(float a_Dt, cChunk & a_Chunk) -{ - if (m_ClientHandle != NULL) - { - if (m_ClientHandle->IsDestroyed()) - { - // This should not happen, because destroying a client will remove it from the world, but just in case - m_ClientHandle = NULL; - return; - } - - if (!m_ClientHandle->IsPlaying()) - { - // We're not yet in the game, ignore everything - return; - } - } - - if (!a_Chunk.IsValid()) - { - // This may happen if the cPlayer is created before the chunks have the chance of being loaded / generated (#83) - return; - } - - super::Tick(a_Dt, a_Chunk); - - // Set player swimming state - SetSwimState(a_Chunk); - - // Handle air drowning stuff - HandleAir(); - - // Handle charging the bow: - if (m_IsChargingBow) - { - m_BowCharge += 1; - } - - //handle updating experience - if (m_bDirtyExperience) - { - SendExperience(); - } - - if (m_bDirtyPosition) - { - // Apply food exhaustion from movement: - ApplyFoodExhaustionFromMovement(); - - cRoot::Get()->GetPluginManager()->CallHookPlayerMoving(*this); - BroadcastMovementUpdate(m_ClientHandle); - m_ClientHandle->StreamChunks(); - } - else - { - BroadcastMovementUpdate(m_ClientHandle); - } - - if (m_Health > 0) // make sure player is alive - { - m_World->CollectPickupsByPlayer(this); - - if ((m_EatingFinishTick >= 0) && (m_EatingFinishTick <= m_World->GetWorldAge())) - { - FinishEating(); - } - - HandleFood(); - } - - // Send Player List (Once per m_LastPlayerListTime/1000 ms) - cTimer t1; - if (m_LastPlayerListTime + cPlayer::PLAYER_LIST_TIME_MS <= t1.GetNowTime()) - { - m_World->SendPlayerList(this); - m_LastPlayerListTime = t1.GetNowTime(); - } -} - - - - - -short cPlayer::CalcLevelFromXp(short a_XpTotal) -{ - //level 0 to 15 - if(a_XpTotal <= XP_TO_LEVEL15) - { - return a_XpTotal / XP_PER_LEVEL_TO15; - } - - //level 30+ - if(a_XpTotal > XP_TO_LEVEL30) - { - return (short) (151.5 + sqrt( 22952.25 - (14 * (2220 - a_XpTotal)))) / 7; - } - - //level 16 to 30 - return (short) ( 29.5 + sqrt( 870.25 - (6 * ( 360 - a_XpTotal )))) / 3; -} - - - - - -short cPlayer::XpForLevel(short a_Level) -{ - //level 0 to 15 - if(a_Level <= 15) - { - return a_Level * XP_PER_LEVEL_TO15; - } - - //level 30+ - if(a_Level >= 31) - { - return (short) ( (3.5 * a_Level * a_Level) - (151.5 * a_Level) + 2220 ); - } - - //level 16 to 30 - return (short) ( (1.5 * a_Level * a_Level) - (29.5 * a_Level) + 360 ); -} - - - - - -short cPlayer::GetXpLevel() -{ - return CalcLevelFromXp(m_CurrentXp); -} - - - - - -float cPlayer::GetXpPercentage() -{ - short int currentLevel = CalcLevelFromXp(m_CurrentXp); - short int currentLevel_XpBase = XpForLevel(currentLevel); - - return (float)(m_CurrentXp - currentLevel_XpBase) / - (float)(XpForLevel(1+currentLevel) - currentLevel_XpBase); -} - - - - - -bool cPlayer::SetCurrentExperience(short int a_CurrentXp) -{ - if(!(a_CurrentXp >= 0) || (a_CurrentXp > (SHRT_MAX - m_LifetimeTotalXp))) - { - LOGWARNING("Tried to update experiece with an invalid Xp value: %d", a_CurrentXp); - return false; //oops, they gave us a dodgey number - } - - m_CurrentXp = a_CurrentXp; - - // Set experience to be updated - m_bDirtyExperience = true; - - return true; -} - - - - - -short cPlayer::DeltaExperience(short a_Xp_delta) -{ - if (a_Xp_delta > (SHRT_MAX - m_CurrentXp)) - { - // Value was bad, abort and report - LOGWARNING("Attempt was made to increment Xp by %d, which overflowed the short datatype. Ignoring.", - a_Xp_delta); - return -1; // Should we instead just return the current Xp? - } - - m_CurrentXp += a_Xp_delta; - - // Make sure they didn't subtract too much - if (m_CurrentXp < 0) - { - m_CurrentXp = 0; - } - - // Update total for score calculation - if (a_Xp_delta > 0) - { - m_LifetimeTotalXp += a_Xp_delta; - } - - LOGD("Player \"%s\" gained/lost %d experience, total is now: %d", - m_PlayerName.c_str(), a_Xp_delta, m_CurrentXp); - - // Set experience to be updated - m_bDirtyExperience = true; - - return m_CurrentXp; -} - - - - - -void cPlayer::StartChargingBow(void) -{ - LOGD("Player \"%s\" started charging their bow", m_PlayerName.c_str()); - m_IsChargingBow = true; - m_BowCharge = 0; -} - - - - - -int cPlayer::FinishChargingBow(void) -{ - LOGD("Player \"%s\" finished charging their bow at a charge of %d", m_PlayerName.c_str(), m_BowCharge); - int res = m_BowCharge; - m_IsChargingBow = false; - m_BowCharge = 0; - return res; -} - - - - - -void cPlayer::CancelChargingBow(void) -{ - LOGD("Player \"%s\" cancelled charging their bow at a charge of %d", m_PlayerName.c_str(), m_BowCharge); - m_IsChargingBow = false; - m_BowCharge = 0; -} - - - - - -void cPlayer::SetTouchGround(bool a_bTouchGround) -{ - m_bTouchGround = a_bTouchGround; - - if (!m_bTouchGround) - { - if (GetPosY() > m_LastJumpHeight) - { - m_LastJumpHeight = (float)GetPosY(); - } - cWorld * World = GetWorld(); - if ((GetPosY() >= 0) && (GetPosY() < cChunkDef::Height)) - { - BLOCKTYPE BlockType = World->GetBlock(float2int(GetPosX()), float2int(GetPosY()), float2int(GetPosZ())); - if (BlockType != E_BLOCK_AIR) - { - m_bTouchGround = true; - } - if ( - (BlockType == E_BLOCK_WATER) || - (BlockType == E_BLOCK_STATIONARY_WATER) || - (BlockType == E_BLOCK_LADDER) || - (BlockType == E_BLOCK_VINES) - ) - { - m_LastGroundHeight = (float)GetPosY(); - } - } - } - else - { - float Dist = (float)(m_LastGroundHeight - floor(GetPosY())); - int Damage = (int)(Dist - 3.f); - if (m_LastJumpHeight > m_LastGroundHeight) Damage++; - m_LastJumpHeight = (float)GetPosY(); - - if ((Damage > 0) && (!IsGameModeCreative())) - { - TakeDamage(dtFalling, NULL, Damage, Damage, 0); - } - - m_LastGroundHeight = (float)GetPosY(); - } -} - - - - - -void cPlayer::Heal(int a_Health) -{ - super::Heal(a_Health); - SendHealth(); -} - - - - - -void cPlayer::SetFoodLevel(int a_FoodLevel) -{ - m_FoodLevel = std::max(0, std::min(a_FoodLevel, (int)MAX_FOOD_LEVEL)); - SendHealth(); -} - - - - - -void cPlayer::SetFoodSaturationLevel(double a_FoodSaturationLevel) -{ - m_FoodSaturationLevel = std::max(0.0, std::min(a_FoodSaturationLevel, (double)m_FoodLevel)); -} - - - - - -void cPlayer::SetFoodTickTimer(int a_FoodTickTimer) -{ - m_FoodTickTimer = a_FoodTickTimer; -} - - - - - -void cPlayer::SetFoodExhaustionLevel(double a_FoodExhaustionLevel) -{ - m_FoodExhaustionLevel = std::max(0.0, std::min(a_FoodExhaustionLevel, 4.0)); -} - - - - - -void cPlayer::SetFoodPoisonedTicksRemaining(int a_FoodPoisonedTicksRemaining) -{ - m_FoodPoisonedTicksRemaining = a_FoodPoisonedTicksRemaining; -} - - - - - -bool cPlayer::Feed(int a_Food, double a_Saturation) -{ - if (m_FoodLevel >= MAX_FOOD_LEVEL) - { - return false; - } - - m_FoodLevel = std::min(a_Food + m_FoodLevel, (int)MAX_FOOD_LEVEL); - m_FoodSaturationLevel = std::min(m_FoodSaturationLevel + a_Saturation, (double)m_FoodLevel); - - SendHealth(); - return true; -} - - - - - -void cPlayer::FoodPoison(int a_NumTicks) -{ - bool HasBeenFoodPoisoned = (m_FoodPoisonedTicksRemaining > 0); - m_FoodPoisonedTicksRemaining = std::max(m_FoodPoisonedTicksRemaining, a_NumTicks); - if (!HasBeenFoodPoisoned) - { - // TODO: Send the poisoning indication to the client - how? - SendHealth(); - } -} - - - - - -void cPlayer::StartEating(void) -{ - // Set the timer: - m_EatingFinishTick = m_World->GetWorldAge() + EATING_TICKS; - - // Send the packets: - m_World->BroadcastPlayerAnimation(*this, 5); - m_World->BroadcastEntityMetadata(*this); -} - - - - - -void cPlayer::FinishEating(void) -{ - // Reset the timer: - m_EatingFinishTick = -1; - - // Send the packets: - m_ClientHandle->SendEntityStatus(*this, ENTITY_STATUS_EATING_ACCEPTED); - m_World->BroadcastPlayerAnimation(*this, 0); - m_World->BroadcastEntityMetadata(*this); - - // consume the item: - cItem Item(GetEquippedItem()); - Item.m_ItemCount = 1; - cItemHandler * ItemHandler = cItemHandler::GetItemHandler(Item.m_ItemType); - if (!ItemHandler->EatItem(this, &Item)) - { - return; - } - ItemHandler->OnFoodEaten(m_World, this, &Item); - - GetInventory().RemoveOneEquippedItem(); - - //if the food is mushroom soup, return a bowl to the inventory - if( Item.m_ItemType == E_ITEM_MUSHROOM_SOUP ) { - cItem emptyBowl(E_ITEM_BOWL, 1, 0, ""); - GetInventory().AddItem(emptyBowl, true, true); - } -} - - - - - -void cPlayer::AbortEating(void) -{ - m_EatingFinishTick = -1; - m_World->BroadcastPlayerAnimation(*this, 0); - m_World->BroadcastEntityMetadata(*this); -} - - - - - -void cPlayer::SendHealth(void) -{ - if (m_ClientHandle != NULL) - { - m_ClientHandle->SendHealth(); - } -} - - - - - -void cPlayer::SendExperience(void) -{ - if (m_ClientHandle != NULL) - { - m_ClientHandle->SendExperience(); - m_bDirtyExperience = false; - } -} - - - - - -void cPlayer::ClearInventoryPaintSlots(void) -{ - // Clear the list of slots that are being inventory-painted. Used by cWindow only - m_InventoryPaintSlots.clear(); -} - - - - - -void cPlayer::AddInventoryPaintSlot(int a_SlotNum) -{ - // Add a slot to the list for inventory painting. Used by cWindow only - m_InventoryPaintSlots.push_back(a_SlotNum); -} - - - - - -const cSlotNums & cPlayer::GetInventoryPaintSlots(void) const -{ - // Return the list of slots currently stored for inventory painting. Used by cWindow only - return m_InventoryPaintSlots; -} - - - - - -double cPlayer::GetMaxSpeed(void) const -{ - return m_IsSprinting ? m_SprintingMaxSpeed : m_NormalMaxSpeed; -} - - - - - -void cPlayer::SetNormalMaxSpeed(double a_Speed) -{ - m_NormalMaxSpeed = a_Speed; - if (!m_IsSprinting) - { - m_ClientHandle->SendPlayerMaxSpeed(); - } -} - - - - - -void cPlayer::SetSprintingMaxSpeed(double a_Speed) -{ - m_SprintingMaxSpeed = a_Speed; - if (m_IsSprinting) - { - m_ClientHandle->SendPlayerMaxSpeed(); - } -} - - - - - -void cPlayer::SetCrouch(bool a_IsCrouched) -{ - // Set the crouch status, broadcast to all visible players - - if (a_IsCrouched == m_IsCrouched) - { - // No change - return; - } - m_IsCrouched = a_IsCrouched; - m_World->BroadcastEntityMetadata(*this); -} - - - - - -void cPlayer::SetSprint(bool a_IsSprinting) -{ - if (a_IsSprinting == m_IsSprinting) - { - // No change - return; - } - - m_IsSprinting = a_IsSprinting; - m_ClientHandle->SendPlayerMaxSpeed(); -} - - - - - -void cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI) -{ - if (a_TDI.DamageType != dtInVoid) - { - if (IsGameModeCreative()) - { - // No damage / health in creative mode - return; - } - } - - super::DoTakeDamage(a_TDI); - - // Any kind of damage adds food exhaustion - AddFoodExhaustion(0.3f); - - SendHealth(); -} - - - - - -void cPlayer::KilledBy(cEntity * a_Killer) -{ - super::KilledBy(a_Killer); - - if (m_Health > 0) - { - return; // not dead yet =] - } - - m_bVisible = false; // So new clients don't see the player - - // Puke out all the items - cItems Pickups; - m_Inventory.CopyToItems(Pickups); - m_Inventory.Clear(); - m_World->SpawnItemPickups(Pickups, GetPosX(), GetPosY(), GetPosZ(), 10); - SaveToDisk(); // Save it, yeah the world is a tough place ! -} - - - - - -void cPlayer::Respawn(void) -{ - m_Health = GetMaxHealth(); - - // Reset food level: - m_FoodLevel = MAX_FOOD_LEVEL; - m_FoodSaturationLevel = 5; - - // Reset Experience - m_CurrentXp = 0; - m_LifetimeTotalXp = 0; - // ToDo: send score to client? How? - - m_ClientHandle->SendRespawn(); - - // Extinguish the fire: - StopBurning(); - - TeleportToCoords(GetWorld()->GetSpawnX(), GetWorld()->GetSpawnY(), GetWorld()->GetSpawnZ()); - - SetVisible(true); -} - - - - - -double cPlayer::GetEyeHeight(void) const -{ - return m_Stance; -} - - - - -Vector3d cPlayer::GetEyePosition(void) const -{ - return Vector3d( GetPosX(), m_Stance, GetPosZ() ); -} - - - - - -bool cPlayer::IsGameModeCreative(void) const -{ - return (m_GameMode == gmCreative) || // Either the player is explicitly in Creative - ((m_GameMode == gmNotSet) && m_World->IsGameModeCreative()); // or they inherit from the world and the world is Creative -} - - - - - -bool cPlayer::IsGameModeSurvival(void) const -{ - return (m_GameMode == gmSurvival) || // Either the player is explicitly in Survival - ((m_GameMode == gmNotSet) && m_World->IsGameModeSurvival()); // or they inherit from the world and the world is Survival -} - - - - - -bool cPlayer::IsGameModeAdventure(void) const -{ - return (m_GameMode == gmCreative) || // Either the player is explicitly in Adventure - ((m_GameMode == gmNotSet) && m_World->IsGameModeCreative()); // or they inherit from the world and the world is Adventure -} - - - - - -void cPlayer::OpenWindow(cWindow * a_Window) -{ - if (a_Window != m_CurrentWindow) - { - CloseWindow(false); - } - a_Window->OpenedByPlayer(*this); - m_CurrentWindow = a_Window; - a_Window->SendWholeWindow(*GetClientHandle()); -} - - - - - -void cPlayer::CloseWindow(bool a_CanRefuse) -{ - if (m_CurrentWindow == NULL) - { - m_CurrentWindow = m_InventoryWindow; - return; - } - - if (m_CurrentWindow->ClosedByPlayer(*this, a_CanRefuse) || !a_CanRefuse) - { - // Close accepted, go back to inventory window (the default): - m_CurrentWindow = m_InventoryWindow; - } - else - { - // Re-open the window - m_CurrentWindow->OpenedByPlayer(*this); - m_CurrentWindow->SendWholeWindow(*GetClientHandle()); - } -} - - - - - -void cPlayer::CloseWindowIfID(char a_WindowID, bool a_CanRefuse) -{ - if ((m_CurrentWindow == NULL) || (m_CurrentWindow->GetWindowID() != a_WindowID)) - { - return; - } - CloseWindow(); -} - - - - - -void cPlayer::SetLastBlockActionTime() -{ - if (m_World != NULL) - { - m_LastBlockActionTime = m_World->GetWorldAge() / 20.0f; - } -} - - - - - -void cPlayer::SetLastBlockActionCnt( int a_LastBlockActionCnt ) -{ - m_LastBlockActionCnt = a_LastBlockActionCnt; -} - - - - - -void cPlayer::SetGameMode(eGameMode a_GameMode) -{ - if ((a_GameMode < gmMin) || (a_GameMode >= gmMax)) - { - LOGWARNING("%s: Setting invalid gamemode: %d", GetName().c_str(), a_GameMode); - return; - } - - if (m_GameMode == a_GameMode) - { - // Gamemode already set - return; - } - - m_GameMode = a_GameMode; - m_ClientHandle->SendGameMode(a_GameMode); -} - - - - - -void cPlayer::LoginSetGameMode( eGameMode a_GameMode ) -{ - m_GameMode = a_GameMode; -} - - - - - -void cPlayer::SetIP(const AString & a_IP) -{ - m_IP = a_IP; -} - - - - - -void cPlayer::SendMessage(const AString & a_Message) -{ - m_ClientHandle->SendChat(a_Message); -} - - - - - -void cPlayer::TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) -{ - SetPosition( a_PosX, a_PosY, a_PosZ ); - m_LastGroundHeight = (float)a_PosY; - - m_World->BroadcastTeleportEntity(*this, GetClientHandle()); - m_ClientHandle->SendPlayerMoveLook(); -} - - - - - -Vector3d cPlayer::GetThrowStartPos(void) const -{ - Vector3d res = GetEyePosition(); - - // Adjust the position to be just outside the player's bounding box: - res.x += 0.16 * cos(GetPitch()); - res.y += -0.1; - res.z += 0.16 * sin(GetPitch()); - - return res; -} - - - - - -Vector3d cPlayer::GetThrowSpeed(double a_SpeedCoeff) const -{ - Vector3d res = GetLookVector(); - res.Normalize(); - - // TODO: Add a slight random change (+-0.0075 in each direction) - - return res * a_SpeedCoeff; -} - - - - - -void cPlayer::MoveTo( const Vector3d & a_NewPos ) -{ - if ((a_NewPos.y < -990) && (GetPosY() > -100)) - { - // When attached to an entity, the client sends position packets with weird coords: - // Y = -999 and X, Z = attempting to create speed, usually up to 0.03 - // We cannot test m_AttachedTo, because when deattaching, the server thinks the client is already deattached while - // the client may still send more of these nonsensical packets. - if (m_AttachedTo != NULL) - { - Vector3d AddSpeed(a_NewPos); - AddSpeed.y = 0; - m_AttachedTo->AddSpeed(AddSpeed); - } - return; - } - - // TODO: should do some checks to see if player is not moving through terrain - // TODO: Official server refuses position packets too far away from each other, kicking "hacked" clients; we should, too - - SetPosition( a_NewPos ); - SetStance(a_NewPos.y + 1.62); -} - - - - - -void cPlayer::SetVisible(bool a_bVisible) -{ - if (a_bVisible && !m_bVisible) // Make visible - { - m_bVisible = true; - m_World->BroadcastSpawnEntity(*this); - } - if (!a_bVisible && m_bVisible) - { - m_bVisible = false; - m_World->BroadcastDestroyEntity(*this, m_ClientHandle); // Destroy on all clients - } -} - - - - - -void cPlayer::AddToGroup( const AString & a_GroupName ) -{ - cGroup* Group = cRoot::Get()->GetGroupManager()->GetGroup( a_GroupName ); - m_Groups.push_back( Group ); - LOGD("Added %s to group %s", m_PlayerName.c_str(), a_GroupName.c_str() ); - ResolveGroups(); - ResolvePermissions(); -} - - - - - -void cPlayer::RemoveFromGroup( const AString & a_GroupName ) -{ - bool bRemoved = false; - for( GroupList::iterator itr = m_Groups.begin(); itr != m_Groups.end(); ++itr ) - { - if( (*itr)->GetName().compare(a_GroupName ) == 0 ) - { - m_Groups.erase( itr ); - bRemoved = true; - break; - } - } - - if( bRemoved ) - { - LOGD("Removed %s from group %s", m_PlayerName.c_str(), a_GroupName.c_str() ); - ResolveGroups(); - ResolvePermissions(); - } - else - { - LOGWARN("Tried to remove %s from group %s but was not in that group", m_PlayerName.c_str(), a_GroupName.c_str() ); - } -} - - - - - -bool cPlayer::CanUseCommand( const AString & a_Command ) -{ - for( GroupList::iterator itr = m_Groups.begin(); itr != m_Groups.end(); ++itr ) - { - if( (*itr)->HasCommand( a_Command ) ) return true; - } - return false; -} - - - - - -bool cPlayer::HasPermission(const AString & a_Permission) -{ - if (a_Permission.empty()) - { - // Empty permission request is always granted - return true; - } - - AStringVector Split = StringSplit( a_Permission, "." ); - PermissionMap Possibilities = m_ResolvedPermissions; - // Now search the namespaces - while( Possibilities.begin() != Possibilities.end() ) - { - PermissionMap::iterator itr = Possibilities.begin(); - if( itr->second ) - { - AStringVector OtherSplit = StringSplit( itr->first, "." ); - if( OtherSplit.size() <= Split.size() ) - { - unsigned int i; - for( i = 0; i < OtherSplit.size(); ++i ) - { - if( OtherSplit[i].compare( Split[i] ) != 0 ) - { - if( OtherSplit[i].compare("*") == 0 ) return true; // WildCard man!! WildCard! - break; - } - } - if( i == Split.size() ) return true; - } - } - Possibilities.erase( itr ); - } - - // Nothing that matched :( - return false; -} - - - - - -bool cPlayer::IsInGroup( const AString & a_Group ) -{ - for( GroupList::iterator itr = m_ResolvedGroups.begin(); itr != m_ResolvedGroups.end(); ++itr ) - { - if( a_Group.compare( (*itr)->GetName().c_str() ) == 0 ) - return true; - } - return false; -} - - - - - -void cPlayer::ResolvePermissions() -{ - m_ResolvedPermissions.clear(); // Start with an empty map yo~ - - // Copy all player specific permissions into the resolved permissions map - for( PermissionMap::iterator itr = m_Permissions.begin(); itr != m_Permissions.end(); ++itr ) - { - m_ResolvedPermissions[ itr->first ] = itr->second; - } - - for( GroupList::iterator GroupItr = m_ResolvedGroups.begin(); GroupItr != m_ResolvedGroups.end(); ++GroupItr ) - { - const cGroup::PermissionMap & Permissions = (*GroupItr)->GetPermissions(); - for( cGroup::PermissionMap::const_iterator itr = Permissions.begin(); itr != Permissions.end(); ++itr ) - { - m_ResolvedPermissions[ itr->first ] = itr->second; - } - } -} - - - - - -void cPlayer::ResolveGroups() -{ - // Clear resolved groups first - m_ResolvedGroups.clear(); - - // Get a complete resolved list of all groups the player is in - std::map< cGroup*, bool > AllGroups; // Use a map, because it's faster than iterating through a list to find duplicates - GroupList ToIterate; - for( GroupList::iterator GroupItr = m_Groups.begin(); GroupItr != m_Groups.end(); ++GroupItr ) - { - ToIterate.push_back( *GroupItr ); - } - while( ToIterate.begin() != ToIterate.end() ) - { - cGroup* CurrentGroup = *ToIterate.begin(); - if( AllGroups.find( CurrentGroup ) != AllGroups.end() ) - { - LOGWARNING("ERROR: Player \"%s\" is in the group multiple times (\"%s\"). Please fix your settings in users.ini!", - m_PlayerName.c_str(), CurrentGroup->GetName().c_str() - ); - } - else - { - AllGroups[ CurrentGroup ] = true; - m_ResolvedGroups.push_back( CurrentGroup ); // Add group to resolved list - const cGroup::GroupList & Inherits = CurrentGroup->GetInherits(); - for( cGroup::GroupList::const_iterator itr = Inherits.begin(); itr != Inherits.end(); ++itr ) - { - if( AllGroups.find( *itr ) != AllGroups.end() ) - { - LOGERROR("ERROR: Player %s is in the same group multiple times due to inheritance (%s). FIX IT!", m_PlayerName.c_str(), (*itr)->GetName().c_str() ); - continue; - } - ToIterate.push_back( *itr ); - } - } - ToIterate.erase( ToIterate.begin() ); - } -} - - - - - -AString cPlayer::GetColor(void) const -{ - if ( m_Color != '-' ) - { - return cChatColor::MakeColor( m_Color ); - } - - if ( m_Groups.size() < 1 ) - { - return cChatColor::White; - } - - return (*m_Groups.begin())->GetColor(); -} - - - - - -void cPlayer::TossItem( - bool a_bDraggingItem, - char a_Amount /* = 1 */, - short a_CreateType /* = 0 */, - short a_CreateHealth /* = 0 */ -) -{ - cItems Drops; - if (a_CreateType != 0) - { - // Just create item without touching the inventory (used in creative mode) - Drops.push_back(cItem(a_CreateType, a_Amount, a_CreateHealth)); - } - else - { - // Drop an item from the inventory: - if (a_bDraggingItem) - { - cItem & Item = GetDraggingItem(); - if (!Item.IsEmpty()) - { - char OriginalItemAmount = Item.m_ItemCount; - Item.m_ItemCount = std::min(OriginalItemAmount, a_Amount); - Drops.push_back(Item); - if (OriginalItemAmount > a_Amount) - { - Item.m_ItemCount = OriginalItemAmount - (char)a_Amount; - } - else - { - Item.Empty(); - } - } - } - else - { - // Else drop equipped item - cItem DroppedItem(GetInventory().GetEquippedItem()); - if (!DroppedItem.IsEmpty()) - { - if (GetInventory().RemoveOneEquippedItem()) - { - DroppedItem.m_ItemCount = 1; // RemoveItem decreases the count, so set it to 1 again - Drops.push_back(DroppedItem); - } - } - } - } - double vX = 0, vY = 0, vZ = 0; - EulerToVector(-GetRotation(), GetPitch(), vZ, vX, vY); - vY = -vY * 2 + 1.f; - m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY() + 1.6f, GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player -} - - - - - -bool cPlayer::MoveToWorld(const char * a_WorldName) -{ - cWorld * World = cRoot::Get()->GetWorld(a_WorldName); - if (World == NULL) - { - LOG("%s: Couldn't find world \"%s\".", __FUNCTION__, a_WorldName); - return false; - } - - eDimension OldDimension = m_World->GetDimension(); - - // Remove all links to the old world - m_World->RemovePlayer(this); - m_ClientHandle->RemoveFromAllChunks(); - m_World->RemoveEntity(this); - - // If the dimension is different, we can send the respawn packet - // http://wiki.vg/Protocol#0x09 says "don't send if dimension is the same" as of 2013_07_02 - m_ClientHandle->MoveToWorld(*World, (OldDimension != World->GetDimension())); - - // Add player to all the necessary parts of the new world - SetWorld(World); - World->AddEntity(this); - World->AddPlayer(this); - - return true; -} - - - - - -void cPlayer::LoadPermissionsFromDisk() -{ - m_Groups.clear(); - m_Permissions.clear(); - - cIniFile IniFile; - if (IniFile.ReadFile("users.ini")) - { - std::string Groups = IniFile.GetValue(m_PlayerName, "Groups", ""); - if (!Groups.empty()) - { - AStringVector Split = StringSplit( Groups, "," ); - for( unsigned int i = 0; i < Split.size(); i++ ) - { - AddToGroup( Split[i].c_str() ); - } - } - else - { - AddToGroup("Default"); - } - - m_Color = IniFile.GetValue(m_PlayerName, "Color", "-")[0]; - } - else - { - LOGWARN("Failed to read the users.ini file. The player will be added only to the Default group."); - AddToGroup("Default"); - } - ResolvePermissions(); -} - - - - -bool cPlayer::LoadFromDisk() -{ - LoadPermissionsFromDisk(); - - // Log player permissions, cause it's what the cool kids do - LOGINFO("Player %s has permissions:", m_PlayerName.c_str() ); - for( PermissionMap::iterator itr = m_ResolvedPermissions.begin(); itr != m_ResolvedPermissions.end(); ++itr ) - { - if( itr->second ) LOGINFO("%s", itr->first.c_str() ); - } - - AString SourceFile; - Printf(SourceFile, "players/%s.json", m_PlayerName.c_str() ); - - cFile f; - if (!f.Open(SourceFile, cFile::fmRead)) - { - // This is a new player whom we haven't seen yet, bail out, let them have the defaults - return false; - } - - AString buffer; - if (f.ReadRestOfFile(buffer) != f.GetSize()) - { - LOGWARNING("Cannot read player data from file \"%s\"", SourceFile.c_str()); - return false; - } - f.Close(); //cool kids play nice - - Json::Value root; - Json::Reader reader; - if (!reader.parse(buffer, root, false)) - { - LOGWARNING("Cannot parse player data in file \"%s\", player will be reset", SourceFile.c_str()); - } - - Json::Value & JSON_PlayerPosition = root["position"]; - if (JSON_PlayerPosition.size() == 3) - { - SetPosX(JSON_PlayerPosition[(unsigned int)0].asDouble()); - SetPosY(JSON_PlayerPosition[(unsigned int)1].asDouble()); - SetPosZ(JSON_PlayerPosition[(unsigned int)2].asDouble()); - m_LastPosX = GetPosX(); - m_LastPosY = GetPosY(); - m_LastPosZ = GetPosZ(); - m_LastFoodPos = GetPosition(); - } - - Json::Value & JSON_PlayerRotation = root["rotation"]; - if (JSON_PlayerRotation.size() == 3) - { - SetRotation ((float)JSON_PlayerRotation[(unsigned int)0].asDouble()); - SetPitch ((float)JSON_PlayerRotation[(unsigned int)1].asDouble()); - SetRoll ((float)JSON_PlayerRotation[(unsigned int)2].asDouble()); - } - - m_Health = root.get("health", 0).asInt(); - m_AirLevel = root.get("air", MAX_AIR_LEVEL).asInt(); - m_FoodLevel = root.get("food", MAX_FOOD_LEVEL).asInt(); - m_FoodSaturationLevel = root.get("foodSaturation", MAX_FOOD_LEVEL).asDouble(); - m_FoodTickTimer = root.get("foodTickTimer", 0).asInt(); - m_FoodExhaustionLevel = root.get("foodExhaustion", 0).asDouble(); - m_LifetimeTotalXp = (short) root.get("xpTotal", 0).asInt(); - m_CurrentXp = (short) root.get("xpCurrent", 0).asInt(); - - //SetExperience(root.get("experience", 0).asInt()); - - m_GameMode = (eGameMode) root.get("gamemode", eGameMode_NotSet).asInt(); - - m_Inventory.LoadFromJson(root["inventory"]); - - m_LoadedWorldName = root.get("world", "world").asString(); - - LOGD("Player \"%s\" was read from file, spawning at {%.2f, %.2f, %.2f} in world \"%s\"", - m_PlayerName.c_str(), GetPosX(), GetPosY(), GetPosZ(), m_LoadedWorldName.c_str() - ); - - return true; -} - - - - - -bool cPlayer::SaveToDisk() -{ - cFile::CreateFolder(FILE_IO_PREFIX + AString("players")); - - // create the JSON data - Json::Value JSON_PlayerPosition; - JSON_PlayerPosition.append(Json::Value(GetPosX())); - JSON_PlayerPosition.append(Json::Value(GetPosY())); - JSON_PlayerPosition.append(Json::Value(GetPosZ())); - - Json::Value JSON_PlayerRotation; - JSON_PlayerRotation.append(Json::Value(GetRotation())); - JSON_PlayerRotation.append(Json::Value(GetPitch())); - JSON_PlayerRotation.append(Json::Value(GetRoll())); - - Json::Value JSON_Inventory; - m_Inventory.SaveToJson(JSON_Inventory); - - Json::Value root; - root["position"] = JSON_PlayerPosition; - root["rotation"] = JSON_PlayerRotation; - root["inventory"] = JSON_Inventory; - root["health"] = m_Health; - root["xpTotal"] = m_LifetimeTotalXp; - root["xpCurrent"] = m_CurrentXp; - root["air"] = m_AirLevel; - root["food"] = m_FoodLevel; - root["foodSaturation"] = m_FoodSaturationLevel; - root["foodTickTimer"] = m_FoodTickTimer; - root["foodExhaustion"] = m_FoodExhaustionLevel; - root["world"] = GetWorld()->GetName(); - - if (m_GameMode == GetWorld()->GetGameMode()) - { - root["gamemode"] = (int) eGameMode_NotSet; - } - else - { - root["gamemode"] = (int) m_GameMode; - } - - Json::StyledWriter writer; - std::string JsonData = writer.write(root); - - AString SourceFile; - Printf(SourceFile, "players/%s.json", m_PlayerName.c_str() ); - - cFile f; - if (!f.Open(SourceFile, cFile::fmWrite)) - { - LOGERROR("ERROR WRITING PLAYER \"%s\" TO FILE \"%s\" - cannot open file", m_PlayerName.c_str(), SourceFile.c_str()); - return false; - } - if (f.Write(JsonData.c_str(), JsonData.size()) != (int)JsonData.size()) - { - LOGERROR("ERROR WRITING PLAYER JSON TO FILE \"%s\"", SourceFile.c_str()); - return false; - } - return true; -} - - - - - -cPlayer::StringList cPlayer::GetResolvedPermissions() -{ - StringList Permissions; - - const PermissionMap& ResolvedPermissions = m_ResolvedPermissions; - for( PermissionMap::const_iterator itr = ResolvedPermissions.begin(); itr != ResolvedPermissions.end(); ++itr ) - { - if( itr->second ) Permissions.push_back( itr->first ); - } - - return Permissions; -} - - - - - -void cPlayer::UseEquippedItem(void) -{ - if (IsGameModeCreative()) // No damage in creative - { - return; - } - - GetInventory().DamageEquippedItem(); -} - - - - - -void cPlayer::SetSwimState(cChunk & a_Chunk) -{ - int RelY = (int)floor(m_LastPosY + 0.1); - if ((RelY < 0) || (RelY >= cChunkDef::Height - 1)) - { - m_IsSwimming = false; - m_IsSubmerged = false; - return; - } - - BLOCKTYPE BlockIn; - int RelX = (int)floor(m_LastPosX) - a_Chunk.GetPosX() * cChunkDef::Width; - int RelZ = (int)floor(m_LastPosZ) - a_Chunk.GetPosZ() * cChunkDef::Width; - - // Check if the player is swimming: - // Use Unbounded, because we're being called *after* processing super::Tick(), which could have changed our chunk - if (!a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockIn)) - { - // This sometimes happens on Linux machines - // Ref.: http://forum.mc-server.org/showthread.php?tid=1244 - LOGD("SetSwimState failure: RelX = %d, RelZ = %d, LastPos = {%.02f, %.02f}, Pos = %.02f, %.02f}", - RelX, RelY, m_LastPosX, m_LastPosZ, GetPosX(), GetPosZ() - ); - m_IsSwimming = false; - m_IsSubmerged = false; - return; - } - m_IsSwimming = IsBlockWater(BlockIn); - - // Check if the player is submerged: - VERIFY(a_Chunk.UnboundedRelGetBlockType(RelX, RelY + 1, RelZ, BlockIn)); - m_IsSubmerged = IsBlockWater(BlockIn); -} - - - - - -void cPlayer::HandleAir(void) -{ - // Ref.: http://www.minecraftwiki.net/wiki/Chunk_format - // see if the player is /submerged/ water (block above is water) - // Get the type of block the player's standing in: - - if (IsSubmerged()) - { - // either reduce air level or damage player - if (m_AirLevel < 1) - { - if (m_AirTickTimer < 1) - { - // damage player - TakeDamage(dtDrowning, NULL, 1, 1, 0); - // reset timer - m_AirTickTimer = DROWNING_TICKS; - } - else - { - m_AirTickTimer -= 1; - } - } - else - { - // reduce air supply - m_AirLevel -= 1; - } - } - else - { - // set the air back to maximum - m_AirLevel = MAX_AIR_LEVEL; - m_AirTickTimer = DROWNING_TICKS; - } -} - - - - - -void cPlayer::HandleFood(void) -{ - // Ref.: http://www.minecraftwiki.net/wiki/Hunger - - // Remember the food level before processing, for later comparison - int LastFoodLevel = m_FoodLevel; - - // Heal or damage, based on the food level, using the m_FoodTickTimer: - if ((m_FoodLevel > 17) || (m_FoodLevel <= 0)) - { - m_FoodTickTimer++; - if (m_FoodTickTimer >= 80) - { - m_FoodTickTimer = 0; - - if (m_FoodLevel >= 17) - { - // Regenerate health from food, incur 3 pts of food exhaustion: - Heal(1); - m_FoodExhaustionLevel += 3; - } - else if (m_FoodLevel <= 0) - { - // Damage from starving - TakeDamage(dtStarving, NULL, 1, 1, 0); - } - } - } - - // Apply food poisoning food exhaustion: - if (m_FoodPoisonedTicksRemaining > 0) - { - m_FoodPoisonedTicksRemaining--; - m_FoodExhaustionLevel += 0.025; // 0.5 per second = 0.025 per tick - } - - // Apply food exhaustion that has accumulated: - if (m_FoodExhaustionLevel >= 4) - { - m_FoodExhaustionLevel -= 4; - - if (m_FoodSaturationLevel >= 1) - { - m_FoodSaturationLevel -= 1; - } - else - { - m_FoodLevel = std::max(m_FoodLevel - 1, 0); - } - } - - if (m_FoodLevel != LastFoodLevel) - { - SendHealth(); - } -} - - - - - -void cPlayer::ApplyFoodExhaustionFromMovement() -{ - if (IsGameModeCreative()) - { - return; - } - - // Calculate the distance travelled, update the last pos: - Vector3d Movement(GetPosition() - m_LastFoodPos); - Movement.y = 0; // Only take XZ movement into account - m_LastFoodPos = GetPosition(); - - // If riding anything, apply no food exhaustion - if (m_AttachedTo != NULL) - { - return; - } - - // Apply the exhaustion based on distance travelled: - double BaseExhaustion = Movement.Length(); - if (IsSprinting()) - { - // 0.1 pt per meter sprinted - BaseExhaustion = BaseExhaustion * 0.1; - } - else if (IsSwimming()) - { - // 0.015 pt per meter swum - BaseExhaustion = BaseExhaustion * 0.015; - } - else - { - // 0.01 pt per meter walked / sneaked - BaseExhaustion = BaseExhaustion * 0.01; - } - m_FoodExhaustionLevel += BaseExhaustion; -} - - - - diff --git a/source/Generating/BioGen.cpp b/source/Generating/BioGen.cpp deleted file mode 100644 index 926120afc..000000000 --- a/source/Generating/BioGen.cpp +++ /dev/null @@ -1,707 +0,0 @@ - -// BioGen.cpp - -// Implements the various biome generators - -#include "Globals.h" -#include "BioGen.h" -#include "../../iniFile/iniFile.h" -#include "../LinearUpscale.h" - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cBioGenConstant: - -void cBioGenConstant::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) -{ - for (int i = 0; i < ARRAYCOUNT(a_BiomeMap); i++) - { - a_BiomeMap[i] = m_Biome; - } -} - - - - - -void cBioGenConstant::InitializeBiomeGen(cIniFile & a_IniFile) -{ - AString Biome = a_IniFile.GetValueSet("Generator", "ConstantBiome", "Plains"); - m_Biome = StringToBiome(Biome); - if (m_Biome == -1) - { - LOGWARN("[Generator]::ConstantBiome value \"%s\" not recognized, using \"Plains\".", Biome.c_str()); - m_Biome = biPlains; - } -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cBioGenCache: - -cBioGenCache::cBioGenCache(cBiomeGen * a_BioGenToCache, int a_CacheSize) : - m_BioGenToCache(a_BioGenToCache), - m_CacheSize(a_CacheSize), - m_CacheOrder(new int[a_CacheSize]), - m_CacheData(new sCacheData[a_CacheSize]), - m_NumHits(0), - m_NumMisses(0), - m_TotalChain(0) -{ - for (int i = 0; i < m_CacheSize; i++) - { - m_CacheOrder[i] = i; - m_CacheData[i].m_ChunkX = 0x7fffffff; - m_CacheData[i].m_ChunkZ = 0x7fffffff; - } -} - - - - - -cBioGenCache::~cBioGenCache() -{ - delete[] m_CacheData; - delete[] m_CacheOrder; -} - - - - - -void cBioGenCache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) -{ - if (((m_NumHits + m_NumMisses) % 1024) == 10) - { - LOGD("BioGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses)); - LOGD("BioGenCache: Avg cache chain length: %.2f", (float)m_TotalChain / m_NumHits); - } - - for (int i = 0; i < m_CacheSize; i++) - { - if ( - (m_CacheData[m_CacheOrder[i]].m_ChunkX != a_ChunkX) || - (m_CacheData[m_CacheOrder[i]].m_ChunkZ != a_ChunkZ) - ) - { - continue; - } - // Found it in the cache - int Idx = m_CacheOrder[i]; - - // Move to front: - for (int j = i; j > 0; j--) - { - m_CacheOrder[j] = m_CacheOrder[j - 1]; - } - m_CacheOrder[0] = Idx; - - // Use the cached data: - memcpy(a_BiomeMap, m_CacheData[Idx].m_BiomeMap, sizeof(a_BiomeMap)); - - m_NumHits++; - m_TotalChain += i; - return; - } // for i - cache - - // Not in the cache: - m_NumMisses++; - m_BioGenToCache->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap); - - // Insert it as the first item in the MRU order: - int Idx = m_CacheOrder[m_CacheSize - 1]; - for (int i = m_CacheSize - 1; i > 0; i--) - { - m_CacheOrder[i] = m_CacheOrder[i - 1]; - } // for i - m_CacheOrder[] - m_CacheOrder[0] = Idx; - memcpy(m_CacheData[Idx].m_BiomeMap, a_BiomeMap, sizeof(a_BiomeMap)); - m_CacheData[Idx].m_ChunkX = a_ChunkX; - m_CacheData[Idx].m_ChunkZ = a_ChunkZ; -} - - - - - -void cBioGenCache::InitializeBiomeGen(cIniFile & a_IniFile) -{ - super::InitializeBiomeGen(a_IniFile); - m_BioGenToCache->InitializeBiomeGen(a_IniFile); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cBiomeGenList: - -void cBiomeGenList::InitializeBiomes(const AString & a_Biomes) -{ - AStringVector Split = StringSplit(a_Biomes, ","); - - // Convert each string in the list into biome: - for (AStringVector::const_iterator itr = Split.begin(); itr != Split.end(); ++itr) - { - AStringVector Split2 = StringSplit(*itr, ":"); - if (Split2.size() < 1) - { - continue; - } - int Count = 1; - if (Split2.size() >= 2) - { - Count = atol(Split2[1].c_str()); - if (Count <= 0) - { - LOGWARNING("Cannot decode biome count: \"%s\"; using 1.", Split2[1].c_str()); - Count = 1; - } - } - EMCSBiome Biome = StringToBiome(Split2[0]); - if (Biome != -1) - { - for (int i = 0; i < Count; i++) - { - m_Biomes.push_back(Biome); - } - } - else - { - LOGWARNING("Cannot decode biome name: \"%s\"; skipping", Split2[0].c_str()); - } - } // for itr - Split[] - if (!m_Biomes.empty()) - { - m_BiomesCount = (int)m_Biomes.size(); - return; - } - - // There were no biomes, add default biomes: - static EMCSBiome Biomes[] = - { - biOcean, - biPlains, - biDesert, - biExtremeHills, - biForest, - biTaiga, - biSwampland, - biRiver, - biFrozenOcean, - biFrozenRiver, - biIcePlains, - biIceMountains, - biMushroomIsland, - biMushroomShore, - biBeach, - biDesertHills, - biForestHills, - biTaigaHills, - biExtremeHillsEdge, - biJungle, - biJungleHills, - } ; - m_Biomes.reserve(ARRAYCOUNT(Biomes)); - for (int i = 0; i < ARRAYCOUNT(Biomes); i++) - { - m_Biomes.push_back(Biomes[i]); - } - m_BiomesCount = (int)m_Biomes.size(); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cBioGenCheckerboard: - -void cBioGenCheckerboard::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) -{ - for (int z = 0; z < cChunkDef::Width; z++) - { - int Base = cChunkDef::Width * a_ChunkZ + z; - for (int x = 0; x < cChunkDef::Width; x++) - { - int Add = cChunkDef::Width * a_ChunkX + x; - a_BiomeMap[x + cChunkDef::Width * z] = m_Biomes[(Base / m_BiomeSize + Add / m_BiomeSize) % m_BiomesCount]; - } - } -} - - - - - -void cBioGenCheckerboard::InitializeBiomeGen(cIniFile & a_IniFile) -{ - super::InitializeBiomeGen(a_IniFile); - AString Biomes = a_IniFile.GetValueSet ("Generator", "CheckerBoardBiomes", ""); - m_BiomeSize = a_IniFile.GetValueSetI("Generator", "CheckerboardBiomeSize", 64); - m_BiomeSize = (m_BiomeSize < 8) ? 8 : m_BiomeSize; - InitializeBiomes(Biomes); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cBioGenVoronoi : - -void cBioGenVoronoi::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) -{ - int BaseZ = cChunkDef::Width * a_ChunkZ; - int BaseX = cChunkDef::Width * a_ChunkX; - for (int z = 0; z < cChunkDef::Width; z++) - { - int AbsoluteZ = BaseZ + z; - for (int x = 0; x < cChunkDef::Width; x++) - { - cChunkDef::SetBiome(a_BiomeMap, x, z, VoronoiBiome(BaseX + x, AbsoluteZ)); - } // for x - } // for z -} - - - - - -void cBioGenVoronoi::InitializeBiomeGen(cIniFile & a_IniFile) -{ - super::InitializeBiomeGen(a_IniFile); - m_CellSize = a_IniFile.GetValueSetI("Generator", "VoronoiCellSize", 64); - AString Biomes = a_IniFile.GetValueSet ("Generator", "VoronoiBiomes", ""); - InitializeBiomes(Biomes); -} - - - - - -EMCSBiome cBioGenVoronoi::VoronoiBiome(int a_BlockX, int a_BlockZ) -{ - int CellX = a_BlockX / m_CellSize; - int CellZ = a_BlockZ / m_CellSize; - - // Note that Noise values need to be divided by 8 to gain a uniform modulo-2^n distribution - - // Get 5x5 neighboring cell seeds, compare distance to each. Return the biome in the minumim-distance cell - int MinDist = m_CellSize * m_CellSize * 16; // There has to be a cell closer than this - EMCSBiome res = biPlains; // Will be overriden - for (int x = CellX - 2; x <= CellX + 2; x++) - { - int BaseX = x * m_CellSize; - for (int z = CellZ - 2; z < CellZ + 2; z++) - { - int OffsetX = (m_Noise.IntNoise3DInt(x, 16 * x + 32 * z, z) / 8) % m_CellSize; - int OffsetZ = (m_Noise.IntNoise3DInt(x, 32 * x - 16 * z, z) / 8) % m_CellSize; - int SeedX = BaseX + OffsetX; - int SeedZ = z * m_CellSize + OffsetZ; - - int Dist = (SeedX - a_BlockX) * (SeedX - a_BlockX) + (SeedZ - a_BlockZ) * (SeedZ - a_BlockZ); - if (Dist < MinDist) - { - MinDist = Dist; - res = m_Biomes[(m_Noise.IntNoise3DInt(x, x - z + 1000, z) / 8) % m_BiomesCount]; - } - } // for z - } // for x - - return res; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cBioGenDistortedVoronoi: - -void cBioGenDistortedVoronoi::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) -{ - int BaseZ = cChunkDef::Width * a_ChunkZ; - int BaseX = cChunkDef::Width * a_ChunkX; - - // Distortions for linear interpolation: - int DistortX[cChunkDef::Width + 1][cChunkDef::Width + 1]; - int DistortZ[cChunkDef::Width + 1][cChunkDef::Width + 1]; - for (int x = 0; x <= 4; x++) for (int z = 0; z <= 4; z++) - { - Distort(BaseX + x * 4, BaseZ + z * 4, DistortX[4 * x][4 * z], DistortZ[4 * x][4 * z]); - } - - LinearUpscale2DArrayInPlace(&DistortX[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); - LinearUpscale2DArrayInPlace(&DistortZ[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); - - for (int z = 0; z < cChunkDef::Width; z++) - { - int AbsoluteZ = BaseZ + z; - for (int x = 0; x < cChunkDef::Width; x++) - { - // Distort(BaseX + x, AbsoluteZ, DistX, DistZ); - cChunkDef::SetBiome(a_BiomeMap, x, z, VoronoiBiome(DistortX[x][z], DistortZ[x][z])); - } // for x - } // for z -} - - - - - -void cBioGenDistortedVoronoi::InitializeBiomeGen(cIniFile & a_IniFile) -{ - // Do NOT call super::InitializeBiomeGen(), as it would try to read Voronoi params instead of DistortedVoronoi params - m_CellSize = a_IniFile.GetValueSetI("Generator", "DistortedVoronoiCellSize", 96); - AString Biomes = a_IniFile.GetValueSet ("Generator", "DistortedVoronoiBiomes", ""); - InitializeBiomes(Biomes); -} - - - - -void cBioGenDistortedVoronoi::Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ) -{ - double NoiseX = m_Noise.CubicNoise3D((float)a_BlockX / m_CellSize, (float)a_BlockZ / m_CellSize, 1000); - NoiseX += 0.5 * m_Noise.CubicNoise3D(2 * (float)a_BlockX / m_CellSize, 2 * (float)a_BlockZ / m_CellSize, 2000); - NoiseX += 0.08 * m_Noise.CubicNoise3D(16 * (float)a_BlockX / m_CellSize, 16 * (float)a_BlockZ / m_CellSize, 3000); - double NoiseZ = m_Noise.CubicNoise3D((float)a_BlockX / m_CellSize, (float)a_BlockZ / m_CellSize, 4000); - NoiseZ += 0.5 * m_Noise.CubicNoise3D(2 * (float)a_BlockX / m_CellSize, 2 * (float)a_BlockZ / m_CellSize, 5000); - NoiseZ += 0.08 * m_Noise.CubicNoise3D(16 * (float)a_BlockX / m_CellSize, 16 * (float)a_BlockZ / m_CellSize, 6000); - - a_DistortedX = a_BlockX + (int)(m_CellSize * 0.5 * NoiseX); - a_DistortedZ = a_BlockZ + (int)(m_CellSize * 0.5 * NoiseZ); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cBioGenMultiStepMap : - -cBioGenMultiStepMap::cBioGenMultiStepMap(int a_Seed) : - m_Noise1(a_Seed + 1000), - m_Noise2(a_Seed + 2000), - m_Noise3(a_Seed + 3000), - m_Noise4(a_Seed + 4000), - m_Noise5(a_Seed + 5000), - m_Noise6(a_Seed + 6000), - m_Seed(a_Seed), - m_OceanCellSize(384), - m_MushroomIslandSize(64), - m_RiverCellSize(384), - m_RiverWidthThreshold(0.125), - m_LandBiomesSize(1024) -{ -} - - - - - -void cBioGenMultiStepMap::InitializeBiomeGen(cIniFile & a_IniFile) -{ - m_OceanCellSize = a_IniFile.GetValueSetI("Generator", "MultiStepMapOceanCellSize", m_OceanCellSize); - m_MushroomIslandSize = a_IniFile.GetValueSetI("Generator", "MultiStepMapMushroomIslandSize", m_MushroomIslandSize); - m_RiverCellSize = a_IniFile.GetValueSetI("Generator", "MultiStepMapRiverCellSize", m_RiverCellSize); - m_RiverWidthThreshold = a_IniFile.GetValueSetF("Generator", "MultiStepMapRiverWidth", m_RiverWidthThreshold); - m_LandBiomesSize = (float)a_IniFile.GetValueSetI("Generator", "MultiStepMapLandBiomeSize", (int)m_LandBiomesSize); -} - - - - - -void cBioGenMultiStepMap::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) -{ - DecideOceanLandMushroom(a_ChunkX, a_ChunkZ, a_BiomeMap); - AddRivers(a_ChunkX, a_ChunkZ, a_BiomeMap); - ApplyTemperatureHumidity(a_ChunkX, a_ChunkZ, a_BiomeMap); -} - - - - - -void cBioGenMultiStepMap::DecideOceanLandMushroom(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) -{ - // Distorted Voronoi over 3 biomes, with mushroom having only a special occurence. - - // Prepare a distortion lookup table, by distorting a 5x5 area and using that as 1:4 zoom (linear interpolate): - int BaseZ = cChunkDef::Width * a_ChunkZ; - int BaseX = cChunkDef::Width * a_ChunkX; - int DistortX[cChunkDef::Width + 1][cChunkDef::Width + 1]; - int DistortZ[cChunkDef::Width + 1][cChunkDef::Width + 1]; - int DistortSize = m_OceanCellSize / 2; - for (int x = 0; x <= 4; x++) for (int z = 0; z <= 4; z++) - { - Distort(BaseX + x * 4, BaseZ + z * 4, DistortX[4 * x][4 * z], DistortZ[4 * x][4 * z], DistortSize); - } - LinearUpscale2DArrayInPlace(&DistortX[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); - LinearUpscale2DArrayInPlace(&DistortZ[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); - - // Prepare a 9x9 area of neighboring cell seeds - // (assuming that 7x7 cell area is larger than a chunk being generated) - const int NEIGHBORHOOD_SIZE = 4; // How many seeds in each direction to check - int CellX = BaseX / m_OceanCellSize; - int CellZ = BaseZ / m_OceanCellSize; - int SeedX[2 * NEIGHBORHOOD_SIZE + 1][2 * NEIGHBORHOOD_SIZE + 1]; - int SeedZ[2 * NEIGHBORHOOD_SIZE + 1][2 * NEIGHBORHOOD_SIZE + 1]; - EMCSBiome SeedV[2 * NEIGHBORHOOD_SIZE + 1][2 * NEIGHBORHOOD_SIZE + 1]; - for (int xc = 0; xc < 2 * NEIGHBORHOOD_SIZE + 1; xc++) - { - int RealCellX = xc + CellX - NEIGHBORHOOD_SIZE; - int CellBlockX = RealCellX * m_OceanCellSize; - for (int zc = 0; zc < 2 * NEIGHBORHOOD_SIZE + 1; zc++) - { - int RealCellZ = zc + CellZ - NEIGHBORHOOD_SIZE; - int CellBlockZ = RealCellZ * m_OceanCellSize; - int OffsetX = (m_Noise2.IntNoise3DInt(RealCellX, 16 * RealCellX + 32 * RealCellZ, RealCellZ) / 8) % m_OceanCellSize; - int OffsetZ = (m_Noise4.IntNoise3DInt(RealCellX, 32 * RealCellX - 16 * RealCellZ, RealCellZ) / 8) % m_OceanCellSize; - SeedX[xc][zc] = CellBlockX + OffsetX; - SeedZ[xc][zc] = CellBlockZ + OffsetZ; - SeedV[xc][zc] = (((m_Noise6.IntNoise3DInt(RealCellX, RealCellX - RealCellZ + 1000, RealCellZ) / 11) % 256) > 90) ? biOcean : ((EMCSBiome)(-1)); - } // for z - } // for x - - for (int xc = 1; xc < 2 * NEIGHBORHOOD_SIZE; xc++) for (int zc = 1; zc < 2 * NEIGHBORHOOD_SIZE; zc++) - { - if ( - (SeedV[xc ][zc] == biOcean) && - (SeedV[xc - 1][zc] == biOcean) && - (SeedV[xc + 1][zc] == biOcean) && - (SeedV[xc ][zc - 1] == biOcean) && - (SeedV[xc ][zc + 1] == biOcean) && - (SeedV[xc - 1][zc - 1] == biOcean) && - (SeedV[xc + 1][zc - 1] == biOcean) && - (SeedV[xc - 1][zc + 1] == biOcean) && - (SeedV[xc + 1][zc + 1] == biOcean) - ) - { - SeedV[xc][zc] = biMushroomIsland; - } - } - - // For each column find the nearest distorted cell and use its value as the biome: - int MushroomOceanThreshold = m_OceanCellSize * m_OceanCellSize * m_MushroomIslandSize / 1024; - int MushroomShoreThreshold = m_OceanCellSize * m_OceanCellSize * m_MushroomIslandSize / 2048; - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - int AbsoluteZ = DistortZ[x][z]; - int AbsoluteX = DistortX[x][z]; - int MinDist = m_OceanCellSize * m_OceanCellSize * 16; // There has to be a cell closer than this - EMCSBiome Biome = biPlains; - // Find the nearest cell seed: - for (int xs = 1; xs < 2 * NEIGHBORHOOD_SIZE; xs++) for (int zs = 1; zs < 2 * NEIGHBORHOOD_SIZE; zs++) - { - int Dist = (SeedX[xs][zs] - AbsoluteX) * (SeedX[xs][zs] - AbsoluteX) + (SeedZ[xs][zs] - AbsoluteZ) * (SeedZ[xs][zs] - AbsoluteZ); - if (Dist >= MinDist) - { - continue; - } - MinDist = Dist; - Biome = SeedV[xs][zs]; - // Shrink mushroom biome and add a shore: - if (Biome == biMushroomIsland) - { - if (Dist > MushroomOceanThreshold) - { - Biome = biOcean; - } - else if (Dist > MushroomShoreThreshold) - { - Biome = biMushroomShore; - } - } - } // for zs, xs - - cChunkDef::SetBiome(a_BiomeMap, x, z, Biome); - } // for x - } // for z -} - - - - - -void cBioGenMultiStepMap::AddRivers(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) -{ - for (int z = 0; z < cChunkDef::Width; z++) - { - float NoiseCoordZ = (float)(a_ChunkZ * cChunkDef::Width + z) / m_RiverCellSize; - for (int x = 0; x < cChunkDef::Width; x++) - { - if (cChunkDef::GetBiome(a_BiomeMap, x, z) != -1) - { - // Biome already set, skip this column - continue; - } - - float NoiseCoordX = (float)(a_ChunkX * cChunkDef::Width + x) / m_RiverCellSize; - - double Noise = m_Noise1.CubicNoise2D( NoiseCoordX, NoiseCoordZ); - Noise += 0.5 * m_Noise3.CubicNoise2D(2 * NoiseCoordX, 2 * NoiseCoordZ); - Noise += 0.1 * m_Noise5.CubicNoise2D(8 * NoiseCoordX, 8 * NoiseCoordZ); - - if ((Noise > 0) && (Noise < m_RiverWidthThreshold)) - { - cChunkDef::SetBiome(a_BiomeMap, x, z, biRiver); - } - } // for x - } // for z -} - - - - - -void cBioGenMultiStepMap::ApplyTemperatureHumidity(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) -{ - IntMap TemperatureMap; - IntMap HumidityMap; - BuildTemperatureHumidityMaps(a_ChunkX, a_ChunkZ, TemperatureMap, HumidityMap); - - FreezeWaterBiomes(a_BiomeMap, TemperatureMap); - DecideLandBiomes(a_BiomeMap, TemperatureMap, HumidityMap); -} - - - - - -void cBioGenMultiStepMap::Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ, int a_CellSize) -{ - double NoiseX = m_Noise3.CubicNoise2D( (float)a_BlockX / a_CellSize, (float)a_BlockZ / a_CellSize); - NoiseX += 0.5 * m_Noise2.CubicNoise2D(2 * (float)a_BlockX / a_CellSize, 2 * (float)a_BlockZ / a_CellSize); - NoiseX += 0.1 * m_Noise1.CubicNoise2D(16 * (float)a_BlockX / a_CellSize, 16 * (float)a_BlockZ / a_CellSize); - double NoiseZ = m_Noise6.CubicNoise2D( (float)a_BlockX / a_CellSize, (float)a_BlockZ / a_CellSize); - NoiseZ += 0.5 * m_Noise5.CubicNoise2D(2 * (float)a_BlockX / a_CellSize, 2 * (float)a_BlockZ / a_CellSize); - NoiseZ += 0.1 * m_Noise4.CubicNoise2D(16 * (float)a_BlockX / a_CellSize, 16 * (float)a_BlockZ / a_CellSize); - - a_DistortedX = a_BlockX + (int)(a_CellSize * 0.5 * NoiseX); - a_DistortedZ = a_BlockZ + (int)(a_CellSize * 0.5 * NoiseZ); -} - - - - - -void cBioGenMultiStepMap::BuildTemperatureHumidityMaps(int a_ChunkX, int a_ChunkZ, IntMap & a_TemperatureMap, IntMap & a_HumidityMap) -{ - // Linear interpolation over 8x8 blocks; use double for better precision: - DblMap TemperatureMap; - DblMap HumidityMap; - for (int z = 0; z < 17; z += 8) - { - float NoiseCoordZ = (float)(a_ChunkZ * cChunkDef::Width + z) / m_LandBiomesSize; - for (int x = 0; x < 17; x += 8) - { - float NoiseCoordX = (float)(a_ChunkX * cChunkDef::Width + x) / m_LandBiomesSize; - - double NoiseT = m_Noise1.CubicNoise2D( NoiseCoordX, NoiseCoordZ); - NoiseT += 0.5 * m_Noise2.CubicNoise2D(2 * NoiseCoordX, 2 * NoiseCoordZ); - NoiseT += 0.1 * m_Noise3.CubicNoise2D(8 * NoiseCoordX, 8 * NoiseCoordZ); - TemperatureMap[x + 17 * z] = NoiseT; - - double NoiseH = m_Noise4.CubicNoise2D( NoiseCoordX, NoiseCoordZ); - NoiseH += 0.5 * m_Noise5.CubicNoise2D(2 * NoiseCoordX, 2 * NoiseCoordZ); - NoiseH += 0.1 * m_Noise6.CubicNoise2D(8 * NoiseCoordX, 8 * NoiseCoordZ); - HumidityMap[x + 17 * z] = NoiseH; - } // for x - } // for z - LinearUpscale2DArrayInPlace(TemperatureMap, 17, 17, 8, 8); - LinearUpscale2DArrayInPlace(HumidityMap, 17, 17, 8, 8); - - // Re-map into integral values in [0 .. 255] range: - for (int idx = 0; idx < ARRAYCOUNT(a_TemperatureMap); idx++) - { - a_TemperatureMap[idx] = std::max(0, std::min(255, (int)(128 + TemperatureMap[idx] * 128))); - a_HumidityMap[idx] = std::max(0, std::min(255, (int)(128 + HumidityMap[idx] * 128))); - } -} - - - - - -void cBioGenMultiStepMap::DecideLandBiomes(cChunkDef::BiomeMap & a_BiomeMap, const IntMap & a_TemperatureMap, const IntMap & a_HumidityMap) -{ - static const EMCSBiome BiomeMap[] = - { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - /* 0 */ biTundra, biTundra, biTundra, biTundra, biPlains, biPlains, biPlains, biPlains, biPlains, biPlains, biDesert, biDesert, biDesert, biDesert, biDesert, biDesert, - /* 1 */ biTundra, biTundra, biTundra, biTundra, biPlains, biPlains, biPlains, biPlains, biPlains, biPlains, biDesert, biDesert, biDesert, biDesert, biDesert, biDesert, - /* 2 */ biTundra, biTundra, biTundra, biTundra, biPlains, biExtremeHills, biPlains, biPlains, biPlains, biPlains, biDesert, biDesert, biDesertHills, biDesertHills, biDesert, biDesert, - /* 3 */ biTundra, biTundra, biTundra, biTundra, biExtremeHills, biExtremeHills, biPlains, biPlains, biPlains, biPlains, biDesert, biDesert, biDesertHills, biDesertHills, biDesert, biDesert, - /* 4 */ biTundra, biTundra, biIceMountains, biIceMountains, biExtremeHills, biExtremeHills, biPlains, biPlains, biPlains, biPlains, biForestHills, biForestHills, biExtremeHills, biExtremeHills, biDesertHills, biDesert, - /* 5 */ biTundra, biTundra, biIceMountains, biIceMountains, biExtremeHills, biExtremeHills, biPlains, biPlains, biPlains, biPlains, biForestHills, biForestHills, biExtremeHills, biExtremeHills, biDesertHills, biDesert, - /* 6 */ biTundra, biTundra, biIceMountains, biIceMountains, biForestHills, biForestHills, biForest, biForest, biForest, biForest, biForest, biForestHills, biExtremeHills, biExtremeHills, biPlains, biPlains, - /* 7 */ biTundra, biTundra, biIceMountains, biIceMountains, biForestHills, biForestHills, biForest, biForest, biForest, biForest, biForest, biForestHills, biExtremeHills, biExtremeHills, biPlains, biPlains, - /* 8 */ biTundra, biTundra, biTaiga, biTaiga, biForest, biForest, biForest, biForest, biForest, biForest, biForest, biForestHills, biExtremeHills, biExtremeHills, biPlains, biPlains, - /* 9 */ biTundra, biTundra, biTaiga, biTaiga, biForest, biForest, biForest, biForest, biForest, biForest, biForest, biForestHills, biExtremeHills, biExtremeHills, biPlains, biPlains, - /* 10 */ biTaiga, biTaiga, biTaiga, biIceMountains, biForestHills, biForestHills, biForest, biForest, biForest, biForest, biJungle, biJungle, biSwampland, biSwampland, biSwampland, biSwampland, - /* 11 */ biTaiga, biTaiga, biIceMountains, biIceMountains, biExtremeHills, biForestHills, biForest, biForest, biForest, biForest, biJungle, biJungle, biSwampland, biSwampland, biSwampland, biSwampland, - /* 12 */ biTaiga, biTaiga, biIceMountains, biIceMountains, biExtremeHills, biJungleHills, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biSwampland, biSwampland, biSwampland, biSwampland, - /* 13 */ biTaiga, biTaiga, biTaiga, biIceMountains, biJungleHills, biJungleHills, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biSwampland, biSwampland, biSwampland, biSwampland, - /* 14 */ biTaiga, biTaiga, biTaiga, biTaiga, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biSwampland, biSwampland, biSwampland, biSwampland, - /* 15 */ biTaiga, biTaiga, biTaiga, biTaiga, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biSwampland, biSwampland, biSwampland, biSwampland, - } ; - for (int z = 0; z < cChunkDef::Width; z++) - { - int idxZ = 17 * z; - for (int x = 0; x < cChunkDef::Width; x++) - { - if (cChunkDef::GetBiome(a_BiomeMap, x, z) != -1) - { - // Already set before - continue; - } - int idx = idxZ + x; - int Temperature = a_TemperatureMap[idx] / 16; // -> [0..15] range - int Humidity = a_HumidityMap[idx] / 16; // -> [0..15] range - cChunkDef::SetBiome(a_BiomeMap, x, z, BiomeMap[Temperature + 16 * Humidity]); - } // for x - } // for z -} - - - - - -void cBioGenMultiStepMap::FreezeWaterBiomes(cChunkDef::BiomeMap & a_BiomeMap, const IntMap & a_TemperatureMap) -{ - int idx = 0; - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++, idx++) - { - if (a_TemperatureMap[idx] > 4 * 16) - { - // Not frozen - continue; - } - switch (cChunkDef::GetBiome(a_BiomeMap, x, z)) - { - case biRiver: cChunkDef::SetBiome(a_BiomeMap, x, z, biFrozenRiver); break; - case biOcean: cChunkDef::SetBiome(a_BiomeMap, x, z, biFrozenOcean); break; - } - } // for x - idx += 1; - } // for z -} - - - - diff --git a/source/Generating/ChunkGenerator.cpp b/source/Generating/ChunkGenerator.cpp deleted file mode 100644 index 33c956eba..000000000 --- a/source/Generating/ChunkGenerator.cpp +++ /dev/null @@ -1,329 +0,0 @@ - -#include "Globals.h" - -#include "ChunkGenerator.h" -#include "../World.h" -#include "../../iniFile/iniFile.h" -#include "../Root.h" -#include "../PluginManager.h" -#include "ChunkDesc.h" -#include "ComposableGenerator.h" -#include "Noise3DGenerator.h" - - - - - -/// If the generation queue size exceeds this number, a warning will be output -const unsigned int QUEUE_WARNING_LIMIT = 1000; - -/// If the generation queue size exceeds this number, chunks with no clients will be skipped -const unsigned int QUEUE_SKIP_LIMIT = 500; - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cChunkGenerator: - -cChunkGenerator::cChunkGenerator(void) : - super("cChunkGenerator"), - m_World(NULL), - m_Generator(NULL) -{ -} - - - - - -cChunkGenerator::~cChunkGenerator() -{ - Stop(); -} - - - - - -bool cChunkGenerator::Start(cWorld * a_World, cIniFile & a_IniFile) -{ - MTRand rnd; - m_World = a_World; - m_Seed = a_IniFile.GetValueSetI("Seed", "Seed", rnd.randInt()); - AString GeneratorName = a_IniFile.GetValueSet("Generator", "Generator", "Composable"); - - if (NoCaseCompare(GeneratorName, "Noise3D") == 0) - { - m_Generator = new cNoise3DGenerator(*this); - } - else - { - if (NoCaseCompare(GeneratorName, "composable") != 0) - { - LOGWARN("[Generator]::Generator value \"%s\" not recognized, using \"Composable\".", GeneratorName.c_str()); - } - m_Generator = new cComposableGenerator(*this); - } - - if (m_Generator == NULL) - { - LOGERROR("Generator could not start, aborting the server"); - return false; - } - - m_Generator->Initialize(a_World, a_IniFile); - - return super::Start(); -} - - - - - -void cChunkGenerator::Stop(void) -{ - m_ShouldTerminate = true; - m_Event.Set(); - m_evtRemoved.Set(); // Wake up anybody waiting for empty queue - Wait(); - - delete m_Generator; - m_Generator = NULL; -} - - - - - -void cChunkGenerator::QueueGenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) -{ - { - cCSLock Lock(m_CS); - - // Check if it is already in the queue: - for (cChunkCoordsList::iterator itr = m_Queue.begin(); itr != m_Queue.end(); ++itr) - { - if ((itr->m_ChunkX == a_ChunkX) && (itr->m_ChunkY == a_ChunkY) && (itr->m_ChunkZ == a_ChunkZ)) - { - // Already in the queue, bail out - return; - } - } // for itr - m_Queue[] - - // Add to queue, issue a warning if too many: - if (m_Queue.size() >= QUEUE_WARNING_LIMIT) - { - LOGWARN("WARNING: Adding chunk [%i, %i] to generation queue; Queue is too big! (%i)", a_ChunkX, a_ChunkZ, m_Queue.size()); - } - m_Queue.push_back(cChunkCoords(a_ChunkX, a_ChunkY, a_ChunkZ)); - } - - m_Event.Set(); -} - - - - - -void cChunkGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) -{ - if (m_Generator != NULL) - { - m_Generator->GenerateBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap); - } -} - - - - - -void cChunkGenerator::WaitForQueueEmpty(void) -{ - cCSLock Lock(m_CS); - while (!m_ShouldTerminate && !m_Queue.empty()) - { - cCSUnlock Unlock(Lock); - m_evtRemoved.Wait(); - } -} - - - - - -int cChunkGenerator::GetQueueLength(void) -{ - cCSLock Lock(m_CS); - return (int)m_Queue.size(); -} - - - - - -EMCSBiome cChunkGenerator::GetBiomeAt(int a_BlockX, int a_BlockZ) -{ - ASSERT(m_Generator != NULL); - return m_Generator->GetBiomeAt(a_BlockX, a_BlockZ); -} - - - - - -BLOCKTYPE cChunkGenerator::GetIniBlock(cIniFile & a_IniFile, const AString & a_SectionName, const AString & a_ValueName, const AString & a_Default) -{ - AString BlockType = a_IniFile.GetValueSet(a_SectionName, a_ValueName, a_Default); - BLOCKTYPE Block = BlockStringToType(BlockType); - if (Block < 0) - { - LOGWARN("[&s].%s Could not parse block value \"%s\". Using default: \"%s\".", a_SectionName.c_str(), a_ValueName.c_str(), BlockType.c_str(),a_Default.c_str()); - return BlockStringToType(a_Default); - } - return Block; -} - - - - - -void cChunkGenerator::Execute(void) -{ - // To be able to display performance information, the generator counts the chunks generated. - // When the queue gets empty, the count is reset, so that waiting for the queue is not counted into the total time. - int NumChunksGenerated = 0; // Number of chunks generated since the queue was last empty - clock_t GenerationStart = clock(); // Clock tick when the queue started to fill - clock_t LastReportTick = clock(); // Clock tick of the last report made (so that performance isn't reported too often) - - while (!m_ShouldTerminate) - { - cCSLock Lock(m_CS); - while (m_Queue.size() == 0) - { - if ((NumChunksGenerated > 16) && (clock() - LastReportTick > CLOCKS_PER_SEC)) - { - LOG("Chunk generator performance: %.2f ch/s (%d ch total)", - (double)NumChunksGenerated * CLOCKS_PER_SEC/ (clock() - GenerationStart), - NumChunksGenerated - ); - } - cCSUnlock Unlock(Lock); - m_Event.Wait(); - if (m_ShouldTerminate) - { - return; - } - NumChunksGenerated = 0; - GenerationStart = clock(); - LastReportTick = clock(); - } - - cChunkCoords coords = m_Queue.front(); // Get next coord from queue - m_Queue.erase( m_Queue.begin() ); // Remove coordinate from queue - bool SkipEnabled = (m_Queue.size() > QUEUE_SKIP_LIMIT); - Lock.Unlock(); // Unlock ASAP - m_evtRemoved.Set(); - - // Display perf info once in a while: - if ((NumChunksGenerated > 16) && (clock() - LastReportTick > 2 * CLOCKS_PER_SEC)) - { - LOG("Chunk generator performance: %.2f ch/s (%d ch total)", - (double)NumChunksGenerated * CLOCKS_PER_SEC / (clock() - GenerationStart), - NumChunksGenerated - ); - LastReportTick = clock(); - } - - // Hack for regenerating chunks: if Y != 0, the chunk is considered invalid, even if it has its data set - if ((coords.m_ChunkY == 0) && m_World->IsChunkValid(coords.m_ChunkX, coords.m_ChunkZ)) - { - LOGD("Chunk [%d, %d] already generated, skipping generation", coords.m_ChunkX, coords.m_ChunkZ); - // Already generated, ignore request - continue; - } - - if (SkipEnabled && !m_World->HasChunkAnyClients(coords.m_ChunkX, coords.m_ChunkZ)) - { - LOGWARNING("Chunk generator overloaded, skipping chunk [%d, %d]", coords.m_ChunkX, coords.m_ChunkZ); - continue; - } - - LOGD("Generating chunk [%d, %d, %d]", coords.m_ChunkX, coords.m_ChunkY, coords.m_ChunkZ); - DoGenerate(coords.m_ChunkX, coords.m_ChunkY, coords.m_ChunkZ); - - // Save the chunk right after generating, so that we don't have to generate it again on next run - m_World->GetStorage().QueueSaveChunk(coords.m_ChunkX, coords.m_ChunkY, coords.m_ChunkZ); - - NumChunksGenerated++; - } // while (!bStop) -} - - - - -void cChunkGenerator::DoGenerate(int a_ChunkX, int a_ChunkY, int a_ChunkZ) -{ - cChunkDesc ChunkDesc(a_ChunkX, a_ChunkZ); - cRoot::Get()->GetPluginManager()->CallHookChunkGenerating(m_World, a_ChunkX, a_ChunkZ, &ChunkDesc); - m_Generator->DoGenerate(a_ChunkX, a_ChunkZ, ChunkDesc); - cRoot::Get()->GetPluginManager()->CallHookChunkGenerated(m_World, a_ChunkX, a_ChunkZ, &ChunkDesc); - - #ifdef _DEBUG - // Verify that the generator has produced valid data: - ChunkDesc.VerifyHeightmap(); - #endif - - cChunkDef::BlockNibbles BlockMetas; - ChunkDesc.CompressBlockMetas(BlockMetas); - - m_World->SetChunkData( - a_ChunkX, a_ChunkZ, - ChunkDesc.GetBlockTypes(), BlockMetas, - NULL, NULL, // We don't have lighting, chunk will be lighted when needed - &ChunkDesc.GetHeightMap(), &ChunkDesc.GetBiomeMap(), - ChunkDesc.GetEntities(), ChunkDesc.GetBlockEntities(), - true - ); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cChunkGenerator::cGenerator: - -cChunkGenerator::cGenerator::cGenerator(cChunkGenerator & a_ChunkGenerator) : - m_ChunkGenerator(a_ChunkGenerator) -{ -} - - - - - -void cChunkGenerator::cGenerator::Initialize(cWorld * a_World, cIniFile & a_IniFile) -{ - m_World = a_World; - UNUSED(a_IniFile); -} - - - - - -EMCSBiome cChunkGenerator::cGenerator::GetBiomeAt(int a_BlockX, int a_BlockZ) -{ - cChunkDef::BiomeMap Biomes; - int Y = 0; - int ChunkX, ChunkZ; - cWorld::AbsoluteToRelative(a_BlockX, Y, a_BlockZ, ChunkX, Y, ChunkZ); - GenerateBiomes(ChunkX, ChunkZ, Biomes); - return cChunkDef::GetBiome(Biomes, a_BlockX, a_BlockZ); -} - - - - diff --git a/source/Generating/CompoGen.cpp b/source/Generating/CompoGen.cpp deleted file mode 100644 index cc2a203af..000000000 --- a/source/Generating/CompoGen.cpp +++ /dev/null @@ -1,634 +0,0 @@ - -// CompoGen.cpp - -/* Implements the various terrain composition generators: - - cCompoGenSameBlock - - cCompoGenDebugBiomes - - cCompoGenClassic -*/ - -#include "Globals.h" -#include "CompoGen.h" -#include "../BlockID.h" -#include "../Item.h" -#include "../LinearUpscale.h" -#include "../../iniFile/iniFile.h" - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cCompoGenSameBlock: - -void cCompoGenSameBlock::ComposeTerrain(cChunkDesc & a_ChunkDesc) -{ - a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - int Start; - if (m_IsBedrocked) - { - a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); - Start = 1; - } - else - { - Start = 0; - } - for (int y = a_ChunkDesc.GetHeight(x, z); y >= Start; y--) - { - a_ChunkDesc.SetBlockType(x, y, z, m_BlockType); - } // for y - } // for z - } // for x -} - - - - - -void cCompoGenSameBlock::InitializeCompoGen(cIniFile & a_IniFile) -{ - m_BlockType = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "SameBlockType", "stone").m_ItemType); - m_IsBedrocked = (a_IniFile.GetValueSetI("Generator", "SameBlockBedrocked", 1) != 0); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cCompoGenDebugBiomes: - -void cCompoGenDebugBiomes::ComposeTerrain(cChunkDesc & a_ChunkDesc) -{ - static BLOCKTYPE Blocks[] = - { - E_BLOCK_STONE, - E_BLOCK_COBBLESTONE, - E_BLOCK_LOG, - E_BLOCK_PLANKS, - E_BLOCK_SANDSTONE, - E_BLOCK_WOOL, - E_BLOCK_COAL_ORE, - E_BLOCK_IRON_ORE, - E_BLOCK_GOLD_ORE, - E_BLOCK_DIAMOND_ORE, - E_BLOCK_LAPIS_ORE, - E_BLOCK_REDSTONE_ORE, - E_BLOCK_IRON_BLOCK, - E_BLOCK_GOLD_BLOCK, - E_BLOCK_DIAMOND_BLOCK, - E_BLOCK_LAPIS_BLOCK, - E_BLOCK_BRICK, - E_BLOCK_MOSSY_COBBLESTONE, - E_BLOCK_OBSIDIAN, - E_BLOCK_NETHERRACK, - E_BLOCK_SOULSAND, - E_BLOCK_NETHER_BRICK, - E_BLOCK_BEDROCK, - } ; - - a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); - - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - BLOCKTYPE BlockType = Blocks[a_ChunkDesc.GetBiome(x, z)]; - for (int y = a_ChunkDesc.GetHeight(x, z); y >= 0; y--) - { - a_ChunkDesc.SetBlockType(x, y, z, BlockType); - } // for y - } // for z - } // for x -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cCompoGenClassic: - -cCompoGenClassic::cCompoGenClassic(void) : - m_SeaLevel(60), - m_BeachHeight(2), - m_BeachDepth(4), - m_BlockTop(E_BLOCK_GRASS), - m_BlockMiddle(E_BLOCK_DIRT), - m_BlockBottom(E_BLOCK_STONE), - m_BlockBeach(E_BLOCK_SAND), - m_BlockBeachBottom(E_BLOCK_SANDSTONE), - m_BlockSea(E_BLOCK_STATIONARY_WATER) -{ -} - - - - - -void cCompoGenClassic::ComposeTerrain(cChunkDesc & a_ChunkDesc) -{ - /* The classic composition means: - - 1 layer of grass, 3 of dirt and the rest stone, if the height > sealevel + beachheight - - 3 sand and a 1 sandstone, rest stone if between sealevel and sealevel + beachheight - - water from waterlevel to height, then 3 sand, 1 sandstone, the rest stone, if water depth < beachdepth - - water from waterlevel, then 3 dirt, the rest stone otherwise - - bedrock at the bottom - */ - - a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); - - // The patterns to use for different situations, must be same length! - const BLOCKTYPE PatternGround[] = {m_BlockTop, m_BlockMiddle, m_BlockMiddle, m_BlockMiddle} ; - const BLOCKTYPE PatternBeach[] = {m_BlockBeach, m_BlockBeach, m_BlockBeach, m_BlockBeachBottom} ; - const BLOCKTYPE PatternOcean[] = {m_BlockMiddle, m_BlockMiddle, m_BlockMiddle, m_BlockBottom} ; - static int PatternLength = ARRAYCOUNT(PatternGround); - ASSERT(ARRAYCOUNT(PatternGround) == ARRAYCOUNT(PatternBeach)); - ASSERT(ARRAYCOUNT(PatternGround) == ARRAYCOUNT(PatternOcean)); - - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - int Height = a_ChunkDesc.GetHeight(x, z); - const BLOCKTYPE * Pattern; - if (Height > m_SeaLevel + m_BeachHeight) - { - Pattern = PatternGround; - } - else if (Height > m_SeaLevel - m_BeachDepth) - { - Pattern = PatternBeach; - } - else - { - Pattern = PatternOcean; - } - - // Fill water from sealevel down to height (if any): - for (int y = m_SeaLevel; y >= Height; --y) - { - a_ChunkDesc.SetBlockType(x, y, z, m_BlockSea); - } - - // Fill from height till the bottom: - for (int y = Height; y >= 1; y--) - { - a_ChunkDesc.SetBlockType(x, y, z, (Height - y < PatternLength) ? Pattern[Height - y] : m_BlockBottom); - } - - // The last layer is always bedrock: - a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); - } // for x - } // for z -} - - - - - -void cCompoGenClassic::InitializeCompoGen(cIniFile & a_IniFile) -{ - m_SeaLevel = a_IniFile.GetValueSetI("Generator", "ClassicSeaLevel", m_SeaLevel); - m_BeachHeight = a_IniFile.GetValueSetI("Generator", "ClassicBeachHeight", m_BeachHeight); - m_BeachDepth = a_IniFile.GetValueSetI("Generator", "ClassicBeachDepth", m_BeachDepth); - m_BlockTop = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "ClassicBlockTop", "grass").m_ItemType); - m_BlockMiddle = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "ClassicBlockMiddle", "dirt").m_ItemType); - m_BlockBottom = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "ClassicBlockBottom", "stone").m_ItemType); - m_BlockBeach = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "ClassicBlockBeach", "sand").m_ItemType); - m_BlockBeachBottom = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "ClassicBlockBeachBottom", "sandstone").m_ItemType); - m_BlockSea = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "ClassicBlockSea", "stationarywater").m_ItemType); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cCompoGenBiomal: - -void cCompoGenBiomal::ComposeTerrain(cChunkDesc & a_ChunkDesc) -{ - a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); - - int ChunkX = a_ChunkDesc.GetChunkX(); - int ChunkZ = a_ChunkDesc.GetChunkZ(); - - /* - _X 2013_04_22: - There's no point in generating the whole cubic noise at once, because the noise values are used in - only about 20 % of the cases, so the speed gained by precalculating is lost by precalculating too much data - */ - - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - int Height = a_ChunkDesc.GetHeight(x, z); - if (Height > m_SeaLevel) - { - switch (a_ChunkDesc.GetBiome(x, z)) - { - case biOcean: - case biPlains: - case biExtremeHills: - case biForest: - case biTaiga: - case biSwampland: - case biRiver: - case biFrozenOcean: - case biFrozenRiver: - case biIcePlains: - case biIceMountains: - case biForestHills: - case biTaigaHills: - case biExtremeHillsEdge: - case biJungle: - case biJungleHills: - { - FillColumnGrass(x, z, Height, a_ChunkDesc.GetBlockTypes()); - break; - } - case biDesertHills: - case biDesert: - case biBeach: - { - FillColumnSand(x, z, Height, a_ChunkDesc.GetBlockTypes()); - break; - } - case biMushroomIsland: - case biMushroomShore: - { - FillColumnMycelium(x, z, Height, a_ChunkDesc.GetBlockTypes()); - break; - } - default: - { - // TODO - ASSERT(!"CompoGenBiomal: Biome not implemented yet!"); - break; - } - } - } - else - { - switch (a_ChunkDesc.GetBiome(x, z)) - { - case biDesert: - case biBeach: - { - // Fill with water, sand, sandstone and stone - FillColumnWaterSand(x, z, Height, a_ChunkDesc.GetBlockTypes()); - break; - } - default: - { - // Fill with water, sand/dirt/clay mix and stone - if (m_Noise.CubicNoise2D(0.3f * (cChunkDef::Width * ChunkX + x), 0.3f * (cChunkDef::Width * ChunkZ + z)) < 0) - { - FillColumnWaterSand(x, z, Height, a_ChunkDesc.GetBlockTypes()); - } - else - { - FillColumnWaterDirt(x, z, Height, a_ChunkDesc.GetBlockTypes()); - } - break; - } - } // switch (biome) - a_ChunkDesc.SetHeight(x, z, m_SeaLevel + 1); - } // else (under water) - a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); - } // for x - } // for z -} - - - - - -void cCompoGenBiomal::InitializeCompoGen(cIniFile & a_IniFile) -{ - m_SeaLevel = a_IniFile.GetValueSetI("Generator", "BiomalSeaLevel", m_SeaLevel) - 1; -} - - - - - -void cCompoGenBiomal::FillColumnGrass(int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes) -{ - BLOCKTYPE Pattern[] = - { - E_BLOCK_GRASS, - E_BLOCK_DIRT, - E_BLOCK_DIRT, - E_BLOCK_DIRT, - } ; - FillColumnPattern(a_RelX, a_RelZ, a_Height, a_BlockTypes, Pattern, ARRAYCOUNT(Pattern)); - - for (int y = a_Height - ARRAYCOUNT(Pattern); y > 0; y--) - { - cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, E_BLOCK_STONE); - } -} - - - - - -void cCompoGenBiomal::FillColumnSand(int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes) -{ - BLOCKTYPE Pattern[] = - { - E_BLOCK_SAND, - E_BLOCK_SAND, - E_BLOCK_SAND, - E_BLOCK_SANDSTONE, - } ; - FillColumnPattern(a_RelX, a_RelZ, a_Height, a_BlockTypes, Pattern, ARRAYCOUNT(Pattern)); - - for (int y = a_Height - ARRAYCOUNT(Pattern); y > 0; y--) - { - cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, E_BLOCK_STONE); - } -} - - - - - - -void cCompoGenBiomal::FillColumnMycelium (int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes) -{ - BLOCKTYPE Pattern[] = - { - E_BLOCK_MYCELIUM, - E_BLOCK_DIRT, - E_BLOCK_DIRT, - E_BLOCK_DIRT, - } ; - FillColumnPattern(a_RelX, a_RelZ, a_Height, a_BlockTypes, Pattern, ARRAYCOUNT(Pattern)); - - for (int y = a_Height - ARRAYCOUNT(Pattern); y > 0; y--) - { - cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, E_BLOCK_STONE); - } -} - - - - - -void cCompoGenBiomal::FillColumnWaterSand(int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes) -{ - FillColumnSand(a_RelX, a_RelZ, a_Height, a_BlockTypes); - for (int y = a_Height + 1; y <= m_SeaLevel + 1; y++) - { - cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, E_BLOCK_STATIONARY_WATER); - } -} - - - - - -void cCompoGenBiomal::FillColumnWaterDirt(int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes) -{ - // Dirt - BLOCKTYPE Pattern[] = - { - E_BLOCK_DIRT, - E_BLOCK_DIRT, - E_BLOCK_DIRT, - E_BLOCK_DIRT, - } ; - FillColumnPattern(a_RelX, a_RelZ, a_Height, a_BlockTypes, Pattern, ARRAYCOUNT(Pattern)); - - for (int y = a_Height - ARRAYCOUNT(Pattern); y > 0; y--) - { - cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, E_BLOCK_STONE); - } - for (int y = a_Height + 1; y <= m_SeaLevel + 1; y++) - { - cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, E_BLOCK_STATIONARY_WATER); - } -} - - - - - - -void cCompoGenBiomal::FillColumnPattern(int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes, const BLOCKTYPE * a_Pattern, int a_PatternSize) -{ - for (int y = a_Height, idx = 0; (y >= 0) && (idx < a_PatternSize); y--, idx++) - { - cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, a_Pattern[idx]); - } -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cCompoGenNether: - -cCompoGenNether::cCompoGenNether(int a_Seed) : - m_Noise1(a_Seed + 10), - m_Noise2(a_Seed * a_Seed * 10 + a_Seed * 1000 + 6000), - m_Threshold(0) -{ -} - - - - - -void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc) -{ - HEIGHTTYPE MaxHeight = a_ChunkDesc.GetMaxHeight(); - - const int SEGMENT_HEIGHT = 8; - const int INTERPOL_X = 16; // Must be a divisor of 16 - const int INTERPOL_Z = 16; // Must be a divisor of 16 - // Interpolate the chunk in 16 * SEGMENT_HEIGHT * 16 "segments", each SEGMENT_HEIGHT blocks high and each linearly interpolated separately. - // Have two buffers, one for the lowest floor and one for the highest floor, so that Y-interpolation can be done between them - // Then swap the buffers and use the previously-top one as the current-bottom, without recalculating it. - - int FloorBuf1[17 * 17]; - int FloorBuf2[17 * 17]; - int * FloorHi = FloorBuf1; - int * FloorLo = FloorBuf2; - int BaseX = a_ChunkDesc.GetChunkX() * cChunkDef::Width; - int BaseZ = a_ChunkDesc.GetChunkZ() * cChunkDef::Width; - - // Interpolate the lowest floor: - for (int z = 0; z <= 16 / INTERPOL_Z; z++) for (int x = 0; x <= 16 / INTERPOL_X; x++) - { - FloorLo[INTERPOL_X * x + 17 * INTERPOL_Z * z] = - m_Noise1.IntNoise3DInt(BaseX + INTERPOL_X * x, 0, BaseZ + INTERPOL_Z * z) * - m_Noise2.IntNoise3DInt(BaseX + INTERPOL_X * x, 0, BaseZ + INTERPOL_Z * z) / - 256; - } // for x, z - FloorLo[] - LinearUpscale2DArrayInPlace(FloorLo, 17, 17, INTERPOL_X, INTERPOL_Z); - - // Interpolate segments: - for (int Segment = 0; Segment < MaxHeight; Segment += SEGMENT_HEIGHT) - { - // First update the high floor: - for (int z = 0; z <= 16 / INTERPOL_Z; z++) for (int x = 0; x <= 16 / INTERPOL_X; x++) - { - FloorHi[INTERPOL_X * x + 17 * INTERPOL_Z * z] = - m_Noise1.IntNoise3DInt(BaseX + INTERPOL_X * x, Segment + SEGMENT_HEIGHT, BaseZ + INTERPOL_Z * z) * - m_Noise2.IntNoise3DInt(BaseX + INTERPOL_Z * x, Segment + SEGMENT_HEIGHT, BaseZ + INTERPOL_Z * z) / - 256; - } // for x, z - FloorLo[] - LinearUpscale2DArrayInPlace(FloorHi, 17, 17, INTERPOL_X, INTERPOL_Z); - - // Interpolate between FloorLo and FloorHi: - for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++) - { - int Lo = FloorLo[x + 17 * z] / 256; - int Hi = FloorHi[x + 17 * z] / 256; - for (int y = 0; y < SEGMENT_HEIGHT; y++) - { - int Val = Lo + (Hi - Lo) * y / SEGMENT_HEIGHT; - a_ChunkDesc.SetBlockType(x, y + Segment, z, (Val < m_Threshold) ? E_BLOCK_NETHERRACK : E_BLOCK_AIR); - } - } - - // Swap the floors: - std::swap(FloorLo, FloorHi); - } - - // Bedrock at the bottom and at the top: - for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++) - { - a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); - a_ChunkDesc.SetBlockType(x, a_ChunkDesc.GetHeight(x, z), z, E_BLOCK_BEDROCK); - } -} - - - - - -void cCompoGenNether::InitializeCompoGen(cIniFile & a_IniFile) -{ - m_Threshold = a_IniFile.GetValueSetI("Generator", "NetherThreshold", m_Threshold); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cCompoGenCache: - -cCompoGenCache::cCompoGenCache(cTerrainCompositionGen & a_Underlying, int a_CacheSize) : - m_Underlying(a_Underlying), - m_CacheSize(a_CacheSize), - m_CacheOrder(new int[a_CacheSize]), - m_CacheData(new sCacheData[a_CacheSize]), - m_NumHits(0), - m_NumMisses(0), - m_TotalChain(0) -{ - for (int i = 0; i < m_CacheSize; i++) - { - m_CacheOrder[i] = i; - m_CacheData[i].m_ChunkX = 0x7fffffff; - m_CacheData[i].m_ChunkZ = 0x7fffffff; - } -} - - - - - -cCompoGenCache::~cCompoGenCache() -{ - delete[] m_CacheData; - delete[] m_CacheOrder; -} - - - - - -void cCompoGenCache::ComposeTerrain(cChunkDesc & a_ChunkDesc) -{ - #ifdef _DEBUG - if (((m_NumHits + m_NumMisses) % 1024) == 10) - { - LOGD("CompoGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses)); - LOGD("CompoGenCache: Avg cache chain length: %.2f", (float)m_TotalChain / m_NumHits); - } - #endif // _DEBUG - - int ChunkX = a_ChunkDesc.GetChunkX(); - int ChunkZ = a_ChunkDesc.GetChunkZ(); - - for (int i = 0; i < m_CacheSize; i++) - { - if ( - (m_CacheData[m_CacheOrder[i]].m_ChunkX != ChunkX) || - (m_CacheData[m_CacheOrder[i]].m_ChunkZ != ChunkZ) - ) - { - continue; - } - // Found it in the cache - int Idx = m_CacheOrder[i]; - - // Move to front: - for (int j = i; j > 0; j--) - { - m_CacheOrder[j] = m_CacheOrder[j - 1]; - } - m_CacheOrder[0] = Idx; - - // Use the cached data: - memcpy(a_ChunkDesc.GetBlockTypes(), m_CacheData[Idx].m_BlockTypes, sizeof(a_ChunkDesc.GetBlockTypes())); - memcpy(a_ChunkDesc.GetBlockMetasUncompressed(), m_CacheData[Idx].m_BlockMetas, sizeof(a_ChunkDesc.GetBlockMetasUncompressed())); - - m_NumHits++; - m_TotalChain += i; - return; - } // for i - cache - - // Not in the cache: - m_NumMisses++; - m_Underlying.ComposeTerrain(a_ChunkDesc); - - // Insert it as the first item in the MRU order: - int Idx = m_CacheOrder[m_CacheSize - 1]; - for (int i = m_CacheSize - 1; i > 0; i--) - { - m_CacheOrder[i] = m_CacheOrder[i - 1]; - } // for i - m_CacheOrder[] - m_CacheOrder[0] = Idx; - memcpy(m_CacheData[Idx].m_BlockTypes, a_ChunkDesc.GetBlockTypes(), sizeof(a_ChunkDesc.GetBlockTypes())); - memcpy(m_CacheData[Idx].m_BlockMetas, a_ChunkDesc.GetBlockMetasUncompressed(), sizeof(a_ChunkDesc.GetBlockMetasUncompressed())); - m_CacheData[Idx].m_ChunkX = ChunkX; - m_CacheData[Idx].m_ChunkZ = ChunkZ; -} - - - - - -void cCompoGenCache::InitializeCompoGen(cIniFile & a_IniFile) -{ - m_Underlying.InitializeCompoGen(a_IniFile); -} - - - - diff --git a/source/Generating/ComposableGenerator.cpp b/source/Generating/ComposableGenerator.cpp deleted file mode 100644 index 2637b64e7..000000000 --- a/source/Generating/ComposableGenerator.cpp +++ /dev/null @@ -1,501 +0,0 @@ - -// ComposableGenerator.cpp - -// Implements the cComposableGenerator class representing the chunk generator that takes the composition approach to generating chunks - -#include "Globals.h" - -#include "ComposableGenerator.h" -#include "../World.h" -#include "../../iniFile/iniFile.h" -#include "../Root.h" - -// Individual composed algorithms: -#include "BioGen.h" -#include "HeiGen.h" -#include "CompoGen.h" -#include "StructGen.h" -#include "FinishGen.h" - -#include "Caves.h" -#include "DistortedHeightmap.h" -#include "EndGen.h" -#include "MineShafts.h" -#include "Noise3DGenerator.h" -#include "Ravines.h" - - - - - - - - - - -cComposableGenerator::cComposableGenerator(cChunkGenerator & a_ChunkGenerator) : - super(a_ChunkGenerator), - m_BiomeGen(NULL), - m_HeightGen(NULL), - m_CompositionGen(NULL), - m_UnderlyingBiomeGen(NULL), - m_UnderlyingHeightGen(NULL), - m_UnderlyingCompositionGen(NULL) -{ -} - - - - - -cComposableGenerator::~cComposableGenerator() -{ - // Delete the generating composition: - for (cFinishGenList::const_iterator itr = m_FinishGens.begin(); itr != m_FinishGens.end(); ++itr) - { - delete *itr; - } - m_FinishGens.clear(); - for (cStructureGenList::const_iterator itr = m_StructureGens.begin(); itr != m_StructureGens.end(); ++itr) - { - delete *itr; - } - m_StructureGens.clear(); - - delete m_CompositionGen; - m_CompositionGen = NULL; - delete m_HeightGen; - m_HeightGen = NULL; - delete m_BiomeGen; - m_BiomeGen = NULL; - delete m_UnderlyingCompositionGen; - m_UnderlyingCompositionGen = NULL; - delete m_UnderlyingHeightGen; - m_UnderlyingHeightGen = NULL; - delete m_UnderlyingBiomeGen; - m_UnderlyingBiomeGen = NULL; -} - - - - - -void cComposableGenerator::Initialize(cWorld * a_World, cIniFile & a_IniFile) -{ - super::Initialize(a_World, a_IniFile); - - InitBiomeGen(a_IniFile); - InitHeightGen(a_IniFile); - InitCompositionGen(a_IniFile); - InitStructureGens(a_IniFile); - InitFinishGens(a_IniFile); -} - - - - - -void cComposableGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) -{ - if (m_BiomeGen != NULL) // Quick fix for generator deinitializing before the world storage finishes loading - { - m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap); - } -} - - - - - -void cComposableGenerator::DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc) -{ - if (a_ChunkDesc.IsUsingDefaultBiomes()) - { - m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, a_ChunkDesc.GetBiomeMap()); - } - - if (a_ChunkDesc.IsUsingDefaultHeight()) - { - m_HeightGen->GenHeightMap(a_ChunkX, a_ChunkZ, a_ChunkDesc.GetHeightMap()); - } - - if (a_ChunkDesc.IsUsingDefaultComposition()) - { - m_CompositionGen->ComposeTerrain(a_ChunkDesc); - } - - if (a_ChunkDesc.IsUsingDefaultStructures()) - { - for (cStructureGenList::iterator itr = m_StructureGens.begin(); itr != m_StructureGens.end(); ++itr) - { - (*itr)->GenStructures(a_ChunkDesc); - } // for itr - m_StructureGens[] - } - - if (a_ChunkDesc.IsUsingDefaultFinish()) - { - for (cFinishGenList::iterator itr = m_FinishGens.begin(); itr != m_FinishGens.end(); ++itr) - { - (*itr)->GenFinish(a_ChunkDesc); - } // for itr - m_FinishGens[] - } -} - - - - - -void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile) -{ - AString BiomeGenName = a_IniFile.GetValueSet("Generator", "BiomeGen", ""); - if (BiomeGenName.empty()) - { - LOGWARN("[Generator] BiomeGen value not set in world.ini, using \"MultiStepMap\"."); - BiomeGenName = "MultiStepMap"; - } - - int Seed = m_ChunkGenerator.GetSeed(); - bool CacheOffByDefault = false; - if (NoCaseCompare(BiomeGenName, "constant") == 0) - { - m_BiomeGen = new cBioGenConstant; - CacheOffByDefault = true; // we're generating faster than a cache would retrieve data :) - } - else if (NoCaseCompare(BiomeGenName, "checkerboard") == 0) - { - m_BiomeGen = new cBioGenCheckerboard; - CacheOffByDefault = true; // we're (probably) generating faster than a cache would retrieve data - } - else if (NoCaseCompare(BiomeGenName, "voronoi") == 0) - { - m_BiomeGen = new cBioGenVoronoi(Seed); - } - else if (NoCaseCompare(BiomeGenName, "distortedvoronoi") == 0) - { - m_BiomeGen = new cBioGenDistortedVoronoi(Seed); - } - else - { - if (NoCaseCompare(BiomeGenName, "multistepmap") != 0) - { - LOGWARNING("Unknown BiomeGen \"%s\", using \"MultiStepMap\" instead.", BiomeGenName.c_str()); - } - m_BiomeGen = new cBioGenMultiStepMap(Seed); - - /* - // Performance-testing: - LOGINFO("Measuring performance of cBioGenMultiStepMap..."); - clock_t BeginTick = clock(); - for (int x = 0; x < 5000; x++) - { - cChunkDef::BiomeMap Biomes; - m_BiomeGen->GenBiomes(x * 5, x * 5, Biomes); - } - clock_t Duration = clock() - BeginTick; - LOGINFO("cBioGenMultiStepMap for 5000 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC); - //*/ - } - - // Add a cache, if requested: - int CacheSize = a_IniFile.GetValueSetI("Generator", "BiomeGenCacheSize", CacheOffByDefault ? 0 : 64); - if (CacheSize > 0) - { - if (CacheSize < 4) - { - LOGWARNING("Biomegen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d", - CacheSize, 4 - ); - CacheSize = 4; - } - LOGD("Using a cache for biomegen of size %d.", CacheSize); - m_UnderlyingBiomeGen = m_BiomeGen; - m_BiomeGen = new cBioGenCache(m_UnderlyingBiomeGen, CacheSize); - } - m_BiomeGen->InitializeBiomeGen(a_IniFile); -} - - - - - -void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile) -{ - AString HeightGenName = a_IniFile.GetValueSet("Generator", "HeightGen", ""); - if (HeightGenName.empty()) - { - LOGWARN("[Generator] HeightGen value not set in world.ini, using \"Biomal\"."); - HeightGenName = "Biomal"; - } - - int Seed = m_ChunkGenerator.GetSeed(); - bool CacheOffByDefault = false; - if (NoCaseCompare(HeightGenName, "flat") == 0) - { - m_HeightGen = new cHeiGenFlat; - CacheOffByDefault = true; // We're generating faster than a cache would retrieve data - } - else if (NoCaseCompare(HeightGenName, "classic") == 0) - { - m_HeightGen = new cHeiGenClassic(Seed); - } - else if (NoCaseCompare(HeightGenName, "DistortedHeightmap") == 0) - { - m_HeightGen = new cDistortedHeightmap(Seed, *m_BiomeGen); - } - else if (NoCaseCompare(HeightGenName, "End") == 0) - { - m_HeightGen = new cEndGen(Seed); - } - else if (NoCaseCompare(HeightGenName, "Noise3D") == 0) - { - m_HeightGen = new cNoise3DComposable(Seed); - } - else // "biomal" or <not found> - { - if (NoCaseCompare(HeightGenName, "biomal") != 0) - { - LOGWARN("Unknown HeightGen \"%s\", using \"Biomal\" instead.", HeightGenName.c_str()); - } - m_HeightGen = new cHeiGenBiomal(Seed, *m_BiomeGen); - - /* - // Performance-testing: - LOGINFO("Measuring performance of cHeiGenBiomal..."); - clock_t BeginTick = clock(); - for (int x = 0; x < 500; x++) - { - cChunkDef::HeightMap Heights; - m_HeightGen->GenHeightMap(x * 5, x * 5, Heights); - } - clock_t Duration = clock() - BeginTick; - LOGINFO("HeightGen for 500 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC); - //*/ - } - - // Read the settings: - m_HeightGen->InitializeHeightGen(a_IniFile); - - // Add a cache, if requested: - int CacheSize = a_IniFile.GetValueSetI("Generator", "HeightGenCacheSize", CacheOffByDefault ? 0 : 64); - if (CacheSize > 0) - { - if (CacheSize < 4) - { - LOGWARNING("Heightgen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d", - CacheSize, 4 - ); - CacheSize = 4; - } - LOGD("Using a cache for Heightgen of size %d.", CacheSize); - m_UnderlyingHeightGen = m_HeightGen; - m_HeightGen = new cHeiGenCache(*m_UnderlyingHeightGen, CacheSize); - } -} - - - - - -void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile) -{ - int Seed = m_ChunkGenerator.GetSeed(); - AString CompoGenName = a_IniFile.GetValueSet("Generator", "CompositionGen", ""); - if (CompoGenName.empty()) - { - LOGWARN("[Generator] CompositionGen value not set in world.ini, using \"Biomal\"."); - CompoGenName = "Biomal"; - } - if (NoCaseCompare(CompoGenName, "sameblock") == 0) - { - m_CompositionGen = new cCompoGenSameBlock; - } - else if (NoCaseCompare(CompoGenName, "debugbiomes") == 0) - { - m_CompositionGen = new cCompoGenDebugBiomes; - } - else if (NoCaseCompare(CompoGenName, "classic") == 0) - { - m_CompositionGen = new cCompoGenClassic; - } - else if (NoCaseCompare(CompoGenName, "DistortedHeightmap") == 0) - { - m_CompositionGen = new cDistortedHeightmap(Seed, *m_BiomeGen); - } - else if (NoCaseCompare(CompoGenName, "end") == 0) - { - m_CompositionGen = new cEndGen(Seed); - } - else if (NoCaseCompare(CompoGenName, "nether") == 0) - { - m_CompositionGen = new cCompoGenNether(Seed); - } - else if (NoCaseCompare(CompoGenName, "Noise3D") == 0) - { - m_CompositionGen = new cNoise3DComposable(m_ChunkGenerator.GetSeed()); - } - else - { - if (NoCaseCompare(CompoGenName, "biomal") != 0) - { - LOGWARN("Unknown CompositionGen \"%s\", using \"biomal\" instead.", CompoGenName.c_str()); - } - m_CompositionGen = new cCompoGenBiomal(Seed); - - /* - // Performance-testing: - LOGINFO("Measuring performance of cCompoGenBiomal..."); - clock_t BeginTick = clock(); - for (int x = 0; x < 500; x++) - { - cChunkDesc Desc(200 + x * 8, 200 + x * 8); - m_BiomeGen->GenBiomes(Desc.GetChunkX(), Desc.GetChunkZ(), Desc.GetBiomeMap()); - m_HeightGen->GenHeightMap(Desc.GetChunkX(), Desc.GetChunkZ(), Desc.GetHeightMap()); - m_CompositionGen->ComposeTerrain(Desc); - } - clock_t Duration = clock() - BeginTick; - LOGINFO("CompositionGen for 500 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC); - //*/ - } - - // Read the settings from the ini file: - m_CompositionGen->InitializeCompoGen(a_IniFile); - - int CompoGenCacheSize = a_IniFile.GetValueSetI("Generator", "CompositionGenCacheSize", 64); - if (CompoGenCacheSize > 1) - { - m_UnderlyingCompositionGen = m_CompositionGen; - m_CompositionGen = new cCompoGenCache(*m_UnderlyingCompositionGen, 32); - } -} - - - - - -void cComposableGenerator::InitStructureGens(cIniFile & a_IniFile) -{ - AString Structures = a_IniFile.GetValueSet("Generator", "Structures", "Ravines, WormNestCaves, WaterLakes, LavaLakes, OreNests, Trees"); - - int Seed = m_ChunkGenerator.GetSeed(); - AStringVector Str = StringSplitAndTrim(Structures, ","); - for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr) - { - if (NoCaseCompare(*itr, "DualRidgeCaves") == 0) - { - float Threshold = (float)a_IniFile.GetValueSetF("Generator", "DualRidgeCavesThreshold", 0.3); - m_StructureGens.push_back(new cStructGenDualRidgeCaves(Seed, Threshold)); - } - else if (NoCaseCompare(*itr, "DirectOverhangs") == 0) - { - m_StructureGens.push_back(new cStructGenDirectOverhangs(Seed)); - } - else if (NoCaseCompare(*itr, "DistortedMembraneOverhangs") == 0) - { - m_StructureGens.push_back(new cStructGenDistortedMembraneOverhangs(Seed)); - } - else if (NoCaseCompare(*itr, "LavaLakes") == 0) - { - int Probability = a_IniFile.GetValueSetI("Generator", "LavaLakesProbability", 10); - m_StructureGens.push_back(new cStructGenLakes(Seed * 5 + 16873, E_BLOCK_STATIONARY_LAVA, *m_HeightGen, Probability)); - } - else if (NoCaseCompare(*itr, "MarbleCaves") == 0) - { - m_StructureGens.push_back(new cStructGenMarbleCaves(Seed)); - } - else if (NoCaseCompare(*itr, "MineShafts") == 0) - { - int GridSize = a_IniFile.GetValueSetI("Generator", "MineShaftsGridSize", 512); - int MaxSystemSize = a_IniFile.GetValueSetI("Generator", "MineShaftsMaxSystemSize", 160); - int ChanceCorridor = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCorridor", 600); - int ChanceCrossing = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCrossing", 200); - int ChanceStaircase = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceStaircase", 200); - m_StructureGens.push_back(new cStructGenMineShafts( - Seed, GridSize, MaxSystemSize, - ChanceCorridor, ChanceCrossing, ChanceStaircase - )); - } - else if (NoCaseCompare(*itr, "OreNests") == 0) - { - m_StructureGens.push_back(new cStructGenOreNests(Seed)); - } - else if (NoCaseCompare(*itr, "Ravines") == 0) - { - m_StructureGens.push_back(new cStructGenRavines(Seed, 128)); - } - else if (NoCaseCompare(*itr, "Trees") == 0) - { - m_StructureGens.push_back(new cStructGenTrees(Seed, m_BiomeGen, m_HeightGen, m_CompositionGen)); - } - else if (NoCaseCompare(*itr, "WaterLakes") == 0) - { - int Probability = a_IniFile.GetValueSetI("Generator", "WaterLakesProbability", 25); - m_StructureGens.push_back(new cStructGenLakes(Seed * 3 + 652, E_BLOCK_STATIONARY_WATER, *m_HeightGen, Probability)); - } - else if (NoCaseCompare(*itr, "WormNestCaves") == 0) - { - m_StructureGens.push_back(new cStructGenWormNestCaves(Seed)); - } - else - { - LOGWARNING("Unknown structure generator: \"%s\". Ignoring.", itr->c_str()); - } - } // for itr - Str[] -} - - - - - -void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile) -{ - int Seed = m_ChunkGenerator.GetSeed(); - AString Structures = a_IniFile.GetValueSet("Generator", "Finishers", "SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator"); - - AStringVector Str = StringSplitAndTrim(Structures, ","); - for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr) - { - // Finishers, alpha-sorted: - if (NoCaseCompare(*itr, "BottomLava") == 0) - { - int DefaultBottomLavaLevel = (m_World->GetDimension() == dimNether) ? 30 : 10; - int BottomLavaLevel = a_IniFile.GetValueSetI("Generator", "BottomLavaLevel", DefaultBottomLavaLevel); - m_FinishGens.push_back(new cFinishGenBottomLava(BottomLavaLevel)); - } - else if (NoCaseCompare(*itr, "DeadBushes") == 0) - { - m_FinishGens.push_back(new cFinishGenSingleBiomeSingleTopBlock(Seed, E_BLOCK_DEAD_BUSH, biDesert, 2, E_BLOCK_SAND, E_BLOCK_SAND)); - } - else if (NoCaseCompare(*itr, "Ice") == 0) - { - m_FinishGens.push_back(new cFinishGenIce); - } - else if (NoCaseCompare(*itr, "LavaSprings") == 0) - { - m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_LAVA, a_IniFile, *m_World)); - } - else if (NoCaseCompare(*itr, "Lilypads") == 0) - { - m_FinishGens.push_back(new cFinishGenSingleBiomeSingleTopBlock(Seed, E_BLOCK_LILY_PAD, biSwampland, 4, E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER)); - } - else if (NoCaseCompare(*itr, "PreSimulator") == 0) - { - m_FinishGens.push_back(new cFinishGenPreSimulator); - } - else if (NoCaseCompare(*itr, "Snow") == 0) - { - m_FinishGens.push_back(new cFinishGenSnow); - } - else if (NoCaseCompare(*itr, "SprinkleFoliage") == 0) - { - m_FinishGens.push_back(new cFinishGenSprinkleFoliage(Seed)); - } - else if (NoCaseCompare(*itr, "WaterSprings") == 0) - { - m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_WATER, a_IniFile, *m_World)); - } - } // for itr - Str[] -} - - - - diff --git a/source/Generating/DistortedHeightmap.cpp b/source/Generating/DistortedHeightmap.cpp deleted file mode 100644 index 7e46c251e..000000000 --- a/source/Generating/DistortedHeightmap.cpp +++ /dev/null @@ -1,444 +0,0 @@ - -// DistortedHeightmap.cpp - -// Implements the cDistortedHeightmap class representing the height and composition generator capable of overhangs - -#include "Globals.h" - -#include "DistortedHeightmap.h" -#include "../OSSupport/File.h" -#include "../../iniFile/iniFile.h" -#include "../LinearUpscale.h" - - - - - -/** This table assigns a relative maximum overhang size in each direction to biomes. -Both numbers indicate a number which will multiply the noise value for each coord; -this means that you can have different-sized overhangs in each direction. -Usually you'd want to keep both numbers the same. -The numbers are "relative", not absolute maximum; overhangs of a slightly larger size are possible -due to the way that noise is calculated. -*/ -const cDistortedHeightmap::sGenParam cDistortedHeightmap::m_GenParam[biNumBiomes] = -{ - /* Biome | AmpX | AmpZ */ - /* biOcean */ { 1.5f, 1.5f}, - /* biPlains */ { 0.5f, 0.5f}, - /* biDesert */ { 0.5f, 0.5f}, - /* biExtremeHills */ {16.0f, 16.0f}, - /* biForest */ { 3.0f, 3.0f}, - /* biTaiga */ { 1.5f, 1.5f}, - - /* biSwampland */ { 0.0f, 0.0f}, - /* biRiver */ { 0.0f, 0.0f}, - /* biNether */ { 0.0f, 0.0f}, // Unused, but must be here due to indexing - /* biSky */ { 0.0f, 0.0f}, // Unused, but must be here due to indexing - /* biFrozenOcean */ { 0.0f, 0.0f}, - /* biFrozenRiver */ { 0.0f, 0.0f}, - /* biIcePlains */ { 0.0f, 0.0f}, - /* biIceMountains */ { 8.0f, 8.0f}, - /* biMushroomIsland */ { 4.0f, 4.0f}, - /* biMushroomShore */ { 0.0f, 0.0f}, - /* biBeach */ { 0.0f, 0.0f}, - /* biDesertHills */ { 5.0f, 5.0f}, - /* biForestHills */ { 6.0f, 6.0f}, - /* biTaigaHills */ { 8.0f, 8.0f}, - /* biExtremeHillsEdge */ { 7.0f, 7.0f}, - /* biJungle */ { 0.0f, 0.0f}, - /* biJungleHills */ { 8.0f, 8.0f}, -} ; - - - - - -cDistortedHeightmap::cDistortedHeightmap(int a_Seed, cBiomeGen & a_BiomeGen) : - m_NoiseDistortX(a_Seed + 1000), - m_NoiseDistortZ(a_Seed + 2000), - m_OceanFloorSelect(a_Seed + 3000), - m_BiomeGen(a_BiomeGen), - m_UnderlyingHeiGen(a_Seed, a_BiomeGen), - m_HeightGen(m_UnderlyingHeiGen, 64) -{ - m_NoiseDistortX.AddOctave((NOISE_DATATYPE)1, (NOISE_DATATYPE)0.5); - m_NoiseDistortX.AddOctave((NOISE_DATATYPE)0.5, (NOISE_DATATYPE)1); - m_NoiseDistortX.AddOctave((NOISE_DATATYPE)0.25, (NOISE_DATATYPE)2); - - m_NoiseDistortZ.AddOctave((NOISE_DATATYPE)1, (NOISE_DATATYPE)0.5); - m_NoiseDistortZ.AddOctave((NOISE_DATATYPE)0.5, (NOISE_DATATYPE)1); - m_NoiseDistortZ.AddOctave((NOISE_DATATYPE)0.25, (NOISE_DATATYPE)2); -} - - - - - -void cDistortedHeightmap::Initialize(cIniFile & a_IniFile) -{ - if (m_IsInitialized) - { - return; - } - - // Read the params from the INI file: - m_SeaLevel = a_IniFile.GetValueSetI("Generator", "DistortedHeightmapSeaLevel", 62); - m_FrequencyX = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyX", 10); - m_FrequencyY = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyY", 10); - m_FrequencyZ = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyZ", 10); - - m_IsInitialized = true; -} - - - - - -void cDistortedHeightmap::PrepareState(int a_ChunkX, int a_ChunkZ) -{ - if ((m_CurChunkX == a_ChunkX) && (m_CurChunkZ == a_ChunkZ)) - { - return; - } - m_CurChunkX = a_ChunkX; - m_CurChunkZ = a_ChunkZ; - - - m_HeightGen.GenHeightMap(a_ChunkX, a_ChunkZ, m_CurChunkHeights); - UpdateDistortAmps(); - GenerateHeightArray(); -} - - - - - -void cDistortedHeightmap::GenerateHeightArray(void) -{ - // Generate distortion noise: - NOISE_DATATYPE DistortNoiseX[DIM_X * DIM_Y * DIM_Z]; - NOISE_DATATYPE DistortNoiseZ[DIM_X * DIM_Y * DIM_Z]; - NOISE_DATATYPE Workspace[DIM_X * DIM_Y * DIM_Z]; - NOISE_DATATYPE StartX = ((NOISE_DATATYPE)(m_CurChunkX * cChunkDef::Width)) / m_FrequencyX; - NOISE_DATATYPE EndX = ((NOISE_DATATYPE)((m_CurChunkX + 1) * cChunkDef::Width - 1)) / m_FrequencyX; - NOISE_DATATYPE StartY = 0; - NOISE_DATATYPE EndY = ((NOISE_DATATYPE)(257)) / m_FrequencyY; - NOISE_DATATYPE StartZ = ((NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width)) / m_FrequencyZ; - NOISE_DATATYPE EndZ = ((NOISE_DATATYPE)((m_CurChunkZ + 1) * cChunkDef::Width - 1)) / m_FrequencyZ; - - m_NoiseDistortX.Generate3D(DistortNoiseX, DIM_X, DIM_Y, DIM_Z, StartX, EndX, StartY, EndY, StartZ, EndZ, Workspace); - m_NoiseDistortZ.Generate3D(DistortNoiseZ, DIM_X, DIM_Y, DIM_Z, StartX, EndX, StartY, EndY, StartZ, EndZ, Workspace); - - // The distorted heightmap, before linear upscaling - NOISE_DATATYPE DistHei[DIM_X * DIM_Y * DIM_Z]; - - // Distort the heightmap using the distortion: - for (int z = 0; z < DIM_Z; z++) - { - int AmpIdx = z * DIM_X; - for (int y = 0; y < DIM_Y; y++) - { - int NoiseArrayIdx = z * DIM_X * DIM_Y + y * DIM_X; - for (int x = 0; x < DIM_X; x++) - { - NOISE_DATATYPE DistX = DistortNoiseX[NoiseArrayIdx + x] * m_DistortAmpX[AmpIdx + x]; - NOISE_DATATYPE DistZ = DistortNoiseZ[NoiseArrayIdx + x] * m_DistortAmpZ[AmpIdx + x]; - DistX += (NOISE_DATATYPE)(m_CurChunkX * cChunkDef::Width + x * INTERPOL_X); - DistZ += (NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width + z * INTERPOL_Z); - // Adding 0.5 helps alleviate the interpolation artifacts - DistHei[NoiseArrayIdx + x] = (NOISE_DATATYPE)GetHeightmapAt(DistX, DistZ) + (NOISE_DATATYPE)0.5; - } - } - } - - // Upscale the distorted heightmap into full dimensions: - LinearUpscale3DArray( - DistHei, DIM_X, DIM_Y, DIM_Z, - m_DistortedHeightmap, INTERPOL_X, INTERPOL_Y, INTERPOL_Z - ); - - // DEBUG: Debug3DNoise(m_DistortedHeightmap, 17, 257, 17, Printf("DistortedHeightmap_%d_%d", m_CurChunkX, m_CurChunkZ)); -} - - - - - -void cDistortedHeightmap::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) -{ - PrepareState(a_ChunkX, a_ChunkZ); - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - int NoiseArrayIdx = x + 17 * 257 * z; - cChunkDef::SetHeight(a_HeightMap, x, z, m_SeaLevel - 1); - for (int y = cChunkDef::Height - 1; y > m_SeaLevel - 1; y--) - { - int HeightMapHeight = (int)m_DistortedHeightmap[NoiseArrayIdx + 17 * y]; - if (y < HeightMapHeight) - { - cChunkDef::SetHeight(a_HeightMap, x, z, y); - break; - } - } // for y - } // for x - } // for z -} - - - - - -void cDistortedHeightmap::InitializeHeightGen(cIniFile & a_IniFile) -{ - Initialize(a_IniFile); -} - - - - - -void cDistortedHeightmap::ComposeTerrain(cChunkDesc & a_ChunkDesc) -{ - // Frequencies for the ocean floor selecting noise: - NOISE_DATATYPE FrequencyX = 3; - NOISE_DATATYPE FrequencyZ = 3; - - // Prepare the internal state for generating this chunk: - PrepareState(a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ()); - - // Compose: - a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - int NoiseArrayIdx = x + 17 * 257 * z; - int LastAir = a_ChunkDesc.GetHeight(x, z) + 1; - bool HasHadWater = false; - for (int y = LastAir - 1; y > 0; y--) - { - int HeightMapHeight = (int)m_DistortedHeightmap[NoiseArrayIdx + 17 * y]; - - if (y >= HeightMapHeight) - { - // "air" part - LastAir = y; - if (y < m_SeaLevel) - { - a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_STATIONARY_WATER); - HasHadWater = true; - } - continue; - } - // "ground" part: - if (y < LastAir - 4) - { - a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_STONE); - continue; - } - if (HasHadWater) - { - // Decide between clay, sand and dirt - NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(m_CurChunkX * cChunkDef::Width + x)) / FrequencyX; - NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width + z)) / FrequencyZ; - NOISE_DATATYPE Val = m_OceanFloorSelect.CubicNoise2D(NoiseX, NoiseY); - if (Val < -0.95) - { - // Clay: - switch (LastAir - y) - { - case 0: - case 1: - { - a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_CLAY); - break; - } - case 2: - case 3: - { - a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SAND); - break; - } - case 4: - { - a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SANDSTONE); - break; - } - } // switch (floor depth) - } - else if (Val < 0) - { - a_ChunkDesc.SetBlockType(x, y, z, (y < LastAir - 3) ? E_BLOCK_SANDSTONE : E_BLOCK_SAND); - } - else - { - a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_DIRT); - } - } - else - { - switch (a_ChunkDesc.GetBiome(x, z)) - { - case biOcean: - case biPlains: - case biExtremeHills: - case biForest: - case biTaiga: - case biSwampland: - case biRiver: - case biFrozenOcean: - case biFrozenRiver: - case biIcePlains: - case biIceMountains: - case biForestHills: - case biTaigaHills: - case biExtremeHillsEdge: - case biJungle: - case biJungleHills: - { - a_ChunkDesc.SetBlockType(x, y, z, (y == LastAir - 1) ? E_BLOCK_GRASS : E_BLOCK_DIRT); - break; - } - case biDesertHills: - case biDesert: - case biBeach: - { - a_ChunkDesc.SetBlockType(x, y, z, (y < LastAir - 3) ? E_BLOCK_SANDSTONE : E_BLOCK_SAND); - break; - } - case biMushroomIsland: - case biMushroomShore: - { - a_ChunkDesc.SetBlockType(x, y, z, (y == LastAir - 1) ? E_BLOCK_MYCELIUM : E_BLOCK_DIRT); - break; - } - } - } - } // for y - a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); - } // for x - } // for z -} - - - - - -void cDistortedHeightmap::InitializeCompoGen(cIniFile & a_IniFile) -{ - Initialize(a_IniFile); -} - - - - - -int cDistortedHeightmap::GetHeightmapAt(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Z) -{ - int ChunkX = (int)floor(a_X / (NOISE_DATATYPE)16); - int ChunkZ = (int)floor(a_Z / (NOISE_DATATYPE)16); - int RelX = (int)(a_X - (NOISE_DATATYPE)ChunkX * cChunkDef::Width); - int RelZ = (int)(a_Z - (NOISE_DATATYPE)ChunkZ * cChunkDef::Width); - - // If we're withing the same chunk, return the pre-cached heightmap: - if ((ChunkX == m_CurChunkX) && (ChunkZ == m_CurChunkZ)) - { - return cChunkDef::GetHeight(m_CurChunkHeights, RelX, RelZ); - } - - // Ask the cache: - HEIGHTTYPE res = 0; - if (m_HeightGen.GetHeightAt(ChunkX, ChunkZ, RelX, RelZ, res)) - { - // The height was in the cache - return res; - } - - // The height is not in the cache, generate full heightmap and get it there: - cChunkDef::HeightMap Heightmap; - m_HeightGen.GenHeightMap(ChunkX, ChunkZ, Heightmap); - return cChunkDef::GetHeight(Heightmap, RelX, RelZ); -} - - - - - -void cDistortedHeightmap::UpdateDistortAmps(void) -{ - BiomeNeighbors Biomes; - for (int z = -1; z <= 1; z++) - { - for (int x = -1; x <= 1; x++) - { - m_BiomeGen.GenBiomes(m_CurChunkX + x, m_CurChunkZ + z, Biomes[x + 1][z + 1]); - } // for x - } // for z - - for (int z = 0; z < DIM_Z; z++) - { - for (int x = 0; x < DIM_Z; x++) - { - GetDistortAmpsAt(Biomes, x * INTERPOL_X, z * INTERPOL_Z, m_DistortAmpX[x + DIM_X * z], m_DistortAmpZ[x + DIM_X * z]); - } - } -} - - - - - -void cDistortedHeightmap::GetDistortAmpsAt(BiomeNeighbors & a_Neighbors, int a_RelX, int a_RelZ, NOISE_DATATYPE & a_DistortAmpX, NOISE_DATATYPE & a_DistortAmpZ) -{ - // Sum up how many biomes of each type there are in the neighborhood: - int BiomeCounts[biNumBiomes]; - memset(BiomeCounts, 0, sizeof(BiomeCounts)); - int Sum = 0; - for (int z = -8; z <= 8; z++) - { - int FinalZ = a_RelZ + z + cChunkDef::Width; - int IdxZ = FinalZ / cChunkDef::Width; - int ModZ = FinalZ % cChunkDef::Width; - int WeightZ = 9 - abs(z); - for (int x = -8; x <= 8; x++) - { - int FinalX = a_RelX + x + cChunkDef::Width; - int IdxX = FinalX / cChunkDef::Width; - int ModX = FinalX % cChunkDef::Width; - EMCSBiome Biome = cChunkDef::GetBiome(a_Neighbors[IdxX][IdxZ], ModX, ModZ); - if ((Biome < 0) || (Biome >= ARRAYCOUNT(BiomeCounts))) - { - continue; - } - int WeightX = 9 - abs(x); - BiomeCounts[Biome] += WeightX + WeightZ; - Sum += WeightX + WeightZ; - } // for x - } // for z - - if (Sum <= 0) - { - // No known biome around? Weird. Return a bogus value: - ASSERT(!"cHeiGenBiomal: Biome sum failed, no known biome around"); - a_DistortAmpX = 16; - a_DistortAmpZ = 16; - } - - // For each biome type that has a nonzero count, calc its amps and add it: - NOISE_DATATYPE AmpX = 0; - NOISE_DATATYPE AmpZ = 0; - for (unsigned int i = 0; i < ARRAYCOUNT(BiomeCounts); i++) - { - AmpX += BiomeCounts[i] * m_GenParam[i].m_DistortAmpX; - AmpZ += BiomeCounts[i] * m_GenParam[i].m_DistortAmpZ; - } - a_DistortAmpX = AmpX / Sum; - a_DistortAmpZ = AmpZ / Sum; -} - - - - diff --git a/source/Generating/EndGen.cpp b/source/Generating/EndGen.cpp deleted file mode 100644 index 90a8071fa..000000000 --- a/source/Generating/EndGen.cpp +++ /dev/null @@ -1,217 +0,0 @@ - -// EndGen.cpp - -// Implements the cEndGen class representing the generator for the End, both as a HeightGen and CompositionGen - -#include "Globals.h" -#include "EndGen.h" -#include "../../iniFile/iniFile.h" -#include "../LinearUpscale.h" - - - - - -enum -{ - // Interpolation cell size: - INTERPOL_X = 4, - INTERPOL_Y = 4, - INTERPOL_Z = 4, - - // Size of chunk data, downscaled before interpolation: - DIM_X = 16 / INTERPOL_X + 1, - DIM_Y = 256 / INTERPOL_Y + 1, - DIM_Z = 16 / INTERPOL_Z + 1, -} ; - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cEndGen: - -cEndGen::cEndGen(int a_Seed) : - m_Seed(a_Seed), - m_IslandSizeX(256), - m_IslandSizeY(96), - m_IslandSizeZ(256), - m_FrequencyX(80), - m_FrequencyY(80), - m_FrequencyZ(80) -{ - m_Perlin.AddOctave(1, 1); - m_Perlin.AddOctave(2, 0.5); - m_Perlin.AddOctave(4, 0.25); -} - - - - - -void cEndGen::Initialize(cIniFile & a_IniFile) -{ - m_IslandSizeX = a_IniFile.GetValueSetI("Generator", "EndGenIslandSizeX", m_IslandSizeX); - m_IslandSizeY = a_IniFile.GetValueSetI("Generator", "EndGenIslandSizeY", m_IslandSizeY); - m_IslandSizeZ = a_IniFile.GetValueSetI("Generator", "EndGenIslandSizeZ", m_IslandSizeZ); - - m_FrequencyX = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "EndGenFrequencyX", m_FrequencyX); - m_FrequencyY = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "EndGenFrequencyY", m_FrequencyY); - m_FrequencyZ = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "EndGenFrequencyZ", m_FrequencyZ); - - // Recalculate the min and max chunk coords of the island - m_MaxChunkX = (m_IslandSizeX + cChunkDef::Width - 1) / cChunkDef::Width; - m_MinChunkX = -m_MaxChunkX; - m_MaxChunkZ = (m_IslandSizeZ + cChunkDef::Width - 1) / cChunkDef::Width; - m_MinChunkZ = -m_MaxChunkZ; -} - - - - - -/// Unless the LastChunk coords are equal to coords given, prepares the internal state (noise array) -void cEndGen::PrepareState(int a_ChunkX, int a_ChunkZ) -{ - ASSERT(!IsChunkOutsideRange(a_ChunkX, a_ChunkZ)); // Should be filtered before calling this function - - if ((m_LastChunkX == a_ChunkX) && (m_LastChunkZ == a_ChunkZ)) - { - return; - } - - m_LastChunkX = a_ChunkX; - m_LastChunkZ = a_ChunkZ; - - GenerateNoiseArray(); -} - - - - - -/// Generates the m_NoiseArray array for the current chunk -void cEndGen::GenerateNoiseArray(void) -{ - NOISE_DATATYPE NoiseData[DIM_X * DIM_Y * DIM_Z]; // [x + DIM_X * z + DIM_X * DIM_Z * y] - NOISE_DATATYPE Workspace[DIM_X * DIM_Y * DIM_Z]; // [x + DIM_X * z + DIM_X * DIM_Z * y] - - // Generate the downscaled noise: - NOISE_DATATYPE StartX = ((NOISE_DATATYPE)(m_LastChunkX * cChunkDef::Width)) / m_FrequencyX; - NOISE_DATATYPE EndX = ((NOISE_DATATYPE)((m_LastChunkX + 1) * cChunkDef::Width)) / m_FrequencyX; - NOISE_DATATYPE StartZ = ((NOISE_DATATYPE)(m_LastChunkZ * cChunkDef::Width)) / m_FrequencyZ; - NOISE_DATATYPE EndZ = ((NOISE_DATATYPE)((m_LastChunkZ + 1) * cChunkDef::Width)) / m_FrequencyZ; - NOISE_DATATYPE StartY = 0; - NOISE_DATATYPE EndY = ((NOISE_DATATYPE)257) / m_FrequencyY; - m_Perlin.Generate3D(NoiseData, DIM_X, DIM_Z, DIM_Y, StartX, EndX, StartZ, EndZ, StartY, EndY, Workspace); - - // Add distance: - int idx = 0; - for (int y = 0; y < DIM_Y; y++) - { - NOISE_DATATYPE ValY = (NOISE_DATATYPE)(2 * INTERPOL_Y * y - m_IslandSizeY) / m_IslandSizeY; - ValY = ValY * ValY; - for (int z = 0; z < DIM_Z; z++) - { - NOISE_DATATYPE ValZ = (NOISE_DATATYPE)(m_LastChunkZ * cChunkDef::Width + (z * cChunkDef::Width / (DIM_Z - 1))) / m_IslandSizeZ; - ValZ = ValZ * ValZ; - for (int x = 0; x < DIM_X; x++) - { - // NOISE_DATATYPE ValX = StartX + (EndX - StartX) * x / (DIM_X - 1); - NOISE_DATATYPE ValX = (NOISE_DATATYPE)(m_LastChunkX * cChunkDef::Width + (x * cChunkDef::Width / (DIM_X - 1))) / m_IslandSizeX; - ValX = ValX * ValX; - NoiseData[idx++] += ValX + ValZ + ValY; - } // for x - } // for z - } // for y - - // Upscale into real chunk size: - LinearUpscale3DArray(NoiseData, DIM_X, DIM_Z, DIM_Y, m_NoiseArray, INTERPOL_X, INTERPOL_Z, INTERPOL_Y); -} - - - - - -/// Returns true if the chunk is outside of the island's dimensions -bool cEndGen::IsChunkOutsideRange(int a_ChunkX, int a_ChunkZ) -{ - return ( - (a_ChunkX < m_MinChunkX) || (a_ChunkX > m_MaxChunkX) || - (a_ChunkZ < m_MinChunkZ) || (a_ChunkZ > m_MaxChunkZ) - ); -} - - - - - -void cEndGen::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) -{ - if (IsChunkOutsideRange(a_ChunkX, a_ChunkZ)) - { - for (unsigned int i = 0; i < ARRAYCOUNT(a_HeightMap); i++) - { - a_HeightMap[i] = 0; - } - return; - } - - PrepareState(a_ChunkX, a_ChunkZ); - - int MaxY = std::min((int)(1.75 * m_IslandSizeY + 1), cChunkDef::Height - 1); - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - cChunkDef::SetHeight(a_HeightMap, x, z, MaxY); - for (int y = MaxY; y > 0; y--) - { - if (m_NoiseArray[y * 17 * 17 + z * 17 + x] <= 0) - { - cChunkDef::SetHeight(a_HeightMap, x, z, y); - break; - } - } // for y - } // for x - } // for z -} - - - - - -void cEndGen::ComposeTerrain(cChunkDesc & a_ChunkDesc) -{ - if (IsChunkOutsideRange(a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ())) - { - a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); - return; - } - - PrepareState(a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ()); - - int MaxY = std::min((int)(1.75 * m_IslandSizeY + 1), cChunkDef::Height - 1); - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - for (int y = MaxY; y > 0; y--) - { - if (m_NoiseArray[y * 17 * 17 + z * 17 + x] <= 0) - { - a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_END_STONE, 0); - } - else - { - a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_AIR, 0); - } - } // for y - } // for x - } // for z -} - - - - diff --git a/source/Generating/HeiGen.cpp b/source/Generating/HeiGen.cpp deleted file mode 100644 index 5dee181b7..000000000 --- a/source/Generating/HeiGen.cpp +++ /dev/null @@ -1,390 +0,0 @@ - -// HeiGen.cpp - -// Implements the various terrain height generators - -#include "Globals.h" -#include "HeiGen.h" -#include "../LinearUpscale.h" -#include "../../iniFile/iniFile.h" - - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cHeiGenFlat: - -void cHeiGenFlat::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) -{ - for (int i = 0; i < ARRAYCOUNT(a_HeightMap); i++) - { - a_HeightMap[i] = m_Height; - } -} - - - - - -void cHeiGenFlat::InitializeHeightGen(cIniFile & a_IniFile) -{ - m_Height = a_IniFile.GetValueSetI("Generator", "FlatHeight", m_Height); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cHeiGenCache: - -cHeiGenCache::cHeiGenCache(cTerrainHeightGen & a_HeiGenToCache, int a_CacheSize) : - m_HeiGenToCache(a_HeiGenToCache), - m_CacheSize(a_CacheSize), - m_CacheOrder(new int[a_CacheSize]), - m_CacheData(new sCacheData[a_CacheSize]), - m_NumHits(0), - m_NumMisses(0), - m_TotalChain(0) -{ - for (int i = 0; i < m_CacheSize; i++) - { - m_CacheOrder[i] = i; - m_CacheData[i].m_ChunkX = 0x7fffffff; - m_CacheData[i].m_ChunkZ = 0x7fffffff; - } -} - - - - - -cHeiGenCache::~cHeiGenCache() -{ - delete[] m_CacheData; - delete[] m_CacheOrder; -} - - - - - -void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) -{ - /* - if (((m_NumHits + m_NumMisses) % 1024) == 10) - { - LOGD("HeiGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses)); - LOGD("HeiGenCache: Avg cache chain length: %.2f", (float)m_TotalChain / m_NumHits); - } - //*/ - - for (int i = 0; i < m_CacheSize; i++) - { - if ( - (m_CacheData[m_CacheOrder[i]].m_ChunkX != a_ChunkX) || - (m_CacheData[m_CacheOrder[i]].m_ChunkZ != a_ChunkZ) - ) - { - continue; - } - // Found it in the cache - int Idx = m_CacheOrder[i]; - - // Move to front: - for (int j = i; j > 0; j--) - { - m_CacheOrder[j] = m_CacheOrder[j - 1]; - } - m_CacheOrder[0] = Idx; - - // Use the cached data: - memcpy(a_HeightMap, m_CacheData[Idx].m_HeightMap, sizeof(a_HeightMap)); - - m_NumHits++; - m_TotalChain += i; - return; - } // for i - cache - - // Not in the cache: - m_NumMisses++; - m_HeiGenToCache.GenHeightMap(a_ChunkX, a_ChunkZ, a_HeightMap); - - // Insert it as the first item in the MRU order: - int Idx = m_CacheOrder[m_CacheSize - 1]; - for (int i = m_CacheSize - 1; i > 0; i--) - { - m_CacheOrder[i] = m_CacheOrder[i - 1]; - } // for i - m_CacheOrder[] - m_CacheOrder[0] = Idx; - memcpy(m_CacheData[Idx].m_HeightMap, a_HeightMap, sizeof(a_HeightMap)); - m_CacheData[Idx].m_ChunkX = a_ChunkX; - m_CacheData[Idx].m_ChunkZ = a_ChunkZ; -} - - - - - -void cHeiGenCache::InitializeHeightGen(cIniFile & a_IniFile) -{ - m_HeiGenToCache.InitializeHeightGen(a_IniFile); -} - - - - - -bool cHeiGenCache::GetHeightAt(int a_ChunkX, int a_ChunkZ, int a_RelX, int a_RelZ, HEIGHTTYPE & a_Height) -{ - for (int i = 0; i < m_CacheSize; i++) - { - if ((m_CacheData[i].m_ChunkX == a_ChunkX) && (m_CacheData[i].m_ChunkZ == a_ChunkZ)) - { - a_Height = cChunkDef::GetHeight(m_CacheData[i].m_HeightMap, a_RelX, a_RelZ); - return true; - } - } // for i - m_CacheData[] - return false; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cHeiGenClassic: - -cHeiGenClassic::cHeiGenClassic(int a_Seed) : - m_Seed(a_Seed), - m_Noise(a_Seed) -{ -} - - - - - -float cHeiGenClassic::GetNoise(float x, float y) -{ - float oct1 = m_Noise.CubicNoise2D(x * m_HeightFreq1, y * m_HeightFreq1) * m_HeightAmp1; - float oct2 = m_Noise.CubicNoise2D(x * m_HeightFreq2, y * m_HeightFreq2) * m_HeightAmp2; - float oct3 = m_Noise.CubicNoise2D(x * m_HeightFreq3, y * m_HeightFreq3) * m_HeightAmp3; - - float height = m_Noise.CubicNoise2D(x * 0.1f, y * 0.1f ) * 2; - - float flatness = ((m_Noise.CubicNoise2D(x * 0.5f, y * 0.5f) + 1.f) * 0.5f) * 1.1f; // 0 ... 1.5 - flatness *= flatness * flatness; - - return (oct1 + oct2 + oct3) * flatness + height; -} - - - - - -void cHeiGenClassic::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) -{ - for (int z = 0; z < cChunkDef::Width; z++) - { - const float zz = (float)(a_ChunkZ * cChunkDef::Width + z); - for (int x = 0; x < cChunkDef::Width; x++) - { - const float xx = (float)(a_ChunkX * cChunkDef::Width + x); - - int hei = 64 + (int)(GetNoise(xx * 0.05f, zz * 0.05f) * 16); - if (hei < 10) - { - hei = 10; - } - if (hei > 250) - { - hei = 250; - } - cChunkDef::SetHeight(a_HeightMap, x , z, hei); - } // for x - } // for z -} - - - - - -void cHeiGenClassic::InitializeHeightGen(cIniFile & a_IniFile) -{ - m_HeightFreq1 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightFreq1", 0.1); - m_HeightFreq2 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightFreq2", 1.0); - m_HeightFreq3 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightFreq3", 2.0); - m_HeightAmp1 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp1", 1.0); - m_HeightAmp2 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp2", 0.5); - m_HeightAmp3 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp3", 0.5); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cHeiGenBiomal: - -const cHeiGenBiomal::sGenParam cHeiGenBiomal::m_GenParam[biNumBiomes] = -{ - /* Fast-changing | Middle-changing | Slow-changing |*/ - /* Biome | Freq1 | Amp1 | Freq2 | Amp2 | Freq3 | Amp3 | BaseHeight */ - /* biOcean */ { 0.1f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 40}, - /* biPlains */ { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 68}, - /* biDesert */ { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 68}, - /* biExtremeHills */ { 0.2f, 4.0f, 0.05f, 20.0f, 0.01f, 16.0f, 100}, - /* biForest */ { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 70}, - /* biTaiga */ { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 70}, - /* biSwampland */ { 0.1f, 1.1f, 0.05f, 1.5f, 0.02f, 2.5f, 61.5}, - /* biRiver */ { 0.2f, 0.1f, 0.05f, 0.1f, 0.01f, 0.1f, 56}, - /* biNether */ { 0.1f, 0.0f, 0.01f, 0.0f, 0.01f, 0.0f, 0}, // Unused, but must be here due to indexing - /* biSky */ { 0.1f, 0.0f, 0.01f, 0.0f, 0.01f, 0.0f, 0}, // Unused, but must be here due to indexing - /* biFrozenOcean */ { 0.1f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 40}, - /* biFrozenRiver */ { 0.2f, 0.1f, 0.05f, 0.1f, 0.01f, 0.1f, 56}, - /* biIcePlains */ { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 68}, - /* biIceMountains */ { 0.2f, 2.0f, 0.05f, 10.0f, 0.01f, 8.0f, 80}, - /* biMushroomIsland */ { 0.1f, 2.0f, 0.05f, 8.0f, 0.01f, 6.0f, 80}, - /* biMushroomShore */ { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 64}, - /* biBeach */ { 0.1f, 0.5f, 0.05f, 1.0f, 0.01f, 1.0f, 64}, - /* biDesertHills */ { 0.2f, 2.0f, 0.05f, 5.0f, 0.01f, 4.0f, 75}, - /* biForestHills */ { 0.2f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 80}, - /* biTaigaHills */ { 0.2f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 80}, - /* biExtremeHillsEdge */ { 0.2f, 3.0f, 0.05f, 16.0f, 0.01f, 12.0f, 80}, - /* biJungle */ { 0.1f, 3.0f, 0.05f, 6.0f, 0.01f, 6.0f, 70}, - /* biJungleHills */ { 0.2f, 3.0f, 0.05f, 12.0f, 0.01f, 10.0f, 80}, -} ; - - - - - -void cHeiGenBiomal::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) -{ - // Generate a 3x3 chunk area of biomes around this chunk: - BiomeNeighbors Biomes; - for (int z = -1; z <= 1; z++) - { - for (int x = -1; x <= 1; x++) - { - m_BiomeGen.GenBiomes(a_ChunkX + x, a_ChunkZ + z, Biomes[x + 1][z + 1]); - } // for x - } // for z - - /* - _X 2013_04_22: - There's no point in precalculating the entire perlin noise arrays, too many values are calculated uselessly, - resulting in speed DEcrease. - */ - - //* - // Linearly interpolate 4x4 blocks of heightmap: - // Must be done on a floating point datatype, else the results are ugly! - const int STEPZ = 4; // Must be a divisor of 16 - const int STEPX = 4; // Must be a divisor of 16 - NOISE_DATATYPE Height[17 * 17]; - for (int z = 0; z < 17; z += STEPZ) - { - for (int x = 0; x < 17; x += STEPX) - { - Height[x + 17 * z] = GetHeightAt(x, z, a_ChunkX, a_ChunkZ, Biomes); - } - } - LinearUpscale2DArrayInPlace(Height, 17, 17, STEPX, STEPZ); - - // Copy into the heightmap - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - cChunkDef::SetHeight(a_HeightMap, x, z, (int)Height[x + 17 * z]); - } - } - //*/ - - /* - // For each height, go through neighboring biomes and add up their idea of height: - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - cChunkDef::SetHeight(a_HeightMap, x, z, GetHeightAt(x, z, a_ChunkX, a_ChunkZ, Biomes)); - } // for x - } - //*/ -} - - - - - -void cHeiGenBiomal::InitializeHeightGen(cIniFile & a_IniFile) -{ - // No user-settable params -} - - - - - -NOISE_DATATYPE cHeiGenBiomal::GetHeightAt(int a_RelX, int a_RelZ, int a_ChunkX, int a_ChunkZ, const cHeiGenBiomal::BiomeNeighbors & a_BiomeNeighbors) -{ - // Sum up how many biomes of each type there are in the neighborhood: - int BiomeCounts[biNumBiomes]; - memset(BiomeCounts, 0, sizeof(BiomeCounts)); - int Sum = 0; - for (int z = -8; z <= 8; z++) - { - int FinalZ = a_RelZ + z + cChunkDef::Width; - int IdxZ = FinalZ / cChunkDef::Width; - int ModZ = FinalZ % cChunkDef::Width; - int WeightZ = 9 - abs(z); - for (int x = -8; x <= 8; x++) - { - int FinalX = a_RelX + x + cChunkDef::Width; - int IdxX = FinalX / cChunkDef::Width; - int ModX = FinalX % cChunkDef::Width; - EMCSBiome Biome = cChunkDef::GetBiome(a_BiomeNeighbors[IdxX][IdxZ], ModX, ModZ); - if ((Biome < 0) || (Biome >= ARRAYCOUNT(BiomeCounts))) - { - continue; - } - int WeightX = 9 - abs(x); - BiomeCounts[Biome] += WeightX + WeightZ; - Sum += WeightX + WeightZ; - } // for x - } // for z - - // For each biome type that has a nonzero count, calc its height and add it: - if (Sum > 0) - { - NOISE_DATATYPE Height = 0; - int BlockX = a_ChunkX * cChunkDef::Width + a_RelX; - int BlockZ = a_ChunkZ * cChunkDef::Width + a_RelZ; - for (int i = 0; i < ARRAYCOUNT(BiomeCounts); i++) - { - if (BiomeCounts[i] == 0) - { - continue; - } - NOISE_DATATYPE oct1 = m_Noise.CubicNoise2D(BlockX * m_GenParam[i].m_HeightFreq1, BlockZ * m_GenParam[i].m_HeightFreq1) * m_GenParam[i].m_HeightAmp1; - NOISE_DATATYPE oct2 = m_Noise.CubicNoise2D(BlockX * m_GenParam[i].m_HeightFreq2, BlockZ * m_GenParam[i].m_HeightFreq2) * m_GenParam[i].m_HeightAmp2; - NOISE_DATATYPE oct3 = m_Noise.CubicNoise2D(BlockX * m_GenParam[i].m_HeightFreq3, BlockZ * m_GenParam[i].m_HeightFreq3) * m_GenParam[i].m_HeightAmp3; - Height += BiomeCounts[i] * (m_GenParam[i].m_BaseHeight + oct1 + oct2 + oct3); - } - NOISE_DATATYPE res = Height / Sum; - return std::min((NOISE_DATATYPE)250, std::max(res, (NOISE_DATATYPE)5)); - } - - // No known biome around? Weird. Return a bogus value: - ASSERT(!"cHeiGenBiomal: Biome sum failed, no known biome around"); - return 5; -} - - - - - diff --git a/source/Generating/Noise3DGenerator.cpp b/source/Generating/Noise3DGenerator.cpp deleted file mode 100644 index 03626a800..000000000 --- a/source/Generating/Noise3DGenerator.cpp +++ /dev/null @@ -1,576 +0,0 @@ - -// Nosie3DGenerator.cpp - -// Generates terrain using 3D noise, rather than composing. Is a test. - -#include "Globals.h" -#include "Noise3DGenerator.h" -#include "../OSSupport/File.h" -#include "../../iniFile/iniFile.h" -#include "../LinearInterpolation.h" -#include "../LinearUpscale.h" - - - - - -/* -// Perform an automatic test of upscaling upon program start (use breakpoints to debug): - -class Test -{ -public: - Test(void) - { - DoTest1(); - DoTest2(); - } - - - void DoTest1(void) - { - float In[3 * 3 * 3]; - for (int i = 0; i < ARRAYCOUNT(In); i++) - { - In[i] = (float)(i % 5); - } - Debug3DNoise(In, 3, 3, 3, "Upscale3D in"); - float Out[17 * 33 * 35]; - LinearUpscale3DArray(In, 3, 3, 3, Out, 8, 16, 17); - Debug3DNoise(Out, 17, 33, 35, "Upscale3D test"); - } - - - void DoTest2(void) - { - float In[3 * 3]; - for (int i = 0; i < ARRAYCOUNT(In); i++) - { - In[i] = (float)(i % 5); - } - Debug2DNoise(In, 3, 3, "Upscale2D in"); - float Out[17 * 33]; - LinearUpscale2DArray(In, 3, 3, Out, 8, 16); - Debug2DNoise(Out, 17, 33, "Upscale2D test"); - } - -} gTest; -//*/ - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cNoise3DGenerator: - -cNoise3DGenerator::cNoise3DGenerator(cChunkGenerator & a_ChunkGenerator) : - super(a_ChunkGenerator), - m_Perlin(1000), - m_Cubic(1000) -{ - m_Perlin.AddOctave(1, (NOISE_DATATYPE)0.5); - m_Perlin.AddOctave((NOISE_DATATYPE)0.5, 1); - m_Perlin.AddOctave((NOISE_DATATYPE)0.5, 2); - - #if 0 - // DEBUG: Test the noise generation: - // NOTE: In order to be able to run MCS with this code, you need to increase the default thread stack size - // In MSVC, it is done in Project Settings -> Configuration Properties -> Linker -> System, set Stack reserve size to at least 64M - m_SeaLevel = 62; - m_HeightAmplification = 0; - m_MidPoint = 75; - m_FrequencyX = 4; - m_FrequencyY = 4; - m_FrequencyZ = 4; - m_AirThreshold = 0.5; - - const int NumChunks = 4; - NOISE_DATATYPE Noise[NumChunks][cChunkDef::Width * cChunkDef::Width * cChunkDef::Height]; - for (int x = 0; x < NumChunks; x++) - { - GenerateNoiseArray(x, 5, Noise[x]); - } - - // Save in XY cuts: - cFile f1; - if (f1.Open("Test_XY.grab", cFile::fmWrite)) - { - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int y = 0; y < cChunkDef::Height; y++) - { - for (int i = 0; i < NumChunks; i++) - { - int idx = y * cChunkDef::Width + z * cChunkDef::Width * cChunkDef::Height; - unsigned char buf[cChunkDef::Width]; - for (int x = 0; x < cChunkDef::Width; x++) - { - buf[x] = (unsigned char)(std::min(256, std::max(0, (int)(128 + 32 * Noise[i][idx++])))); - } - f1.Write(buf, cChunkDef::Width); - } - } // for y - } // for z - } // if (XY file open) - - cFile f2; - if (f2.Open("Test_XZ.grab", cFile::fmWrite)) - { - for (int y = 0; y < cChunkDef::Height; y++) - { - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int i = 0; i < NumChunks; i++) - { - int idx = y * cChunkDef::Width + z * cChunkDef::Width * cChunkDef::Height; - unsigned char buf[cChunkDef::Width]; - for (int x = 0; x < cChunkDef::Width; x++) - { - buf[x] = (unsigned char)(std::min(256, std::max(0, (int)(128 + 32 * Noise[i][idx++])))); - } - f2.Write(buf, cChunkDef::Width); - } - } // for z - } // for y - } // if (XZ file open) - #endif // 0 -} - - - - - -cNoise3DGenerator::~cNoise3DGenerator() -{ - // Nothing needed yet -} - - - - - -void cNoise3DGenerator::Initialize(cWorld * a_World, cIniFile & a_IniFile) -{ - m_World = a_World; - - // Params: - m_SeaLevel = a_IniFile.GetValueSetI("Generator", "Noise3DSeaLevel", 62); - m_HeightAmplification = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DHeightAmplification", 0); - m_MidPoint = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DMidPoint", 75); - m_FrequencyX = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DFrequencyX", 8); - m_FrequencyY = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DFrequencyY", 8); - m_FrequencyZ = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DFrequencyZ", 8); - m_AirThreshold = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DAirThreshold", 0.5); -} - - - - - -void cNoise3DGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) -{ - for (unsigned int i = 0; i < ARRAYCOUNT(a_BiomeMap); i++) - { - a_BiomeMap[i] = biExtremeHills; - } -} - - - - - -void cNoise3DGenerator::DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc) -{ - NOISE_DATATYPE Noise[17 * 257 * 17]; - GenerateNoiseArray(a_ChunkX, a_ChunkZ, Noise); - - // Output noise into chunk: - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int y = 0; y < cChunkDef::Height; y++) - { - int idx = z * 17 * 257 + y * 17; - for (int x = 0; x < cChunkDef::Width; x++) - { - NOISE_DATATYPE n = Noise[idx++]; - BLOCKTYPE BlockType; - if (n > m_AirThreshold) - { - BlockType = (y > m_SeaLevel) ? E_BLOCK_AIR : E_BLOCK_STATIONARY_WATER; - } - else - { - BlockType = E_BLOCK_STONE; - } - a_ChunkDesc.SetBlockType(x, y, z, BlockType); - } - } - } - - UpdateHeightmap(a_ChunkDesc); - ComposeTerrain (a_ChunkDesc); -} - - - - - -void cNoise3DGenerator::GenerateNoiseArray(int a_ChunkX, int a_ChunkZ, NOISE_DATATYPE * a_OutNoise) -{ - NOISE_DATATYPE NoiseO[DIM_X * DIM_Y * DIM_Z]; // Output for the Perlin noise - NOISE_DATATYPE NoiseW[DIM_X * DIM_Y * DIM_Z]; // Workspace that the noise calculation can use and trash - - // Our noise array has different layout, XZY, instead of regular chunk's XYZ, that's why the coords are "renamed" - NOISE_DATATYPE StartX = ((NOISE_DATATYPE)(a_ChunkX * cChunkDef::Width)) / m_FrequencyX; - NOISE_DATATYPE EndX = ((NOISE_DATATYPE)((a_ChunkX + 1) * cChunkDef::Width) - 1) / m_FrequencyX; - NOISE_DATATYPE StartZ = ((NOISE_DATATYPE)(a_ChunkZ * cChunkDef::Width)) / m_FrequencyZ; - NOISE_DATATYPE EndZ = ((NOISE_DATATYPE)((a_ChunkZ + 1) * cChunkDef::Width) - 1) / m_FrequencyZ; - NOISE_DATATYPE StartY = 0; - NOISE_DATATYPE EndY = ((NOISE_DATATYPE)256) / m_FrequencyY; - - m_Perlin.Generate3D(NoiseO, DIM_X, DIM_Y, DIM_Z, StartX, EndX, StartY, EndY, StartZ, EndZ, NoiseW); - - // DEBUG: Debug3DNoise(NoiseO, DIM_X, DIM_Y, DIM_Z, Printf("Chunk_%d_%d_orig", a_ChunkX, a_ChunkZ)); - - // Precalculate a "height" array: - NOISE_DATATYPE Height[DIM_X * DIM_Z]; // Output for the cubic noise heightmap ("source") - m_Cubic.Generate2D(Height, DIM_X, DIM_Z, StartX / 25, EndX / 25, StartZ / 25, EndZ / 25); - for (unsigned int i = 0; i < ARRAYCOUNT(Height); i++) - { - Height[i] = abs(Height[i]) * m_HeightAmplification + 1; - } - - // Modify the noise by height data: - for (int y = 0; y < DIM_Y; y++) - { - NOISE_DATATYPE AddHeight = (y * UPSCALE_Y - m_MidPoint) / 20; - AddHeight *= AddHeight * AddHeight; - for (int z = 0; z < DIM_Z; z++) - { - NOISE_DATATYPE * CurRow = &(NoiseO[y * DIM_X + z * DIM_X * DIM_Y]); - for (int x = 0; x < DIM_X; x++) - { - CurRow[x] += AddHeight / Height[x + DIM_X * z]; - } - } - } - - // DEBUG: Debug3DNoise(NoiseO, DIM_X, DIM_Y, DIM_Z, Printf("Chunk_%d_%d_hei", a_ChunkX, a_ChunkZ)); - - // Upscale the Perlin noise into full-blown chunk dimensions: - LinearUpscale3DArray( - NoiseO, DIM_X, DIM_Y, DIM_Z, - a_OutNoise, UPSCALE_X, UPSCALE_Y, UPSCALE_Z - ); - - // DEBUG: Debug3DNoise(a_OutNoise, 17, 257, 17, Printf("Chunk_%d_%d_lerp", a_ChunkX, a_ChunkZ)); -} - - - - - -void cNoise3DGenerator::UpdateHeightmap(cChunkDesc & a_ChunkDesc) -{ - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - for (int y = cChunkDef::Height - 1; y > 0; y--) - { - if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR) - { - a_ChunkDesc.SetHeight(x, z, y); - break; - } - } // for y - } // for x - } // for z -} - - - - - -void cNoise3DGenerator::ComposeTerrain(cChunkDesc & a_ChunkDesc) -{ - // Make basic terrain composition: - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - int LastAir = a_ChunkDesc.GetHeight(x, z) + 1; - bool HasHadWater = false; - for (int y = LastAir - 1; y > 0; y--) - { - switch (a_ChunkDesc.GetBlockType(x, y, z)) - { - case E_BLOCK_AIR: - { - LastAir = y; - break; - } - case E_BLOCK_STONE: - { - if (LastAir - y > 3) - { - break; - } - if (HasHadWater) - { - a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SAND); - } - else - { - a_ChunkDesc.SetBlockType(x, y, z, (LastAir == y + 1) ? E_BLOCK_GRASS : E_BLOCK_DIRT); - } - break; - } - case E_BLOCK_STATIONARY_WATER: - { - LastAir = y; - HasHadWater = true; - break; - } - } // switch (GetBlockType()) - } // for y - a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); - } // for x - } // for z -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cNoise3DComposable: - -cNoise3DComposable::cNoise3DComposable(int a_Seed) : - m_Noise1(a_Seed + 1000), - m_Noise2(a_Seed + 2000), - m_Noise3(a_Seed + 3000) -{ -} - - - - - -void cNoise3DComposable::Initialize(cIniFile & a_IniFile) -{ - // Params: - m_SeaLevel = a_IniFile.GetValueSetI("Generator", "Noise3DSeaLevel", 62); - m_HeightAmplification = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DHeightAmplification", 0); - m_MidPoint = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DMidPoint", 75); - m_FrequencyX = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DFrequencyX", 10); - m_FrequencyY = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DFrequencyY", 10); - m_FrequencyZ = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DFrequencyZ", 10); - m_AirThreshold = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DAirThreshold", 0.5); -} - - - - - -void cNoise3DComposable::GenerateNoiseArrayIfNeeded(int a_ChunkX, int a_ChunkZ) -{ - if ((a_ChunkX == m_LastChunkX) && (a_ChunkZ == m_LastChunkZ)) - { - // The noise for this chunk is already generated in m_Noise - return; - } - m_LastChunkX = a_ChunkX; - m_LastChunkZ = a_ChunkZ; - - // Upscaling parameters: - const int UPSCALE_X = 8; - const int UPSCALE_Y = 4; - const int UPSCALE_Z = 8; - - // Precalculate a "height" array: - NOISE_DATATYPE Height[17 * 17]; // x + 17 * z - for (int z = 0; z < 17; z += UPSCALE_Z) - { - NOISE_DATATYPE NoiseZ = ((NOISE_DATATYPE)(a_ChunkZ * cChunkDef::Width + z)) / m_FrequencyZ; - for (int x = 0; x < 17; x += UPSCALE_X) - { - NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(a_ChunkX * cChunkDef::Width + x)) / m_FrequencyX; - NOISE_DATATYPE val = abs(m_Noise1.CubicNoise2D(NoiseX / 5, NoiseZ / 5)) * m_HeightAmplification + 1; - Height[x + 17 * z] = val * val * val; - } - } - - for (int y = 0; y < 257; y += UPSCALE_Y) - { - NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)y) / m_FrequencyY; - NOISE_DATATYPE AddHeight = (y - m_MidPoint) / 20; - AddHeight *= AddHeight * AddHeight; - NOISE_DATATYPE * CurFloor = &(m_NoiseArray[y * 17 * 17]); - for (int z = 0; z < 17; z += UPSCALE_Z) - { - NOISE_DATATYPE NoiseZ = ((NOISE_DATATYPE)(a_ChunkZ * cChunkDef::Width + z)) / m_FrequencyZ; - for (int x = 0; x < 17; x += UPSCALE_X) - { - NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(a_ChunkX * cChunkDef::Width + x)) / m_FrequencyX; - CurFloor[x + 17 * z] = - m_Noise1.CubicNoise3D(NoiseX, NoiseY, NoiseZ) * (NOISE_DATATYPE)0.5 + - m_Noise2.CubicNoise3D(NoiseX / 2, NoiseY / 2, NoiseZ / 2) + - m_Noise3.CubicNoise3D(NoiseX / 4, NoiseY / 4, NoiseZ / 4) * 2 + - AddHeight / Height[x + 17 * z]; - } - } - // Linear-interpolate this XZ floor: - LinearUpscale2DArrayInPlace(CurFloor, 17, 17, UPSCALE_X, UPSCALE_Z); - } - - // Finish the 3D linear interpolation by interpolating between each XZ-floors on the Y axis - for (int y = 1; y < cChunkDef::Height; y++) - { - if ((y % UPSCALE_Y) == 0) - { - // This is the interpolation source floor, already calculated - continue; - } - int LoFloorY = (y / UPSCALE_Y) * UPSCALE_Y; - int HiFloorY = LoFloorY + UPSCALE_Y; - NOISE_DATATYPE * LoFloor = &(m_NoiseArray[LoFloorY * 17 * 17]); - NOISE_DATATYPE * HiFloor = &(m_NoiseArray[HiFloorY * 17 * 17]); - NOISE_DATATYPE * CurFloor = &(m_NoiseArray[y * 17 * 17]); - NOISE_DATATYPE Ratio = ((NOISE_DATATYPE)(y % UPSCALE_Y)) / UPSCALE_Y; - int idx = 0; - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - CurFloor[idx] = LoFloor[idx] + (HiFloor[idx] - LoFloor[idx]) * Ratio; - idx += 1; - } - idx += 1; // Skipping one X column - } - } - - // The noise array is now fully interpolated - /* - // DEBUG: Output two images of the array, sliced by XY and XZ: - cFile f1; - if (f1.Open(Printf("Chunk_%d_%d_XY.raw", a_ChunkX, a_ChunkZ), cFile::fmWrite)) - { - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int y = 0; y < cChunkDef::Height; y++) - { - int idx = y * 17 * 17 + z * 17; - unsigned char buf[16]; - for (int x = 0; x < cChunkDef::Width; x++) - { - buf[x] = (unsigned char)(std::min(256, std::max(0, (int)(128 + 128 * m_Noise[idx++])))); - } - f1.Write(buf, 16); - } // for y - } // for z - } // if (XY file open) - - cFile f2; - if (f2.Open(Printf("Chunk_%d_%d_XZ.raw", a_ChunkX, a_ChunkZ), cFile::fmWrite)) - { - for (int y = 0; y < cChunkDef::Height; y++) - { - for (int z = 0; z < cChunkDef::Width; z++) - { - int idx = y * 17 * 17 + z * 17; - unsigned char buf[16]; - for (int x = 0; x < cChunkDef::Width; x++) - { - buf[x] = (unsigned char)(std::min(256, std::max(0, (int)(128 + 128 * m_Noise[idx++])))); - } - f2.Write(buf, 16); - } // for z - } // for y - } // if (XZ file open) - */ -} - - - - - -void cNoise3DComposable::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) -{ - GenerateNoiseArrayIfNeeded(a_ChunkX, a_ChunkZ); - - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - cChunkDef::SetHeight(a_HeightMap, x, z, m_SeaLevel); - for (int y = cChunkDef::Height - 1; y > m_SeaLevel; y--) - { - if (m_NoiseArray[y * 17 * 17 + z * 17 + x] <= m_AirThreshold) - { - cChunkDef::SetHeight(a_HeightMap, x, z, y); - break; - } - } // for y - } // for x - } // for z -} - - - - - -void cNoise3DComposable::ComposeTerrain(cChunkDesc & a_ChunkDesc) -{ - GenerateNoiseArrayIfNeeded(a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ()); - - a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); - - // Make basic terrain composition: - for (int z = 0; z < cChunkDef::Width; z++) - { - for (int x = 0; x < cChunkDef::Width; x++) - { - int LastAir = a_ChunkDesc.GetHeight(x, z) + 1; - bool HasHadWater = false; - for (int y = LastAir; y < m_SeaLevel; y++) - { - a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_STATIONARY_WATER); - } - for (int y = LastAir - 1; y > 0; y--) - { - if (m_NoiseArray[x + 17 * z + 17 * 17 * y] > m_AirThreshold) - { - // "air" part - LastAir = y; - if (y < m_SeaLevel) - { - a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_STATIONARY_WATER); - HasHadWater = true; - } - continue; - } - // "ground" part: - if (LastAir - y > 4) - { - a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_STONE); - continue; - } - if (HasHadWater) - { - a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SAND); - } - else - { - a_ChunkDesc.SetBlockType(x, y, z, (LastAir == y + 1) ? E_BLOCK_GRASS : E_BLOCK_DIRT); - } - } // for y - a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); - } // for x - } // for z -} - - - - diff --git a/source/GroupManager.cpp b/source/GroupManager.cpp deleted file mode 100644 index d7332fd0a..000000000 --- a/source/GroupManager.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "GroupManager.h" -#include "Group.h" -#include "../iniFile/iniFile.h" -#include "ChatColor.h" -#include "Root.h" - - - - - -typedef std::map< AString, cGroup* > GroupMap; - - - - - -struct cGroupManager::sGroupManagerState -{ - GroupMap Groups; -}; - - - - - -cGroupManager::~cGroupManager() -{ - for( GroupMap::iterator itr = m_pState->Groups.begin(); itr != m_pState->Groups.end(); ++itr ) - { - delete itr->second; - } - m_pState->Groups.clear(); - - delete m_pState; -} - - - - - -cGroupManager::cGroupManager() - : m_pState( new sGroupManagerState ) -{ - LOGD("-- Loading Groups --"); - cIniFile IniFile; - if (!IniFile.ReadFile("groups.ini")) - { - LOGWARNING("groups.ini inaccessible, no groups are defined"); - return; - } - - unsigned int NumKeys = IniFile.GetNumKeys(); - for( unsigned int i = 0; i < NumKeys; i++ ) - { - std::string KeyName = IniFile.GetKeyName( i ); - cGroup* Group = GetGroup( KeyName.c_str() ); - - LOGD("Loading group: %s", KeyName.c_str() ); - - Group->SetName( KeyName ); - char Color = IniFile.GetValue( KeyName, "Color", "-" )[0]; - if( Color != '-' ) - Group->SetColor( cChatColor::MakeColor(Color) ); - else - Group->SetColor( cChatColor::White ); - - std::string Commands = IniFile.GetValue( KeyName, "Commands", "" ); - if( Commands.size() > 0 ) - { - AStringVector Split = StringSplit( Commands, "," ); - for( unsigned int i = 0; i < Split.size(); i++) - { - Group->AddCommand( Split[i] ); - } - } - - std::string Permissions = IniFile.GetValue( KeyName, "Permissions", "" ); - if( Permissions.size() > 0 ) - { - AStringVector Split = StringSplit( Permissions, "," ); - for( unsigned int i = 0; i < Split.size(); i++) - { - Group->AddPermission( Split[i] ); - } - } - - std::string Groups = IniFile.GetValue( KeyName, "Inherits", "" ); - if( Groups.size() > 0 ) - { - AStringVector Split = StringSplit( Groups, "," ); - for( unsigned int i = 0; i < Split.size(); i++) - { - Group->InheritFrom( GetGroup( Split[i].c_str() ) ); - } - } - } - LOGD("-- Groups Successfully Loaded --"); -} - - - - - -cGroup* cGroupManager::GetGroup( const AString & a_Name ) -{ - GroupMap::iterator itr = m_pState->Groups.find( a_Name ); - if( itr != m_pState->Groups.end() ) - { - return itr->second; - } - - cGroup* Group = new cGroup(); - m_pState->Groups[a_Name] = Group; - - return Group; -} - - - - diff --git a/source/HTTPServer/HTTPServer.h b/source/HTTPServer/HTTPServer.h deleted file mode 100644 index fea2a9029..000000000 --- a/source/HTTPServer/HTTPServer.h +++ /dev/null @@ -1,101 +0,0 @@ - -// HTTPServer.h - -// Declares the cHTTPServer class representing a HTTP webserver that uses cListenThread and cSocketThreads for processing - - - - - -#pragma once - -#include "../OSSupport/ListenThread.h" -#include "../OSSupport/SocketThreads.h" -#include "../../iniFile/iniFile.h" - - - - - -// fwd: -class cHTTPMessage; -class cHTTPRequest; -class cHTTPResponse; -class cHTTPConnection; - -typedef std::vector<cHTTPConnection *> cHTTPConnections; - - - - - - -class cHTTPServer : - public cListenThread::cCallback -{ -public: - class cCallbacks - { - public: - /** Called when a new request arrives over a connection and its headers have been parsed. - The request body needn't have arrived yet. - */ - virtual void OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) = 0; - - /// Called when another part of request body has arrived. - virtual void OnRequestBody(cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, int a_Size) = 0; - - /// Called when the request body has been fully received in previous calls to OnRequestBody() - virtual void OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) = 0; - } ; - - cHTTPServer(void); - ~cHTTPServer(); - - /// Initializes the server on the specified ports - bool Initialize(const AString & a_PortsIPv4, const AString & a_PortsIPv6); - - /// Starts the server and assigns the callbacks to use for incoming requests - bool Start(cCallbacks & a_Callbacks); - - /// Stops the server, drops all current connections - void Stop(void); - -protected: - friend class cHTTPConnection; - - cListenThread m_ListenThreadIPv4; - cListenThread m_ListenThreadIPv6; - - cSocketThreads m_SocketThreads; - - cCriticalSection m_CSConnections; - cHTTPConnections m_Connections; ///< All the connections that are currently being serviced - - /// The callbacks to call for various events - cCallbacks * m_Callbacks; - - - // cListenThread::cCallback overrides: - virtual void OnConnectionAccepted(cSocket & a_Socket) override; - - /// Called by cHTTPConnection to close the connection (presumably due to an error) - void CloseConnection(cHTTPConnection & a_Connection); - - /// Called by cHTTPConnection to notify SocketThreads that there's data to be sent for the connection - void NotifyConnectionWrite(cHTTPConnection & a_Connection); - - /// Called by cHTTPConnection when it finishes parsing the request header - void NewRequest(cHTTPConnection & a_Connection, cHTTPRequest & a_Request); - - /// Called by cHTTPConenction when it receives more data for the request body - void RequestBody(cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, int a_Size); - - /// Called by cHTTPConnection when it detects that the request has finished (all of its body has been received) - void RequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request); -} ; - - - - - diff --git a/source/Inventory.cpp b/source/Inventory.cpp deleted file mode 100644 index 90b998358..000000000 --- a/source/Inventory.cpp +++ /dev/null @@ -1,682 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "Inventory.h" -#include "Entities/Player.h" -#include "ClientHandle.h" -#include "UI/Window.h" -#include "Item.h" -#include "Root.h" -#include "World.h" - -#include <json/json.h> - -#include "Items/ItemHandler.h" - - - - - -cInventory::cInventory(cPlayer & a_Owner) : - m_ArmorSlots (1, 4), // 1 x 4 slots - m_InventorySlots(9, 3), // 9 x 3 slots - m_HotbarSlots (9, 1), // 9 x 1 slots - m_Owner(a_Owner) -{ - // Ask each ItemGrid to report changes to us: - m_ArmorSlots.AddListener(*this); - m_InventorySlots.AddListener(*this); - m_HotbarSlots.AddListener(*this); - - SetEquippedSlotNum(0); -} - - - - - -void cInventory::Clear(void) -{ - m_ArmorSlots.Clear(); - m_InventorySlots.Clear(); - m_HotbarSlots.Clear(); -} - - - - - -int cInventory::HowManyCanFit(const cItem & a_ItemStack, bool a_ConsiderEmptySlots) -{ - return HowManyCanFit(a_ItemStack, 0, invNumSlots - 1, a_ConsiderEmptySlots); -} - - - - - -int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int a_EndSlotNum, bool a_ConsiderEmptySlots) -{ - if ((a_BeginSlotNum < 0) || (a_BeginSlotNum >= invNumSlots)) - { - LOGWARNING("%s: Bad BeginSlotNum, got %d, there are %d slots; correcting to 0.", __FUNCTION__, a_BeginSlotNum, invNumSlots - 1); - a_BeginSlotNum = 0; - } - if ((a_EndSlotNum < 0) || (a_EndSlotNum >= invNumSlots)) - { - LOGWARNING("%s: Bad EndSlotNum, got %d, there are %d slots; correcting to %d.", __FUNCTION__, a_BeginSlotNum, invNumSlots, invNumSlots - 1); - a_EndSlotNum = invNumSlots - 1; - } - if (a_BeginSlotNum > a_EndSlotNum) - { - std::swap(a_BeginSlotNum, a_EndSlotNum); - } - - char NumLeft = a_ItemStack.m_ItemCount; - int MaxStack = ItemHandler(a_ItemStack.m_ItemType)->GetMaxStackSize(); - for (int i = a_BeginSlotNum; i <= a_EndSlotNum; i++) - { - const cItem & Slot = GetSlot(i); - if (Slot.IsEmpty()) - { - NumLeft -= MaxStack; - } - else if (Slot.IsStackableWith(a_ItemStack)) - { - NumLeft -= MaxStack - Slot.m_ItemCount; - } - if (NumLeft <= 0) - { - // All items fit - return a_ItemStack.m_ItemCount; - } - } // for i - m_Slots[] - return a_ItemStack.m_ItemCount - NumLeft; -} - - - - - -int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst) -{ - cItem ToAdd(a_Item); - int res = 0; - if (ItemCategory::IsArmor(a_Item.m_ItemType)) - { - res = m_ArmorSlots.AddItem(ToAdd, a_AllowNewStacks); - ToAdd.m_ItemCount -= res; - if (ToAdd.m_ItemCount == 0) - { - return res; - } - } - - res += m_HotbarSlots.AddItem(ToAdd, a_AllowNewStacks, a_tryToFillEquippedFirst ? m_EquippedSlotNum : -1); - ToAdd.m_ItemCount = a_Item.m_ItemCount - res; - if (ToAdd.m_ItemCount == 0) - { - return res; - } - - res += m_InventorySlots.AddItem(ToAdd, a_AllowNewStacks); - return res; -} - - - - - -int cInventory::AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst) -{ - int TotalAdded = 0; - for (cItems::iterator itr = a_ItemStackList.begin(); itr != a_ItemStackList.end();) - { - int NumAdded = AddItem(*itr, a_AllowNewStacks, a_tryToFillEquippedFirst); - if (itr->m_ItemCount == NumAdded) - { - itr = a_ItemStackList.erase(itr); - } - else - { - itr->m_ItemCount -= NumAdded; - ++itr; - } - TotalAdded += NumAdded; - } - return TotalAdded; -} - - - - - -bool cInventory::RemoveOneEquippedItem(void) -{ - if (m_HotbarSlots.GetSlot(m_EquippedSlotNum).IsEmpty()) - { - return false; - } - - m_HotbarSlots.ChangeSlotCount(m_EquippedSlotNum, -1); - return true; -} - - - - - -int cInventory::HowManyItems(const cItem & a_Item) -{ - return - m_ArmorSlots.HowManyItems(a_Item) + - m_InventorySlots.HowManyItems(a_Item) + - m_HotbarSlots.HowManyItems(a_Item); -} - - - - - -bool cInventory::HasItems(const cItem & a_ItemStack) -{ - int CurrentlyHave = HowManyItems(a_ItemStack); - return (CurrentlyHave >= a_ItemStack.m_ItemCount); -} - - - - - -void cInventory::SetSlot(int a_SlotNum, const cItem & a_Item) -{ - if ((a_SlotNum < 0) || (a_SlotNum >= invNumSlots)) - { - LOGWARNING("%s: requesting an invalid slot index: %d out of %d. Ignoring.", __FUNCTION__, a_SlotNum, invNumSlots - 1); - return; - } - - int GridSlotNum = 0; - cItemGrid * Grid = GetGridForSlotNum(a_SlotNum, GridSlotNum); - if (Grid == NULL) - { - LOGWARNING("%s(%d): requesting an invalid itemgrid. Ignoring.", __FUNCTION__, a_SlotNum); - return; - } - Grid->SetSlot(GridSlotNum, a_Item); -} - - - - - -void cInventory::SetArmorSlot(int a_ArmorSlotNum, const cItem & a_Item) -{ - m_ArmorSlots.SetSlot(a_ArmorSlotNum, a_Item); -} - - - - - -void cInventory::SetInventorySlot(int a_InventorySlotNum, const cItem & a_Item) -{ - m_InventorySlots.SetSlot(a_InventorySlotNum, a_Item); -} - - - - - -void cInventory::SetHotbarSlot(int a_HotBarSlotNum, const cItem & a_Item) -{ - m_HotbarSlots.SetSlot(a_HotBarSlotNum, a_Item); -} - - - - - -const cItem & cInventory::GetSlot(int a_SlotNum) const -{ - if ((a_SlotNum < 0) || (a_SlotNum >= invNumSlots)) - { - LOGWARNING("%s: requesting an invalid slot index: %d out of %d. Returning the first inventory slot instead.", __FUNCTION__, a_SlotNum, invNumSlots - 1); - return m_InventorySlots.GetSlot(0); - } - int GridSlotNum = 0; - const cItemGrid * Grid = GetGridForSlotNum(a_SlotNum, GridSlotNum); - if (Grid == NULL) - { - // Something went wrong, but we don't know what. We must return a value, so return the first inventory slot - LOGWARNING("%s(%d): requesting an invalid ItemGrid, returning the first inventory slot instead.", __FUNCTION__, a_SlotNum); - return m_InventorySlots.GetSlot(0); - } - return Grid->GetSlot(GridSlotNum); -} - - - - - -const cItem & cInventory::GetArmorSlot(int a_ArmorSlotNum) const -{ - if ((a_ArmorSlotNum < 0) || (a_ArmorSlotNum >= invArmorCount)) - { - LOGWARNING("%s: requesting an invalid slot index: %d out of %d. Returning the first one instead", __FUNCTION__, a_ArmorSlotNum, invArmorCount - 1); - return m_ArmorSlots.GetSlot(0); - } - return m_ArmorSlots.GetSlot(a_ArmorSlotNum); -} - - - - - -const cItem & cInventory::GetInventorySlot(int a_InventorySlotNum) const -{ - if ((a_InventorySlotNum < 0) || (a_InventorySlotNum >= invInventoryCount)) - { - LOGWARNING("%s: requesting an invalid slot index: %d out of %d. Returning the first one instead", __FUNCTION__, a_InventorySlotNum, invInventoryCount - 1); - return m_InventorySlots.GetSlot(0); - } - return m_InventorySlots.GetSlot(a_InventorySlotNum); -} - - - - - -const cItem & cInventory::GetHotbarSlot(int a_SlotNum) const -{ - if ((a_SlotNum < 0) || (a_SlotNum >= invHotbarCount)) - { - LOGWARNING("%s: requesting an invalid slot index: %d out of %d. Returning the first one instead", __FUNCTION__, a_SlotNum, invHotbarCount - 1); - return m_HotbarSlots.GetSlot(0); - } - return m_HotbarSlots.GetSlot(a_SlotNum); -} - - - - - -const cItem & cInventory::GetEquippedItem(void) const -{ - return GetHotbarSlot(m_EquippedSlotNum); -} - - - - - -void cInventory::SetEquippedSlotNum(int a_SlotNum) -{ - if ((a_SlotNum < 0) || (a_SlotNum >= invHotbarCount)) - { - LOGWARNING("%s: requesting invalid slot index: %d out of %d. Setting 0 instead.", __FUNCTION__, a_SlotNum, invHotbarCount - 1); - m_EquippedSlotNum = 0; - } - else - { - m_EquippedSlotNum = a_SlotNum; - } -} - - - - - -bool cInventory::DamageEquippedItem(short a_Amount) -{ - return DamageItem(invHotbarOffset + m_EquippedSlotNum, a_Amount); -} - - - - - -int cInventory::ChangeSlotCount(int a_SlotNum, int a_AddToCount) -{ - int GridSlotNum = 0; - cItemGrid * Grid = GetGridForSlotNum(a_SlotNum, GridSlotNum); - if (Grid == NULL) - { - LOGWARNING("%s: invalid slot number, expected 0 .. %d, got %d; ignoring", __FUNCTION__, invNumSlots, a_SlotNum); - return -1; - } - return Grid->ChangeSlotCount(GridSlotNum, a_AddToCount); -} - - - - - -bool cInventory::DamageItem(int a_SlotNum, short a_Amount) -{ - if ((a_SlotNum < 0) || (a_SlotNum >= invNumSlots)) - { - LOGWARNING("%s: requesting an invalid slot index: %d out of %d", __FUNCTION__, a_SlotNum, invNumSlots - 1); - return false; - } - - int GridSlotNum = 0; - cItemGrid * Grid = GetGridForSlotNum(a_SlotNum, GridSlotNum); - if (Grid == NULL) - { - LOGWARNING("%s(%d, %d): requesting an invalid grid, ignoring.", __FUNCTION__, a_SlotNum, a_Amount); - return false; - } - if (!Grid->DamageItem(GridSlotNum, a_Amount)) - { - // The item has been damaged, but did not break yet - return false; - } - - // The item has broken, remove it: - Grid->EmptySlot(GridSlotNum); - return true; -} - - - - - -void cInventory::CopyToItems(cItems & a_Items) -{ - m_ArmorSlots.CopyToItems(a_Items); - m_InventorySlots.CopyToItems(a_Items); - m_HotbarSlots.CopyToItems(a_Items); -} - - - - - -void cInventory::SendSlot(int a_SlotNum) -{ - cItem Item(GetSlot(a_SlotNum)); - if (Item.IsEmpty()) - { - // Sanitize items that are not completely empty (ie. count == 0, but type != empty) - Item.Empty(); - } - m_Owner.GetClientHandle()->SendInventorySlot(0, a_SlotNum + 5, Item); // Slots in the client are numbered "+ 5" because of crafting grid and result -} - - - - - -/* -int cInventory::MoveItem(short a_ItemType, short a_ItemDamage, int a_Count, int a_BeginSlot, int a_EndSlot) -{ - int res = 0; - for (int i = a_BeginSlot; i <= a_EndSlot; i++) - { - if ( - m_Slots[i].IsEmpty() || - ((m_Slots[i].m_ItemType == a_ItemType) && (m_Slots[i].m_ItemDamage == a_ItemDamage)) - ) - { - int MaxCount = ItemHandler(a_ItemType)->GetMaxStackSize(); - ASSERT(m_Slots[i].m_ItemCount <= MaxCount); - int NumToMove = std::min(a_Count, MaxCount - m_Slots[i].m_ItemCount); - m_Slots[i].m_ItemCount += NumToMove; - m_Slots[i].m_ItemDamage = a_ItemDamage; - m_Slots[i].m_ItemType = a_ItemType; - SendSlot(i); - res += NumToMove; - a_Count -= NumToMove; - if (a_Count <= 0) - { - // No more items to distribute - return res; - } - } - } // for i - m_Slots[] - // No more space to distribute to - return res; -} -*/ - - - - - -int cInventory::ArmorSlotNumToEntityEquipmentID(short a_ArmorSlotNum) -{ - switch (a_ArmorSlotNum) - { - case 0: return 4; // Helmet - case 1: return 3; // Chestplate - case 2: return 2; // Leggings - case 3: return 1; // Boots - } - LOGWARN("%s: invalid armor slot number: %d", __FUNCTION__, a_ArmorSlotNum); - return 0; -} - - - - - -#if 0 -bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode /* = 0 */ ) -{ - // Fill already present stacks - if( a_Mode < 2 ) - { - int MaxStackSize = cItemHandler::GetItemHandler(a_Item.m_ItemType)->GetMaxStackSize(); - for(int i = 0; i < a_Size; i++) - { - if( m_Slots[i + a_Offset].m_ItemType == a_Item.m_ItemType && m_Slots[i + a_Offset].m_ItemCount < MaxStackSize && m_Slots[i + a_Offset].m_ItemDamage == a_Item.m_ItemDamage ) - { - int NumFree = MaxStackSize - m_Slots[i + a_Offset].m_ItemCount; - if( NumFree >= a_Item.m_ItemCount ) - { - - //printf("1. Adding %i items ( free: %i )\n", a_Item.m_ItemCount, NumFree ); - m_Slots[i + a_Offset].m_ItemCount += a_Item.m_ItemCount; - a_Item.m_ItemCount = 0; - a_bChangedSlots[i + a_Offset] = true; - break; - } - else - { - //printf("2. Adding %i items\n", NumFree ); - m_Slots[i + a_Offset].m_ItemCount += (char)NumFree; - a_Item.m_ItemCount -= (char)NumFree; - a_bChangedSlots[i + a_Offset] = true; - } - } - } - } - - if( a_Mode > 0 ) - { - // If we got more left, find first empty slot - for(int i = 0; i < a_Size && a_Item.m_ItemCount > 0; i++) - { - if( m_Slots[i + a_Offset].m_ItemType == -1 ) - { - m_Slots[i + a_Offset] = a_Item; - a_Item.m_ItemCount = 0; - a_bChangedSlots[i + a_Offset] = true; - } - } - } - - return true; -} -#endif - - - - - -void cInventory::SaveToJson(Json::Value & a_Value) -{ - // The JSON originally included the 4 crafting slots and the result, so we have to put empty items there, too: - cItem EmptyItem; - Json::Value EmptyItemJson; - EmptyItem.GetJson(EmptyItemJson); - for (int i = 0; i < 5; i++) - { - a_Value.append(EmptyItemJson); - } - - // The 4 armor slots follow: - for (int i = 0; i < invArmorCount; i++) - { - Json::Value JSON_Item; - m_ArmorSlots.GetSlot(i).GetJson(JSON_Item); - a_Value.append(JSON_Item); - } - - // Next comes the main inventory: - for (int i = 0; i < invInventoryCount; i++) - { - Json::Value JSON_Item; - m_InventorySlots.GetSlot(i).GetJson(JSON_Item); - a_Value.append(JSON_Item); - } - - // The hotbar is the last: - for (int i = 0; i < invHotbarCount; i++) - { - Json::Value JSON_Item; - m_HotbarSlots.GetSlot(i).GetJson(JSON_Item); - a_Value.append(JSON_Item); - } -} - - - - - -bool cInventory::LoadFromJson(Json::Value & a_Value) -{ - int SlotIdx = 0; - - for (Json::Value::iterator itr = a_Value.begin(); itr != a_Value.end(); ++itr, SlotIdx++) - { - cItem Item; - Item.FromJson(*itr); - - // The JSON originally included the 4 crafting slots and the result slot, so we need to skip the first 5 items: - if (SlotIdx < 5) - { - continue; - } - - // If we loaded all the slots, stop now, even if the JSON has more: - if (SlotIdx - 5 >= invNumSlots) - { - break; - } - - int GridSlotNum = 0; - cItemGrid * Grid = GetGridForSlotNum(SlotIdx - 5, GridSlotNum); - ASSERT(Grid != NULL); - Grid->SetSlot(GridSlotNum, Item); - } // for itr - a_Value[] - return true; -} - - - - - -const cItemGrid * cInventory::GetGridForSlotNum(int a_SlotNum, int & a_GridSlotNum) const -{ - ASSERT(a_SlotNum >= 0); - - if (a_SlotNum < invArmorCount) - { - a_GridSlotNum = a_SlotNum; - return &m_ArmorSlots; - } - a_SlotNum -= invArmorCount; - if (a_SlotNum < invInventoryCount) - { - a_GridSlotNum = a_SlotNum; - return &m_InventorySlots; - } - a_GridSlotNum = a_SlotNum - invInventoryCount; - return &m_HotbarSlots; -} - - - - - -cItemGrid * cInventory::GetGridForSlotNum(int a_SlotNum, int & a_GridSlotNum) -{ - ASSERT(a_SlotNum >= 0); - - if (a_SlotNum < invArmorCount) - { - a_GridSlotNum = a_SlotNum; - return &m_ArmorSlots; - } - a_SlotNum -= invArmorCount; - if (a_SlotNum < invInventoryCount) - { - a_GridSlotNum = a_SlotNum; - return &m_InventorySlots; - } - a_GridSlotNum = a_SlotNum - invInventoryCount; - return &m_HotbarSlots; -} - - - - - -void cInventory::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) -{ - // Send the neccessary updates to whoever needs them - - if (m_Owner.IsDestroyed()) - { - // Owner is not (yet) valid, skip for now - return; - } - - // Armor update needs broadcast to other players: - cWorld * World = m_Owner.GetWorld(); - if ((a_ItemGrid == &m_ArmorSlots) && (World != NULL)) - { - World->BroadcastEntityEquipment( - m_Owner, ArmorSlotNumToEntityEquipmentID(a_SlotNum), - m_ArmorSlots.GetSlot(a_SlotNum), m_Owner.GetClientHandle() - ); - } - - // Convert the grid-local a_SlotNum to our global SlotNum: - int Base = 0; - if (a_ItemGrid == &m_ArmorSlots) - { - Base = invArmorOffset; - } - else if (a_ItemGrid == &m_InventorySlots) - { - Base = invInventoryOffset; - } - else if (a_ItemGrid == &m_HotbarSlots) - { - Base = invHotbarOffset; - } - else - { - ASSERT(!"Unknown ItemGrid calling OnSlotChanged()"); - return; - } - - SendSlot(Base + a_SlotNum); -} - - - - diff --git a/source/Item.cpp b/source/Item.cpp deleted file mode 100644 index 25664e4df..000000000 --- a/source/Item.cpp +++ /dev/null @@ -1,261 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "Item.h" -#include <json/json.h> -#include "Items/ItemHandler.h" - - - - - -cItem cItem::CopyOne(void) const -{ - cItem res(*this); - res.m_ItemCount = 1; - return res; -} - - - - - -cItem & cItem::AddCount(char a_AmountToAdd) -{ - m_ItemCount += a_AmountToAdd; - if (m_ItemCount <= 0) - { - Empty(); - } - return *this; -} - - - - - -short cItem::GetMaxDamage(void) const -{ - switch (m_ItemType) - { - case E_ITEM_BOW: return 384; - case E_ITEM_DIAMOND_AXE: return 1563; - case E_ITEM_DIAMOND_HOE: return 1563; - case E_ITEM_DIAMOND_PICKAXE: return 1563; - case E_ITEM_DIAMOND_SHOVEL: return 1563; - case E_ITEM_DIAMOND_SWORD: return 1563; - case E_ITEM_FLINT_AND_STEEL: return 65; - case E_ITEM_GOLD_AXE: return 32; - case E_ITEM_GOLD_HOE: return 32; - case E_ITEM_GOLD_PICKAXE: return 32; - case E_ITEM_GOLD_SHOVEL: return 32; - case E_ITEM_GOLD_SWORD: return 32; - case E_ITEM_IRON_AXE: return 251; - case E_ITEM_IRON_HOE: return 251; - case E_ITEM_IRON_PICKAXE: return 251; - case E_ITEM_IRON_SHOVEL: return 251; - case E_ITEM_IRON_SWORD: return 251; - case E_ITEM_SHEARS: return 251; - case E_ITEM_STONE_AXE: return 132; - case E_ITEM_STONE_HOE: return 132; - case E_ITEM_STONE_PICKAXE: return 132; - case E_ITEM_STONE_SHOVEL: return 132; - case E_ITEM_STONE_SWORD: return 132; - case E_ITEM_WOODEN_AXE: return 60; - case E_ITEM_WOODEN_HOE: return 60; - case E_ITEM_WOODEN_PICKAXE: return 60; - case E_ITEM_WOODEN_SHOVEL: return 60; - case E_ITEM_WOODEN_SWORD: return 60; - } - return 0; -} - - - - - -bool cItem::DamageItem(short a_Amount) -{ - short MaxDamage = GetMaxDamage(); - if (MaxDamage == 0) - { - // Item doesn't have damage - return false; - } - - m_ItemDamage += a_Amount; - return (m_ItemDamage >= MaxDamage); -} - - - - - -bool cItem::IsStackableWith(const cItem & a_OtherStack) const -{ - if (a_OtherStack.m_ItemType != m_ItemType) - { - return false; - } - if (a_OtherStack.m_ItemDamage != m_ItemDamage) - { - return false; - } - if (a_OtherStack.m_Enchantments != m_Enchantments) - { - return false; - } - - return true; -} - - - - - -bool cItem::IsFullStack(void) const -{ - return (m_ItemCount >= ItemHandler(m_ItemType)->GetMaxStackSize()); -} - - - - - -char cItem::GetMaxStackSize(void) const -{ - return ItemHandler(m_ItemType)->GetMaxStackSize(); -} - - - - - -/// Returns the cItemHandler responsible for this item type -cItemHandler * cItem::GetHandler(void) const -{ - return ItemHandler(m_ItemType); -} - - - - - -void cItem::GetJson(Json::Value & a_OutValue) const -{ - a_OutValue["ID"] = m_ItemType; - if (m_ItemType > 0) - { - a_OutValue["Count"] = m_ItemCount; - a_OutValue["Health"] = m_ItemDamage; - AString Enchantments(m_Enchantments.ToString()); - if (!Enchantments.empty()) - { - a_OutValue["ench"] = Enchantments; - } - } -} - - - - - -void cItem::FromJson(const Json::Value & a_Value) -{ - m_ItemType = (ENUM_ITEM_ID)a_Value.get("ID", -1 ).asInt(); - if (m_ItemType > 0) - { - m_ItemCount = (char)a_Value.get("Count", -1 ).asInt(); - m_ItemDamage = (short)a_Value.get("Health", -1 ).asInt(); - m_Enchantments.Clear(); - m_Enchantments.AddFromString(a_Value.get("ench", "").asString()); - } -} - - - - - -bool cItem::IsEnchantable(short item) -{ - if ((item >= 256) && (item <= 259)) - return true; - if ((item >= 267) && (item <= 279)) - return true; - if ((item >= 283) && (item <= 286)) - return true; - if ((item >= 290) && (item <= 294)) - return true; - if ((item >= 298) && (item <= 317)) - return true; - if ((item >= 290) && (item <= 294)) - return true; - - if ((item == 346) || (item == 359) || (item == 261)) - return true; - - return false; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cItems: - -cItem * cItems::Get(int a_Idx) -{ - if ((a_Idx < 0) || (a_Idx >= (int)size())) - { - LOGWARNING("cItems: Attempt to get an out-of-bounds item at index %d; there are currently %d items. Returning a nil.", a_Idx, size()); - return NULL; - } - return &at(a_Idx); -} - - - - - -void cItems::Set(int a_Idx, const cItem & a_Item) -{ - if ((a_Idx < 0) || (a_Idx >= (int)size())) - { - LOGWARNING("cItems: Attempt to set an item at an out-of-bounds index %d; there are currently %d items. Not setting.", a_Idx, size()); - return; - } - at(a_Idx) = a_Item; -} - - - - - -void cItems::Delete(int a_Idx) -{ - if ((a_Idx < 0) || (a_Idx >= (int)size())) - { - LOGWARNING("cItems: Attempt to delete an item at an out-of-bounds index %d; there are currently %d items. Ignoring.", a_Idx, size()); - return; - } - erase(begin() + a_Idx); -} - - - - - -void cItems::Set(int a_Idx, ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemDamage) -{ - if ((a_Idx < 0) || (a_Idx >= (int)size())) - { - LOGWARNING("cItems: Attempt to set an item at an out-of-bounds index %d; there are currently %d items. Not setting.", a_Idx, size()); - return; - } - at(a_Idx) = cItem(a_ItemType, a_ItemCount, a_ItemDamage); -} - - - - diff --git a/source/LuaExpat/lxplib.c b/source/LuaExpat/lxplib.c deleted file mode 100644 index e26343ce9..000000000 --- a/source/LuaExpat/lxplib.c +++ /dev/null @@ -1,599 +0,0 @@ -/* -** $Id: lxplib.c,v 1.16 2007/06/05 20:03:12 carregal Exp $ -** LuaExpat: Lua bind for Expat library -** See Copyright Notice in license.html -*/ - - -#include <assert.h> -#include <stdlib.h> -#include <string.h> - -#include "expat.h" - -#include "lua.h" -#include "lauxlib.h" - - -#include "lxplib.h" - - -#if !defined(lua_pushliteral) -#define lua_pushliteral(L, s) \ - lua_pushstring(L, "" s, (sizeof(s)/sizeof(char))-1) -#endif - - -enum XPState { - XPSpre, /* parser just initialized */ - XPSok, /* state while parsing */ - XPSfinished, /* state after finished parsing */ - XPSerror, - XPSstring /* state while reading a string */ -}; - -struct lxp_userdata { - lua_State *L; - XML_Parser parser; /* associated expat parser */ - int tableref; /* table with callbacks for this parser */ - enum XPState state; - luaL_Buffer *b; /* to concatenate sequences of cdata pieces */ -}; - -typedef struct lxp_userdata lxp_userdata; - - -static int reporterror (lxp_userdata *xpu) { - lua_State *L = xpu->L; - XML_Parser p = xpu->parser; - lua_pushnil(L); - lua_pushstring(L, XML_ErrorString(XML_GetErrorCode(p))); - lua_pushnumber(L, XML_GetCurrentLineNumber(p)); - lua_pushnumber(L, XML_GetCurrentColumnNumber(p) + 1); - lua_pushnumber(L, XML_GetCurrentByteIndex(p) + 1); - return 5; -} - - -static lxp_userdata *createlxp (lua_State *L) { - lxp_userdata *xpu = (lxp_userdata *)lua_newuserdata(L, sizeof(lxp_userdata)); - xpu->tableref = LUA_REFNIL; /* in case of errors... */ - xpu->parser = NULL; - xpu->L = NULL; - xpu->state = XPSpre; - luaL_getmetatable(L, ParserType); - lua_setmetatable(L, -2); - return xpu; -} - - -static void lxpclose (lua_State *L, lxp_userdata *xpu) { - luaL_unref(L, LUA_REGISTRYINDEX, xpu->tableref); - xpu->tableref = LUA_REFNIL; - if (xpu->parser) - XML_ParserFree(xpu->parser); - xpu->parser = NULL; -} - - - - -/* -** Auxiliary function to call a Lua handle -*/ -static void docall (lxp_userdata *xpu, int nargs, int nres) { - lua_State *L = xpu->L; - assert(xpu->state == XPSok); - if (lua_pcall(L, nargs + 1, nres, 0) != 0) { - xpu->state = XPSerror; - luaL_unref(L, LUA_REGISTRYINDEX, xpu->tableref); - xpu->tableref = luaL_ref(L, LUA_REGISTRYINDEX); /* error message */ - } -} - - -/* -** Check whether there is pending Cdata, and call its handle if necessary -*/ -static void dischargestring (lxp_userdata *xpu) { - assert(xpu->state == XPSstring); - xpu->state = XPSok; - luaL_pushresult(xpu->b); - docall(xpu, 1, 0); -} - - -/* -** Check whether there is a Lua handle for a given event: If so, -** put it on the stack (to be called later), and also push `self' -*/ -static int getHandle (lxp_userdata *xpu, const char *handle) { - lua_State *L = xpu->L; - if (xpu->state == XPSstring) dischargestring(xpu); - if (xpu->state == XPSerror) - return 0; /* some error happened before; skip all handles */ - lua_pushstring(L, handle); - lua_gettable(L, 3); - if (lua_toboolean(L, -1) == 0) { - lua_pop(L, 1); - return 0; - } - if (!lua_isfunction(L, -1)) { - luaL_error(L, "lxp `%s' callback is not a function", handle); - } - lua_pushvalue(L, 1); /* first argument in every call (self) */ - return 1; -} - - - -/* -** {====================================================== -** Handles -** ======================================================= -*/ - - -static void f_StartCdata (void *ud) { - lxp_userdata *xpu = (lxp_userdata *)ud; - if (getHandle(xpu, StartCdataKey) == 0) return; /* no handle */ - docall(xpu, 0, 0); -} - - -static void f_EndCdataKey (void *ud) { - lxp_userdata *xpu = (lxp_userdata *)ud; - if (getHandle(xpu, EndCdataKey) == 0) return; /* no handle */ - docall(xpu, 0, 0); -} - - -static void f_CharData (void *ud, const char *s, int len) { - lxp_userdata *xpu = (lxp_userdata *)ud; - if (xpu->state == XPSok) { - if (getHandle(xpu, CharDataKey) == 0) return; /* no handle */ - xpu->state = XPSstring; - luaL_buffinit(xpu->L, xpu->b); - } - if (xpu->state == XPSstring) - luaL_addlstring(xpu->b, s, len); -} - - -static void f_Comment (void *ud, const char *data) { - lxp_userdata *xpu = (lxp_userdata *)ud; - if (getHandle(xpu, CommentKey) == 0) return; /* no handle */ - lua_pushstring(xpu->L, data); - docall(xpu, 1, 0); -} - - -static void f_Default (void *ud, const char *data, int len) { - lxp_userdata *xpu = (lxp_userdata *)ud; - if (getHandle(xpu, DefaultKey) == 0) return; /* no handle */ - lua_pushlstring(xpu->L, data, len); - docall(xpu, 1, 0); -} - - -static void f_DefaultExpand (void *ud, const char *data, int len) { - lxp_userdata *xpu = (lxp_userdata *)ud; - if (getHandle(xpu, DefaultExpandKey) == 0) return; /* no handle */ - lua_pushlstring(xpu->L, data, len); - docall(xpu, 1, 0); -} - - -static void f_StartElement (void *ud, const char *name, const char **attrs) { - lxp_userdata *xpu = (lxp_userdata *)ud; - lua_State *L = xpu->L; - int lastspec = XML_GetSpecifiedAttributeCount(xpu->parser) / 2; - int i = 1; - if (getHandle(xpu, StartElementKey) == 0) return; /* no handle */ - lua_pushstring(L, name); - lua_newtable(L); - while (*attrs) { - if (i <= lastspec) { - lua_pushnumber(L, i++); - lua_pushstring(L, *attrs); - lua_settable(L, -3); - } - lua_pushstring(L, *attrs++); - lua_pushstring(L, *attrs++); - lua_settable(L, -3); - } - docall(xpu, 2, 0); /* call function with self, name, and attributes */ -} - - -static void f_EndElement (void *ud, const char *name) { - lxp_userdata *xpu = (lxp_userdata *)ud; - if (getHandle(xpu, EndElementKey) == 0) return; /* no handle */ - lua_pushstring(xpu->L, name); - docall(xpu, 1, 0); -} - - -static int f_ExternaEntity (XML_Parser p, const char *context, - const char *base, - const char *systemId, - const char *publicId) { - lxp_userdata *xpu = (lxp_userdata *)XML_GetUserData(p); - lua_State *L = xpu->L; - lxp_userdata *child; - int status; - if (getHandle(xpu, ExternalEntityKey) == 0) return 1; /* no handle */ - child = createlxp(L); - child->parser = XML_ExternalEntityParserCreate(p, context, NULL); - if (!child->parser) - luaL_error(L, "XML_ParserCreate failed"); - lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); /*lua_getref(L, xpu->tableref); */ /* child uses the same table of its father */ - child->tableref = luaL_ref(L, LUA_REGISTRYINDEX); - lua_pushstring(L, base); - lua_pushstring(L, systemId); - lua_pushstring(L, publicId); - docall(xpu, 4, 1); - status = lua_toboolean(L, -1); - lua_pop(L, 1); - lxpclose(L, child); - return status; -} - - -static void f_StartNamespaceDecl (void *ud, const char *prefix, - const char *uri) { - lxp_userdata *xpu = (lxp_userdata *)ud; - lua_State *L = xpu->L; - if (getHandle(xpu, StartNamespaceDeclKey) == 0) return; /* no handle */ - lua_pushstring(L, prefix); - lua_pushstring(L, uri); - docall(xpu, 2, 0); -} - - -static void f_EndNamespaceDecl (void *ud, const char *prefix) { - lxp_userdata *xpu = (lxp_userdata *)ud; - if (getHandle(xpu, EndNamespaceDeclKey) == 0) return; /* no handle */ - lua_pushstring(xpu->L, prefix); - docall(xpu, 1, 0); -} - - -static void f_NotationDecl (void *ud, const char *notationName, - const char *base, - const char *systemId, - const char *publicId) { - lxp_userdata *xpu = (lxp_userdata *)ud; - lua_State *L = xpu->L; - if (getHandle(xpu, NotationDeclKey) == 0) return; /* no handle */ - lua_pushstring(L, notationName); - lua_pushstring(L, base); - lua_pushstring(L, systemId); - lua_pushstring(L, publicId); - docall(xpu, 4, 0); -} - - -static int f_NotStandalone (void *ud) { - int status; - lxp_userdata *xpu = (lxp_userdata *)ud; - lua_State *L = xpu->L; - if (getHandle(xpu, NotStandaloneKey) == 0) return 1; /* no handle */ - docall(xpu, 0, 1); - status = lua_toboolean(L, -1); - lua_pop(L, 1); - return status; -} - - -static void f_ProcessingInstruction (void *ud, const char *target, - const char *data) { - lxp_userdata *xpu = (lxp_userdata *)ud; - lua_State *L = xpu->L; - if (getHandle(xpu, ProcessingInstructionKey) == 0) return; /* no handle */ - lua_pushstring(L, target); - lua_pushstring(L, data); - docall(xpu, 2, 0); -} - - -static void f_UnparsedEntityDecl (void *ud, const char *entityName, - const char *base, - const char *systemId, - const char *publicId, - const char *notationName) { - lxp_userdata *xpu = (lxp_userdata *)ud; - lua_State *L = xpu->L; - if (getHandle(xpu, UnparsedEntityDeclKey) == 0) return; /* no handle */ - lua_pushstring(L, entityName); - lua_pushstring(L, base); - lua_pushstring(L, systemId); - lua_pushstring(L, publicId); - lua_pushstring(L, notationName); - docall(xpu, 5, 0); -} - -static void f_StartDoctypeDecl (void *ud, const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset) { - lxp_userdata *xpu = (lxp_userdata *)ud; - if (getHandle(xpu, StartDoctypeDeclKey) == 0) return; /* no handle */ - lua_pushstring(xpu->L, doctypeName); - lua_pushstring(xpu->L, sysid); - lua_pushstring(xpu->L, pubid); - lua_pushboolean(xpu->L, has_internal_subset); - docall(xpu, 4, 0); -} - -/* }====================================================== */ - - - -static int hasfield (lua_State *L, const char *fname) { - int res; - lua_pushstring(L, fname); - lua_gettable(L, 1); - res = !lua_isnil(L, -1); - lua_pop(L, 1); - return res; -} - - -static void checkcallbacks (lua_State *L) { - static const char *const validkeys[] = { - "StartCdataSection", "EndCdataSection", "CharacterData", "Comment", - "Default", "DefaultExpand", "StartElement", "EndElement", - "ExternalEntityRef", "StartNamespaceDecl", "EndNamespaceDecl", - "NotationDecl", "NotStandalone", "ProcessingInstruction", - "UnparsedEntityDecl", "StartDoctypeDecl", NULL}; - if (hasfield(L, "_nonstrict")) return; - lua_pushnil(L); - while (lua_next(L, 1)) { - lua_pop(L, 1); /* remove value */ -#if ! defined (LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 - if (lua_type(L, -1) != LUA_TSTRING || - luaL_findstring(lua_tostring(L, -1), validkeys) < 0) - luaL_error(L, "invalid key `%s' in callback table", lua_tostring(L, -1)); -#else - luaL_checkoption(L, -1, NULL, validkeys); -#endif - } -} - - -static int lxp_make_parser (lua_State *L) { - XML_Parser p; - char sep = *luaL_optstring(L, 2, ""); - lxp_userdata *xpu = createlxp(L); - p = xpu->parser = (sep == '\0') ? XML_ParserCreate(NULL) : - XML_ParserCreateNS(NULL, sep); - if (!p) - luaL_error(L, "XML_ParserCreate failed"); - luaL_checktype(L, 1, LUA_TTABLE); - checkcallbacks(L); - lua_pushvalue(L, 1); - xpu->tableref = luaL_ref(L, LUA_REGISTRYINDEX); - XML_SetUserData(p, xpu); - if (hasfield(L, StartCdataKey) || hasfield(L, EndCdataKey)) - XML_SetCdataSectionHandler(p, f_StartCdata, f_EndCdataKey); - if (hasfield(L, CharDataKey)) - XML_SetCharacterDataHandler(p, f_CharData); - if (hasfield(L, CommentKey)) - XML_SetCommentHandler(p, f_Comment); - if (hasfield(L, DefaultKey)) - XML_SetDefaultHandler(p, f_Default); - if (hasfield(L, DefaultExpandKey)) - XML_SetDefaultHandlerExpand(p, f_DefaultExpand); - if (hasfield(L, StartElementKey) || hasfield(L, EndElementKey)) - XML_SetElementHandler(p, f_StartElement, f_EndElement); - if (hasfield(L, ExternalEntityKey)) - XML_SetExternalEntityRefHandler(p, f_ExternaEntity); - if (hasfield(L, StartNamespaceDeclKey) || hasfield(L, EndNamespaceDeclKey)) - XML_SetNamespaceDeclHandler(p, f_StartNamespaceDecl, f_EndNamespaceDecl); - if (hasfield(L, NotationDeclKey)) - XML_SetNotationDeclHandler(p, f_NotationDecl); - if (hasfield(L, NotStandaloneKey)) - XML_SetNotStandaloneHandler(p, f_NotStandalone); - if (hasfield(L, ProcessingInstructionKey)) - XML_SetProcessingInstructionHandler(p, f_ProcessingInstruction); - if (hasfield(L, UnparsedEntityDeclKey)) - XML_SetUnparsedEntityDeclHandler(p, f_UnparsedEntityDecl); - if (hasfield(L, StartDoctypeDeclKey)) - XML_SetStartDoctypeDeclHandler(p, f_StartDoctypeDecl); - return 1; -} - - -static lxp_userdata *checkparser (lua_State *L, int idx) { - lxp_userdata *xpu = (lxp_userdata *)luaL_checkudata(L, idx, ParserType); - luaL_argcheck(L, xpu, idx, "expat parser expected"); - luaL_argcheck(L, xpu->parser, idx, "parser is closed"); - return xpu; -} - - -static int parser_gc (lua_State *L) { - lxp_userdata *xpu = (lxp_userdata *)luaL_checkudata(L, 1, ParserType); - luaL_argcheck(L, xpu, 1, "expat parser expected"); - lxpclose(L, xpu); - return 0; -} - - -static int setbase (lua_State *L) { - lxp_userdata *xpu = checkparser(L, 1); - if (XML_SetBase(xpu->parser, luaL_checkstring(L, 2)) == 0) - luaL_error(L, "no memory to store base"); - return 0; -} - - -static int getbase (lua_State *L) { - lxp_userdata *xpu = checkparser(L, 1); - lua_pushstring(L, XML_GetBase(xpu->parser)); - return 1; -} - - -static int getcallbacks (lua_State *L) { - lxp_userdata *xpu = checkparser(L, 1); - lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); - return 1; -} - - -static int parse_aux (lua_State *L, lxp_userdata *xpu, const char *s, - size_t len) { - luaL_Buffer b; - int status; - xpu->L = L; - xpu->state = XPSok; - xpu->b = &b; - lua_settop(L, 2); - lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); /*lua_getref(L, xpu->tableref);*/ /* to be used by handlers */ - status = XML_Parse(xpu->parser, s, (int)len, s == NULL); - if (xpu->state == XPSstring) dischargestring(xpu); - if (xpu->state == XPSerror) { /* callback error? */ - lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); /* get original msg. */ - lua_error(L); - } - if (s == NULL) xpu->state = XPSfinished; - if (status) { - lua_pushboolean(L, 1); - return 1; - } - else { /* error */ - return reporterror(xpu); - } -} - - -static int lxp_parse (lua_State *L) { - lxp_userdata *xpu = checkparser(L, 1); - size_t len; - const char *s = luaL_optlstring(L, 2, NULL, &len); - if (xpu->state == XPSfinished && s != NULL) { - lua_pushnil(L); - lua_pushliteral(L, "cannot parse - document is finished"); - return 2; - } - return parse_aux(L, xpu, s, len); -} - - -static int lxp_close (lua_State *L) { - int status = 1; - lxp_userdata *xpu = (lxp_userdata *)luaL_checkudata(L, 1, ParserType); - luaL_argcheck(L, xpu, 1, "expat parser expected"); - if (xpu->state != XPSfinished) - status = parse_aux(L, xpu, NULL, 0); - lxpclose(L, xpu); - if (status > 1) luaL_error(L, "error closing parser: %s", - lua_tostring(L, -status+1)); - return 0; -} - - -static int lxp_pos (lua_State *L) { - lxp_userdata *xpu = checkparser(L, 1); - XML_Parser p = xpu->parser; - lua_pushnumber(L, XML_GetCurrentLineNumber(p)); - lua_pushnumber(L, XML_GetCurrentColumnNumber(p) + 1); - lua_pushnumber(L, XML_GetCurrentByteIndex(p) + 1); - return 3; -} - - -static int lxp_setencoding (lua_State *L) { - lxp_userdata *xpu = checkparser(L, 1); - const char *encoding = luaL_checkstring(L, 2); - luaL_argcheck(L, xpu->state == XPSpre, 1, "invalid parser state"); - XML_SetEncoding(xpu->parser, encoding); - return 0; -} - -static int lxp_stop (lua_State *L) { - lxp_userdata *xpu = checkparser(L, 1); - lua_pushboolean(L, XML_StopParser(xpu->parser, XML_FALSE) == XML_STATUS_OK); - return 1; -} - -#if !defined LUA_VERSION_NUM -/* Lua 5.0 */ -#define luaL_Reg luaL_reg -#endif - -static const struct luaL_Reg lxp_meths[] = { - {"parse", lxp_parse}, - {"close", lxp_close}, - {"__gc", parser_gc}, - {"pos", lxp_pos}, - {"setencoding", lxp_setencoding}, - {"getcallbacks", getcallbacks}, - {"getbase", getbase}, - {"setbase", setbase}, - {"stop", lxp_stop}, - {NULL, NULL} -}; - -static const struct luaL_Reg lxp_funcs[] = { - {"new", lxp_make_parser}, - {NULL, NULL} -}; - - -/* -** Assumes the table is on top of the stack. -*/ -static void set_info (lua_State *L) { - lua_pushliteral (L, "_COPYRIGHT"); - lua_pushliteral (L, "Copyright (C) 2003-2012 Kepler Project"); - lua_settable (L, -3); - lua_pushliteral (L, "_DESCRIPTION"); - lua_pushliteral (L, "LuaExpat is a SAX XML parser based on the Expat library"); - lua_settable (L, -3); - lua_pushliteral (L, "_VERSION"); - lua_pushliteral (L, "LuaExpat 1.3.0"); - lua_settable (L, -3); -} - - -#if !defined LUA_VERSION_NUM || LUA_VERSION_NUM==501 -/* -** Adapted from Lua 5.2.0 -*/ -static void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { - luaL_checkstack(L, nup, "too many upvalues"); - for (; l->name != NULL; l++) { /* fill the table with given functions */ - int i; - for (i = 0; i < nup; i++) /* copy upvalues to the top */ - lua_pushvalue(L, -nup); - lua_pushstring(L, l->name); - lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ - lua_settable(L, -(nup + 3)); - } - lua_pop(L, nup); /* remove upvalues */ -} -#endif - - -int luaopen_lxp (lua_State *L) { - luaL_newmetatable(L, ParserType); - - lua_pushliteral(L, "__index"); - lua_pushvalue(L, -2); - lua_rawset(L, -3); - - luaL_setfuncs (L, lxp_meths, 0); - lua_pop (L, 1); /* remove metatable */ - - // _X 2013_04_09: Modified to allow embedding - luaL_openlib (L, "lxp", lxp_funcs, 0); - /* - lua_newtable (L); - luaL_setfuncs (L, lxp_funcs, 0); - */ - set_info (L); - return 1; -} diff --git a/source/LuaState.cpp b/source/LuaState.cpp deleted file mode 100644 index 644f4972c..000000000 --- a/source/LuaState.cpp +++ /dev/null @@ -1,1024 +0,0 @@ - -// LuaState.cpp - -// Implements the cLuaState class representing the wrapper over lua_State *, provides associated helper functions - -#include "Globals.h" -#include "LuaState.h" - -extern "C" -{ - #include "lualib.h" -} - -#include "tolua++.h" -#include "Bindings.h" -#include "ManualBindings.h" - -// fwd: SQLite/lsqlite3.c -extern "C" -{ - LUALIB_API int luaopen_lsqlite3(lua_State * L); -} - -// fwd: LuaExpat/lxplib.c: -extern "C" -{ - int luaopen_lxp(lua_State * L); -} - - - - - - -const cLuaState::cRet cLuaState::Return = {}; - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cLuaState: - -cLuaState::cLuaState(const AString & a_SubsystemName) : - m_LuaState(NULL), - m_IsOwned(false), - m_SubsystemName(a_SubsystemName), - m_NumCurrentFunctionArgs(-1) -{ -} - - - - - -cLuaState::cLuaState(lua_State * a_AttachState) : - m_LuaState(a_AttachState), - m_IsOwned(false), - m_SubsystemName("<attached>"), - m_NumCurrentFunctionArgs(-1) -{ -} - - - - - -cLuaState::~cLuaState() -{ - if (IsValid()) - { - if (m_IsOwned) - { - Close(); - } - else - { - Detach(); - } - } -} - - - - - -void cLuaState::Create(void) -{ - if (m_LuaState != NULL) - { - LOGWARNING("%s: Trying to create an already-existing LuaState, ignoring.", __FUNCTION__); - return; - } - m_LuaState = lua_open(); - luaL_openlibs(m_LuaState); - tolua_AllToLua_open(m_LuaState); - ManualBindings::Bind(m_LuaState); - luaopen_lsqlite3(m_LuaState); - luaopen_lxp(m_LuaState); - m_IsOwned = true; -} - - - - - -void cLuaState::Close(void) -{ - if (m_LuaState == NULL) - { - LOGWARNING("%s: Trying to close an invalid LuaState, ignoring.", __FUNCTION__); - return; - } - if (!m_IsOwned) - { - LOGWARNING( - "%s: Detected mis-use, calling Close() on an attached state (0x%p). Detaching instead.", - __FUNCTION__, m_LuaState - ); - Detach(); - return; - } - lua_close(m_LuaState); - m_LuaState = NULL; - m_IsOwned = false; -} - - - - - -void cLuaState::Attach(lua_State * a_State) -{ - if (m_LuaState != NULL) - { - LOGINFO("%s: Already contains a LuaState (0x%p), will be closed / detached.", __FUNCTION__, m_LuaState); - if (m_IsOwned) - { - Close(); - } - else - { - Detach(); - } - } - m_LuaState = a_State; - m_IsOwned = false; -} - - - - - -void cLuaState::Detach(void) -{ - if (m_LuaState == NULL) - { - return; - } - if (m_IsOwned) - { - LOGWARNING( - "%s: Detected a mis-use, calling Detach() when the state is owned. Closing the owned state (0x%p).", - __FUNCTION__, m_LuaState - ); - Close(); - return; - } - m_LuaState = NULL; -} - - - - - -bool cLuaState::LoadFile(const AString & a_FileName) -{ - ASSERT(IsValid()); - - // Load the file: - int s = luaL_loadfile(m_LuaState, a_FileName.c_str()); - if (ReportErrors(s)) - { - LOGWARNING("Can't load %s because of an error in file %s", m_SubsystemName.c_str(), a_FileName.c_str()); - return false; - } - - // Execute the globals: - s = lua_pcall(m_LuaState, 0, LUA_MULTRET, 0); - if (ReportErrors(s)) - { - LOGWARNING("Error in %s in file %s", m_SubsystemName.c_str(), a_FileName.c_str()); - return false; - } - - return true; -} - - - - - -bool cLuaState::HasFunction(const char * a_FunctionName) -{ - if (!IsValid()) - { - // This happens if cPlugin::Initialize() fails with an error - return false; - } - - lua_getglobal(m_LuaState, a_FunctionName); - bool res = (!lua_isnil(m_LuaState, -1) && lua_isfunction(m_LuaState, -1)); - lua_pop(m_LuaState, 1); - return res; -} - - - - - -bool cLuaState::PushFunction(const char * a_FunctionName) -{ - ASSERT(m_NumCurrentFunctionArgs == -1); // If not, there's already something pushed onto the stack - - if (!IsValid()) - { - // This happens if cPlugin::Initialize() fails with an error - return false; - } - - lua_getglobal(m_LuaState, a_FunctionName); - if (!lua_isfunction(m_LuaState, -1)) - { - LOGWARNING("Error in %s: Could not find function %s()", m_SubsystemName.c_str(), a_FunctionName); - lua_pop(m_LuaState, 1); - return false; - } - m_CurrentFunctionName.assign(a_FunctionName); - m_NumCurrentFunctionArgs = 0; - return true; -} - - - - - -bool cLuaState::PushFunction(int a_FnRef) -{ - ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs == -1); // If not, there's already something pushed onto the stack - - lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, a_FnRef); // same as lua_getref() - if (!lua_isfunction(m_LuaState, -1)) - { - lua_pop(m_LuaState, 1); - return false; - } - m_CurrentFunctionName = "<callback>"; - m_NumCurrentFunctionArgs = 0; - return true; -} - - - - - -bool cLuaState::PushFunctionFromRefTable(cRef & a_TableRef, const char * a_FnName) -{ - ASSERT(IsValid()); - ASSERT(m_NumCurrentFunctionArgs == -1); // If not, there's already something pushed onto the stack - - lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, a_TableRef); // Get the table ref - if (!lua_istable(m_LuaState, -1)) - { - // Not a table, bail out - lua_pop(m_LuaState, 1); - return false; - } - lua_getfield(m_LuaState, -1, a_FnName); - if (lua_isnil(m_LuaState, -1) || !lua_isfunction(m_LuaState, -1)) - { - // Not a valid function, bail out - lua_pop(m_LuaState, 2); - return false; - } - lua_remove(m_LuaState, -2); // Remove the table ref from the stack - m_CurrentFunctionName = "<table_callback>"; - m_NumCurrentFunctionArgs = 0; - return true; -} - - - - - -void cLuaState::Push(const AString & a_String) -{ - ASSERT(IsValid()); - - tolua_pushcppstring(m_LuaState, a_String); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(const AStringVector & a_Vector) -{ - ASSERT(IsValid()); - - lua_createtable(m_LuaState, a_Vector.size(), 0); - int newTable = lua_gettop(m_LuaState); - int index = 1; - for (AStringVector::const_iterator itr = a_Vector.begin(), end = a_Vector.end(); itr != end; ++itr, ++index) - { - tolua_pushstring(m_LuaState, itr->c_str()); - lua_rawseti(m_LuaState, newTable, index); - } - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::PushUserType(void * a_Object, const char * a_Type) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Object, a_Type); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(int a_Value) -{ - ASSERT(IsValid()); - - tolua_pushnumber(m_LuaState, a_Value); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(double a_Value) -{ - ASSERT(IsValid()); - - tolua_pushnumber(m_LuaState, a_Value); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(const char * a_Value) -{ - ASSERT(IsValid()); - - tolua_pushstring(m_LuaState, a_Value); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(bool a_Value) -{ - ASSERT(IsValid()); - - tolua_pushboolean(m_LuaState, a_Value ? 1 : 0); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cWorld * a_World) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_World, "cWorld"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cPlayer * a_Player) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Player, "cPlayer"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(const cPlayer * a_Player) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, (void *)a_Player, "cPlayer"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cEntity * a_Entity) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Entity, "cEntity"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cMonster * a_Monster) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Monster, "cMonster"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cItem * a_Item) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Item, "cItem"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cItems * a_Items) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Items, "cItems"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cClientHandle * a_Client) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Client, "cClientHandle"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cPickup * a_Pickup) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Pickup, "cPickup"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cChunkDesc * a_ChunkDesc) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_ChunkDesc, "cChunkDesc"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(const cCraftingGrid * a_Grid) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, (void *)a_Grid, "cCraftingGrid"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(const cCraftingRecipe * a_Recipe) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, (void *)a_Recipe, "cCraftingRecipe"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(TakeDamageInfo * a_TDI) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_TDI, "TakeDamageInfo"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cWindow * a_Window) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Window, "cWindow"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cPluginLua * a_Plugin) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Plugin, "cPluginLua"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(const HTTPRequest * a_Request) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPRequest"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cWebAdmin * a_WebAdmin) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_WebAdmin, "cWebAdmin"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(const HTTPTemplateRequest * a_Request) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPTemplateRequest"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cTNTEntity * a_TNTEntity) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_TNTEntity, "cTNTEntity"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cCreeper * a_Creeper) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Creeper, "cCreeper"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(Vector3i * a_Vector) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Vector, "Vector3i"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(void * a_Ptr) -{ - ASSERT(IsValid()); - - lua_pushnil(m_LuaState); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cHopperEntity * a_Hopper) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_Hopper, "cHopperEntity"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::Push(cBlockEntity * a_BlockEntity) -{ - ASSERT(IsValid()); - - tolua_pushusertype(m_LuaState, a_BlockEntity, "cBlockEntity"); - m_NumCurrentFunctionArgs += 1; -} - - - - - -void cLuaState::GetReturn(int a_StackPos, bool & a_ReturnedVal) -{ - a_ReturnedVal = (tolua_toboolean(m_LuaState, a_StackPos, a_ReturnedVal ? 1 : 0) > 0); -} - - - - - -void cLuaState::GetReturn(int a_StackPos, AString & a_ReturnedVal) -{ - if (lua_isstring(m_LuaState, a_StackPos)) - { - a_ReturnedVal = tolua_tocppstring(m_LuaState, a_StackPos, a_ReturnedVal.c_str()); - } -} - - - - - -void cLuaState::GetReturn(int a_StackPos, int & a_ReturnedVal) -{ - if (lua_isnumber(m_LuaState, a_StackPos)) - { - a_ReturnedVal = (int)tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal); - } -} - - - - - -void cLuaState::GetReturn(int a_StackPos, double & a_ReturnedVal) -{ - if (lua_isnumber(m_LuaState, a_StackPos)) - { - a_ReturnedVal = tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal); - } -} - - - - - -bool cLuaState::CallFunction(int a_NumResults) -{ - ASSERT (m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first - ASSERT(lua_isfunction(m_LuaState, -m_NumCurrentFunctionArgs - 1)); - - int s = lua_pcall(m_LuaState, m_NumCurrentFunctionArgs, a_NumResults, 0); - if (ReportErrors(s)) - { - LOGWARNING("Error in %s calling function %s()", m_SubsystemName.c_str(), m_CurrentFunctionName.c_str()); - m_NumCurrentFunctionArgs = -1; - m_CurrentFunctionName.clear(); - return false; - } - m_NumCurrentFunctionArgs = -1; - m_CurrentFunctionName.clear(); - return true; -} - - - - - -bool cLuaState::CheckParamUserTable(int a_StartParam, const char * a_UserTable, int a_EndParam) -{ - ASSERT(IsValid()); - - if (a_EndParam < 0) - { - a_EndParam = a_StartParam; - } - - tolua_Error tolua_err; - for (int i = a_StartParam; i <= a_EndParam; i++) - { - if (tolua_isusertable(m_LuaState, i, a_UserTable, 0, &tolua_err)) - { - continue; - } - // Not the correct parameter - lua_Debug entry; - VERIFY(lua_getstack(m_LuaState, 0, &entry)); - VERIFY(lua_getinfo (m_LuaState, "n", &entry)); - AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?"); - tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); - return false; - } // for i - Param - - // All params checked ok - return true; -} - - - - - -bool cLuaState::CheckParamUserType(int a_StartParam, const char * a_UserType, int a_EndParam) -{ - ASSERT(IsValid()); - - if (a_EndParam < 0) - { - a_EndParam = a_StartParam; - } - - tolua_Error tolua_err; - for (int i = a_StartParam; i <= a_EndParam; i++) - { - if (tolua_isusertype(m_LuaState, i, a_UserType, 0, &tolua_err)) - { - continue; - } - // Not the correct parameter - lua_Debug entry; - VERIFY(lua_getstack(m_LuaState, 0, &entry)); - VERIFY(lua_getinfo (m_LuaState, "n", &entry)); - AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?"); - tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); - return false; - } // for i - Param - - // All params checked ok - return true; -} - - - - - -bool cLuaState::CheckParamTable(int a_StartParam, int a_EndParam) -{ - ASSERT(IsValid()); - - if (a_EndParam < 0) - { - a_EndParam = a_StartParam; - } - - tolua_Error tolua_err; - for (int i = a_StartParam; i <= a_EndParam; i++) - { - if (tolua_istable(m_LuaState, i, 0, &tolua_err)) - { - continue; - } - // Not the correct parameter - lua_Debug entry; - VERIFY(lua_getstack(m_LuaState, 0, &entry)); - VERIFY(lua_getinfo (m_LuaState, "n", &entry)); - AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?"); - tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); - return false; - } // for i - Param - - // All params checked ok - return true; -} - - - - - -bool cLuaState::CheckParamNumber(int a_StartParam, int a_EndParam) -{ - ASSERT(IsValid()); - - if (a_EndParam < 0) - { - a_EndParam = a_StartParam; - } - - tolua_Error tolua_err; - for (int i = a_StartParam; i <= a_EndParam; i++) - { - if (tolua_isnumber(m_LuaState, i, 0, &tolua_err)) - { - continue; - } - // Not the correct parameter - lua_Debug entry; - VERIFY(lua_getstack(m_LuaState, 0, &entry)); - VERIFY(lua_getinfo (m_LuaState, "n", &entry)); - AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?"); - tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); - return false; - } // for i - Param - - // All params checked ok - return true; -} - - - - - -bool cLuaState::CheckParamString(int a_StartParam, int a_EndParam) -{ - ASSERT(IsValid()); - - if (a_EndParam < 0) - { - a_EndParam = a_StartParam; - } - - tolua_Error tolua_err; - for (int i = a_StartParam; i <= a_EndParam; i++) - { - if (tolua_isstring(m_LuaState, i, 0, &tolua_err)) - { - continue; - } - // Not the correct parameter - lua_Debug entry; - VERIFY(lua_getstack(m_LuaState, 0, &entry)); - VERIFY(lua_getinfo (m_LuaState, "n", &entry)); - AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?"); - tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); - return false; - } // for i - Param - - // All params checked ok - return true; -} - - - - - -bool cLuaState::CheckParamEnd(int a_Param) -{ - tolua_Error tolua_err; - if (tolua_isnoobj(m_LuaState, a_Param, &tolua_err)) - { - return true; - } - // Not the correct parameter - lua_Debug entry; - VERIFY(lua_getstack(m_LuaState, 0, &entry)); - VERIFY(lua_getinfo (m_LuaState, "n", &entry)); - AString ErrMsg = Printf("#ferror in function '%s': Too many arguments.", (entry.name != NULL) ? entry.name : "?"); - tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); - return false; -} - - - - - -bool cLuaState::ReportErrors(int a_Status) -{ - return ReportErrors(m_LuaState, a_Status); -} - - - - - -bool cLuaState::ReportErrors(lua_State * a_LuaState, int a_Status) -{ - if (a_Status == 0) - { - // No error to report - return false; - } - - LOGWARNING("LUA: %d - %s", a_Status, lua_tostring(a_LuaState, -1)); - lua_pop(a_LuaState, 1); - return true; -} - - - - - -void cLuaState::LogStackTrace(void) -{ - LOGWARNING("Stack trace:"); - lua_Debug entry; - int depth = 0; - while (lua_getstack(m_LuaState, depth, &entry)) - { - int status = lua_getinfo(m_LuaState, "Sln", &entry); - assert(status); - - LOGWARNING(" %s(%d): %s", entry.short_src, entry.currentline, entry.name ? entry.name : "?"); - depth++; - } - LOGWARNING("Stack trace end"); -} - - - - - -AString cLuaState::GetTypeText(int a_StackPos) -{ - int Type = lua_type(m_LuaState, a_StackPos); - switch (Type) - { - case LUA_TNONE: return "TNONE"; - case LUA_TNIL: return "TNIL"; - case LUA_TBOOLEAN: return "TBOOLEAN"; - case LUA_TLIGHTUSERDATA: return "TLIGHTUSERDATA"; - case LUA_TNUMBER: return "TNUMBER"; - case LUA_TSTRING: return "TSTRING"; - case LUA_TTABLE: return "TTABLE"; - case LUA_TFUNCTION: return "TFUNCTION"; - case LUA_TUSERDATA: return "TUSERDATA"; - case LUA_TTHREAD: return "TTHREAD"; - } - return Printf("Unknown (%d)", Type); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cLuaState::cRef: - -cLuaState::cRef::cRef(cLuaState & a_LuaState, int a_StackPos) : - m_LuaState(a_LuaState) -{ - ASSERT(m_LuaState.IsValid()); - - lua_pushvalue(m_LuaState, a_StackPos); // Push a copy of the value at a_StackPos onto the stack - m_Ref = luaL_ref(m_LuaState, LUA_REGISTRYINDEX); -} - - - - - -cLuaState::cRef::~cRef() -{ - ASSERT(m_LuaState.IsValid()); - - if (IsValid()) - { - luaL_unref(m_LuaState, LUA_REGISTRYINDEX, m_Ref); - } -} - - - - diff --git a/source/LuaState.h b/source/LuaState.h deleted file mode 100644 index aa71ee226..000000000 --- a/source/LuaState.h +++ /dev/null @@ -1,817 +0,0 @@ - -// LuaState.h - -// Declares the cLuaState class representing the wrapper over lua_State *, provides associated helper functions - -/* -The contained lua_State can be either owned or attached. -Owned lua_State is created by calling Create() and the cLuaState automatically closes the state -Or, lua_State can be attached by calling Attach(), the cLuaState doesn't close such a state -Attaching a state will automatically close an owned state. - -Calling a Lua function is done by pushing the function, either by PushFunction() or PushFunctionFromRegistry(), -then pushing the arguments (PushString(), PushNumber(), PushUserData() etc.) and finally -executing CallFunction(). cLuaState automatically keeps track of the number of arguments and the name of the -function (for logging purposes), which makes the call less error-prone. - -Reference management is provided by the cLuaState::cRef class. This is used when you need to hold a reference to -any Lua object across several function calls; usually this is used for callbacks. The class is RAII-like, with -automatic resource management. -*/ - - - - -#pragma once - -extern "C" -{ - #include "lauxlib.h" -} - - - - - -class cWorld; -class cPlayer; -class cEntity; -class cMonster; -class cItem; -class cItems; -class cClientHandle; -class cPickup; -class cChunkDesc; -class cCraftingGrid; -class cCraftingRecipe; -struct TakeDamageInfo; -class cWindow; -class cPluginLua; -struct HTTPRequest; -class cWebAdmin; -struct HTTPTemplateRequest; -class cTNTEntity; -class cCreeper; -class Vector3i; -class cHopperEntity; -class cBlockEntity; - - - - - -/// Encapsulates a Lua state and provides some syntactic sugar for common operations -class cLuaState -{ -public: - - /// Used for storing references to object in the global registry - class cRef - { - public: - /// Creates a reference in the specified LuaState for object at the specified StackPos - cRef(cLuaState & a_LuaState, int a_StackPos); - ~cRef(); - - /// Returns true if the reference is valid - bool IsValid(void) const {return (m_Ref != LUA_REFNIL); } - - /// Allows to use this class wherever an int (i. e. ref) is to be used - operator int(void) const { return m_Ref; } - - protected: - cLuaState & m_LuaState; - int m_Ref; - } ; - - - /// A dummy class that's used only to delimit function args from return values for cLuaState::Call() - class cRet - { - } ; - - static const cRet Return; // Use this constant to delimit function args from return values for cLuaState::Call() - - - /** Creates a new instance. The LuaState is not initialized. - a_SubsystemName is used for reporting problems in the console, it is "plugin %s" for plugins, - or "LuaScript" for the cLuaScript template - */ - cLuaState(const AString & a_SubsystemName); - - /** Creates a new instance. The a_AttachState is attached. - Subsystem name is set to "<attached>". - */ - explicit cLuaState(lua_State * a_AttachState); - - ~cLuaState(); - - /// Allows this object to be used in the same way as a lua_State *, for example in the LuaLib functions - operator lua_State * (void) { return m_LuaState; } - - /// Creates the m_LuaState, if not closed already. This state will be automatically closed in the destructor - void Create(void); - - /// Closes the m_LuaState, if not closed already - void Close(void); - - /// Attaches the specified state. Operations will be carried out on this state, but it will not be closed in the destructor - void Attach(lua_State * a_State); - - /// Detaches a previously attached state. - void Detach(void); - - /// Returns true if the m_LuaState is valid - bool IsValid(void) const { return (m_LuaState != NULL); } - - /** Loads the specified file - Returns false and logs a warning to the console if not successful (but the LuaState is kept open). - m_SubsystemName is displayed in the warning log message. - */ - bool LoadFile(const AString & a_FileName); - - /// Returns true if a_FunctionName is a valid Lua function that can be called - bool HasFunction(const char * a_FunctionName); - - /** Pushes the function of the specified name onto the stack. - Returns true if successful. Logs a warning on failure (incl. m_SubsystemName) - */ - bool PushFunction(const char * a_FunctionName); - - /** Pushes a function that has been saved into the global registry, identified by a_FnRef. - Returns true if successful. Logs a warning on failure - */ - bool PushFunction(int a_FnRef); - - /** Pushes a function that is stored in a table ref. - Returns true if successful, false on failure. Doesn't log failure. - */ - bool PushFunctionFromRefTable(cRef & a_TableRef, const char * a_FnName); - - /// Pushes a usertype of the specified class type onto the stack - void PushUserType(void * a_Object, const char * a_Type); - - // Push a value onto the stack - void Push(const AString & a_String); - void Push(const AStringVector & a_Vector); - void Push(int a_Value); - void Push(double a_Value); - void Push(const char * a_Value); - void Push(bool a_Value); - void Push(cWorld * a_World); - void Push(cPlayer * a_Player); - void Push(const cPlayer * a_Player); - void Push(cEntity * a_Entity); - void Push(cMonster * a_Monster); - void Push(cItem * a_Item); - void Push(cItems * a_Items); - void Push(cClientHandle * a_ClientHandle); - void Push(cPickup * a_Pickup); - void Push(cChunkDesc * a_ChunkDesc); - void Push(const cCraftingGrid * a_Grid); - void Push(const cCraftingRecipe * a_Recipe); - void Push(TakeDamageInfo * a_TDI); - void Push(cWindow * a_Window); - void Push(cPluginLua * a_Plugin); - void Push(const HTTPRequest * a_Request); - void Push(cWebAdmin * a_WebAdmin); - void Push(const HTTPTemplateRequest * a_Request); - void Push(cTNTEntity * a_TNTEntity); - void Push(cCreeper * a_Creeper); - void Push(Vector3i * a_Vector); - void Push(void * a_Ptr); - void Push(cHopperEntity * a_Hopper); - void Push(cBlockEntity * a_BlockEntity); - - /// Call any 0-param 0-return Lua function in a single line: - template <typename FnT> - bool Call(FnT a_FnName) - { - if (!PushFunction(a_FnName)) - { - return false; - } - return CallFunction(0); - } - - /// Call any 1-param 0-return Lua function in a single line: - template< - typename FnT, - typename ArgT1 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - return CallFunction(0); - } - - /// Call any 2-param 0-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - return CallFunction(0); - } - - /// Call any 1-param 1-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename RetT1 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, const cRet & a_Mark, RetT1 & a_Ret1) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - if (!CallFunction(1)) - { - return false; - } - GetReturn(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; - } - - /// Call any 2-param 1-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename RetT1 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, const cRet & a_Mark, RetT1 & a_Ret1) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - if (!CallFunction(1)) - { - return false; - } - GetReturn(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; - } - - /// Call any 3-param 1-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename RetT1 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, const cRet & a_Mark, RetT1 & a_Ret1) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - if (!CallFunction(1)) - { - return false; - } - GetReturn(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; - } - - /// Call any 4-param 1-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename RetT1 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, const cRet & a_Mark, RetT1 & a_Ret1) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - if (!CallFunction(1)) - { - return false; - } - GetReturn(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; - } - - /// Call any 5-param 1-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename RetT1 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, const cRet & a_Mark, RetT1 & a_Ret1) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - Push(a_Arg5); - if (!CallFunction(1)) - { - return false; - } - GetReturn(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; - } - - /// Call any 6-param 1-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename ArgT6, - typename RetT1 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, const cRet & a_Mark, RetT1 & a_Ret1) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - Push(a_Arg5); - Push(a_Arg6); - if (!CallFunction(1)) - { - return false; - } - GetReturn(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; - } - - /// Call any 7-param 1-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename ArgT6, - typename ArgT7, typename RetT1 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - Push(a_Arg5); - Push(a_Arg6); - Push(a_Arg7); - if (!CallFunction(1)) - { - return false; - } - GetReturn(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; - } - - /// Call any 8-param 1-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename ArgT6, - typename ArgT7, typename ArgT8, typename RetT1 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, const cRet & a_Mark, RetT1 & a_Ret1) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - Push(a_Arg5); - Push(a_Arg6); - Push(a_Arg7); - Push(a_Arg8); - if (!CallFunction(1)) - { - return false; - } - GetReturn(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; - } - - /// Call any 9-param 1-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename ArgT6, - typename ArgT7, typename ArgT8, typename ArgT9, typename RetT1 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, const cRet & a_Mark, RetT1 & a_Ret1) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - Push(a_Arg5); - Push(a_Arg6); - Push(a_Arg7); - Push(a_Arg8); - Push(a_Arg9); - if (!CallFunction(1)) - { - return false; - } - GetReturn(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; - } - - /// Call any 10-param 1-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename ArgT6, - typename ArgT7, typename ArgT8, typename ArgT9, typename ArgT10, typename RetT1 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, ArgT10 a_Arg10, const cRet & a_Mark, RetT1 & a_Ret1) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - Push(a_Arg5); - Push(a_Arg6); - Push(a_Arg7); - Push(a_Arg8); - Push(a_Arg9); - Push(a_Arg10); - if (!CallFunction(1)) - { - return false; - } - GetReturn(-1, a_Ret1); - lua_pop(m_LuaState, 1); - return true; - } - - /// Call any 1-param 2-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename RetT1, typename RetT2 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - if (!CallFunction(2)) - { - return false; - } - GetReturn(-2, a_Ret1); - GetReturn(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; - } - - /// Call any 2-param 2-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename RetT1, typename RetT2 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - if (!CallFunction(2)) - { - return false; - } - GetReturn(-2, a_Ret1); - GetReturn(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; - } - - /// Call any 3-param 2-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, - typename RetT1, typename RetT2 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - if (!CallFunction(2)) - { - return false; - } - GetReturn(-2, a_Ret1); - GetReturn(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; - } - - /// Call any 4-param 2-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, - typename RetT1, typename RetT2 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - if (!CallFunction(2)) - { - return false; - } - GetReturn(-2, a_Ret1); - GetReturn(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; - } - - /// Call any 5-param 2-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, - typename RetT1, typename RetT2 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - Push(a_Arg5); - if (!CallFunction(2)) - { - return false; - } - GetReturn(-2, a_Ret1); - GetReturn(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; - } - - /// Call any 6-param 2-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, - typename ArgT6, - typename RetT1, typename RetT2 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - Push(a_Arg5); - Push(a_Arg6); - if (!CallFunction(2)) - { - return false; - } - GetReturn(-2, a_Ret1); - GetReturn(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; - } - - /// Call any 7-param 2-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, - typename ArgT6, typename ArgT7, - typename RetT1, typename RetT2 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - Push(a_Arg5); - Push(a_Arg6); - Push(a_Arg7); - if (!CallFunction(2)) - { - return false; - } - GetReturn(-2, a_Ret1); - GetReturn(-1, a_Ret2); - lua_pop(m_LuaState, 2); - return true; - } - - /// Call any 7-param 3-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, - typename ArgT6, typename ArgT7, - typename RetT1, typename RetT2, typename RetT3 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - Push(a_Arg5); - Push(a_Arg6); - Push(a_Arg7); - if (!CallFunction(3)) - { - return false; - } - GetReturn(-3, a_Ret1); - GetReturn(-2, a_Ret2); - GetReturn(-1, a_Ret3); - lua_pop(m_LuaState, 3); - return true; - } - - /// Call any 8-param 3-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, - typename ArgT6, typename ArgT7, typename ArgT8, - typename RetT1, typename RetT2, typename RetT3 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - Push(a_Arg5); - Push(a_Arg6); - Push(a_Arg7); - Push(a_Arg8); - if (!CallFunction(3)) - { - return false; - } - GetReturn(-3, a_Ret1); - GetReturn(-2, a_Ret2); - GetReturn(-1, a_Ret3); - lua_pop(m_LuaState, 3); - return true; - } - - /// Call any 9-param 5-return Lua function in a single line: - template< - typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, - typename ArgT6, typename ArgT7, typename ArgT8, typename ArgT9, - typename RetT1, typename RetT2, typename RetT3, typename RetT4, typename RetT5 - > - bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3, RetT4 & a_Ret4, RetT5 & a_Ret5) - { - if (!PushFunction(a_FnName)) - { - return false; - } - Push(a_Arg1); - Push(a_Arg2); - Push(a_Arg3); - Push(a_Arg4); - Push(a_Arg5); - Push(a_Arg6); - Push(a_Arg7); - Push(a_Arg8); - Push(a_Arg9); - if (!CallFunction(5)) - { - return false; - } - GetReturn(-5, a_Ret1); - GetReturn(-4, a_Ret2); - GetReturn(-3, a_Ret3); - GetReturn(-2, a_Ret4); - GetReturn(-1, a_Ret5); - lua_pop(m_LuaState, 5); - return true; - } - - - /// Retrieve value returned at a_StackPos, if it is a valid bool. If not, a_ReturnedVal is unchanged - void GetReturn(int a_StackPos, bool & a_ReturnedVal); - - /// Retrieve value returned at a_StackPos, if it is a valid string. If not, a_ReturnedVal is unchanged - void GetReturn(int a_StackPos, AString & a_ReturnedVal); - - /// Retrieve value returned at a_StackPos, if it is a valid number. If not, a_ReturnedVal is unchanged - void GetReturn(int a_StackPos, int & a_ReturnedVal); - - /// Retrieve value returned at a_StackPos, if it is a valid number. If not, a_ReturnedVal is unchanged - void GetReturn(int a_StackPos, double & a_ReturnedVal); - - /** - Calls the function that has been pushed onto the stack by PushFunction(), - with arguments pushed by PushXXX(). - Returns true if successful, logs a warning on failure. - */ - bool CallFunction(int a_NumReturnValues); - - /// Returns true if the specified parameters on the stack are of the specified usertable type; also logs warning if not. Used for static functions - bool CheckParamUserTable(int a_StartParam, const char * a_UserTable, int a_EndParam = -1); - - /// Returns true if the specified parameters on the stack are of the specified usertype; also logs warning if not. Used for regular functions - bool CheckParamUserType(int a_StartParam, const char * a_UserType, int a_EndParam = -1); - - /// Returns true if the specified parameters on the stack are tables; also logs warning if not - bool CheckParamTable(int a_StartParam, int a_EndParam = -1); - - /// Returns true if the specified parameters on the stack are numbers; also logs warning if not - bool CheckParamNumber(int a_StartParam, int a_EndParam = -1); - - /// Returns true if the specified parameters on the stack are strings; also logs warning if not - bool CheckParamString(int a_StartParam, int a_EndParam = -1); - - /// Returns true if the specified parameter on the stack is nil (indicating an end-of-parameters) - bool CheckParamEnd(int a_Param); - - /// If the status is nonzero, prints the text on the top of Lua stack and returns true - bool ReportErrors(int status); - - /// If the status is nonzero, prints the text on the top of Lua stack and returns true - static bool ReportErrors(lua_State * a_LuaState, int status); - - /// Logs all items in the current stack trace to the server console - void LogStackTrace(void); - - /// Returns the type of the item on the specified position in the stack - AString GetTypeText(int a_StackPos); - -protected: - lua_State * m_LuaState; - - /// If true, the state is owned by this object and will be auto-Closed. False => attached state - bool m_IsOwned; - - /** The subsystem name is used for reporting errors to the console, it is either "plugin %s" or "LuaScript" - whatever is given to the constructor - */ - AString m_SubsystemName; - - /// Name of the currently pushed function (for the Push / Call chain) - AString m_CurrentFunctionName; - - /// Number of arguments currently pushed (for the Push / Call chain) - int m_NumCurrentFunctionArgs; -} ; - - - - diff --git a/source/LuaWindow.cpp b/source/LuaWindow.cpp deleted file mode 100644 index 9011d668c..000000000 --- a/source/LuaWindow.cpp +++ /dev/null @@ -1,185 +0,0 @@ - -// LuaWindow.cpp - -// Implements the cLuaWindow class representing a virtual window that plugins may create and open for the player - -#include "Globals.h" -#include "LuaWindow.h" -#include "UI/SlotArea.h" -#include "PluginLua.h" -#include "Entities/Player.h" -#include "lauxlib.h" // Needed for LUA_REFNIL - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cLuaWindow: - -cLuaWindow::cLuaWindow(cWindow::WindowType a_WindowType, int a_SlotsX, int a_SlotsY, const AString & a_Title) : - super(a_WindowType, a_Title), - m_Contents(a_SlotsX, a_SlotsY), - m_Plugin(NULL), - m_LuaRef(LUA_REFNIL), - m_OnClosingFnRef(LUA_REFNIL), - m_OnSlotChangedFnRef(LUA_REFNIL) -{ - m_Contents.AddListener(*this); - m_SlotAreas.push_back(new cSlotAreaItemGrid(m_Contents, *this)); - - // If appropriate, add an Armor slot area: - switch (a_WindowType) - { - case cWindow::wtInventory: - case cWindow::wtWorkbench: - { - m_SlotAreas.push_back(new cSlotAreaArmor(*this)); - break; - } - } - m_SlotAreas.push_back(new cSlotAreaInventory(*this)); - m_SlotAreas.push_back(new cSlotAreaHotBar(*this)); -} - - - - - -cLuaWindow::~cLuaWindow() -{ - m_Contents.RemoveListener(*this); - - // Must delete slot areas now, because they are referencing this->m_Contents and would try to access it in cWindow's - // destructor, when the member is already gone. - for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr) - { - delete *itr; - } - m_SlotAreas.clear(); - - ASSERT(m_OpenedBy.empty()); -} - - - - - -void cLuaWindow::SetLuaRef(cPluginLua * a_Plugin, int a_LuaRef) -{ - // Either m_Plugin is not set or equal to the passed plugin; only one plugin can use one cLuaWindow object - ASSERT((m_Plugin == NULL) || (m_Plugin == a_Plugin)); - ASSERT(m_LuaRef == LUA_REFNIL); - m_Plugin = a_Plugin; - m_LuaRef = a_LuaRef; -} - - - - - -bool cLuaWindow::IsLuaReferenced(void) const -{ - return ((m_Plugin != NULL) && (m_LuaRef != LUA_REFNIL)); -} - - - - - -void cLuaWindow::SetOnClosing(cPluginLua * a_Plugin, int a_FnRef) -{ - // Either m_Plugin is not set or equal to the passed plugin; only one plugin can use one cLuaWindow object - ASSERT((m_Plugin == NULL) || (m_Plugin == a_Plugin)); - - // If there already was a function, unreference it first - if (m_OnClosingFnRef != LUA_REFNIL) - { - m_Plugin->Unreference(m_OnClosingFnRef); - } - - // Store the new reference - m_Plugin = a_Plugin; - m_OnClosingFnRef = a_FnRef; -} - - - - - -void cLuaWindow::SetOnSlotChanged(cPluginLua * a_Plugin, int a_FnRef) -{ - // Either m_Plugin is not set or equal to the passed plugin; only one plugin can use one cLuaWindow object - ASSERT((m_Plugin == NULL) || (m_Plugin == a_Plugin)); - - // If there already was a function, unreference it first - if (m_OnSlotChangedFnRef != LUA_REFNIL) - { - m_Plugin->Unreference(m_OnSlotChangedFnRef); - } - - // Store the new reference - m_Plugin = a_Plugin; - m_OnSlotChangedFnRef = a_FnRef; -} - - - - - -bool cLuaWindow::ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse) -{ - // First notify the plugin through the registered callback: - if (m_OnClosingFnRef != LUA_REFNIL) - { - ASSERT(m_Plugin != NULL); - if (m_Plugin->CallbackWindowClosing(m_OnClosingFnRef, *this, a_Player, a_CanRefuse)) - { - // The callback disagrees (the higher levels check the CanRefuse flag compliance) - return false; - } - } - - return super::ClosedByPlayer(a_Player, a_CanRefuse); -} - - - - - -void cLuaWindow::Destroy(void) -{ - super::Destroy(); - - if ((m_LuaRef != LUA_REFNIL) && (m_Plugin != NULL)) - { - // The object is referenced by Lua, un-reference it - m_Plugin->Unreference(m_LuaRef); - } - - // Lua will take care of this object, it will garbage-collect it, so we *must not* delete it! - m_IsDestroyed = false; -} - - - - - -void cLuaWindow::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) -{ - if (a_ItemGrid != &m_Contents) - { - ASSERT(!"Invalid ItemGrid in callback"); - return; - } - - // If an OnSlotChanged callback has been registered, call it: - if (m_OnSlotChangedFnRef != LUA_REFNIL) - { - m_Plugin->CallbackWindowSlotChanged(m_OnSlotChangedFnRef, *this, a_SlotNum); - } -} - - - - diff --git a/source/MonsterConfig.cpp b/source/MonsterConfig.cpp deleted file mode 100644 index a5a1ebd49..000000000 --- a/source/MonsterConfig.cpp +++ /dev/null @@ -1,104 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "MonsterConfig.h" -#include "Mobs/Monster.h" -#include "../iniFile/iniFile.h" -//#include <cstdio> - - - - - -struct cMonsterConfig::sAttributesStruct -{ - AString m_Name; - double m_SightDistance; - double m_AttackDamage; - double m_AttackRange; - double m_AttackRate; - int m_MaxHealth; -}; - - - - - -struct cMonsterConfig::sMonsterConfigState -{ - AString MonsterTypes; - std::list< sAttributesStruct > AttributesList; -}; - - - - - -cMonsterConfig::cMonsterConfig(void) - : m_pState( new sMonsterConfigState ) -{ - Initialize(); -} - - - - - -cMonsterConfig::~cMonsterConfig() -{ - delete m_pState; -} - - - - - -void cMonsterConfig::Initialize() -{ - cIniFile MonstersIniFile; - - if (!MonstersIniFile.ReadFile("monsters.ini")) - { - LOGWARNING("%s: Cannot read monsters.ini file, monster attributes not available", __FUNCTION__); - return; - } - - for (int i = (int)MonstersIniFile.GetNumKeys(); i >= 0; i--) - { - sAttributesStruct Attributes; - AString Name = MonstersIniFile.GetKeyName(i); - Attributes.m_Name = Name; - Attributes.m_AttackDamage = MonstersIniFile.GetValueF(Name, "AttackDamage", 0); - Attributes.m_AttackRange = MonstersIniFile.GetValueF(Name, "AttackRange", 0); - Attributes.m_SightDistance = MonstersIniFile.GetValueF(Name, "SightDistance", 0); - Attributes.m_AttackRate = MonstersIniFile.GetValueF(Name, "AttackRate", 0); - Attributes.m_MaxHealth = MonstersIniFile.GetValueI(Name, "MaxHealth", 1); - m_pState->AttributesList.push_front(Attributes); - } // for i - SplitList[] -} - - - - - -void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Name) -{ - std::list<sAttributesStruct>::const_iterator itr; - for (itr = m_pState->AttributesList.begin(); itr != m_pState->AttributesList.end(); ++itr) - { - if (itr->m_Name.compare(a_Name) == 0) - { - a_Monster->SetAttackDamage ((float)itr->m_AttackDamage); - a_Monster->SetAttackRange ((float)itr->m_AttackRange); - a_Monster->SetSightDistance((float)itr->m_SightDistance); - a_Monster->SetAttackRate ((int)itr->m_AttackRate); - a_Monster->SetMaxHealth (itr->m_MaxHealth); - return; - } - } // for itr - m_pState->AttributesList[] -} - - - - - diff --git a/source/OSSupport/GZipFile.h b/source/OSSupport/GZipFile.h deleted file mode 100644 index e5aa68afa..000000000 --- a/source/OSSupport/GZipFile.h +++ /dev/null @@ -1,52 +0,0 @@ - -// GZipFile.h - -// Declares the cGZipFile class representing a RAII wrapper over zlib's GZip file routines - - - - - -#pragma once - -#include "zlib.h" - - - - - -class cGZipFile -{ -public: - enum eMode - { - fmRead, // Read-only. If the file doesn't exist, object will not be valid - fmWrite, // Write-only. If the file already exists, it will be overwritten - } ; - - cGZipFile(void); - ~cGZipFile(); - - /// Opens the file. Returns true if successful. Fails if a file has already been opened through this object. - bool Open(const AString & a_FileName, eMode a_Mode); - - /// Closes the file, flushing all buffers. This object may be then reused for a different file and / or mode - void Close(void); - - /// Reads the rest of the file and decompresses it into a_Contents. Returns the number of decompressed bytes, <0 for error - int ReadRestOfFile(AString & a_Contents); - - /// Writes a_Contents into file, compressing it along the way. Returns true if successful. Multiple writes are supported. - bool Write(const AString & a_Contents) { return Write(a_Contents.data(), (int)(a_Contents.size())); } - - bool Write(const char * a_Data, int a_Size); - -protected: - gzFile m_File; - eMode m_Mode; -} ; - - - - - diff --git a/source/PluginLua.cpp b/source/PluginLua.cpp deleted file mode 100644 index 23d079b05..000000000 --- a/source/PluginLua.cpp +++ /dev/null @@ -1,1471 +0,0 @@ - -// PluginLua.cpp - -// Implements the cPluginLua class representing a plugin written in Lua - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#define LUA_USE_POSIX -#include "PluginLua.h" -#include "CommandOutput.h" - -extern "C" -{ - #include "lualib.h" -} - -#include "tolua++.h" - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cPluginLua: - -cPluginLua::cPluginLua(const AString & a_PluginDirectory) : - cPlugin(a_PluginDirectory), - m_LuaState(Printf("plugin %s", a_PluginDirectory.c_str())) -{ -} - - - - - -cPluginLua::~cPluginLua() -{ - cCSLock Lock(m_CriticalSection); - Close(); -} - - - - - -void cPluginLua::Close(void) -{ - if (m_LuaState.IsValid()) - { - // Release all the references in the hook map: - for (cHookMap::iterator itrH = m_HookMap.begin(), endH = m_HookMap.end(); itrH != endH; ++itrH) - { - for (cLuaRefs::iterator itrR = itrH->second.begin(), endR = itrH->second.end(); itrR != endR; ++itrR) - { - delete *itrR; - } // for itrR - itrH->second[] - } // for itrH - m_HookMap[] - m_HookMap.clear(); - - m_LuaState.Close(); - } - else - { - ASSERT(m_HookMap.empty()); - } -} - - - - - -bool cPluginLua::Initialize(void) -{ - cCSLock Lock(m_CriticalSection); - if (!m_LuaState.IsValid()) - { - m_LuaState.Create(); - - // Inject the identification global variables into the state: - lua_pushlightuserdata(m_LuaState, this); - lua_setglobal(m_LuaState, LUA_PLUGIN_INSTANCE_VAR_NAME); - lua_pushstring(m_LuaState, GetName().c_str()); - lua_setglobal(m_LuaState, LUA_PLUGIN_NAME_VAR_NAME); - - tolua_pushusertype(m_LuaState, this, "cPluginLua"); - lua_setglobal(m_LuaState, "g_Plugin"); - } - - std::string PluginPath = FILE_IO_PREFIX + GetLocalFolder() + "/"; - - // Load all files for this plugin, and execute them - AStringVector Files = cFile::GetFolderContents(PluginPath.c_str()); - for (AStringVector::const_iterator itr = Files.begin(); itr != Files.end(); ++itr) - { - if (itr->rfind(".lua") == AString::npos) - { - continue; - } - AString Path = PluginPath + *itr; - if (!m_LuaState.LoadFile(Path)) - { - Close(); - return false; - } - } // for itr - Files[] - - // Call intialize function - bool res = false; - if (!m_LuaState.Call("Initialize", this, cLuaState::Return, res)) - { - LOGWARNING("Error in plugin %s: Cannot call the Initialize() function. Plugin is temporarily disabled.", GetName().c_str()); - Close(); - return false; - } - - if (!res) - { - LOGINFO("Plugin %s: Initialize() call failed, plugin is temporarily disabled.", GetName().c_str()); - Close(); - return false; - } - - return true; -} - - - - - -void cPluginLua::OnDisable(void) -{ - cCSLock Lock(m_CriticalSection); - if (!m_LuaState.HasFunction("OnDisable")) - { - return; - } - m_LuaState.Call("OnDisable"); -} - - - - - -void cPluginLua::Tick(float a_Dt) -{ - cCSLock Lock(m_CriticalSection); - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_TICK]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_Dt); - } -} - - - - - -bool cPluginLua::OnBlockToPickups(cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_BLOCK_TO_PICKUPS]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_World, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, &a_Pickups, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnChat(cPlayer * a_Player, AString & a_Message) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CHAT]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_Player, a_Message, cLuaState::Return, res, a_Message); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnChunkAvailable(cWorld * a_World, int a_ChunkX, int a_ChunkZ) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CHUNK_AVAILABLE]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_World, a_ChunkX, a_ChunkZ, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnChunkGenerated(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CHUNK_GENERATED]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CHUNK_GENERATING]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnChunkUnloaded(cWorld * a_World, int a_ChunkX, int a_ChunkZ) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CHUNK_UNLOADED]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_World, a_ChunkX, a_ChunkZ, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnChunkUnloading(cWorld * a_World, int a_ChunkX, int a_ChunkZ) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CHUNK_UNLOADING]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_World, a_ChunkX, a_ChunkZ, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnCollectingPickup(cPlayer * a_Player, cPickup * a_Pickup) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_COLLECTING_PICKUP]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_Player, a_Pickup, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CRAFTING_NO_RECIPE]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), (cPlayer *)a_Player, a_Grid, a_Recipe, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnDisconnect(cPlayer * a_Player, const AString & a_Reason) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_DISCONNECT]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_Player, a_Reason, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnExecuteCommand(cPlayer * a_Player, const AStringVector & a_Split) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_EXECUTE_COMMAND]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_Player, a_Split, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnExploded(cWorld & a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_EXPLODED]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - switch (a_Source) - { - case esOther: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break; - case esPrimedTNT: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (cTNTEntity *)a_SourceData, cLuaState::Return, res); break; - case esCreeper: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (cCreeper *)a_SourceData, cLuaState::Return, res); break; - case esBed: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (Vector3i *)a_SourceData, cLuaState::Return, res); break; - case esEnderCrystal: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (Vector3i *)a_SourceData, cLuaState::Return, res); break; - case esGhastFireball: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break; - case esWitherSkullBlack: - case esWitherSkullBlue: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break; - case esWitherBirth: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break; - case esPlugin: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break; - default: - { - ASSERT(!"Unhandled ExplosionSource"); - return false; - } - } - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnExploding(cWorld & a_World, double & a_ExplosionSize, bool & a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_EXPLODING]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - switch (a_Source) - { - case esOther: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; - case esPrimedTNT: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (cTNTEntity *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; - case esCreeper: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (cCreeper *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; - case esBed: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (Vector3i *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; - case esEnderCrystal: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (Vector3i *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; - case esGhastFireball: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; - case esWitherSkullBlack: - case esWitherSkullBlue: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; - case esWitherBirth: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; - case esPlugin: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; - default: - { - ASSERT(!"Unhandled ExplosionSource"); - return false; - } - } - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnHandshake(cClientHandle * a_Client, const AString & a_Username) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_HANDSHAKE]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_Client, a_Username, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnHopperPullingItem(cWorld & a_World, cHopperEntity & a_Hopper, int a_DstSlotNum, cBlockEntityWithItems & a_SrcEntity, int a_SrcSlotNum) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_HOPPER_PULLING_ITEM]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_World, &a_Hopper, a_DstSlotNum, &a_SrcEntity, a_SrcSlotNum, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnHopperPushingItem(cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_HOPPER_PUSHING_ITEM]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_World, &a_Hopper, a_SrcSlotNum, &a_DstEntity, a_DstSlotNum, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnKilling(cEntity & a_Victim, cEntity * a_Killer) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_KILLING]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Victim, a_Killer, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnLogin(cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_LOGIN]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_Client, a_ProtocolVersion, a_Username, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerAnimation(cPlayer & a_Player, int a_Animation) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_ANIMATION]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, a_Animation, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerBreakingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_BREAKING_BLOCK]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_BlockType, a_BlockMeta, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerBrokenBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_BROKEN_BLOCK]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_BlockType, a_BlockMeta, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerEating(cPlayer & a_Player) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_EATING]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerJoined(cPlayer & a_Player) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_JOINED]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerLeftClick(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_LEFT_CLICK]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerMoved(cPlayer & a_Player) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_MOVING]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerPlacedBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_PLACED_BLOCK]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerPlacingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_PLACING_BLOCK]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerRightClick(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_RIGHT_CLICK]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_RIGHT_CLICKING_ENTITY]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, &a_Entity, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerShooting(cPlayer & a_Player) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_SHOOTING]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerSpawned(cPlayer & a_Player) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_SPAWNED]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerTossingItem(cPlayer & a_Player) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_TOSSING_ITEM]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerUsedBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_USED_BLOCK]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerUsedItem(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_USED_ITEM]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerUsingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_USING_BLOCK]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPlayerUsingItem(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_USING_ITEM]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPostCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_POST_CRAFTING]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_Player, a_Grid, a_Recipe, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PRE_CRAFTING]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_Player, a_Grid, a_Recipe, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnSpawnedEntity(cWorld & a_World, cEntity & a_Entity) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_SPAWNED_ENTITY]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_World, &a_Entity, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnSpawnedMonster(cWorld & a_World, cMonster & a_Monster) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_SPAWNED_MONSTER]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_World, &a_Monster, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnSpawningEntity(cWorld & a_World, cEntity & a_Entity) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_SPAWNING_ENTITY]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_World, &a_Entity, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnSpawningMonster(cWorld & a_World, cMonster & a_Monster) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_SPAWNING_MONSTER]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_World, &a_Monster, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnTakeDamage(cEntity & a_Receiver, TakeDamageInfo & a_TDI) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_TAKE_DAMAGE]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_Receiver, &a_TDI, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnUpdatedSign( - cWorld * a_World, - int a_BlockX, int a_BlockY, int a_BlockZ, - const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, - cPlayer * a_Player -) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_UPDATED_SIGN]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, a_Player, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnUpdatingSign( - cWorld * a_World, - int a_BlockX, int a_BlockY, int a_BlockZ, - AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, - cPlayer * a_Player -) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_UPDATING_SIGN]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, a_Player, cLuaState::Return, res, a_Line1, a_Line2, a_Line3, a_Line4); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnWeatherChanged(cWorld & a_World) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_WEATHER_CHANGED]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_World, cLuaState::Return, res); - if (res) - { - return true; - } - } - return false; -} - - - - - -bool cPluginLua::OnWeatherChanging(cWorld & a_World, eWeather & a_NewWeather) -{ - cCSLock Lock(m_CriticalSection); - bool res = false; - int NewWeather = a_NewWeather; - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_WEATHER_CHANGING]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_World, NewWeather, cLuaState::Return, res, NewWeather); - if (res) - { - a_NewWeather = (eWeather)NewWeather; - return true; - } - } - a_NewWeather = (eWeather)NewWeather; - return false; -} - - - - - -bool cPluginLua::OnWorldTick(cWorld & a_World, float a_Dt) -{ - cCSLock Lock(m_CriticalSection); - cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_WORLD_TICK]; - for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) - { - m_LuaState.Call((int)(**itr), &a_World, a_Dt); - } - return false; -} - - - - - -bool cPluginLua::HandleCommand(const AStringVector & a_Split, cPlayer * a_Player) -{ - ASSERT(!a_Split.empty()); - CommandMap::iterator cmd = m_Commands.find(a_Split[0]); - if (cmd == m_Commands.end()) - { - LOGWARNING("Command handler is registered in cPluginManager but not in cPlugin, wtf? Command \"%s\".", a_Split[0].c_str()); - return false; - } - - cCSLock Lock(m_CriticalSection); - bool res = false; - m_LuaState.Call(cmd->second, a_Split, a_Player, cLuaState::Return, res); - return res; -} - - - - - -bool cPluginLua::HandleConsoleCommand(const AStringVector & a_Split, cCommandOutputCallback & a_Output) -{ - ASSERT(!a_Split.empty()); - CommandMap::iterator cmd = m_ConsoleCommands.find(a_Split[0]); - if (cmd == m_ConsoleCommands.end()) - { - LOGWARNING("Console command handler is registered in cPluginManager but not in cPlugin, wtf? Console command \"%s\", plugin \"%s\".", - a_Split[0].c_str(), GetName().c_str() - ); - return false; - } - - cCSLock Lock(m_CriticalSection); - bool res = false; - AString str; - m_LuaState.Call(cmd->second, a_Split, cLuaState::Return, res, str); - if (res && !str.empty()) - { - a_Output.Out(str); - } - return res; -} - - - - - -void cPluginLua::ClearCommands(void) -{ - cCSLock Lock(m_CriticalSection); - - // Unreference the bound functions so that Lua can GC them - if (m_LuaState != NULL) - { - for (CommandMap::iterator itr = m_Commands.begin(), end = m_Commands.end(); itr != end; ++itr) - { - luaL_unref(m_LuaState, LUA_REGISTRYINDEX, itr->second); - } - } - m_Commands.clear(); -} - - - - - -void cPluginLua::ClearConsoleCommands(void) -{ - cCSLock Lock(m_CriticalSection); - - // Unreference the bound functions so that Lua can GC them - if (m_LuaState != NULL) - { - for (CommandMap::iterator itr = m_ConsoleCommands.begin(), end = m_ConsoleCommands.end(); itr != end; ++itr) - { - luaL_unref(m_LuaState, LUA_REGISTRYINDEX, itr->second); - } - } - m_ConsoleCommands.clear(); -} - - - - - -bool cPluginLua::CanAddOldStyleHook(int a_HookType) -{ - const char * FnName = GetHookFnName(a_HookType); - if (FnName == NULL) - { - // Unknown hook ID - LOGWARNING("Plugin %s wants to add an unknown hook ID (%d). The plugin need not work properly.", - GetName().c_str(), a_HookType - ); - m_LuaState.LogStackTrace(); - return false; - } - - // Check if the function is available - if (m_LuaState.HasFunction(FnName)) - { - return true; - } - - LOGWARNING("Plugin %s wants to add a hook (%d), but it doesn't provide the callback function \"%s\" for it. The plugin need not work properly.", - GetName().c_str(), a_HookType, FnName - ); - m_LuaState.LogStackTrace(); - return false; -} - - - - - -const char * cPluginLua::GetHookFnName(int a_HookType) -{ - switch (a_HookType) - { - case cPluginManager::HOOK_BLOCK_TO_PICKUPS: return "OnBlockToPickups"; - case cPluginManager::HOOK_CHAT: return "OnChat"; - case cPluginManager::HOOK_CHUNK_AVAILABLE: return "OnChunkAvailable"; - case cPluginManager::HOOK_CHUNK_GENERATED: return "OnChunkGenerated"; - case cPluginManager::HOOK_CHUNK_GENERATING: return "OnChunkGenerating"; - case cPluginManager::HOOK_CHUNK_UNLOADED: return "OnChunkUnloaded"; - case cPluginManager::HOOK_CHUNK_UNLOADING: return "OnChunkUnloading"; - case cPluginManager::HOOK_COLLECTING_PICKUP: return "OnCollectingPickup"; - case cPluginManager::HOOK_CRAFTING_NO_RECIPE: return "OnCraftingNoRecipe"; - case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect"; - case cPluginManager::HOOK_EXECUTE_COMMAND: return "OnExecuteCommand"; - case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake"; - case cPluginManager::HOOK_KILLING: return "OnKilling"; - case cPluginManager::HOOK_LOGIN: return "OnLogin"; - case cPluginManager::HOOK_PLAYER_ANIMATION: return "OnPlayerAnimation"; - case cPluginManager::HOOK_PLAYER_BREAKING_BLOCK: return "OnPlayerBreakingBlock"; - case cPluginManager::HOOK_PLAYER_BROKEN_BLOCK: return "OnPlayerBrokenBlock"; - case cPluginManager::HOOK_PLAYER_EATING: return "OnPlayerEating"; - case cPluginManager::HOOK_PLAYER_JOINED: return "OnPlayerJoined"; - case cPluginManager::HOOK_PLAYER_LEFT_CLICK: return "OnPlayerLeftClick"; - case cPluginManager::HOOK_PLAYER_MOVING: return "OnPlayerMoving"; - case cPluginManager::HOOK_PLAYER_PLACED_BLOCK: return "OnPlayerPlacedBlock"; - case cPluginManager::HOOK_PLAYER_PLACING_BLOCK: return "OnPlayerPlacingBlock"; - case cPluginManager::HOOK_PLAYER_RIGHT_CLICK: return "OnPlayerRightClick"; - case cPluginManager::HOOK_PLAYER_RIGHT_CLICKING_ENTITY: return "OnPlayerRightClickingEntity"; - case cPluginManager::HOOK_PLAYER_SHOOTING: return "OnPlayerShooting"; - case cPluginManager::HOOK_PLAYER_SPAWNED: return "OnPlayerSpawned"; - case cPluginManager::HOOK_PLAYER_TOSSING_ITEM: return "OnPlayerTossingItem"; - case cPluginManager::HOOK_PLAYER_USED_BLOCK: return "OnPlayerUsedBlock"; - case cPluginManager::HOOK_PLAYER_USED_ITEM: return "OnPlayerUsedItem"; - case cPluginManager::HOOK_PLAYER_USING_BLOCK: return "OnPlayerUsingBlock"; - case cPluginManager::HOOK_PLAYER_USING_ITEM: return "OnPlayerUsingItem"; - case cPluginManager::HOOK_POST_CRAFTING: return "OnPostCrafting"; - case cPluginManager::HOOK_PRE_CRAFTING: return "OnPreCrafting"; - case cPluginManager::HOOK_SPAWNED_ENTITY: return "OnSpawnedEntity"; - case cPluginManager::HOOK_SPAWNED_MONSTER: return "OnSpawnedMonster"; - case cPluginManager::HOOK_SPAWNING_ENTITY: return "OnSpawningEntity"; - case cPluginManager::HOOK_SPAWNING_MONSTER: return "OnSpawningMonster"; - case cPluginManager::HOOK_TAKE_DAMAGE: return "OnTakeDamage"; - case cPluginManager::HOOK_TICK: return "OnTick"; - case cPluginManager::HOOK_UPDATED_SIGN: return "OnUpdatedSign"; - case cPluginManager::HOOK_UPDATING_SIGN: return "OnUpdatingSign"; - case cPluginManager::HOOK_WEATHER_CHANGED: return "OnWeatherChanged"; - case cPluginManager::HOOK_WEATHER_CHANGING: return "OnWeatherChanging"; - case cPluginManager::HOOK_WORLD_TICK: return "OnWorldTick"; - default: return NULL; - } // switch (a_Hook) -} - - - - - -bool cPluginLua::AddHookRef(int a_HookType, int a_FnRefIdx) -{ - ASSERT(m_CriticalSection.IsLockedByCurrentThread()); // It probably has to be, how else would we have a LuaState? - - // Check if the function reference is valid: - cLuaState::cRef * Ref = new cLuaState::cRef(m_LuaState, a_FnRefIdx); - if ((Ref == NULL) || !Ref->IsValid()) - { - LOGWARNING("Plugin %s tried to add a hook %d with bad handler function.", GetName().c_str(), a_HookType); - m_LuaState.LogStackTrace(); - delete Ref; - return false; - } - - m_HookMap[a_HookType].push_back(Ref); - return true; -} - - - - - -AString cPluginLua::HandleWebRequest(const HTTPRequest * a_Request ) -{ - cCSLock Lock(m_CriticalSection); - std::string RetVal = ""; - - std::pair< std::string, std::string > TabName = GetTabNameForRequest(a_Request); - std::string SafeTabName = TabName.second; - if (SafeTabName.empty()) - { - return ""; - } - - sWebPluginTab * Tab = 0; - for (TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr) - { - if ((*itr)->SafeTitle.compare(SafeTabName) == 0) // This is the one! Rawr - { - Tab = *itr; - break; - } - } - - if (Tab != NULL) - { - AString Contents = Printf("WARNING: WebPlugin tab '%s' did not return a string!", Tab->Title.c_str()); - if (!m_LuaState.Call(Tab->UserData, a_Request, cLuaState::Return, Contents)) - { - return "Lua encountered error while processing the page request"; - } - - RetVal += Contents; - } - - return RetVal; -} - - - - - -bool cPluginLua::AddWebTab(const AString & a_Title, lua_State * a_LuaState, int a_FunctionReference) -{ - cCSLock Lock(m_CriticalSection); - if (a_LuaState != m_LuaState) - { - LOGERROR("Only allowed to add a tab to a WebPlugin of your own Plugin!"); - return false; - } - sWebPluginTab * Tab = new sWebPluginTab(); - Tab->Title = a_Title; - Tab->SafeTitle = SafeString(a_Title); - - Tab->UserData = a_FunctionReference; - - GetTabs().push_back(Tab); - return true; -} - - - - - -void cPluginLua::BindCommand(const AString & a_Command, int a_FnRef) -{ - ASSERT(m_Commands.find(a_Command) == m_Commands.end()); - m_Commands[a_Command] = a_FnRef; -} - - - - - -void cPluginLua::BindConsoleCommand(const AString & a_Command, int a_FnRef) -{ - ASSERT(m_ConsoleCommands.find(a_Command) == m_ConsoleCommands.end()); - m_ConsoleCommands[a_Command] = a_FnRef; -} - - - - - -void cPluginLua::Unreference(int a_LuaRef) -{ - cCSLock Lock(m_CriticalSection); - luaL_unref(m_LuaState, LUA_REGISTRYINDEX, a_LuaRef); -} - - - - - -bool cPluginLua::CallbackWindowClosing(int a_FnRef, cWindow & a_Window, cPlayer & a_Player, bool a_CanRefuse) -{ - ASSERT(a_FnRef != LUA_REFNIL); - - cCSLock Lock(m_CriticalSection); - bool res; - m_LuaState.Call(a_FnRef, &a_Window, &a_Player, a_CanRefuse, cLuaState::Return, res); - return res; -} - - - - - -void cPluginLua::CallbackWindowSlotChanged(int a_FnRef, cWindow & a_Window, int a_SlotNum) -{ - ASSERT(a_FnRef != LUA_REFNIL); - - cCSLock Lock(m_CriticalSection); - m_LuaState.Call(a_FnRef, &a_Window, a_SlotNum); -} - - - - diff --git a/source/PluginManager.cpp b/source/PluginManager.cpp deleted file mode 100644 index e08ebe503..000000000 --- a/source/PluginManager.cpp +++ /dev/null @@ -1,1668 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "PluginManager.h" -#include "Plugin.h" -#include "PluginLua.h" -#include "WebAdmin.h" -#include "Item.h" -#include "Root.h" -#include "Server.h" -#include "CommandOutput.h" - -#include "../iniFile/iniFile.h" -#include "tolua++.h" -#include "Entities/Player.h" - - - - - -cPluginManager * cPluginManager::Get(void) -{ - return cRoot::Get()->GetPluginManager(); -} - - - - - -cPluginManager::cPluginManager(void) : - m_bReloadPlugins(false) -{ -} - - - - - -cPluginManager::~cPluginManager() -{ - UnloadPluginsNow(); -} - - - - - -void cPluginManager::ReloadPlugins(void) -{ - m_bReloadPlugins = true; -} - - - - - -void cPluginManager::FindPlugins(void) -{ - AString PluginsPath = FILE_IO_PREFIX + AString( "Plugins/" ); - - // First get a clean list of only the currently running plugins, we don't want to mess those up - for (PluginMap::iterator itr = m_Plugins.begin(); itr != m_Plugins.end();) - { - if (itr->second == NULL) - { - PluginMap::iterator thiz = itr; - ++thiz; - m_Plugins.erase( itr ); - itr = thiz; - continue; - } - ++itr; - } - - AStringVector Files = cFile::GetFolderContents(PluginsPath.c_str()); - for (AStringVector::const_iterator itr = Files.begin(); itr != Files.end(); ++itr) - { - if ((*itr == ".") || (*itr == "..") || (!cFile::IsFolder(PluginsPath + *itr))) - { - // We only want folders, and don't want "." or ".." - continue; - } - - // Add plugin name/directory to the list - if (m_Plugins.find(*itr) == m_Plugins.end()) - { - m_Plugins[*itr] = NULL; - } - } -} - - - - - -void cPluginManager::ReloadPluginsNow(void) -{ - cIniFile a_SettingsIni; - a_SettingsIni.ReadFile("settings.ini"); - ReloadPluginsNow(a_SettingsIni); -} - - - - - -void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni) -{ - LOG("-- Loading Plugins --"); - m_bReloadPlugins = false; - UnloadPluginsNow(); - - FindPlugins(); - - cServer::BindBuiltInConsoleCommands(); - - // Check if the Plugins section exists. - int KeyNum = a_SettingsIni.FindKey("Plugins"); - - // If it does, how many plugins are there? - unsigned int NumPlugins = ((KeyNum != -1) ? (a_SettingsIni.GetNumValues(KeyNum)) : 0); - - if (KeyNum == -1) - { - InsertDefaultPlugins(a_SettingsIni); - } - else if (NumPlugins > 0) - { - for(unsigned int i = 0; i < NumPlugins; i++) - { - AString ValueName = a_SettingsIni.GetValueName(KeyNum, i); - if (ValueName.compare("Plugin") == 0) - { - AString PluginFile = a_SettingsIni.GetValue(KeyNum, i); - if (!PluginFile.empty()) - { - if (m_Plugins.find(PluginFile) != m_Plugins.end()) - { - LoadPlugin( PluginFile ); - } - } - } - } - } - - if (GetNumPlugins() == 0) - { - LOG("-- No Plugins Loaded --"); - } - else if (GetNumPlugins() > 1) - { - LOG("-- Loaded %i Plugins --", GetNumPlugins()); - } - else - { - LOG("-- Loaded 1 Plugin --"); - } -} - - - - - -void cPluginManager::InsertDefaultPlugins(cIniFile & a_SettingsIni) -{ - a_SettingsIni.AddKeyName("Plugins"); - a_SettingsIni.AddKeyComment("Plugins", " Plugin=Debuggers"); - a_SettingsIni.AddKeyComment("Plugins", " Plugin=HookNotify"); - a_SettingsIni.AddKeyComment("Plugins", " Plugin=ChunkWorx"); - a_SettingsIni.AddKeyComment("Plugins", " Plugin=APIDump"); - a_SettingsIni.SetValue("Plugins", "Plugin", "Core"); - a_SettingsIni.SetValue("Plugins", "Plugin", "TransAPI"); - a_SettingsIni.SetValue("Plugins", "Plugin", "ChatLog"); -} - - - - - -void cPluginManager::Tick(float a_Dt) -{ - while (!m_DisablePluginList.empty()) - { - RemovePlugin(m_DisablePluginList.front()); - m_DisablePluginList.pop_front(); - } - - if (m_bReloadPlugins) - { - ReloadPluginsNow(); - } - - HookMap::iterator Plugins = m_Hooks.find(HOOK_TICK); - if (Plugins != m_Hooks.end()) - { - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - (*itr)->Tick(a_Dt); - } - } -} - - - - - -bool cPluginManager::CallHookBlockToPickups( - cWorld * a_World, cEntity * a_Digger, - int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, - cItems & a_Pickups -) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_BLOCK_TO_PICKUPS); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnBlockToPickups(a_World, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_Pickups)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookChat(cPlayer * a_Player, AString & a_Message) -{ - if (ExecuteCommand(a_Player, a_Message)) - { - return true; - } - - // Check if it was a standard command (starts with a slash) - if (!a_Message.empty() && (a_Message[0] == '/')) - { - AStringVector Split(StringSplit(a_Message, " ")); - ASSERT(!Split.empty()); // This should not happen - we know there's at least one char in the message so the split needs to be at least one item long - a_Player->SendMessage(Printf("Unknown Command: \"%s\"", Split[0].c_str())); - LOGINFO("Player \"%s\" issued an unknown command: \"%s\"", a_Player->GetName().c_str(), a_Message.c_str()); - return true; // Cancel sending - } - - HookMap::iterator Plugins = m_Hooks.find(HOOK_CHAT); - if (Plugins == m_Hooks.end()) - { - return false; - } - - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnChat(a_Player, a_Message)) - { - return true; - } - } - - return false; -} - - - - - -bool cPluginManager::CallHookChunkAvailable(cWorld * a_World, int a_ChunkX, int a_ChunkZ) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_AVAILABLE); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnChunkAvailable(a_World, a_ChunkX, a_ChunkZ)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookChunkGenerated(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_GENERATED); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_GENERATING); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnChunkGenerating(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookChunkUnloaded(cWorld * a_World, int a_ChunkX, int a_ChunkZ) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_UNLOADED); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnChunkUnloaded(a_World, a_ChunkX, a_ChunkZ)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookChunkUnloading(cWorld * a_World, int a_ChunkX, int a_ChunkZ) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_UNLOADING); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnChunkUnloading(a_World, a_ChunkX, a_ChunkZ)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookCollectingPickup(cPlayer * a_Player, cPickup & a_Pickup) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_COLLECTING_PICKUP); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnCollectingPickup(a_Player, &a_Pickup)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_CRAFTING_NO_RECIPE); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnCraftingNoRecipe(a_Player, a_Grid, a_Recipe)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookDisconnect(cPlayer * a_Player, const AString & a_Reason) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_DISCONNECT); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnDisconnect(a_Player, a_Reason)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookExecuteCommand(cPlayer * a_Player, const AStringVector & a_Split) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_EXECUTE_COMMAND); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnExecuteCommand(a_Player, a_Split)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookExploded(cWorld & a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_EXPLODED); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnExploded(a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookExploding(cWorld & a_World, double & a_ExplosionSize, bool & a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_EXPLODING); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnExploding(a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookHandshake(cClientHandle * a_ClientHandle, const AString & a_Username) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_HANDSHAKE); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnHandshake(a_ClientHandle, a_Username)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookHopperPullingItem(cWorld & a_World, cHopperEntity & a_Hopper, int a_DstSlotNum, cBlockEntityWithItems & a_SrcEntity, int a_SrcSlotNum) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_HOPPER_PULLING_ITEM); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnHopperPullingItem(a_World, a_Hopper, a_DstSlotNum, a_SrcEntity, a_SrcSlotNum)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookHopperPushingItem(cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_HOPPER_PUSHING_ITEM); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnHopperPushingItem(a_World, a_Hopper, a_SrcSlotNum, a_DstEntity, a_DstSlotNum)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookKilling(cEntity & a_Victim, cEntity * a_Killer) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_KILLING); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnKilling(a_Victim, a_Killer)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookLogin(cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_LOGIN); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnLogin(a_Client, a_ProtocolVersion, a_Username)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerAnimation(cPlayer & a_Player, int a_Animation) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_ANIMATION); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerAnimation(a_Player, a_Animation)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerBreakingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_BREAKING_BLOCK); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerBreakingBlock(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_BlockType, a_BlockMeta)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerBrokenBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_BROKEN_BLOCK); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerBrokenBlock(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_BlockType, a_BlockMeta)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerEating(cPlayer & a_Player) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_EATING); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerEating(a_Player)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerJoined(cPlayer & a_Player) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_JOINED); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerJoined(a_Player)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerLeftClick(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_LEFT_CLICK); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerLeftClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerMoving(cPlayer & a_Player) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_MOVING); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerMoved(a_Player)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerPlacedBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_PLACED_BLOCK); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerPlacedBlock(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerPlacingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_PLACING_BLOCK); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerPlacingBlock(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerRightClick(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_RIGHT_CLICK); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerRightClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_RIGHT_CLICKING_ENTITY); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerRightClickingEntity(a_Player, a_Entity)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerShooting(cPlayer & a_Player) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_SHOOTING); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerShooting(a_Player)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerSpawned(cPlayer & a_Player) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_SPAWNED); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerSpawned(a_Player)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerTossingItem(cPlayer & a_Player) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_TOSSING_ITEM); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerTossingItem(a_Player)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerUsedBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_USED_BLOCK); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerUsedBlock(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerUsedItem(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_USED_ITEM); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerUsedItem(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerUsingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_USING_BLOCK); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerUsingBlock(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPlayerUsingItem(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_USING_ITEM); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPlayerUsingItem(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPostCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_POST_CRAFTING); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPostCrafting(a_Player, a_Grid, a_Recipe)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_PRE_CRAFTING); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnPreCrafting(a_Player, a_Grid, a_Recipe)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookSpawnedEntity(cWorld & a_World, cEntity & a_Entity) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_SPAWNED_ENTITY); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnSpawnedEntity(a_World, a_Entity)) - { - return true; - } - } - return false; -} - - - - -bool cPluginManager::CallHookSpawnedMonster(cWorld & a_World, cMonster & a_Monster) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_SPAWNED_MONSTER); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnSpawnedMonster(a_World, a_Monster)) - { - return true; - } - } - return false; -} - - - - -bool cPluginManager::CallHookSpawningEntity(cWorld & a_World, cEntity & a_Entity) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_SPAWNING_ENTITY); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnSpawningEntity(a_World, a_Entity)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookSpawningMonster(cWorld & a_World, cMonster & a_Monster) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_SPAWNING_MONSTER); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnSpawningMonster(a_World, a_Monster)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookTakeDamage(cEntity & a_Receiver, TakeDamageInfo & a_TDI) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_TAKE_DAMAGE); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnTakeDamage(a_Receiver, a_TDI)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookUpdatingSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_UPDATING_SIGN); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnUpdatingSign(a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, a_Player)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookUpdatedSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_UPDATED_SIGN); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnUpdatedSign(a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, a_Player)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookWeatherChanged(cWorld & a_World) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_WEATHER_CHANGED); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnWeatherChanged(a_World)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookWeatherChanging(cWorld & a_World, eWeather & a_NewWeather) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_WEATHER_CHANGING); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnWeatherChanging(a_World, a_NewWeather)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::CallHookWorldTick(cWorld & a_World, float a_Dt) -{ - HookMap::iterator Plugins = m_Hooks.find(HOOK_WORLD_TICK); - if (Plugins == m_Hooks.end()) - { - return false; - } - for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) - { - if ((*itr)->OnWorldTick(a_World, a_Dt)) - { - return true; - } - } - return false; -} - - - - - -bool cPluginManager::HandleCommand(cPlayer * a_Player, const AString & a_Command, bool a_ShouldCheckPermissions) -{ - ASSERT(a_Player != NULL); - - AStringVector Split(StringSplit(a_Command, " ")); - if (Split.empty()) - { - return false; - } - - CommandMap::iterator cmd = m_Commands.find(Split[0]); - if (cmd == m_Commands.end()) - { - // Command not found - return false; - } - - // Ask plugins first if a command is okay to execute the command: - if (CallHookExecuteCommand(a_Player, Split)) - { - LOGINFO("Player \"%s\" tried executing command \"%s\" that was stopped by the HOOK_EXECUTE_COMMAND hook", a_Player->GetName().c_str(), Split[0].c_str()); - return false; - } - - if ( - a_ShouldCheckPermissions && - !cmd->second.m_Permission.empty() && - !a_Player->HasPermission(cmd->second.m_Permission) - ) - { - LOGINFO("Player \"%s\" tried to execute forbidden command \"%s\".", a_Player->GetName().c_str(), Split[0].c_str()); - return false; - } - - ASSERT(cmd->second.m_Plugin != NULL); - - return cmd->second.m_Plugin->HandleCommand(Split, a_Player); -} - - - - - -cPlugin * cPluginManager::GetPlugin( const AString & a_Plugin ) const -{ - for( PluginMap::const_iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr ) - { - if (itr->second == NULL ) continue; - if (itr->second->GetName().compare(a_Plugin) == 0) - { - return itr->second; - } - } - return 0; -} - - - - - -const cPluginManager::PluginMap & cPluginManager::GetAllPlugins() const -{ - return m_Plugins; -} - - - - - -void cPluginManager::UnloadPluginsNow() -{ - m_Hooks.clear(); - - while (!m_Plugins.empty()) - { - RemovePlugin(m_Plugins.begin()->second); - } - - m_Commands.clear(); - m_ConsoleCommands.clear(); -} - - - - - -bool cPluginManager::DisablePlugin(const AString & a_PluginName) -{ - PluginMap::iterator itr = m_Plugins.find(a_PluginName); - if (itr == m_Plugins.end()) - { - return false; - } - - if (itr->first.compare(a_PluginName) == 0) // _X 2013_02_01: wtf? Isn't this supposed to be what find() does? - { - m_DisablePluginList.push_back(itr->second); - itr->second = NULL; // Get rid of this thing right away - return true; - } - return false; -} - - - - - -bool cPluginManager::LoadPlugin(const AString & a_PluginName) -{ - return AddPlugin(new cPluginLua(a_PluginName.c_str())); -} - - - - - -void cPluginManager::RemoveHooks(cPlugin * a_Plugin) -{ - for (HookMap::iterator itr = m_Hooks.begin(), end = m_Hooks.end(); itr != end; ++itr) - { - itr->second.remove(a_Plugin); - } -} - - - - - -void cPluginManager::RemovePlugin(cPlugin * a_Plugin) -{ - for (PluginMap::iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr) - { - if (itr->second == a_Plugin) - { - m_Plugins.erase(itr); - break; - } - } - - RemovePluginCommands(a_Plugin); - RemovePluginConsoleCommands(a_Plugin); - RemoveHooks(a_Plugin); - if (a_Plugin != NULL) - { - a_Plugin->OnDisable(); - } - delete a_Plugin; -} - - - - - -void cPluginManager::RemovePluginCommands(cPlugin * a_Plugin) -{ - if (a_Plugin != NULL) - { - a_Plugin->ClearCommands(); - } - - for (CommandMap::iterator itr = m_Commands.begin(); itr != m_Commands.end();) - { - if (itr->second.m_Plugin == a_Plugin) - { - CommandMap::iterator EraseMe = itr; // Stupid GCC doesn't have a std::map::erase() that would return the next iterator - ++itr; - m_Commands.erase(EraseMe); - } - else - { - ++itr; - } - } // for itr - m_Commands[] -} - - - - - -bool cPluginManager::BindCommand(const AString & a_Command, cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) -{ - CommandMap::iterator cmd = m_Commands.find(a_Command); - if (cmd != m_Commands.end()) - { - LOGWARNING("Command \"%s\" is already bound to plugin \"%s\".", a_Command.c_str(), cmd->second.m_Plugin->GetName().c_str()); - return false; - } - - m_Commands[a_Command].m_Plugin = a_Plugin; - m_Commands[a_Command].m_Permission = a_Permission; - m_Commands[a_Command].m_HelpString = a_HelpString; - return true; -} - - - - - -bool cPluginManager::ForEachCommand(cCommandEnumCallback & a_Callback) -{ - for (CommandMap::iterator itr = m_Commands.begin(), end = m_Commands.end(); itr != end; ++itr) - { - if (a_Callback.Command(itr->first, itr->second.m_Plugin, itr->second.m_Permission, itr->second.m_HelpString)) - { - return false; - } - } // for itr - m_Commands[] - return true; -} - - - - - -bool cPluginManager::IsCommandBound(const AString & a_Command) -{ - return (m_Commands.find(a_Command) != m_Commands.end()); -} - - - - - -AString cPluginManager::GetCommandPermission(const AString & a_Command) -{ - CommandMap::iterator cmd = m_Commands.find(a_Command); - return (cmd == m_Commands.end()) ? "" : cmd->second.m_Permission; -} - - - - - -bool cPluginManager::ExecuteCommand(cPlayer * a_Player, const AString & a_Command) -{ - return HandleCommand(a_Player, a_Command, true); -} - - - - - -bool cPluginManager::ForceExecuteCommand(cPlayer * a_Player, const AString & a_Command) -{ - return HandleCommand(a_Player, a_Command, false); -} - - - - - -void cPluginManager::RemovePluginConsoleCommands(cPlugin * a_Plugin) -{ - if (a_Plugin != NULL) - { - a_Plugin->ClearConsoleCommands(); - } - - for (CommandMap::iterator itr = m_ConsoleCommands.begin(); itr != m_ConsoleCommands.end();) - { - if (itr->second.m_Plugin == a_Plugin) - { - CommandMap::iterator EraseMe = itr; // Stupid GCC doesn't have a std::map::erase() that would return the next iterator - ++itr; - m_ConsoleCommands.erase(EraseMe); - } - else - { - ++itr; - } - } // for itr - m_Commands[] -} - - - - - -bool cPluginManager::BindConsoleCommand(const AString & a_Command, cPlugin * a_Plugin, const AString & a_HelpString) -{ - CommandMap::iterator cmd = m_ConsoleCommands.find(a_Command); - if (cmd != m_ConsoleCommands.end()) - { - if (cmd->second.m_Plugin == NULL) - { - LOGWARNING("Console command \"%s\" is already bound internally by MCServer, cannot bind in plugin \"%s\".", a_Command.c_str(), a_Plugin->GetName().c_str()); - } - else - { - LOGWARNING("Console command \"%s\" is already bound to plugin \"%s\", cannot bind in plugin \"%s\".", a_Command.c_str(), cmd->second.m_Plugin->GetName().c_str(), a_Plugin->GetName().c_str()); - } - return false; - } - - m_ConsoleCommands[a_Command].m_Plugin = a_Plugin; - m_ConsoleCommands[a_Command].m_Permission = ""; - m_ConsoleCommands[a_Command].m_HelpString = a_HelpString; - return true; -} - - - - - -bool cPluginManager::ForEachConsoleCommand(cCommandEnumCallback & a_Callback) -{ - for (CommandMap::iterator itr = m_ConsoleCommands.begin(), end = m_ConsoleCommands.end(); itr != end; ++itr) - { - if (a_Callback.Command(itr->first, itr->second.m_Plugin, "", itr->second.m_HelpString)) - { - return false; - } - } // for itr - m_Commands[] - return true; -} - - - - - -bool cPluginManager::IsConsoleCommandBound(const AString & a_Command) -{ - return (m_ConsoleCommands.find(a_Command) != m_ConsoleCommands.end()); -} - - - - - -bool cPluginManager::ExecuteConsoleCommand(const AStringVector & a_Split, cCommandOutputCallback & a_Output) -{ - if (a_Split.empty()) - { - return false; - } - - CommandMap::iterator cmd = m_ConsoleCommands.find(a_Split[0]); - if (cmd == m_ConsoleCommands.end()) - { - // Command not found - return false; - } - - if (cmd->second.m_Plugin == NULL) - { - // This is a built-in command - return false; - } - - // Ask plugins first if a command is okay to execute the console command: - if (CallHookExecuteCommand(NULL, a_Split)) - { - a_Output.Out("Command \"%s\" was stopped by the HOOK_EXECUTE_COMMAND hook", a_Split[0].c_str()); - return false; - } - - return cmd->second.m_Plugin->HandleConsoleCommand(a_Split, a_Output); -} - - - - - -void cPluginManager::TabCompleteCommand(const AString & a_Text, AStringVector & a_Results, cPlayer * a_Player) -{ - for (CommandMap::iterator itr = m_Commands.begin(), end = m_Commands.end(); itr != end; ++itr) - { - if (NoCaseCompare(itr->first.substr(0, a_Text.length()), a_Text) != 0) - { - // Command name doesn't match - continue; - } - if ((a_Player != NULL) && !a_Player->HasPermission(itr->second.m_Permission)) - { - // Player doesn't have permission for the command - continue; - } - a_Results.push_back(itr->first); - } -} - - - - - -bool cPluginManager::IsValidHookType(int a_HookType) -{ - return ((a_HookType >= 0) && (a_HookType <= HOOK_MAX)); -} - - - - - -bool cPluginManager::AddPlugin(cPlugin * a_Plugin) -{ - m_Plugins[a_Plugin->GetDirectory()] = a_Plugin; - if (a_Plugin->Initialize()) - { - // Initialization OK - return true; - } - - // Initialization failed - RemovePlugin(a_Plugin); // Also undoes any registrations that Initialize() might have made - return false; -} - - - - - -void cPluginManager::AddHook(cPlugin * a_Plugin, int a_Hook) -{ - if (!a_Plugin) - { - LOGWARN("Called cPluginManager::AddHook() with a_Plugin == NULL"); - return; - } - PluginList & Plugins = m_Hooks[a_Hook]; - Plugins.remove(a_Plugin); - Plugins.push_back(a_Plugin); -} - - - - - -unsigned int cPluginManager::GetNumPlugins() const -{ - return m_Plugins.size(); -} - - - - diff --git a/source/Protocol/ChunkDataSerializer.cpp b/source/Protocol/ChunkDataSerializer.cpp deleted file mode 100644 index 2a9230fee..000000000 --- a/source/Protocol/ChunkDataSerializer.cpp +++ /dev/null @@ -1,176 +0,0 @@ - -// ChunkDataSerializer.cpp - -// Implements the cChunkDataSerializer class representing the object that can: -// - serialize chunk data to different protocol versions -// - cache such serialized data for multiple clients - -#include "Globals.h" -#include "ChunkDataSerializer.h" -#include "zlib.h" - - - - -cChunkDataSerializer::cChunkDataSerializer( - const cChunkDef::BlockTypes & a_BlockTypes, - const cChunkDef::BlockNibbles & a_BlockMetas, - const cChunkDef::BlockNibbles & a_BlockLight, - const cChunkDef::BlockNibbles & a_BlockSkyLight, - const unsigned char * a_BiomeData -) : - m_BlockTypes(a_BlockTypes), - m_BlockMetas(a_BlockMetas), - m_BlockLight(a_BlockLight), - m_BlockSkyLight(a_BlockSkyLight), - m_BiomeData(a_BiomeData) -{ -} - - - - -const AString & cChunkDataSerializer::Serialize(int a_Version) -{ - Serializations::const_iterator itr = m_Serializations.find(a_Version); - if (itr != m_Serializations.end()) - { - return itr->second; - } - - AString data; - switch (a_Version) - { - case RELEASE_1_2_5: Serialize29(data); break; - case RELEASE_1_3_2: Serialize39(data); break; - // TODO: Other protocol versions may serialize the data differently; implement here - - default: - { - LOGERROR("cChunkDataSerializer::Serialize(): Unknown version: %d", a_Version); - ASSERT(!"Unknown chunk data serialization version"); - break; - } - } - m_Serializations[a_Version] = data; - return m_Serializations[a_Version]; -} - - - - - -void cChunkDataSerializer::Serialize29(AString & a_Data) -{ - // TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib *can* stream) - - const int BiomeDataSize = cChunkDef::Width * cChunkDef::Width; - const int MetadataOffset = sizeof(m_BlockTypes); - const int BlockLightOffset = MetadataOffset + sizeof(m_BlockMetas); - const int SkyLightOffset = BlockLightOffset + sizeof(m_BlockLight); - const int BiomeOffset = SkyLightOffset + sizeof(m_BlockSkyLight); - const int DataSize = BiomeOffset + BiomeDataSize; - - // Temporary buffer for the composed data: - char AllData [DataSize]; - - memcpy(AllData, m_BlockTypes, sizeof(m_BlockTypes)); - memcpy(AllData + MetadataOffset, m_BlockMetas, sizeof(m_BlockMetas)); - memcpy(AllData + BlockLightOffset, m_BlockLight, sizeof(m_BlockLight)); - memcpy(AllData + SkyLightOffset, m_BlockSkyLight, sizeof(m_BlockSkyLight)); - memcpy(AllData + BiomeOffset, m_BiomeData, BiomeDataSize); - - // Compress the data: - // In order not to use allocation, use a fixed-size buffer, with the size - // that uses the same calculation as compressBound(): - const uLongf CompressedMaxSize = DataSize + (DataSize >> 12) + (DataSize >> 14) + (DataSize >> 25) + 16; - char CompressedBlockData[CompressedMaxSize]; - - uLongf CompressedSize = compressBound(DataSize); - - // Run-time check that our compile-time guess about CompressedMaxSize was enough: - ASSERT(CompressedSize <= CompressedMaxSize); - - compress2((Bytef*)CompressedBlockData, &CompressedSize, (const Bytef*)AllData, sizeof(AllData), Z_DEFAULT_COMPRESSION); - - // Now put all those data into a_Data: - - // "Ground-up continuous", or rather, "biome data present" flag: - a_Data.push_back('\x01'); - - // Two bitmaps; we're aways sending the full chunk with no additional data, so the bitmaps are 0xffff and 0, respectively - // Also, no endian flipping is needed because of the const values - unsigned short BitMap1 = 0xffff; - unsigned short BitMap2 = 0; - a_Data.append((const char *)&BitMap1, sizeof(short)); - a_Data.append((const char *)&BitMap2, sizeof(short)); - - Int32 CompressedSizeBE = htonl(CompressedSize); - a_Data.append((const char *)&CompressedSizeBE, sizeof(CompressedSizeBE)); - - Int32 UnusedInt32 = 0; - a_Data.append((const char *)&UnusedInt32, sizeof(UnusedInt32)); - - a_Data.append(CompressedBlockData, CompressedSize); -} - - - - - -void cChunkDataSerializer::Serialize39(AString & a_Data) -{ - // TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib *can* stream) - - const int BiomeDataSize = cChunkDef::Width * cChunkDef::Width; - const int MetadataOffset = sizeof(m_BlockTypes); - const int BlockLightOffset = MetadataOffset + sizeof(m_BlockMetas); - const int SkyLightOffset = BlockLightOffset + sizeof(m_BlockLight); - const int BiomeOffset = SkyLightOffset + sizeof(m_BlockSkyLight); - const int DataSize = BiomeOffset + BiomeDataSize; - - // Temporary buffer for the composed data: - char AllData [DataSize]; - - memcpy(AllData, m_BlockTypes, sizeof(m_BlockTypes)); - memcpy(AllData + MetadataOffset, m_BlockMetas, sizeof(m_BlockMetas)); - memcpy(AllData + BlockLightOffset, m_BlockLight, sizeof(m_BlockLight)); - memcpy(AllData + SkyLightOffset, m_BlockSkyLight, sizeof(m_BlockSkyLight)); - memcpy(AllData + BiomeOffset, m_BiomeData, BiomeDataSize); - - // Compress the data: - // In order not to use allocation, use a fixed-size buffer, with the size - // that uses the same calculation as compressBound(): - const uLongf CompressedMaxSize = DataSize + (DataSize >> 12) + (DataSize >> 14) + (DataSize >> 25) + 16; - char CompressedBlockData[CompressedMaxSize]; - - uLongf CompressedSize = compressBound(DataSize); - - // Run-time check that our compile-time guess about CompressedMaxSize was enough: - ASSERT(CompressedSize <= CompressedMaxSize); - - compress2((Bytef*)CompressedBlockData, &CompressedSize, (const Bytef*)AllData, sizeof(AllData), Z_DEFAULT_COMPRESSION); - - // Now put all those data into a_Data: - - // "Ground-up continuous", or rather, "biome data present" flag: - a_Data.push_back('\x01'); - - // Two bitmaps; we're aways sending the full chunk with no additional data, so the bitmaps are 0xffff and 0, respectively - // Also, no endian flipping is needed because of the const values - unsigned short BitMap1 = 0xffff; - unsigned short BitMap2 = 0; - a_Data.append((const char *)&BitMap1, sizeof(short)); - a_Data.append((const char *)&BitMap2, sizeof(short)); - - Int32 CompressedSizeBE = htonl(CompressedSize); - a_Data.append((const char *)&CompressedSizeBE, sizeof(CompressedSizeBE)); - - // Unlike 29, 39 doesn't have the "unused" int - - a_Data.append(CompressedBlockData, CompressedSize); -} - - - - diff --git a/source/Protocol/Protocol132.cpp b/source/Protocol/Protocol132.cpp deleted file mode 100644 index 22eac4312..000000000 --- a/source/Protocol/Protocol132.cpp +++ /dev/null @@ -1,950 +0,0 @@ - -// Protocol132.cpp - -// Implements the cProtocol132 class representing the release 1.3.2 protocol (#39) - -#include "Globals.h" -#include "Protocol132.h" -#include "../Root.h" -#include "../Server.h" -#include "../World.h" -#include "../ClientHandle.h" -#include "../../CryptoPP/randpool.h" -#include "../Item.h" -#include "ChunkDataSerializer.h" -#include "../Entities/Player.h" -#include "../Mobs/Monster.h" -#include "../UI/Window.h" -#include "../Entities/Pickup.h" -#include "../WorldStorage/FastNBT.h" -#include "../StringCompression.h" - - - - - -#define HANDLE_PACKET_READ(Proc, Type, Var) \ - Type Var; \ - { \ - if (!m_ReceivedData.Proc(Var)) \ - { \ - m_ReceivedData.CheckValid(); \ - return PARSE_INCOMPLETE; \ - } \ - m_ReceivedData.CheckValid(); \ - } - - - - -typedef unsigned char Byte; - - - - - -using namespace CryptoPP; - - - - - -const int MAX_ENC_LEN = 512; // Maximum size of the encrypted message; should be 128, but who knows... - - - - - -enum -{ - PACKET_KEEP_ALIVE = 0x00, - PACKET_LOGIN = 0x01, - PACKET_ENTITY_EQUIPMENT = 0x05, - PACKET_COMPASS = 0x06, - PACKET_PLAYER_SPAWN = 0x14, - PACKET_COLLECT_PICKUP = 0x16, - PACKET_SPAWN_MOB = 0x18, - PACKET_DESTROY_ENTITIES = 0x1d, - PACKET_CHUNK_DATA = 0x33, - PACKET_BLOCK_CHANGE = 0x35, - PACKET_BLOCK_ACTION = 0x36, - PACKET_BLOCK_BREAK_ANIM = 0x37, - PACKET_SOUND_EFFECT = 0x3e, - PACKET_SOUND_PARTICLE_EFFECT = 0x3d, - PACKET_TAB_COMPLETION = 0xcb, - PACKET_LOCALE_VIEW_DISTANCE = 0xcc, - PACKET_CLIENT_STATUSES = 0xcd, - PACKET_ENCRYPTION_KEY_RESP = 0xfc, -} ; - - - - - -// Converts a raw 160-bit SHA1 digest into a Java Hex representation -// According to http://wiki.vg/wiki/index.php?title=Protocol_Encryption&oldid=2802 -static void DigestToJava(byte a_Digest[20], AString & a_Out) -{ - bool IsNegative = (a_Digest[0] >= 0x80); - if (IsNegative) - { - // Two's complement: - bool carry = true; // Add one to the whole number - for (int i = 19; i >= 0; i--) - { - a_Digest[i] = ~a_Digest[i]; - if (carry) - { - carry = (a_Digest[i] == 0xff); - a_Digest[i]++; - } - } - } - a_Out.clear(); - a_Out.reserve(40); - for (int i = 0; i < 20; i++) - { - AppendPrintf(a_Out, "%02x", a_Digest[i]); - } - while ((a_Out.length() > 0) && (a_Out[0] == '0')) - { - a_Out.erase(0, 1); - } - if (IsNegative) - { - a_Out.insert(0, "-"); - } -} - - - - - -/* -// Self-test the hash formatting for known values: -// sha1(Notch) : 4ed1f46bbe04bc756bcb17c0c7ce3e4632f06a48 -// sha1(jeb_) : -7c9d5b0044c130109a5d7b5fb5c317c02b4e28c1 -// sha1(simon) : 88e16a1019277b15d58faf0541e11910eb756f6 - -class Test -{ -public: - Test(void) - { - AString DigestNotch, DigestJeb, DigestSimon; - byte Digest[20]; - CryptoPP::SHA1 Checksum; - Checksum.Update((const byte *)"Notch", 5); - Checksum.Final(Digest); - DigestToJava(Digest, DigestNotch); - Checksum.Restart(); - Checksum.Update((const byte *)"jeb_", 4); - Checksum.Final(Digest); - DigestToJava(Digest, DigestJeb); - Checksum.Restart(); - Checksum.Update((const byte *)"simon", 5); - Checksum.Final(Digest); - DigestToJava(Digest, DigestSimon); - printf("Notch: \"%s\"", DigestNotch.c_str()); - printf("jeb_: \"%s\"", DigestJeb.c_str()); - printf("simon: \"%s\"", DigestSimon.c_str()); - } -} test; -*/ - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cProtocol132: - -cProtocol132::cProtocol132(cClientHandle * a_Client) : - super(a_Client), - m_IsEncrypted(false) -{ -} - - - - - -cProtocol132::~cProtocol132() -{ - if (!m_DataToSend.empty()) - { - LOGD("There are %d unsent bytes while deleting cProtocol132", m_DataToSend.size()); - } -} - - - - - -void cProtocol132::DataReceived(const char * a_Data, int a_Size) -{ - if (m_IsEncrypted) - { - byte Decrypted[512]; - while (a_Size > 0) - { - int NumBytes = (a_Size > sizeof(Decrypted)) ? sizeof(Decrypted) : a_Size; - m_Decryptor.ProcessData(Decrypted, (byte *)a_Data, NumBytes); - super::DataReceived((const char *)Decrypted, NumBytes); - a_Size -= NumBytes; - a_Data += NumBytes; - } - } - else - { - super::DataReceived(a_Data, a_Size); - } -} - - - - - -void cProtocol132::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) -{ - cCSLock Lock(m_CSPacket); - WriteByte (PACKET_BLOCK_ACTION); - WriteInt (a_BlockX); - WriteShort((short)a_BlockY); - WriteInt (a_BlockZ); - WriteByte (a_Byte1); - WriteByte (a_Byte2); - WriteShort(a_BlockType); - Flush(); -} - - - - - -void cProtocol132::SendBlockBreakAnim(int a_entityID, int a_BlockX, int a_BlockY, int a_BlockZ, char stage) -{ - cCSLock Lock(m_CSPacket); - WriteByte (PACKET_BLOCK_BREAK_ANIM); - WriteInt (a_entityID); - WriteInt (a_BlockX); - WriteInt (a_BlockY); - WriteInt (a_BlockZ); - WriteByte (stage); - Flush(); -} - - - - - -void cProtocol132::SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - cCSLock Lock(m_CSPacket); - WriteByte (PACKET_BLOCK_CHANGE); - WriteInt (a_BlockX); - WriteByte ((unsigned char)a_BlockY); - WriteInt (a_BlockZ); - WriteShort(a_BlockType); - WriteByte (a_BlockMeta); - Flush(); -} - - - - - -void cProtocol132::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) -{ - cCSLock Lock(m_CSPacket); - - // Pre-chunk not used in 1.3.2. Finally. - - // Send the chunk data: - AString Serialized = a_Serializer.Serialize(cChunkDataSerializer::RELEASE_1_3_2); - WriteByte(PACKET_CHUNK_DATA); - WriteInt (a_ChunkX); - WriteInt (a_ChunkZ); - SendData(Serialized.data(), Serialized.size()); - Flush(); -} - - - - - -void cProtocol132::SendCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player) -{ - cCSLock Lock(m_CSPacket); - WriteByte(PACKET_COLLECT_PICKUP); - WriteInt (a_Pickup.GetUniqueID()); - WriteInt (a_Player.GetUniqueID()); - Flush(); - - // Also send the "pop" sound effect with a somewhat random pitch (fast-random using EntityID ;) - SendSoundEffect( - "random.pop", - (int)(a_Pickup.GetPosX() * 8), (int)(a_Pickup.GetPosY() * 8), (int)(a_Pickup.GetPosZ() * 8), - 0.5, (float)(0.75 + ((float)((a_Pickup.GetUniqueID() * 23) % 32)) / 64) - ); -} - - - - - -void cProtocol132::SendDestroyEntity(const cEntity & a_Entity) -{ - if (a_Entity.GetUniqueID() == m_Client->GetPlayer()->GetUniqueID()) - { - // Do not send "destroy self" to the client, the client would crash (FS #254) - return; - } - - cCSLock Lock(m_CSPacket); - WriteByte(PACKET_DESTROY_ENTITIES); - WriteByte(1); // entity count - WriteInt (a_Entity.GetUniqueID()); - Flush(); -} - - - - - -void cProtocol132::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) -{ - cCSLock Lock(m_CSPacket); - WriteByte (PACKET_ENTITY_EQUIPMENT); - WriteInt (a_Entity.GetUniqueID()); - WriteShort(a_SlotNum); - WriteItem (a_Item); - Flush(); -} - - - - - -void cProtocol132::SendLogin(const cPlayer & a_Player, const cWorld & a_World) -{ - cCSLock Lock(m_CSPacket); - WriteByte (PACKET_LOGIN); - WriteInt (a_Player.GetUniqueID()); // EntityID of the player - WriteString("default"); // Level type - WriteByte ((int)a_Player.GetGameMode()); - WriteByte ((Byte)(a_World.GetDimension())); - WriteByte (2); // TODO: Difficulty - WriteByte (0); // Unused, used to be world height - WriteByte (8); // Client list width or something - Flush(); - - SendCompass(a_World); -} - - - - - -void cProtocol132::SendPlayerSpawn(const cPlayer & a_Player) -{ - const cItem & HeldItem = a_Player.GetEquippedItem(); - cCSLock Lock(m_CSPacket); - WriteByte (PACKET_PLAYER_SPAWN); - WriteInt (a_Player.GetUniqueID()); - WriteString(a_Player.GetName()); - WriteInt ((int)(a_Player.GetPosX() * 32)); - WriteInt ((int)(a_Player.GetPosY() * 32)); - WriteInt ((int)(a_Player.GetPosZ() * 32)); - WriteByte ((char)((a_Player.GetRot().x / 360.f) * 256)); - WriteByte ((char)((a_Player.GetRot().y / 360.f) * 256)); - WriteShort (HeldItem.IsEmpty() ? 0 : HeldItem.m_ItemType); - // Player metadata: just use a default metadata value, since the client doesn't like starting without any metadata: - WriteByte (0); // Index 0, byte (flags) - WriteByte (0); // Flags, empty - WriteByte (0x7f); // End of metadata - Flush(); -} - - - - - -void cProtocol132::SendSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) -{ - cCSLock Lock(m_CSPacket); - WriteByte (PACKET_SOUND_EFFECT); - WriteString (a_SoundName); - WriteInt (a_SrcX); - WriteInt (a_SrcY); - WriteInt (a_SrcZ); - WriteFloat (a_Volume); - WriteByte ((char)(a_Pitch * 63.0f)); - Flush(); -} - - - - - -void cProtocol132::SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) -{ - cCSLock Lock(m_CSPacket); - WriteByte(PACKET_SOUND_PARTICLE_EFFECT); - WriteInt (a_EffectID); - WriteInt (a_SrcX); - WriteByte(a_SrcY); - WriteInt (a_SrcZ); - WriteInt (a_Data); - Flush(); -} - - - - - -void cProtocol132::SendSpawnMob(const cMonster & a_Mob) -{ - cCSLock Lock(m_CSPacket); - WriteByte (PACKET_SPAWN_MOB); - WriteInt (a_Mob.GetUniqueID()); - WriteByte (a_Mob.GetMobType()); - WriteVectorI((Vector3i)(a_Mob.GetPosition() * 32)); - WriteByte ((Byte)((a_Mob.GetRotation() / 360.f) * 256)); - WriteByte ((Byte)((a_Mob.GetPitch() / 360.f) * 256)); - WriteByte ((Byte)((a_Mob.GetHeadYaw() / 360.f) * 256)); - WriteShort ((short)(a_Mob.GetSpeedX() * 400)); - WriteShort ((short)(a_Mob.GetSpeedY() * 400)); - WriteShort ((short)(a_Mob.GetSpeedZ() * 400)); - - WriteCommonMetadata(a_Mob); - WriteMobMetadata(a_Mob); - WriteByte(0x7f); - - Flush(); -} - - - - - -void cProtocol132::SendTabCompletionResults(const AStringVector & a_Results) -{ - if (a_Results.empty()) - { - // No results to send - return; - } - - AString Serialized(a_Results[0]); - for (AStringVector::const_iterator itr = a_Results.begin() + 1, end = a_Results.end(); itr != end; ++itr) - { - Serialized.push_back(0); - Serialized.append(*itr); - } // for itr - a_Results[] - - cCSLock Lock(m_CSPacket); - WriteByte(PACKET_TAB_COMPLETION); - WriteString(Serialized); - Flush(); -} - - - - - -void cProtocol132::SendUnloadChunk(int a_ChunkX, int a_ChunkZ) -{ - // Unloading the chunk is done by sending a "map chunk" packet - // with IncludeInitialize set to true and primary bitmap set to 0: - cCSLock Lock(m_CSPacket); - WriteByte(PACKET_CHUNK_DATA); - WriteInt (a_ChunkX); - WriteInt (a_ChunkZ); - WriteBool(true); // IncludeInitialize - WriteShort(0); // Primary bitmap - WriteShort(0); // Add bitmap - WriteInt(0); - Flush(); -} - - - - - -void cProtocol132::SendWholeInventory(const cWindow & a_Window) -{ - // 1.3.2 requires player inventory slots to be sent as SetSlot packets, - // otherwise it sometimes fails to update the window - - // Send the entire window: - super::SendWholeInventory(a_Window); - - // Send the player inventory and hotbar: - const cInventory & Inventory = m_Client->GetPlayer()->GetInventory(); - int BaseOffset = a_Window.GetNumSlots() - (cInventory::invNumSlots - cInventory::invInventoryOffset); // Number of non-inventory slots - char WindowID = a_Window.GetWindowID(); - for (int i = 0; i < cInventory::invInventoryCount; i++) - { - SendInventorySlot(WindowID, BaseOffset + i, Inventory.GetInventorySlot(i)); - } // for i - Inventory[] - BaseOffset += cInventory::invInventoryCount; - for (int i = 0; i < cInventory::invHotbarCount; i++) - { - SendInventorySlot(WindowID, BaseOffset + i, Inventory.GetHotbarSlot(i)); - } // for i - Hotbar[] - - // Send even the item being dragged: - SendInventorySlot(-1, -1, m_Client->GetPlayer()->GetDraggingItem()); -} - - - - - -AString cProtocol132::GetAuthServerID(void) -{ - // http://wiki.vg/wiki/index.php?title=Session&oldid=2615 - // Server uses SHA1 to mix ServerID, Client secret and server public key together - // The mixing is done in StartEncryption, the result is in m_AuthServerID - - return m_AuthServerID; -} - - - - - -int cProtocol132::ParsePacket(unsigned char a_PacketType) -{ - switch (a_PacketType) - { - default: return super::ParsePacket(a_PacketType); // off-load previously known packets into cProtocol125 - case PACKET_CLIENT_STATUSES: return ParseClientStatuses(); - case PACKET_ENCRYPTION_KEY_RESP: return ParseEncryptionKeyResponse(); - case PACKET_LOCALE_VIEW_DISTANCE: return ParseLocaleViewDistance(); - case PACKET_TAB_COMPLETION: return ParseTabCompletion(); - } -} - - - - - -int cProtocol132::ParseBlockPlace(void) -{ - HANDLE_PACKET_READ(ReadBEInt, int, PosX); - HANDLE_PACKET_READ(ReadByte, Byte, PosY); - HANDLE_PACKET_READ(ReadBEInt, int, PosZ); - HANDLE_PACKET_READ(ReadChar, char, BlockFace); - - cItem HeldItem; - int res = ParseItem(HeldItem); - if (res < 0) - { - return res; - } - - HANDLE_PACKET_READ(ReadChar, char, CursorX); - HANDLE_PACKET_READ(ReadChar, char, CursorY); - HANDLE_PACKET_READ(ReadChar, char, CursorZ); - - m_Client->HandleRightClick(PosX, PosY, PosZ, BlockFace, CursorX, CursorY, CursorZ, HeldItem); - return PARSE_OK; -} - - - - - -int cProtocol132::ParseHandshake(void) -{ - HANDLE_PACKET_READ(ReadByte, Byte, ProtocolVersion); - HANDLE_PACKET_READ(ReadBEUTF16String16, AString, Username); - HANDLE_PACKET_READ(ReadBEUTF16String16, AString, ServerHost); - HANDLE_PACKET_READ(ReadBEInt, int, ServerPort); - m_Username = Username; - - if (!m_Client->HandleHandshake( m_Username )) - { - return PARSE_OK; // Player is not allowed into the server - } - - // Send a 0xFD Encryption Key Request http://wiki.vg/Protocol#0xFD - CryptoPP::StringSink sink(m_ServerPublicKey); // GCC won't allow inline instantiation in the following line, damned temporary refs - cRoot::Get()->GetServer()->GetPublicKey().Save(sink); - SendEncryptionKeyRequest(); - - return PARSE_OK; -} - - - - - -int cProtocol132::ParseClientStatuses(void) -{ - HANDLE_PACKET_READ(ReadByte, byte, Status); - if ((Status & 1) == 0) - { - m_Client->HandleLogin(39, m_Username); - } - else - { - m_Client->HandleRespawn(); - } - return PARSE_OK; -} - - - - - -int cProtocol132::ParseEncryptionKeyResponse(void) -{ - HANDLE_PACKET_READ(ReadBEShort, short, EncKeyLength); - AString EncKey; - if (!m_ReceivedData.ReadString(EncKey, EncKeyLength)) - { - return PARSE_INCOMPLETE; - } - HANDLE_PACKET_READ(ReadBEShort, short, EncNonceLength); - AString EncNonce; - if (!m_ReceivedData.ReadString(EncNonce, EncNonceLength)) - { - return PARSE_INCOMPLETE; - } - if ((EncKeyLength > MAX_ENC_LEN) || (EncNonceLength > MAX_ENC_LEN)) - { - LOGD("Too long encryption"); - m_Client->Kick("Hacked client"); - return PARSE_OK; - } - - HandleEncryptionKeyResponse(EncKey, EncNonce); - return PARSE_OK; -} - - - - - -int cProtocol132::ParseLocaleViewDistance(void) -{ - HANDLE_PACKET_READ(ReadBEUTF16String16, AString, Locale); - HANDLE_PACKET_READ(ReadChar, char, ViewDistance); - HANDLE_PACKET_READ(ReadChar, char, ChatFlags); - HANDLE_PACKET_READ(ReadChar, char, ClientDifficulty); - // TODO: m_Client->HandleLocale(Locale); - // TODO: m_Client->HandleViewDistance(ViewDistance); - // TODO: m_Client->HandleChatFlags(ChatFlags); - // Ignoring client difficulty - return PARSE_OK; -} - - - - - -int cProtocol132::ParseLogin(void) -{ - // Login packet not used in 1.3.2 - return PARSE_ERROR; -} - - - - - -int cProtocol132::ParsePlayerAbilities(void) -{ - HANDLE_PACKET_READ(ReadBool, bool, Flags); - HANDLE_PACKET_READ(ReadChar, char, FlyingSpeed); - HANDLE_PACKET_READ(ReadChar, char, WalkingSpeed); - // TODO: m_Client->HandlePlayerAbilities(...); - return PARSE_OK; -} - - - - - -int cProtocol132::ParseTabCompletion(void) -{ - HANDLE_PACKET_READ(ReadBEUTF16String16, AString, Text); - m_Client->HandleTabCompletion(Text); - return PARSE_OK; -} - - - - - -void cProtocol132::SendData(const char * a_Data, int a_Size) -{ - m_DataToSend.append(a_Data, a_Size); -} - - - - - -void cProtocol132::Flush(void) -{ - ASSERT(m_CSPacket.IsLockedByCurrentThread()); // Did all packets lock the CS properly? - - if (m_DataToSend.empty()) - { - LOGD("Flushing empty"); - return; - } - const char * a_Data = m_DataToSend.data(); - int a_Size = m_DataToSend.size(); - if (m_IsEncrypted) - { - byte Encrypted[8192]; // Larger buffer, we may be sending lots of data (chunks) - while (a_Size > 0) - { - int NumBytes = (a_Size > sizeof(Encrypted)) ? sizeof(Encrypted) : a_Size; - m_Encryptor.ProcessData(Encrypted, (byte *)a_Data, NumBytes); - super::SendData((const char *)Encrypted, NumBytes); - a_Size -= NumBytes; - a_Data += NumBytes; - } - } - else - { - super::SendData(a_Data, a_Size); - } - m_DataToSend.clear(); -} - - - - - -void cProtocol132::WriteItem(const cItem & a_Item) -{ - short ItemType = a_Item.m_ItemType; - ASSERT(ItemType >= -1); // Check validity of packets in debug runtime - if (ItemType <= 0) - { - // Fix, to make sure no invalid values are sent. - ItemType = -1; - } - - if (a_Item.IsEmpty()) - { - WriteShort(-1); - return; - } - - WriteShort(ItemType); - WriteByte (a_Item.m_ItemCount); - WriteShort(a_Item.m_ItemDamage); - - if (a_Item.m_Enchantments.IsEmpty()) - { - WriteShort(-1); - return; - } - - // Send the enchantments: - cFastNBTWriter Writer; - const char * TagName = (a_Item.m_ItemType == E_ITEM_BOOK) ? "StoredEnchantments" : "ench"; - a_Item.m_Enchantments.WriteToNBTCompound(Writer, TagName); - Writer.Finish(); - AString Compressed; - CompressStringGZIP(Writer.GetResult().data(), Writer.GetResult().size(), Compressed); - WriteShort(Compressed.size()); - SendData(Compressed.data(), Compressed.size()); -} - - - - - -int cProtocol132::ParseItem(cItem & a_Item) -{ - HANDLE_PACKET_READ(ReadBEShort, short, ItemType); - - if (ItemType <= -1) - { - a_Item.Empty(); - return PARSE_OK; - } - a_Item.m_ItemType = ItemType; - - HANDLE_PACKET_READ(ReadChar, char, ItemCount); - HANDLE_PACKET_READ(ReadBEShort, short, ItemDamage); - a_Item.m_ItemCount = ItemCount; - a_Item.m_ItemDamage = ItemDamage; - if (ItemCount <= 0) - { - a_Item.Empty(); - } - - HANDLE_PACKET_READ(ReadBEShort, short, MetadataLength); - if (MetadataLength <= 0) - { - return PARSE_OK; - } - - // Read the metadata - AString Metadata; - Metadata.resize(MetadataLength); - if (!m_ReceivedData.ReadBuf((void *)Metadata.data(), MetadataLength)) - { - return PARSE_INCOMPLETE; - } - - return ParseItemMetadata(a_Item, Metadata); -} - - - - - -int cProtocol132::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata) -{ - // Uncompress the GZIPped data: - AString Uncompressed; - if (UncompressStringGZIP(a_Metadata.data(), a_Metadata.size(), Uncompressed) != Z_OK) - { - AString HexDump; - CreateHexDump(HexDump, a_Metadata.data(), a_Metadata.size(), 16); - LOG("Cannot unGZIP item metadata:\n%s", HexDump.c_str()); - return PARSE_ERROR; - } - - // Parse into NBT: - cParsedNBT NBT(Uncompressed.data(), Uncompressed.size()); - if (!NBT.IsValid()) - { - AString HexDump; - CreateHexDump(HexDump, Uncompressed.data(), Uncompressed.size(), 16); - LOG("Cannot parse NBT item metadata:\n%s", HexDump.c_str()); - return PARSE_ERROR; - } - - // Load enchantments from the NBT: - for (int tag = NBT.GetFirstChild(NBT.GetRoot()); tag >= 0; tag = NBT.GetNextSibling(tag)) - { - if ( - (NBT.GetType(tag) == TAG_List) && - ( - (NBT.GetName(tag) == "ench") || - (NBT.GetName(tag) == "StoredEnchantments") - ) - ) - { - a_Item.m_Enchantments.ParseFromNBT(NBT, tag); - } - } - - return PARSE_OK; -} - - - - - -void cProtocol132::SendCompass(const cWorld & a_World) -{ - cCSLock Lock(m_CSPacket); - WriteByte(PACKET_COMPASS); - WriteInt((int)(a_World.GetSpawnX())); - WriteInt((int)(a_World.GetSpawnY())); - WriteInt((int)(a_World.GetSpawnZ())); - Flush(); -} - - - - - -void cProtocol132::SendEncryptionKeyRequest(void) -{ - cCSLock Lock(m_CSPacket); - WriteByte((char)0xfd); - WriteString(cRoot::Get()->GetServer()->GetServerID()); - WriteShort((short)m_ServerPublicKey.size()); - SendData(m_ServerPublicKey.data(), m_ServerPublicKey.size()); - WriteShort(4); - WriteInt((int)(intptr_t)this); // Using 'this' as the cryptographic nonce, so that we don't have to generate one each time :) - Flush(); -} - - - - - -void cProtocol132::HandleEncryptionKeyResponse(const AString & a_EncKey, const AString & a_EncNonce) -{ - // Decrypt EncNonce using privkey - RSAES<PKCS1v15>::Decryptor rsaDecryptor(cRoot::Get()->GetServer()->GetPrivateKey()); - time_t CurTime = time(NULL); - CryptoPP::RandomPool rng; - rng.Put((const byte *)&CurTime, sizeof(CurTime)); - byte DecryptedNonce[MAX_ENC_LEN]; - DecodingResult res = rsaDecryptor.Decrypt(rng, (const byte *)a_EncNonce.data(), a_EncNonce.size(), DecryptedNonce); - if (!res.isValidCoding || (res.messageLength != 4)) - { - LOGD("Bad nonce length"); - m_Client->Kick("Hacked client"); - return; - } - if (ntohl(*((int *)DecryptedNonce)) != (unsigned)(uintptr_t)this) - { - LOGD("Bad nonce value"); - m_Client->Kick("Hacked client"); - return; - } - - // Decrypt the symmetric encryption key using privkey: - byte DecryptedKey[MAX_ENC_LEN]; - res = rsaDecryptor.Decrypt(rng, (const byte *)a_EncKey.data(), a_EncKey.size(), DecryptedKey); - if (!res.isValidCoding || (res.messageLength != 16)) - { - LOGD("Bad key length"); - m_Client->Kick("Hacked client"); - return; - } - - { - // Send encryption key response: - cCSLock Lock(m_CSPacket); - WriteByte((char)0xfc); - WriteShort(0); - WriteShort(0); - Flush(); - } - - StartEncryption(DecryptedKey); - return; -} - - - - - -void cProtocol132::StartEncryption(const byte * a_Key) -{ - m_Encryptor.SetKey(a_Key, 16, MakeParameters(Name::IV(), ConstByteArrayParameter(a_Key, 16))(Name::FeedbackSize(), 1)); - m_Decryptor.SetKey(a_Key, 16, MakeParameters(Name::IV(), ConstByteArrayParameter(a_Key, 16))(Name::FeedbackSize(), 1)); - m_IsEncrypted = true; - - // Prepare the m_AuthServerID: - CryptoPP::SHA1 Checksum; - AString ServerID = cRoot::Get()->GetServer()->GetServerID(); - Checksum.Update((const byte *)ServerID.c_str(), ServerID.length()); - Checksum.Update(a_Key, 16); - Checksum.Update((const byte *)m_ServerPublicKey.c_str(), m_ServerPublicKey.length()); - byte Digest[20]; - Checksum.Final(Digest); - DigestToJava(Digest, m_AuthServerID); -} - - - - diff --git a/source/Protocol/Protocol132.h b/source/Protocol/Protocol132.h deleted file mode 100644 index dc4d8aeef..000000000 --- a/source/Protocol/Protocol132.h +++ /dev/null @@ -1,102 +0,0 @@ - -// Protocol132.h - -// Interfaces to the cProtocol132 class representing the release 1.3.2 protocol (#39) - - - - - -#pragma once - -#include "Protocol125.h" -#include "../../CryptoPP/modes.h" -#include "../../CryptoPP/aes.h" - - - - - -class cProtocol132 : - public cProtocol125 -{ - typedef cProtocol125 super; -public: - - cProtocol132(cClientHandle * a_Client); - virtual ~cProtocol132(); - - /// Called when client sends some data: - virtual void DataReceived(const char * a_Data, int a_Size) override; - - // Sending commands (alphabetically sorted): - virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override; - virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override; - virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; - virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override; - virtual void SendDestroyEntity (const cEntity & a_Entity) override; - virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; - virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; - virtual void SendPlayerSpawn (const cPlayer & a_Player) override; - virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8 - virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; - virtual void SendSpawnMob (const cMonster & a_Mob) override; - virtual void SendTabCompletionResults(const AStringVector & a_Results) override; - virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override; - virtual void SendWholeInventory (const cWindow & a_Window) override; - - virtual AString GetAuthServerID(void) override; - - /// Handling of the additional packets: - virtual int ParsePacket(unsigned char a_PacketType) override; - - // Modified packets: - virtual int ParseBlockPlace (void) override; - virtual int ParseHandshake (void) override; - virtual int ParseLogin (void) override; - virtual int ParsePlayerAbilities(void) override; - - // New packets: - virtual int ParseClientStatuses (void); - virtual int ParseEncryptionKeyResponse(void); - virtual int ParseLocaleViewDistance (void); - virtual int ParseTabCompletion (void); - -protected: - bool m_IsEncrypted; - CryptoPP::CFB_Mode<CryptoPP::AES>::Decryption m_Decryptor; - CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption m_Encryptor; - AString m_DataToSend; - - /// The ServerID used for session authentication; set in StartEncryption(), used in GetAuthServerID() - AString m_AuthServerID; - - /// The server's public key, as used by SendEncryptionKeyRequest() and StartEncryption() - AString m_ServerPublicKey; - - virtual void SendData(const char * a_Data, int a_Size) override; - - // DEBUG: - virtual void Flush(void) override; - - // Items in slots are sent differently - virtual void WriteItem(const cItem & a_Item) override; - virtual int ParseItem(cItem & a_Item) override; - - /// Parses the metadata that may come with the item. - int ParseItemMetadata(cItem & a_Item, const AString & a_Metadata); - - virtual void SendCompass(const cWorld & a_World); - virtual void SendEncryptionKeyRequest(void); - - /// Decrypts the key and nonce, checks nonce, starts the symmetric encryption - void HandleEncryptionKeyResponse(const AString & a_EncKey, const AString & a_EncNonce); - - /// Starts the symmetric encryption with the specified key; also sets m_AuthServerID - void StartEncryption(const byte * a_Key); -} ; - - - - diff --git a/source/Protocol/Protocol14x.cpp b/source/Protocol/Protocol14x.cpp deleted file mode 100644 index d2582458b..000000000 --- a/source/Protocol/Protocol14x.cpp +++ /dev/null @@ -1,256 +0,0 @@ - -// Protocol14x.cpp - -/* -Implements the 1.4.x protocol classes representing these protocols: -- cProtocol142: - - release 1.4.2 protocol (#47) - - release 1.4.4 protocol (#49) - the same protocol class is used, because the only difference is in a packet that MCServer doesn't implement yet (ITEM_DATA) - - release 1.4.5 protocol (same as 1.4.4) -- cProtocol146: - - release 1.4.6 protocol (#51) -*/ - -#include "Globals.h" -#include "Protocol14x.h" -#include "../Root.h" -#include "../Server.h" -#include "../ClientHandle.h" -#include "../../CryptoPP/randpool.h" -#include "../Item.h" -#include "ChunkDataSerializer.h" -#include "../Entities/Player.h" -#include "../Mobs/Monster.h" -#include "../UI/Window.h" -#include "../Entities/Pickup.h" -#include "../Entities/FallingBlock.h" - - - - - -#define HANDLE_PACKET_READ(Proc, Type, Var) \ - Type Var; \ - { \ - if (!m_ReceivedData.Proc(Var)) \ - { \ - m_ReceivedData.CheckValid(); \ - return PARSE_INCOMPLETE; \ - } \ - m_ReceivedData.CheckValid(); \ - } - - - - - -enum -{ - PACKET_UPDATE_TIME = 0x04, - PACKET_PICKUP_SPAWN = 0x15, - PACKET_SPAWN_OBJECT = 0x17, - PACKET_ENTITY_METADATA = 0x28, - PACKET_SOUND_PARTICLE_EFFECT = 0x3d -} ; - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cProtocol142: - -cProtocol142::cProtocol142(cClientHandle * a_Client) : - super(a_Client) -{ -} - - - - - -int cProtocol142::ParseLocaleViewDistance(void) -{ - HANDLE_PACKET_READ(ReadBEUTF16String16, AString, Locale); - HANDLE_PACKET_READ(ReadChar, char, ViewDistance); - HANDLE_PACKET_READ(ReadChar, char, ChatFlags); - HANDLE_PACKET_READ(ReadChar, char, ClientDifficulty); - HANDLE_PACKET_READ(ReadChar, char, ShouldShowCape); // <-- new in 1.4.2 - // TODO: m_Client->HandleLocale(Locale); - // TODO: m_Client->HandleViewDistance(ViewDistance); - // TODO: m_Client->HandleChatFlags(ChatFlags); - // Ignoring client difficulty - return PARSE_OK; -} - - - - - -void cProtocol142::SendPickupSpawn(const cPickup & a_Pickup) -{ - cCSLock Lock(m_CSPacket); - WriteByte (PACKET_PICKUP_SPAWN); - WriteInt (a_Pickup.GetUniqueID()); - WriteItem (a_Pickup.GetItem()); - WriteVectorI((Vector3i)(a_Pickup.GetPosition() * 32)); - WriteByte ((char)(a_Pickup.GetSpeed().x * 8)); - WriteByte ((char)(a_Pickup.GetSpeed().y * 8)); - WriteByte ((char)(a_Pickup.GetSpeed().z * 8)); - Flush(); -} - - - - - -void cProtocol142::SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) -{ - cCSLock Lock(m_CSPacket); - WriteByte(PACKET_SOUND_PARTICLE_EFFECT); - WriteInt (a_EffectID); - WriteInt (a_SrcX); - WriteByte(a_SrcY); - WriteInt (a_SrcZ); - WriteInt (a_Data); - WriteBool(0); - Flush(); -} - - - - - -void cProtocol142::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay) -{ - cCSLock Lock(m_CSPacket); - WriteByte (PACKET_UPDATE_TIME); - WriteInt64(a_WorldAge); - WriteInt64(a_TimeOfDay); - Flush(); -} - - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cProtocol146: - -cProtocol146::cProtocol146(cClientHandle * a_Client) : - super(a_Client) -{ -} - - - - - -void cProtocol146::SendPickupSpawn(const cPickup & a_Pickup) -{ - ASSERT(!a_Pickup.GetItem().IsEmpty()); - - cCSLock Lock(m_CSPacket); - - // Send a SPAWN_OBJECT packet for the base entity: - WriteByte(PACKET_SPAWN_OBJECT); - WriteInt (a_Pickup.GetUniqueID()); - WriteByte(0x02); - WriteInt ((int)(a_Pickup.GetPosX() * 32)); - WriteInt ((int)(a_Pickup.GetPosY() * 32)); - WriteInt ((int)(a_Pickup.GetPosZ() * 32)); - WriteInt (1); - WriteShort((short)(a_Pickup.GetSpeed().x * 32)); - WriteShort((short)(a_Pickup.GetSpeed().y * 32)); - WriteShort((short)(a_Pickup.GetSpeed().z * 32)); - WriteByte(0); - WriteByte(0); - - // Send a ENTITY_METADATA packet with the slot info: - WriteByte(PACKET_ENTITY_METADATA); - WriteInt(a_Pickup.GetUniqueID()); - WriteByte(0xaa); // a slot value at index 10 - WriteItem(a_Pickup.GetItem()); - WriteByte(0x7f); // End of metadata - Flush(); -} - - - - - -void cProtocol146::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) -{ - // Send a spawn object / vehicle packet - cCSLock Lock(m_CSPacket); - - WriteByte(PACKET_SPAWN_OBJECT); - WriteInt (a_FallingBlock.GetUniqueID()); - WriteByte(70); - WriteInt ((int)(a_FallingBlock.GetPosX() * 32)); - WriteInt ((int)(a_FallingBlock.GetPosY() * 32)); - WriteInt ((int)(a_FallingBlock.GetPosZ() * 32)); - WriteByte (0); // Pitch - WriteByte (0); // Yaw - WriteInt (a_FallingBlock.GetBlockType()); // data indicator = blocktype - WriteShort((short)(a_FallingBlock.GetSpeedX() * 400)); - WriteShort((short)(a_FallingBlock.GetSpeedY() * 400)); - WriteShort((short)(a_FallingBlock.GetSpeedZ() * 400)); - Flush(); -} - - - - - -void cProtocol146::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) -{ - cCSLock Lock(m_CSPacket); - WriteByte(PACKET_SPAWN_OBJECT); - WriteInt (a_Entity.GetUniqueID()); - WriteByte(a_ObjectType); - WriteInt ((int)(a_Entity.GetPosX() * 32)); - WriteInt ((int)(a_Entity.GetPosY() * 32)); - WriteInt ((int)(a_Entity.GetPosZ() * 32)); - WriteByte(a_Pitch); - WriteByte(a_Yaw); - WriteInt (a_ObjectData); - if (a_ObjectData != 0) - { - WriteShort((short)(a_Entity.GetSpeedX() * 400)); - WriteShort((short)(a_Entity.GetSpeedY() * 400)); - WriteShort((short)(a_Entity.GetSpeedZ() * 400)); - } - Flush(); -} - - - - - -void cProtocol146::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) -{ - cCSLock Lock(m_CSPacket); - WriteByte (PACKET_SPAWN_OBJECT); - WriteInt (a_Vehicle.GetUniqueID()); - WriteByte (a_VehicleType); - WriteInt ((int)(a_Vehicle.GetPosX() * 32)); - WriteInt ((int)(a_Vehicle.GetPosY() * 32)); - WriteInt ((int)(a_Vehicle.GetPosZ() * 32)); - WriteByte ((Byte)((a_Vehicle.GetPitch() / 360.f) * 256)); - WriteByte ((Byte)((a_Vehicle.GetRotation() / 360.f) * 256)); - WriteInt (a_VehicleSubType); - if (a_VehicleSubType != 0) - { - WriteShort((short)(a_Vehicle.GetSpeedX() * 400)); - WriteShort((short)(a_Vehicle.GetSpeedY() * 400)); - WriteShort((short)(a_Vehicle.GetSpeedZ() * 400)); - } - Flush(); -} - - - - - diff --git a/source/Protocol/Protocol17x.h b/source/Protocol/Protocol17x.h deleted file mode 100644 index 255cb4ef5..000000000 --- a/source/Protocol/Protocol17x.h +++ /dev/null @@ -1,260 +0,0 @@ - -// Protocol17x.h - -/* -Declares the 1.7.x protocol classes: - - cProtocol172 - - release 1.7.2 protocol (#4) -(others may be added later in the future for the 1.7 release series) -*/ - - - - - -#pragma once - -#include "Protocol.h" -#include "../ByteBuffer.h" -#include "../../CryptoPP/modes.h" -#include "../../CryptoPP/aes.h" - - - - - -class cProtocol172 : - public cProtocol // TODO -{ - typedef cProtocol super; // TODO - -public: - - cProtocol172(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); - - /// Called when client sends some data: - virtual void DataReceived(const char * a_Data, int a_Size) override; - - /// Sending stuff to clients (alphabetically sorted): - virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override; - virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override; - virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override; - virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; - virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override; - virtual void SendChat (const AString & a_Message) override; - virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; - virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override; - virtual void SendDestroyEntity (const cEntity & a_Entity) override; - virtual void SendDisconnect (const AString & a_Reason) override; - virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+) - virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; - virtual void SendEntityHeadLook (const cEntity & a_Entity) override; - virtual void SendEntityLook (const cEntity & a_Entity) override; - virtual void SendEntityMetadata (const cEntity & a_Entity) override; - virtual void SendEntityProperties (const cEntity & a_Entity) override; - virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override; - virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override; - virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) override; - virtual void SendEntityVelocity (const cEntity & a_Entity) override; - virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override; - virtual void SendGameMode (eGameMode a_GameMode) override; - virtual void SendHealth (void) override; - virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override; - virtual void SendKeepAlive (int a_PingID) override; - virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; - virtual void SendPickupSpawn (const cPickup & a_Pickup) override; - virtual void SendPlayerAbilities (void) override; - virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override; - virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override; - virtual void SendPlayerMaxSpeed (void) override; - virtual void SendPlayerMoveLook (void) override; - virtual void SendPlayerPosition (void) override; - virtual void SendPlayerSpawn (const cPlayer & a_Player) override; - virtual void SendRespawn (void) override; - virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8 - virtual void SendExperience (void) override; - virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override; - virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; - virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override; - virtual void SendSpawnMob (const cMonster & a_Mob) override; - virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override; - virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) override; - virtual void SendTabCompletionResults(const AStringVector & a_Results) override; - virtual void SendTeleportEntity (const cEntity & a_Entity) override; - virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override; - virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) override; - virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override; - virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override; - virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override; - virtual void SendWeather (eWeather a_Weather) override; - virtual void SendWholeInventory (const cWindow & a_Window) override; - virtual void SendWindowClose (const cWindow & a_Window) override; - virtual void SendWindowOpen (const cWindow & a_Window) override; - virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override; - - virtual AString GetAuthServerID(void) override { return m_AuthServerID; } - -protected: - - /// Composes individual packets in the protocol's m_OutPacketBuffer; sends them upon being destructed - class cPacketizer - { - public: - cPacketizer(cProtocol172 & a_Protocol, UInt32 a_PacketType) : - m_Protocol(a_Protocol), - m_Out(a_Protocol.m_OutPacketBuffer), - m_Lock(a_Protocol.m_CSPacket) - { - m_Out.WriteVarInt(a_PacketType); - } - - ~cPacketizer(); - - void WriteBool(bool a_Value) - { - m_Out.WriteBool(a_Value); - } - - void WriteByte(Byte a_Value) - { - m_Out.WriteByte(a_Value); - } - - void WriteChar(char a_Value) - { - m_Out.WriteChar(a_Value); - } - - void WriteShort(short a_Value) - { - m_Out.WriteBEShort(a_Value); - } - - void WriteInt(int a_Value) - { - m_Out.WriteBEInt(a_Value); - } - - void WriteInt64(Int64 a_Value) - { - m_Out.WriteBEInt64(a_Value); - } - - void WriteFloat(float a_Value) - { - m_Out.WriteBEFloat(a_Value); - } - - void WriteDouble(double a_Value) - { - m_Out.WriteBEDouble(a_Value); - } - - void WriteVarInt(UInt32 a_Value) - { - m_Out.WriteVarInt(a_Value); - } - - void WriteString(const AString & a_Value) - { - m_Out.WriteVarUTF8String(a_Value); - } - - void WriteBuf(const char * a_Data, int a_Size) - { - m_Out.Write(a_Data, a_Size); - } - - void WriteItem(const cItem & a_Item); - void WriteByteAngle(double a_Angle); // Writes the specified angle using a single byte - void WriteFPInt(double a_Value); // Writes the double value as a 27:5 fixed-point integer - void WriteEntityMetadata(const cEntity & a_Entity); // Writes the metadata for the specified entity, not including the terminating 0x7f - void WriteMobMetadata(const cMonster & a_Mob); // Writes the mob-specific metadata for the specified mob - void WriteEntityProperties(const cEntity & a_Entity); // Writes the entity properties for the specified entity, including the Count field - - protected: - cProtocol172 & m_Protocol; - cByteBuffer & m_Out; - cCSLock m_Lock; - } ; - - AString m_ServerAddress; - - UInt16 m_ServerPort; - - AString m_AuthServerID; - - /// State of the protocol. 1 = status, 2 = login, 3 = game - UInt32 m_State; - - /// Buffer for the received data - cByteBuffer m_ReceivedData; - - /// Buffer for composing the outgoing packets, through cPacketizer - cByteBuffer m_OutPacketBuffer; - - /// Buffer for composing packet length (so that each cPacketizer instance doesn't allocate a new cPacketBuffer) - cByteBuffer m_OutPacketLenBuffer; - - bool m_IsEncrypted; - CryptoPP::CFB_Mode<CryptoPP::AES>::Decryption m_Decryptor; - CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption m_Encryptor; - - - /// Adds the received (unencrypted) data to m_ReceivedData, parses complete packets - void AddReceivedData(const char * a_Data, int a_Size); - - /// Reads and handles the packet. The packet length and type have already been read. - void HandlePacket(UInt32 a_PacketType, UInt32 a_RemainingBytes); - - // Packet handlers while in the Status state (m_State == 1): - void HandlePacketStatusPing (UInt32 a_RemainingBytes); - void HandlePacketStatusRequest(UInt32 a_RemainingBytes); - - // Packet handlers while in the Login state (m_State == 2): - void HandlePacketLoginEncryptionResponse(UInt32 a_RemainingBytes); - void HandlePacketLoginStart (UInt32 a_RemainingBytes); - - // Packet handlers while in the Game state (m_State == 3): - void HandlePacketAnimation (UInt32 a_RemainingBytes); - void HandlePacketBlockDig (UInt32 a_RemainingBytes); - void HandlePacketBlockPlace (UInt32 a_RemainingBytes); - void HandlePacketChatMessage (UInt32 a_RemainingBytes); - void HandlePacketClientSettings (UInt32 a_RemainingBytes); - void HandlePacketClientStatus (UInt32 a_RemainingBytes); - void HandlePacketCreativeInventoryAction(UInt32 a_RemainingBytes); - void HandlePacketEntityAction (UInt32 a_RemainingBytes); - void HandlePacketKeepAlive (UInt32 a_RemainingBytes); - void HandlePacketPlayer (UInt32 a_RemainingBytes); - void HandlePacketPlayerAbilities (UInt32 a_RemainingBytes); - void HandlePacketPlayerLook (UInt32 a_RemainingBytes); - void HandlePacketPlayerPos (UInt32 a_RemainingBytes); - void HandlePacketPlayerPosLook (UInt32 a_RemainingBytes); - void HandlePacketPluginMessage (UInt32 a_RemainingBytes); - void HandlePacketSlotSelect (UInt32 a_RemainingBytes); - void HandlePacketSteerVehicle (UInt32 a_RemainingBytes); - void HandlePacketTabComplete (UInt32 a_RemainingBytes); - void HandlePacketUpdateSign (UInt32 a_RemainingBytes); - void HandlePacketUseEntity (UInt32 a_RemainingBytes); - void HandlePacketWindowClick (UInt32 a_RemainingBytes); - void HandlePacketWindowClose (UInt32 a_RemainingBytes); - - - /// Writes an entire packet into the output stream. a_Packet is expected to start with the packet type; data length is prepended here. - void WritePacket(cByteBuffer & a_Packet); - - /// Sends the data to the client, encrypting them if needed. - virtual void SendData(const char * a_Data, int a_Size) override; - - void SendCompass(const cWorld & a_World); - - /// Reads an item out of the received data, sets a_Item to the values read. Returns false if not enough received data - bool ReadItem(cItem & a_Item); - - /// Parses item metadata as read by ReadItem(), into the item enchantments. - void ParseItemMetadata(cItem & a_Item, const AString & a_Metadata); -} ; - - - - diff --git a/source/RCONServer.cpp b/source/RCONServer.cpp deleted file mode 100644 index 3f86a7ca2..000000000 --- a/source/RCONServer.cpp +++ /dev/null @@ -1,333 +0,0 @@ - -// RCONServer.cpp - -// Implements the cRCONServer class representing the RCON server - -#include "Globals.h" -#include "../iniFile/iniFile.h" -#include "RCONServer.h" -#include "Server.h" -#include "Root.h" -#include "CommandOutput.h" - - - - - -// Disable MSVC warnings: -#if defined(_MSC_VER) - #pragma warning(push) - #pragma warning(disable:4355) // 'this' : used in base member initializer list -#endif - - - - - -enum -{ - // Client -> Server: - RCON_PACKET_COMMAND = 2, - RCON_PACKET_LOGIN = 3, - - // Server -> Client: - RCON_PACKET_RESPONSE = 2, -} ; - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cRCONCommandOutput: - -class cRCONCommandOutput : - public cCommandOutputCallback -{ -public: - cRCONCommandOutput(cRCONServer::cConnection & a_Connection, int a_RequestID) : - m_Connection(a_Connection), - m_RequestID(a_RequestID) - { - } - - // cCommandOutputCallback overrides: - virtual void Out(const AString & a_Text) override - { - m_Buffer.append(a_Text); - } - - virtual void Finished(void) override - { - m_Connection.SendResponse(m_RequestID, RCON_PACKET_RESPONSE, m_Buffer.size(), m_Buffer.c_str()); - delete this; - } - -protected: - cRCONServer::cConnection & m_Connection; - int m_RequestID; - AString m_Buffer; -} ; - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cRCONServer: - -cRCONServer::cRCONServer(cServer & a_Server) : - m_Server(a_Server), - m_ListenThread4(*this, cSocket::IPv4, "RCON IPv4"), - m_ListenThread6(*this, cSocket::IPv6, "RCON IPv6") -{ -} - - - - - -cRCONServer::~cRCONServer() -{ - m_ListenThread4.Stop(); - m_ListenThread6.Stop(); -} - - - - - -void cRCONServer::Initialize(cIniFile & a_IniFile) -{ - if (!a_IniFile.GetValueSetB("RCON", "Enabled", false)) - { - return; - } - - // Read the password, don't allow an empty one: - m_Password = a_IniFile.GetValueSet("RCON", "Password", ""); - if (m_Password.empty()) - { - LOGWARNING("RCON is requested, but the password is not set. RCON is now disabled."); - return; - } - - // Read and initialize both IPv4 and IPv6 ports for RCON - bool HasAnyPorts = false; - AString Ports4 = a_IniFile.GetValueSet("RCON", "PortsIPv4", "25575"); - if (m_ListenThread4.Initialize(Ports4)) - { - HasAnyPorts = true; - m_ListenThread4.Start(); - } - AString Ports6 = a_IniFile.GetValueSet("RCON", "PortsIPv6", "25575"); - if (m_ListenThread6.Initialize(Ports6)) - { - HasAnyPorts = true; - m_ListenThread6.Start(); - } - if (!HasAnyPorts) - { - LOGWARNING("RCON is requested, but no ports are specified. Specify at least one port in PortsIPv4 or PortsIPv6. RCON is now disabled."); - return; - } -} - - - - - -void cRCONServer::OnConnectionAccepted(cSocket & a_Socket) -{ - if (!a_Socket.IsValid()) - { - return; - } - - LOG("RCON Client \"%s\" connected!", a_Socket.GetIPString().c_str()); - - // Create a new cConnection object, it will be deleted when the connection is closed - m_SocketThreads.AddClient(a_Socket, new cConnection(*this, a_Socket)); -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cRCONServer::cConnection: - -cRCONServer::cConnection::cConnection(cRCONServer & a_RCONServer, cSocket & a_Socket) : - m_IsAuthenticated(false), - m_RCONServer(a_RCONServer), - m_Socket(a_Socket), - m_IPAddress(a_Socket.GetIPString()) -{ -} - - - - - -void cRCONServer::cConnection::DataReceived(const char * a_Data, int a_Size) -{ - // Append data to the buffer: - m_Buffer.append(a_Data, a_Size); - - // Process the packets in the buffer: - while (m_Buffer.size() >= 14) - { - int Length = IntFromBuffer(m_Buffer.data()); - if (Length > 1500) - { - // Too long, drop the connection - LOGWARNING("Received an invalid RCON packet length (%d), dropping RCON connection to %s.", - Length, m_IPAddress.c_str() - ); - m_RCONServer.m_SocketThreads.RemoveClient(this); - m_Socket.CloseSocket(); - delete this; - return; - } - if (Length > (int)(m_Buffer.size() + 4)) - { - // Incomplete packet yet, wait for more data to come - return; - } - - int RequestID = IntFromBuffer(m_Buffer.data() + 4); - int PacketType = IntFromBuffer(m_Buffer.data() + 8); - if (!ProcessPacket(RequestID, PacketType, Length - 10, m_Buffer.data() + 12)) - { - m_RCONServer.m_SocketThreads.RemoveClient(this); - m_Socket.CloseSocket(); - delete this; - return; - } - m_Buffer.erase(0, Length + 4); - } // while (m_Buffer.size() >= 14) -} - - - - - -void cRCONServer::cConnection::GetOutgoingData(AString & a_Data) -{ - a_Data.assign(m_Outgoing); - m_Outgoing.clear(); -} - - - - - -void cRCONServer::cConnection::SocketClosed(void) -{ - m_RCONServer.m_SocketThreads.RemoveClient(this); - delete this; -} - - - - - -bool cRCONServer::cConnection::ProcessPacket(int a_RequestID, int a_PacketType, int a_PayloadLength, const char * a_Payload) -{ - switch (a_PacketType) - { - case RCON_PACKET_LOGIN: - { - if (strncmp(a_Payload, m_RCONServer.m_Password.c_str(), a_PayloadLength) != 0) - { - LOGINFO("RCON: Invalid password from client %s, dropping connection.", m_IPAddress.c_str()); - SendResponse(-1, RCON_PACKET_RESPONSE, 0, NULL); - return false; - } - m_IsAuthenticated = true; - - LOGD("RCON: Client at %s has successfully authenticated", m_IPAddress.c_str()); - - // Send OK response: - SendResponse(a_RequestID, RCON_PACKET_RESPONSE, 0, NULL); - return true; - } - - case RCON_PACKET_COMMAND: - { - if (!m_IsAuthenticated) - { - char AuthNeeded[] = "You need to authenticate first!"; - SendResponse(a_RequestID, RCON_PACKET_RESPONSE, sizeof(AuthNeeded), AuthNeeded); - return false; - } - - AString cmd(a_Payload, a_PayloadLength); - LOGD("RCON command from %s: \"%s\"", m_IPAddress.c_str(), cmd.c_str()); - cRoot::Get()->ExecuteConsoleCommand(cmd, *(new cRCONCommandOutput(*this, a_RequestID))); - - // Send an empty response: - SendResponse(a_RequestID, RCON_PACKET_RESPONSE, 0, NULL); - return true; - } - } - - // Unknown packet type, drop the connection: - LOGWARNING("RCON: Client at %s has sent an unknown packet type %d, dropping connection.", - m_IPAddress.c_str(), a_PacketType - ); - return false; -} - - - - - -/// Reads 4 bytes from a_Buffer and returns the int they represent -int cRCONServer::cConnection::IntFromBuffer(const char * a_Buffer) -{ - return ((unsigned char)a_Buffer[3] << 24) | ((unsigned char)a_Buffer[2] << 16) | ((unsigned char)a_Buffer[1] << 8) | (unsigned char)a_Buffer[0]; -} - - - - - -/// Puts 4 bytes representing the int into the buffer -void cRCONServer::cConnection::IntToBuffer(int a_Value, char * a_Buffer) -{ - a_Buffer[0] = a_Value & 0xff; - a_Buffer[1] = (a_Value >> 8) & 0xff; - a_Buffer[2] = (a_Value >> 16) & 0xff; - a_Buffer[3] = (a_Value >> 24) & 0xff; -} - - - - - -/// Sends a RCON packet back to the client -void cRCONServer::cConnection::SendResponse(int a_RequestID, int a_PacketType, int a_PayloadLength, const char * a_Payload) -{ - ASSERT((a_PayloadLength == 0) || (a_Payload != NULL)); // Either zero data to send, or a valid payload ptr - - char Buffer[4]; - int Length = a_PayloadLength + 10; - IntToBuffer(Length, Buffer); - m_Outgoing.append(Buffer, 4); - IntToBuffer(a_RequestID, Buffer); - m_Outgoing.append(Buffer, 4); - IntToBuffer(a_PacketType, Buffer); - m_Outgoing.append(Buffer, 4); - if (a_PayloadLength > 0) - { - m_Outgoing.append(a_Payload, a_PayloadLength); - } - m_Outgoing.push_back(0); - m_Outgoing.push_back(0); - m_RCONServer.m_SocketThreads.NotifyWrite(this); -} - - - - diff --git a/source/Root.cpp b/source/Root.cpp deleted file mode 100644 index 5bb04abfb..000000000 --- a/source/Root.cpp +++ /dev/null @@ -1,754 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "Root.h" -#include "Server.h" -#include "World.h" -#include "WebAdmin.h" -#include "FurnaceRecipe.h" -#include "GroupManager.h" -#include "CraftingRecipes.h" -#include "PluginManager.h" -#include "MonsterConfig.h" -#include "Entities/Player.h" -#include "Blocks/BlockHandler.h" -#include "Items/ItemHandler.h" -#include "Chunk.h" -#include "Protocol/ProtocolRecognizer.h" // for protocol version constants -#include "CommandOutput.h" -#include "DeadlockDetect.h" -#include "OSSupport/Timer.h" - -#include "../iniFile/iniFile.h" - -#ifdef _WIN32 - #include <psapi.h> -#elif defined(__linux__) - #include <fstream> -#elif defined(__APPLE__) - #include <mach/mach.h> -#endif - - - - - -cRoot* cRoot::s_Root = NULL; - - - - - -cRoot::cRoot() - : m_Server( NULL ) - , m_MonsterConfig( NULL ) - , m_GroupManager( NULL ) - , m_CraftingRecipes(NULL) - , m_FurnaceRecipe( NULL ) - , m_WebAdmin( NULL ) - , m_PluginManager( NULL ) - , m_Log( NULL ) - , m_bStop( false ) - , m_bRestart( false ) - , m_InputThread( NULL ) - , m_pDefaultWorld( NULL ) -{ - s_Root = this; -} - - - - - -cRoot::~cRoot() -{ - s_Root = 0; -} - - - - - -void cRoot::InputThread(void * a_Params) -{ - cRoot & self = *(cRoot*)a_Params; - - cLogCommandOutputCallback Output; - - while (!(self.m_bStop || self.m_bRestart) && std::cin.good()) - { - std::string Command; - std::getline(std::cin, Command); - if (!Command.empty()) - { - self.ExecuteConsoleCommand(Command, Output); - } - } - - if (!(self.m_bStop || self.m_bRestart)) - { - // We have come here because the std::cin has received an EOF and the server is still running; stop the server: - self.m_bStop = true; - } -} - - - - - -void cRoot::Start(void) -{ - cDeadlockDetect dd; - delete m_Log; - m_Log = new cMCLogger(); - - m_bStop = false; - while (!m_bStop) - { - cTimer Time; - long long mseconds = Time.GetNowTime(); - - m_bRestart = false; - - LoadGlobalSettings(); - - LOG("Creating new server instance..."); - m_Server = new cServer(); - - LOG("Reading server config..."); - cIniFile IniFile; - if (!IniFile.ReadFile("settings.ini")) - { - LOGWARN("Regenerating settings.ini, all settings will be reset"); - IniFile.AddHeaderComment(" This is the main server configuration"); - IniFile.AddHeaderComment(" Most of the settings here can be configured using the webadmin interface, if enabled in webadmin.ini"); - IniFile.AddHeaderComment(" See: http://www.mc-server.org/wiki/doku.php?id=configure:settings.ini for further configuration help"); - } - - m_PrimaryServerVersion = IniFile.GetValueI("Server", "PrimaryServerVersion", 0); - if (m_PrimaryServerVersion == 0) - { - m_PrimaryServerVersion = cProtocolRecognizer::PROTO_VERSION_LATEST; - } - else - { - // Make a note in the log that the primary server version is explicitly set in the ini file - LOGINFO("Primary server version set explicitly to %d.", m_PrimaryServerVersion); - } - - LOG("Starting server..."); - if (!m_Server->InitServer(IniFile)) - { - LOGERROR("Failure starting server, aborting..."); - return; - } - - m_WebAdmin = new cWebAdmin(); - m_WebAdmin->Init(); - - LOGD("Loading settings..."); - m_GroupManager = new cGroupManager(); - m_CraftingRecipes = new cCraftingRecipes; - m_FurnaceRecipe = new cFurnaceRecipe(); - - LOGD("Loading worlds..."); - LoadWorlds(IniFile); - - LOGD("Loading plugin manager..."); - m_PluginManager = new cPluginManager(); - m_PluginManager->ReloadPluginsNow(IniFile); - - LOGD("Loading MonsterConfig..."); - m_MonsterConfig = new cMonsterConfig; - - // This sets stuff in motion - LOGD("Starting Authenticator..."); - m_Authenticator.Start(IniFile); - - IniFile.WriteFile("settings.ini"); - - LOGD("Starting worlds..."); - StartWorlds(); - - LOGD("Starting deadlock detector..."); - dd.Start(); - - LOGD("Finalising startup..."); - m_Server->Start(); - - m_WebAdmin->Start(); - - #if !defined(ANDROID_NDK) - LOGD("Starting InputThread..."); - m_InputThread = new cThread( InputThread, this, "cRoot::InputThread" ); - m_InputThread->Start( false ); // We should NOT wait? Otherwise we can´t stop the server from other threads than the input thread - #endif - - long long finishmseconds = Time.GetNowTime(); - finishmseconds -= mseconds; - - LOG("Startup complete, took %i ms!", finishmseconds); - - while (!m_bStop && !m_bRestart) // These are modified by external threads - { - cSleep::MilliSleep(1000); - } - - #if !defined(ANDROID_NDK) - delete m_InputThread; m_InputThread = NULL; - #endif - - // Deallocate stuffs - LOG("Shutting down server..."); - m_Server->Shutdown(); - - LOGD("Shutting down deadlock detector..."); - dd.Stop(); - - LOGD("Stopping world threads..."); - StopWorlds(); - - LOGD("Stopping authenticator..."); - m_Authenticator.Stop(); - - LOGD("Freeing MonsterConfig..."); - delete m_MonsterConfig; m_MonsterConfig = NULL; - delete m_WebAdmin; m_WebAdmin = NULL; - LOGD("Unloading recipes..."); - delete m_FurnaceRecipe; m_FurnaceRecipe = NULL; - delete m_CraftingRecipes; m_CraftingRecipes = NULL; - LOGD("Forgetting groups..."); - delete m_GroupManager; m_GroupManager = 0; - LOGD("Unloading worlds..."); - UnloadWorlds(); - - LOGD("Stopping plugin manager..."); - delete m_PluginManager; m_PluginManager = NULL; - - cItemHandler::Deinit(); - cBlockHandler::Deinit(); - - LOG("Cleaning up..."); - //delete HeartBeat; HeartBeat = 0; - delete m_Server; m_Server = 0; - LOG("Shutdown successful!"); - } - - delete m_Log; m_Log = 0; -} - - - - - -void cRoot::LoadGlobalSettings() -{ - // Nothing needed yet -} - - - - - -void cRoot::LoadWorlds(cIniFile & IniFile) -{ - // First get the default world - AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world"); - m_pDefaultWorld = new cWorld( DefaultWorldName.c_str() ); - m_WorldsByName[ DefaultWorldName ] = m_pDefaultWorld; - - // Then load the other worlds - unsigned int KeyNum = IniFile.FindKey("Worlds"); - unsigned int NumWorlds = IniFile.GetNumValues( KeyNum ); - if (NumWorlds <= 0) - { - return; - } - - bool FoundAdditionalWorlds = false; - for (unsigned int i = 0; i < NumWorlds; i++) - { - AString ValueName = IniFile.GetValueName(KeyNum, i ); - if (ValueName.compare("World") != 0) - { - continue; - } - AString WorldName = IniFile.GetValue(KeyNum, i ); - if (WorldName.empty()) - { - continue; - } - FoundAdditionalWorlds = true; - cWorld* NewWorld = new cWorld( WorldName.c_str() ); - m_WorldsByName[ WorldName ] = NewWorld; - } // for i - Worlds - - if (!FoundAdditionalWorlds) - { - if (IniFile.GetKeyComment("Worlds", 0) != " World=secondworld") - { - IniFile.AddKeyComment("Worlds", " World=secondworld"); - } - } -} - - - - - -void cRoot::StartWorlds(void) -{ - for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr) - { - itr->second->Start(); - itr->second->InitializeSpawn(); - } -} - - - - - -void cRoot::StopWorlds(void) -{ - for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr) - { - itr->second->Stop(); - } -} - - - - - -void cRoot::UnloadWorlds(void) -{ - m_pDefaultWorld = NULL; - for( WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr ) - { - delete itr->second; - } - m_WorldsByName.clear(); -} - - - - - -cWorld* cRoot::GetDefaultWorld() -{ - return m_pDefaultWorld; -} - - - - - -cWorld* cRoot::GetWorld( const AString & a_WorldName ) -{ - WorldMap::iterator itr = m_WorldsByName.find( a_WorldName ); - if( itr != m_WorldsByName.end() ) - return itr->second; - return 0; -} - - - - - -bool cRoot::ForEachWorld(cWorldListCallback & a_Callback) -{ - for (WorldMap::iterator itr = m_WorldsByName.begin(), itr2 = itr; itr != m_WorldsByName.end(); itr = itr2) - { - ++itr2; - if (a_Callback.Item(itr->second)) - { - return false; - } - } - return true; -} - - - - - -void cRoot::TickCommands(void) -{ - // Execute any pending commands: - cCommandQueue PendingCommands; - { - cCSLock Lock(m_CSPendingCommands); - std::swap(PendingCommands, m_PendingCommands); - } - for (cCommandQueue::iterator itr = PendingCommands.begin(), end = PendingCommands.end(); itr != end; ++itr) - { - ExecuteConsoleCommand(itr->m_Command, *(itr->m_Output)); - } -} - - - - - -void cRoot::QueueExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output) -{ - // Some commands are built-in: - if (a_Cmd == "stop") - { - m_bStop = true; - } - else if (a_Cmd == "restart") - { - m_bRestart = true; - } - - // Put the command into a queue (Alleviates FS #363): - cCSLock Lock(m_CSPendingCommands); - m_PendingCommands.push_back(cCommand(a_Cmd, &a_Output)); -} - - - - - -void cRoot::QueueExecuteConsoleCommand(const AString & a_Cmd) -{ - // Some commands are built-in: - if (a_Cmd == "stop") - { - m_bStop = true; - } - else if (a_Cmd == "restart") - { - m_bRestart = true; - } - - // Put the command into a queue (Alleviates FS #363): - cCSLock Lock(m_CSPendingCommands); - m_PendingCommands.push_back(cCommand(a_Cmd, new cLogCommandDeleteSelfOutputCallback)); -} - - - - - -void cRoot::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output) -{ - // Some commands are built-in: - if (a_Cmd == "stop") - { - m_bStop = true; - } - else if (a_Cmd == "restart") - { - m_bRestart = true; - } - - LOG("Executing console command: \"%s\"", a_Cmd.c_str()); - m_Server->ExecuteConsoleCommand(a_Cmd, a_Output); -} - - - - - -void cRoot::KickUser(int a_ClientID, const AString & a_Reason) -{ - m_Server->KickUser(a_ClientID, a_Reason); -} - - - - - -void cRoot::AuthenticateUser(int a_ClientID) -{ - m_Server->AuthenticateUser(a_ClientID); -} - - - - - -int cRoot::GetTotalChunkCount(void) -{ - int res = 0; - for ( WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr ) - { - res += itr->second->GetNumChunks(); - } - return res; -} - - - - - -void cRoot::SaveAllChunks(void) -{ - for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr) - { - itr->second->QueueSaveAllChunks(); - } -} - - - - - -void cRoot::BroadcastChat(const AString & a_Message) -{ - for (WorldMap::iterator itr = m_WorldsByName.begin(), end = m_WorldsByName.end(); itr != end; ++itr) - { - itr->second->BroadcastChat(a_Message); - } // for itr - m_WorldsByName[] -} - - - - - -bool cRoot::ForEachPlayer(cPlayerListCallback & a_Callback) -{ - for (WorldMap::iterator itr = m_WorldsByName.begin(), itr2 = itr; itr != m_WorldsByName.end(); itr = itr2) - { - ++itr2; - if (!itr->second->ForEachPlayer(a_Callback)) - { - return false; - } - } - return true; -} - - - - - -bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback) -{ - class cCallback : public cPlayerListCallback - { - unsigned int BestRating; - unsigned int NameLength; - const AString PlayerName; - - cPlayerListCallback & m_Callback; - virtual bool Item (cPlayer * a_pPlayer) - { - unsigned int Rating = RateCompareString (PlayerName, a_pPlayer->GetName()); - if (Rating > 0 && Rating >= BestRating) - { - BestMatch = a_pPlayer; - if( Rating > BestRating ) NumMatches = 0; - BestRating = Rating; - ++NumMatches; - } - if (Rating == NameLength) // Perfect match - { - return true; - } - return false; - } - - public: - cCallback (const AString & a_PlayerName, cPlayerListCallback & a_Callback) - : m_Callback( a_Callback ) - , BestMatch( NULL ) - , BestRating( 0 ) - , NumMatches( 0 ) - , NameLength( a_PlayerName.length() ) - , PlayerName( a_PlayerName ) - {} - - cPlayer * BestMatch; - unsigned int NumMatches; - } Callback (a_PlayerName, a_Callback); - ForEachPlayer( Callback ); - - if (Callback.NumMatches == 1) - { - return a_Callback.Item (Callback.BestMatch); - } - return false; -} - - - - - -AString cRoot::GetProtocolVersionTextFromInt(int a_ProtocolVersion) -{ - return cProtocolRecognizer::GetVersionTextFromInt(a_ProtocolVersion); -} - - - - - -int cRoot::GetVirtualRAMUsage(void) -{ - #ifdef _WIN32 - PROCESS_MEMORY_COUNTERS_EX pmc; - if (GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS *)&pmc, sizeof(pmc))) - { - return (int)(pmc.PrivateUsage / 1024); - } - return -1; - #elif defined(__linux__) - // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process - std::ifstream StatFile("/proc/self/status"); - if (!StatFile.good()) - { - return -1; - } - while (StatFile.good()) - { - AString Line; - std::getline(StatFile, Line); - if (strncmp(Line.c_str(), "VmSize:", 7) == 0) - { - int res = atoi(Line.c_str() + 8); - return (res == 0) ? -1 : res; // If parsing failed, return -1 - } - } - return -1; - #elif defined (__APPLE__) - // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process - struct task_basic_info t_info; - mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT; - - if (KERN_SUCCESS == task_info( - mach_task_self(), - TASK_BASIC_INFO, - (task_info_t)&t_info, - &t_info_count - )) - { - return (int)(t_info.virtual_size / 1024); - } - return -1; - #else - LOGINFO("%s: Unknown platform, cannot query memory usage", __FUNCTION__); - return -1; - #endif -} - - - - - -int cRoot::GetPhysicalRAMUsage(void) -{ - #ifdef _WIN32 - PROCESS_MEMORY_COUNTERS pmc; - if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) - { - return (int)(pmc.WorkingSetSize / 1024); - } - return -1; - #elif defined(__linux__) - // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process - std::ifstream StatFile("/proc/self/status"); - if (!StatFile.good()) - { - return -1; - } - while (StatFile.good()) - { - AString Line; - std::getline(StatFile, Line); - if (strncmp(Line.c_str(), "VmRSS:", 7) == 0) - { - int res = atoi(Line.c_str() + 8); - return (res == 0) ? -1 : res; // If parsing failed, return -1 - } - } - return -1; - #elif defined (__APPLE__) - // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process - struct task_basic_info t_info; - mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT; - - if (KERN_SUCCESS == task_info( - mach_task_self(), - TASK_BASIC_INFO, - (task_info_t)&t_info, - &t_info_count - )) - { - return (int)(t_info.resident_size / 1024); - } - return -1; - #else - LOGINFO("%s: Unknown platform, cannot query memory usage", __FUNCTION__); - return -1; - #endif -} - - - - - -void cRoot::LogChunkStats(cCommandOutputCallback & a_Output) -{ - int SumNumValid = 0; - int SumNumDirty = 0; - int SumNumInLighting = 0; - int SumNumInGenerator = 0; - int SumMem = 0; - for (WorldMap::iterator itr = m_WorldsByName.begin(), end = m_WorldsByName.end(); itr != end; ++itr) - { - cWorld * World = itr->second; - int NumInGenerator = World->GetGeneratorQueueLength(); - int NumInSaveQueue = World->GetStorageSaveQueueLength(); - int NumInLoadQueue = World->GetStorageLoadQueueLength(); - int NumValid = 0; - int NumDirty = 0; - int NumInLighting = 0; - World->GetChunkStats(NumValid, NumDirty, NumInLighting); - a_Output.Out("World %s:", World->GetName().c_str()); - a_Output.Out(" Num loaded chunks: %d", NumValid); - a_Output.Out(" Num dirty chunks: %d", NumDirty); - a_Output.Out(" Num chunks in lighting queue: %d", NumInLighting); - a_Output.Out(" Num chunks in generator queue: %d", NumInGenerator); - a_Output.Out(" Num chunks in storage load queue: %d", NumInLoadQueue); - a_Output.Out(" Num chunks in storage save queue: %d", NumInSaveQueue); - int Mem = NumValid * sizeof(cChunk); - a_Output.Out(" Memory used by chunks: %d KiB (%d MiB)", (Mem + 1023) / 1024, (Mem + 1024 * 1024 - 1) / (1024 * 1024)); - a_Output.Out(" Per-chunk memory size breakdown:"); - a_Output.Out(" block types: %6d bytes (%3d KiB)", sizeof(cChunkDef::BlockTypes), (sizeof(cChunkDef::BlockTypes) + 1023) / 1024); - a_Output.Out(" block metadata: %6d bytes (%3d KiB)", sizeof(cChunkDef::BlockNibbles), (sizeof(cChunkDef::BlockNibbles) + 1023) / 1024); - a_Output.Out(" block lighting: %6d bytes (%3d KiB)", 2 * sizeof(cChunkDef::BlockNibbles), (2 * sizeof(cChunkDef::BlockNibbles) + 1023) / 1024); - a_Output.Out(" heightmap: %6d bytes (%3d KiB)", sizeof(cChunkDef::HeightMap), (sizeof(cChunkDef::HeightMap) + 1023) / 1024); - a_Output.Out(" biomemap: %6d bytes (%3d KiB)", sizeof(cChunkDef::BiomeMap), (sizeof(cChunkDef::BiomeMap) + 1023) / 1024); - int Rest = sizeof(cChunk) - sizeof(cChunkDef::BlockTypes) - 3 * sizeof(cChunkDef::BlockNibbles) - sizeof(cChunkDef::HeightMap) - sizeof(cChunkDef::BiomeMap); - a_Output.Out(" other: %6d bytes (%3d KiB)", Rest, (Rest + 1023) / 1024); - SumNumValid += NumValid; - SumNumDirty += NumDirty; - SumNumInLighting += NumInLighting; - SumNumInGenerator += NumInGenerator; - SumMem += Mem; - } - a_Output.Out("Totals:"); - a_Output.Out(" Num loaded chunks: %d", SumNumValid); - a_Output.Out(" Num dirty chunks: %d", SumNumDirty); - a_Output.Out(" Num chunks in lighting queue: %d", SumNumInLighting); - a_Output.Out(" Num chunks in generator queue: %d", SumNumInGenerator); - a_Output.Out(" Memory used by chunks: %d KiB (%d MiB)", (SumMem + 1023) / 1024, (SumMem + 1024 * 1024 - 1) / (1024 * 1024)); -} - - - - - -int cRoot::GetFurnaceFuelBurnTime(const cItem & a_Fuel) -{ - cFurnaceRecipe * FR = Get()->GetFurnaceRecipe(); - return FR->GetBurnTime(a_Fuel); -} - - - - diff --git a/source/SQLite/lsqlite3.c b/source/SQLite/lsqlite3.c deleted file mode 100644 index 4c81b5878..000000000 --- a/source/SQLite/lsqlite3.c +++ /dev/null @@ -1,2175 +0,0 @@ -/************************************************************************ -* lsqlite3 * -* Copyright (C) 2002-2013 Tiago Dionizio, Doug Currie * -* All rights reserved. * -* Author : Tiago Dionizio <tiago.dionizio@ist.utl.pt> * -* Author : Doug Currie <doug.currie@alum.mit.edu> * -* Library : lsqlite3 - a SQLite 3 database binding for Lua 5 * -* * -* 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. * -************************************************************************/ -// Slightly modified by _Xoft to compile in MSVC - - - - -// 2013_04_07 _X: Added the following #define-s so that MSVC doesn't complain about non-secure stuff: -#define _CRT_SECURE_NO_WARNINGS -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - - - - -#include <stdlib.h> -#include <string.h> -#include <assert.h> - -#define LUA_LIB -#include "lua.h" -#include "lauxlib.h" - -#if LUA_VERSION_NUM > 501 -// -// Lua 5.2 -// -#define lua_strlen lua_rawlen -// luaL_typerror always used with arg at ndx == NULL -#define luaL_typerror(L,ndx,str) luaL_error(L,"bad argument %d (%s expected, got nil)",ndx,str) -// luaL_register used once, so below expansion is OK for this case -#define luaL_register(L,name,reg) lua_newtable(L);luaL_setfuncs(L,reg,0) -// luaL_openlib always used with name == NULL -#define luaL_openlib(L,name,reg,nup) luaL_setfuncs(L,reg,nup) -#endif - -#include "sqlite3.h" - -/* compile time features */ -#if !defined(SQLITE_OMIT_PROGRESS_CALLBACK) - #define SQLITE_OMIT_PROGRESS_CALLBACK 0 -#endif -#if !defined(LSQLITE_OMIT_UPDATE_HOOK) - #define LSQLITE_OMIT_UPDATE_HOOK 0 -#endif - -typedef struct sdb sdb; -typedef struct sdb_vm sdb_vm; -typedef struct sdb_func sdb_func; - -/* to use as C user data so i know what function sqlite is calling */ -struct sdb_func { - /* references to associated lua values */ - int fn_step; - int fn_finalize; - int udata; - - sdb *db; - char aggregate; - - sdb_func *next; -}; - -/* information about database */ -struct sdb { - /* associated lua state */ - lua_State *L; - /* sqlite database handle */ - sqlite3 *db; - - /* sql functions stack usage */ - sdb_func *func; /* top SQL function being called */ - - /* references */ - int busy_cb; /* busy callback */ - int busy_udata; - - int progress_cb; /* progress handler */ - int progress_udata; - - int trace_cb; /* trace callback */ - int trace_udata; - -#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK - - int update_hook_cb; /* update_hook callback */ - int update_hook_udata; - - int commit_hook_cb; /* commit_hook callback */ - int commit_hook_udata; - - int rollback_hook_cb; /* rollback_hook callback */ - int rollback_hook_udata; - -#endif -}; - -static const char *sqlite_meta = ":sqlite3"; -static const char *sqlite_vm_meta = ":sqlite3:vm"; -static const char *sqlite_ctx_meta = ":sqlite3:ctx"; -static int sqlite_ctx_meta_ref; - -/* -** ======================================================= -** Database Virtual Machine Operations -** ======================================================= -*/ - -static void vm_push_column(lua_State *L, sqlite3_stmt *vm, int idx) { - switch (sqlite3_column_type(vm, idx)) { - case SQLITE_INTEGER: - { - sqlite_int64 i64 = sqlite3_column_int64(vm, idx); - lua_Number n = (lua_Number)i64; - if (n == i64) - lua_pushnumber(L, n); - else - lua_pushlstring(L, (const char*)sqlite3_column_text(vm, idx), sqlite3_column_bytes(vm, idx)); - } - break; - case SQLITE_FLOAT: - lua_pushnumber(L, sqlite3_column_double(vm, idx)); - break; - case SQLITE_TEXT: - lua_pushlstring(L, (const char*)sqlite3_column_text(vm, idx), sqlite3_column_bytes(vm, idx)); - break; - case SQLITE_BLOB: - lua_pushlstring(L, sqlite3_column_blob(vm, idx), sqlite3_column_bytes(vm, idx)); - break; - case SQLITE_NULL: - lua_pushnil(L); - break; - default: - lua_pushnil(L); - break; - } -} - -/* virtual machine information */ -struct sdb_vm { - sdb *db; /* associated database handle */ - sqlite3_stmt *vm; /* virtual machine */ - - /* sqlite3_step info */ - int columns; /* number of columns in result */ - char has_values; /* true when step succeeds */ - - char temp; /* temporary vm used in db:rows */ -}; - -/* called with sql text on the lua stack */ -static sdb_vm *newvm(lua_State *L, sdb *db) { - sdb_vm *svm = (sdb_vm*)lua_newuserdata(L, sizeof(sdb_vm)); - - luaL_getmetatable(L, sqlite_vm_meta); - lua_setmetatable(L, -2); /* set metatable */ - - svm->db = db; - svm->columns = 0; - svm->has_values = 0; - svm->vm = NULL; - svm->temp = 0; - - /* add an entry on the database table: svm -> sql text */ - lua_pushlightuserdata(L, db); - lua_rawget(L, LUA_REGISTRYINDEX); - lua_pushlightuserdata(L, svm); - lua_pushvalue(L, -4); /* the sql text */ - lua_rawset(L, -3); - lua_pop(L, 1); - - return svm; -} - -static int cleanupvm(lua_State *L, sdb_vm *svm) { - /* remove entry in database table - no harm if not present in the table */ - lua_pushlightuserdata(L, svm->db); - lua_rawget(L, LUA_REGISTRYINDEX); - lua_pushlightuserdata(L, svm); - lua_pushnil(L); - lua_rawset(L, -3); - lua_pop(L, 1); - - svm->columns = 0; - svm->has_values = 0; - - if (!svm->vm) return 0; - - lua_pushnumber(L, sqlite3_finalize(svm->vm)); - svm->vm = NULL; - return 1; -} - -static int stepvm(lua_State *L, sdb_vm *svm) { - int result; - int loop_limit = 3; - while ( loop_limit-- ) { - result = sqlite3_step(svm->vm); - if ( result==SQLITE_ERROR ) { - result = sqlite3_reset (svm->vm); - } - if ( result==SQLITE_SCHEMA ) { - sqlite3_stmt *vn; - const char *sql; - /* recover sql text */ - lua_pushlightuserdata(L, svm->db); - lua_rawget(L, LUA_REGISTRYINDEX); - lua_pushlightuserdata(L, svm); - lua_rawget(L, -2); /* sql text */ - sql = luaL_checkstring(L, -1); - /* re-prepare */ - result = sqlite3_prepare(svm->db->db, sql, -1, &vn, NULL); - if (result != SQLITE_OK) break; - sqlite3_transfer_bindings(svm->vm, vn); - sqlite3_finalize(svm->vm); - svm->vm = vn; - lua_pop(L,2); - } else { - break; - } - } - return result; -} - -static sdb_vm *lsqlite_getvm(lua_State *L, int index) { - sdb_vm *svm = (sdb_vm*)luaL_checkudata(L, index, sqlite_vm_meta); - if (svm == NULL) luaL_argerror(L, index, "bad sqlite virtual machine"); - return svm; -} - -static sdb_vm *lsqlite_checkvm(lua_State *L, int index) { - sdb_vm *svm = lsqlite_getvm(L, index); - if (svm->vm == NULL) luaL_argerror(L, index, "attempt to use closed sqlite virtual machine"); - return svm; -} - -static int dbvm_isopen(lua_State *L) { - sdb_vm *svm = lsqlite_getvm(L, 1); - lua_pushboolean(L, svm->vm != NULL ? 1 : 0); - return 1; -} - -static int dbvm_tostring(lua_State *L) { - char buff[39]; - sdb_vm *svm = lsqlite_getvm(L, 1); - if (svm->vm == NULL) - strcpy(buff, "closed"); - else - sprintf(buff, "%p", svm); - lua_pushfstring(L, "sqlite virtual machine (%s)", buff); - return 1; -} - -static int dbvm_gc(lua_State *L) { - sdb_vm *svm = lsqlite_getvm(L, 1); - if (svm->vm != NULL) /* ignore closed vms */ - cleanupvm(L, svm); - return 0; -} - -static int dbvm_step(lua_State *L) { - int result; - sdb_vm *svm = lsqlite_checkvm(L, 1); - - result = stepvm(L, svm); - svm->has_values = result == SQLITE_ROW ? 1 : 0; - svm->columns = sqlite3_data_count(svm->vm); - - lua_pushnumber(L, result); - return 1; -} - -static int dbvm_finalize(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - return cleanupvm(L, svm); -} - -static int dbvm_reset(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_reset(svm->vm); - lua_pushnumber(L, sqlite3_errcode(svm->db->db)); - return 1; -} - -static void dbvm_check_contents(lua_State *L, sdb_vm *svm) { - if (!svm->has_values) { - luaL_error(L, "misuse of function"); - } -} - -static void dbvm_check_index(lua_State *L, sdb_vm *svm, int index) { - if (index < 0 || index >= svm->columns) { - luaL_error(L, "index out of range [0..%d]", svm->columns - 1); - } -} - -static void dbvm_check_bind_index(lua_State *L, sdb_vm *svm, int index) { - if (index < 1 || index > sqlite3_bind_parameter_count(svm->vm)) { - luaL_error(L, "bind index out of range [1..%d]", sqlite3_bind_parameter_count(svm->vm)); - } -} - -/* -** ======================================================= -** Virtual Machine - generic info -** ======================================================= -*/ -static int dbvm_columns(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - lua_pushnumber(L, sqlite3_column_count(svm->vm)); - return 1; -} - -/* -** ======================================================= -** Virtual Machine - getters -** ======================================================= -*/ - -static int dbvm_get_value(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - int index = luaL_checkint(L, 2); - dbvm_check_contents(L, svm); - dbvm_check_index(L, svm, index); - vm_push_column(L, svm->vm, index); - return 1; -} - -static int dbvm_get_name(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - int index = (int)luaL_checknumber(L, 2); - dbvm_check_index(L, svm, index); - lua_pushstring(L, sqlite3_column_name(svm->vm, index)); - return 1; -} - -static int dbvm_get_type(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - int index = (int)luaL_checknumber(L, 2); - dbvm_check_index(L, svm, index); - lua_pushstring(L, sqlite3_column_decltype(svm->vm, index)); - return 1; -} - -static int dbvm_get_values(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_stmt *vm = svm->vm; - int columns = svm->columns; - int n; - dbvm_check_contents(L, svm); - - lua_newtable(L); - for (n = 0; n < columns;) { - vm_push_column(L, vm, n++); - lua_rawseti(L, -2, n); - } - return 1; -} - -static int dbvm_get_names(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_stmt *vm = svm->vm; - int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */ - int n; - - lua_newtable(L); - for (n = 0; n < columns;) { - lua_pushstring(L, sqlite3_column_name(vm, n++)); - lua_rawseti(L, -2, n); - } - return 1; -} - -static int dbvm_get_types(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_stmt *vm = svm->vm; - int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */ - int n; - - lua_newtable(L); - for (n = 0; n < columns;) { - lua_pushstring(L, sqlite3_column_decltype(vm, n++)); - lua_rawseti(L, -2, n); - } - return 1; -} - -static int dbvm_get_uvalues(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_stmt *vm = svm->vm; - int columns = svm->columns; - int n; - dbvm_check_contents(L, svm); - - lua_checkstack(L, columns); - for (n = 0; n < columns; ++n) - vm_push_column(L, vm, n); - return columns; -} - -static int dbvm_get_unames(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_stmt *vm = svm->vm; - int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */ - int n; - - lua_checkstack(L, columns); - for (n = 0; n < columns; ++n) - lua_pushstring(L, sqlite3_column_name(vm, n)); - return columns; -} - -static int dbvm_get_utypes(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_stmt *vm = svm->vm; - int columns = sqlite3_column_count(vm); /* valid as soon as statement prepared */ - int n; - - lua_checkstack(L, columns); - for (n = 0; n < columns; ++n) - lua_pushstring(L, sqlite3_column_decltype(vm, n)); - return columns; -} - -static int dbvm_get_named_values(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_stmt *vm = svm->vm; - int columns = svm->columns; - int n; - dbvm_check_contents(L, svm); - - lua_newtable(L); - for (n = 0; n < columns; ++n) { - lua_pushstring(L, sqlite3_column_name(vm, n)); - vm_push_column(L, vm, n); - lua_rawset(L, -3); - } - return 1; -} - -static int dbvm_get_named_types(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_stmt *vm = svm->vm; - int columns = sqlite3_column_count(vm); - int n; - - lua_newtable(L); - for (n = 0; n < columns; ++n) { - lua_pushstring(L, sqlite3_column_name(vm, n)); - lua_pushstring(L, sqlite3_column_decltype(vm, n)); - lua_rawset(L, -3); - } - return 1; -} - -/* -** ======================================================= -** Virtual Machine - Bind -** ======================================================= -*/ - -static int dbvm_bind_index(lua_State *L, sqlite3_stmt *vm, int index, int lindex) { - switch (lua_type(L, lindex)) { - case LUA_TSTRING: - return sqlite3_bind_text(vm, index, lua_tostring(L, lindex), lua_strlen(L, lindex), SQLITE_TRANSIENT); - case LUA_TNUMBER: - return sqlite3_bind_double(vm, index, lua_tonumber(L, lindex)); - case LUA_TBOOLEAN: - return sqlite3_bind_int(vm, index, lua_toboolean(L, lindex) ? 1 : 0); - case LUA_TNONE: - case LUA_TNIL: - return sqlite3_bind_null(vm, index); - default: - luaL_error(L, "index (%d) - invalid data type for bind (%s)", index, lua_typename(L, lua_type(L, lindex))); - return SQLITE_MISUSE; /*!*/ - } -} - - -static int dbvm_bind_parameter_count(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - lua_pushnumber(L, sqlite3_bind_parameter_count(svm->vm)); - return 1; -} - -static int dbvm_bind_parameter_name(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - int index = (int)luaL_checknumber(L, 2); - dbvm_check_bind_index(L, svm, index); - lua_pushstring(L, sqlite3_bind_parameter_name(svm->vm, index)); - return 1; -} - -static int dbvm_bind(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_stmt *vm = svm->vm; - int index = luaL_checkint(L, 2); - int result; - - dbvm_check_bind_index(L, svm, index); - result = dbvm_bind_index(L, vm, index, 3); - - lua_pushnumber(L, result); - return 1; -} - -static int dbvm_bind_blob(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - int index = luaL_checkint(L, 2); - const char *value = luaL_checkstring(L, 3); - int len = lua_strlen(L, 3); - - lua_pushnumber(L, sqlite3_bind_blob(svm->vm, index, value, len, SQLITE_TRANSIENT)); - return 1; -} - -static int dbvm_bind_values(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_stmt *vm = svm->vm; - int top = lua_gettop(L); - int result, n; - - if (top - 1 != sqlite3_bind_parameter_count(vm)) - luaL_error(L, - "incorrect number of parameters to bind (%d given, %d to bind)", - top - 1, - sqlite3_bind_parameter_count(vm) - ); - - for (n = 2; n <= top; ++n) { - if ((result = dbvm_bind_index(L, vm, n - 1, n)) != SQLITE_OK) { - lua_pushnumber(L, result); - return 1; - } - } - - lua_pushnumber(L, SQLITE_OK); - return 1; -} - -static int dbvm_bind_names(lua_State *L) { - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_stmt *vm = svm->vm; - int count = sqlite3_bind_parameter_count(vm); - const char *name; - int result, n; - luaL_checktype(L, 2, LUA_TTABLE); - - for (n = 1; n <= count; ++n) { - name = sqlite3_bind_parameter_name(vm, n); - if (name && (name[0] == ':' || name[0] == '$')) { - lua_pushstring(L, ++name); - lua_gettable(L, 2); - result = dbvm_bind_index(L, vm, n, -1); - lua_pop(L, 1); - } - else { - lua_pushnumber(L, n); - lua_gettable(L, 2); - result = dbvm_bind_index(L, vm, n, -1); - lua_pop(L, 1); - } - - if (result != SQLITE_OK) { - lua_pushnumber(L, result); - return 1; - } - } - - lua_pushnumber(L, SQLITE_OK); - return 1; -} - -/* -** ======================================================= -** Database (internal management) -** ======================================================= -*/ - -/* -** When creating database handles, always creates a `closed' database handle -** before opening the actual database; so, if there is a memory error, the -** database is not left opened. -** -** Creates a new 'table' and leaves it in the stack -*/ -static sdb *newdb (lua_State *L) { - sdb *db = (sdb*)lua_newuserdata(L, sizeof(sdb)); - db->L = L; - db->db = NULL; /* database handle is currently `closed' */ - db->func = NULL; - - db->busy_cb = - db->busy_udata = - db->progress_cb = - db->progress_udata = - db->trace_cb = - db->trace_udata = -#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK - db->update_hook_cb = - db->update_hook_udata = - db->commit_hook_cb = - db->commit_hook_udata = - db->rollback_hook_cb = - db->rollback_hook_udata = -#endif - LUA_NOREF; - - luaL_getmetatable(L, sqlite_meta); - lua_setmetatable(L, -2); /* set metatable */ - - /* to keep track of 'open' virtual machines */ - lua_pushlightuserdata(L, db); - lua_newtable(L); - lua_rawset(L, LUA_REGISTRYINDEX); - - return db; -} - -static int cleanupdb(lua_State *L, sdb *db) { - sdb_func *func; - sdb_func *func_next; - int top; - int result; - - /* free associated virtual machines */ - lua_pushlightuserdata(L, db); - lua_rawget(L, LUA_REGISTRYINDEX); - - /* close all used handles */ - top = lua_gettop(L); - lua_pushnil(L); - while (lua_next(L, -2)) { - sdb_vm *svm = lua_touserdata(L, -2); /* key: vm; val: sql text */ - cleanupvm(L, svm); - - lua_settop(L, top); - lua_pushnil(L); - } - - lua_pop(L, 1); /* pop vm table */ - - /* remove entry in lua registry table */ - lua_pushlightuserdata(L, db); - lua_pushnil(L); - lua_rawset(L, LUA_REGISTRYINDEX); - - /* 'free' all references */ - luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata); - luaL_unref(L, LUA_REGISTRYINDEX, db->progress_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->progress_udata); - luaL_unref(L, LUA_REGISTRYINDEX, db->trace_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->trace_udata); -#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK - luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_udata); - luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_udata); - luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_udata); -#endif - - /* close database */ - result = sqlite3_close(db->db); - db->db = NULL; - - /* free associated memory with created functions */ - func = db->func; - while (func) { - func_next = func->next; - luaL_unref(L, LUA_REGISTRYINDEX, func->fn_step); - luaL_unref(L, LUA_REGISTRYINDEX, func->fn_finalize); - luaL_unref(L, LUA_REGISTRYINDEX, func->udata); - free(func); - func = func_next; - } - db->func = NULL; - return result; -} - -static sdb *lsqlite_getdb(lua_State *L, int index) { - sdb *db = (sdb*)luaL_checkudata(L, index, sqlite_meta); - if (db == NULL) luaL_typerror(L, index, "sqlite database"); - return db; -} - -static sdb *lsqlite_checkdb(lua_State *L, int index) { - sdb *db = lsqlite_getdb(L, index); - if (db->db == NULL) luaL_argerror(L, index, "attempt to use closed sqlite database"); - return db; -} - - -/* -** ======================================================= -** User Defined Functions - Context Methods -** ======================================================= -*/ -typedef struct { - sqlite3_context *ctx; - int ud; -} lcontext; - -static lcontext *lsqlite_make_context(lua_State *L) { - lcontext *ctx = (lcontext*)lua_newuserdata(L, sizeof(lcontext)); - lua_rawgeti(L, LUA_REGISTRYINDEX, sqlite_ctx_meta_ref); - lua_setmetatable(L, -2); - ctx->ctx = NULL; - ctx->ud = LUA_NOREF; - return ctx; -} - -static lcontext *lsqlite_getcontext(lua_State *L, int index) { - lcontext *ctx = (lcontext*)luaL_checkudata(L, index, sqlite_ctx_meta); - if (ctx == NULL) luaL_typerror(L, index, "sqlite context"); - return ctx; -} - -static lcontext *lsqlite_checkcontext(lua_State *L, int index) { - lcontext *ctx = lsqlite_getcontext(L, index); - if (ctx->ctx == NULL) luaL_argerror(L, index, "invalid sqlite context"); - return ctx; -} - -static int lcontext_tostring(lua_State *L) { - char buff[39]; - lcontext *ctx = lsqlite_getcontext(L, 1); - if (ctx->ctx == NULL) - strcpy(buff, "closed"); - else - sprintf(buff, "%p", ctx->ctx); - lua_pushfstring(L, "sqlite function context (%s)", buff); - return 1; -} - -static void lcontext_check_aggregate(lua_State *L, lcontext *ctx) { - sdb_func *func = (sdb_func*)sqlite3_user_data(ctx->ctx); - if (!func->aggregate) { - luaL_error(L, "attempt to call aggregate method from scalar function"); - } -} - -static int lcontext_user_data(lua_State *L) { - lcontext *ctx = lsqlite_checkcontext(L, 1); - sdb_func *func = (sdb_func*)sqlite3_user_data(ctx->ctx); - lua_rawgeti(L, LUA_REGISTRYINDEX, func->udata); - return 1; -} - -static int lcontext_get_aggregate_context(lua_State *L) { - lcontext *ctx = lsqlite_checkcontext(L, 1); - lcontext_check_aggregate(L, ctx); - lua_rawgeti(L, LUA_REGISTRYINDEX, ctx->ud); - return 1; -} - -static int lcontext_set_aggregate_context(lua_State *L) { - lcontext *ctx = lsqlite_checkcontext(L, 1); - lcontext_check_aggregate(L, ctx); - lua_settop(L, 2); - luaL_unref(L, LUA_REGISTRYINDEX, ctx->ud); - ctx->ud = luaL_ref(L, LUA_REGISTRYINDEX); - return 0; -} - -static int lcontext_aggregate_count(lua_State *L) { - lcontext *ctx = lsqlite_checkcontext(L, 1); - lcontext_check_aggregate(L, ctx); - lua_pushnumber(L, sqlite3_aggregate_count(ctx->ctx)); - return 1; -} - -#if 0 -void *sqlite3_get_auxdata(sqlite3_context*, int); -void sqlite3_set_auxdata(sqlite3_context*, int, void*, void (*)(void*)); -#endif - -static int lcontext_result(lua_State *L) { - lcontext *ctx = lsqlite_checkcontext(L, 1); - switch (lua_type(L, 2)) { - case LUA_TNUMBER: - sqlite3_result_double(ctx->ctx, luaL_checknumber(L, 2)); - break; - case LUA_TSTRING: - sqlite3_result_text(ctx->ctx, luaL_checkstring(L, 2), lua_strlen(L, 2), SQLITE_TRANSIENT); - break; - case LUA_TNIL: - case LUA_TNONE: - sqlite3_result_null(ctx->ctx); - break; - default: - luaL_error(L, "invalid result type %s", lua_typename(L, 2)); - break; - } - - return 0; -} - -static int lcontext_result_blob(lua_State *L) { - lcontext *ctx = lsqlite_checkcontext(L, 1); - const char *blob = luaL_checkstring(L, 2); - int size = lua_strlen(L, 2); - sqlite3_result_blob(ctx->ctx, (const void*)blob, size, SQLITE_TRANSIENT); - return 0; -} - -static int lcontext_result_double(lua_State *L) { - lcontext *ctx = lsqlite_checkcontext(L, 1); - double d = luaL_checknumber(L, 2); - sqlite3_result_double(ctx->ctx, d); - return 0; -} - -static int lcontext_result_error(lua_State *L) { - lcontext *ctx = lsqlite_checkcontext(L, 1); - const char *err = luaL_checkstring(L, 2); - int size = lua_strlen(L, 2); - sqlite3_result_error(ctx->ctx, err, size); - return 0; -} - -static int lcontext_result_int(lua_State *L) { - lcontext *ctx = lsqlite_checkcontext(L, 1); - int i = luaL_checkint(L, 2); - sqlite3_result_int(ctx->ctx, i); - return 0; -} - -static int lcontext_result_null(lua_State *L) { - lcontext *ctx = lsqlite_checkcontext(L, 1); - sqlite3_result_null(ctx->ctx); - return 0; -} - -static int lcontext_result_text(lua_State *L) { - lcontext *ctx = lsqlite_checkcontext(L, 1); - const char *text = luaL_checkstring(L, 2); - int size = lua_strlen(L, 2); - sqlite3_result_text(ctx->ctx, text, size, SQLITE_TRANSIENT); - return 0; -} - -/* -** ======================================================= -** Database Methods -** ======================================================= -*/ - -static int db_isopen(lua_State *L) { - sdb *db = lsqlite_getdb(L, 1); - lua_pushboolean(L, db->db != NULL ? 1 : 0); - return 1; -} - -static int db_last_insert_rowid(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - /* conversion warning: int64 -> luaNumber */ - sqlite_int64 rowid = sqlite3_last_insert_rowid(db->db); - lua_Number n = (lua_Number)rowid; - if (n == rowid) - lua_pushnumber(L, n); - else - lua_pushfstring(L, "%ll", rowid); - return 1; -} - -static int db_changes(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - lua_pushnumber(L, sqlite3_changes(db->db)); - return 1; -} - -static int db_total_changes(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - lua_pushnumber(L, sqlite3_total_changes(db->db)); - return 1; -} - -static int db_errcode(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - lua_pushnumber(L, sqlite3_errcode(db->db)); - return 1; -} - -static int db_errmsg(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - lua_pushstring(L, sqlite3_errmsg(db->db)); - return 1; -} - -static int db_interrupt(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - sqlite3_interrupt(db->db); - return 0; -} - -/* -** Registering SQL functions: -*/ - -static void db_push_value(lua_State *L, sqlite3_value *value) { - switch (sqlite3_value_type(value)) { - case SQLITE_TEXT: - lua_pushlstring(L, (const char*)sqlite3_value_text(value), sqlite3_value_bytes(value)); - break; - - case SQLITE_INTEGER: - { - sqlite_int64 i64 = sqlite3_value_int64(value); - lua_Number n = (lua_Number)i64; - if (n == i64) - lua_pushnumber(L, n); - else - lua_pushlstring(L, (const char*)sqlite3_value_text(value), sqlite3_value_bytes(value)); - } - break; - - case SQLITE_FLOAT: - lua_pushnumber(L, sqlite3_value_double(value)); - break; - - case SQLITE_BLOB: - lua_pushlstring(L, sqlite3_value_blob(value), sqlite3_value_bytes(value)); - break; - - case SQLITE_NULL: - lua_pushnil(L); - break; - - default: - /* things done properly (SQLite + Lua SQLite) - ** this should never happen */ - lua_pushnil(L); - break; - } -} - -/* -** callback functions used when calling registered sql functions -*/ - -/* scalar function to be called -** callback params: context, values... */ -static void db_sql_normal_function(sqlite3_context *context, int argc, sqlite3_value **argv) { - sdb_func *func = (sdb_func*)sqlite3_user_data(context); - lua_State *L = func->db->L; - int n; - lcontext *ctx; - - int top = lua_gettop(L); - - /* ensure there is enough space in the stack */ - lua_checkstack(L, argc + 3); - - lua_rawgeti(L, LUA_REGISTRYINDEX, func->fn_step); /* function to call */ - - if (!func->aggregate) { - ctx = lsqlite_make_context(L); /* push context - used to set results */ - } - else { - /* reuse context userdata value */ - void *p = sqlite3_aggregate_context(context, 1); - /* i think it is OK to use assume that using a light user data - ** as an entry on LUA REGISTRY table will be unique */ - lua_pushlightuserdata(L, p); - lua_rawget(L, LUA_REGISTRYINDEX); /* context table */ - - if (lua_isnil(L, -1)) { /* not yet created? */ - lua_pop(L, 1); - ctx = lsqlite_make_context(L); - lua_pushlightuserdata(L, p); - lua_pushvalue(L, -2); - lua_rawset(L, LUA_REGISTRYINDEX); - } - else - ctx = lsqlite_getcontext(L, -1); - } - - /* push params */ - for (n = 0; n < argc; ++n) { - db_push_value(L, argv[n]); - } - - /* set context */ - ctx->ctx = context; - - if (lua_pcall(L, argc + 1, 0, 0)) { - const char *errmsg = lua_tostring(L, -1); - int size = lua_strlen(L, -1); - sqlite3_result_error(context, errmsg, size); - } - - /* invalidate context */ - ctx->ctx = NULL; - - if (!func->aggregate) { - luaL_unref(L, LUA_REGISTRYINDEX, ctx->ud); - } - - lua_settop(L, top); -} - -static void db_sql_finalize_function(sqlite3_context *context) { - sdb_func *func = (sdb_func*)sqlite3_user_data(context); - lua_State *L = func->db->L; - void *p = sqlite3_aggregate_context(context, 1); /* minimal mem usage */ - lcontext *ctx; - int top = lua_gettop(L); - - lua_rawgeti(L, LUA_REGISTRYINDEX, func->fn_finalize); /* function to call */ - - /* i think it is OK to use assume that using a light user data - ** as an entry on LUA REGISTRY table will be unique */ - lua_pushlightuserdata(L, p); - lua_rawget(L, LUA_REGISTRYINDEX); /* context table */ - - if (lua_isnil(L, -1)) { /* not yet created? - shouldn't happen in finalize function */ - lua_pop(L, 1); - ctx = lsqlite_make_context(L); - lua_pushlightuserdata(L, p); - lua_pushvalue(L, -2); - lua_rawset(L, LUA_REGISTRYINDEX); - } - else - ctx = lsqlite_getcontext(L, -1); - - /* set context */ - ctx->ctx = context; - - if (lua_pcall(L, 1, 0, 0)) { - sqlite3_result_error(context, lua_tostring(L, -1), -1); - } - - /* invalidate context */ - ctx->ctx = NULL; - - /* cleanup context */ - luaL_unref(L, LUA_REGISTRYINDEX, ctx->ud); - /* remove it from registry */ - lua_pushlightuserdata(L, p); - lua_pushnil(L); - lua_rawset(L, LUA_REGISTRYINDEX); - - lua_settop(L, top); -} - -/* -** Register a normal function -** Params: db, function name, number arguments, [ callback | step, finalize], user data -** Returns: true on sucess -** -** Normal function: -** Params: context, params -** -** Aggregate function: -** Params of step: context, params -** Params of finalize: context -*/ -static int db_register_function(lua_State *L, int aggregate) { - sdb *db = lsqlite_checkdb(L, 1); - const char *name; - int args; - int result; - sdb_func *func; - - /* safety measure */ - if (aggregate) aggregate = 1; - - name = luaL_checkstring(L, 2); - args = luaL_checkint(L, 3); - luaL_checktype(L, 4, LUA_TFUNCTION); - if (aggregate) luaL_checktype(L, 5, LUA_TFUNCTION); - - /* maybe an alternative way to allocate memory should be used/avoided */ - func = (sdb_func*)malloc(sizeof(sdb_func)); - if (func == NULL) { - luaL_error(L, "out of memory"); - } - - result = sqlite3_create_function( - db->db, name, args, SQLITE_UTF8, func, - aggregate ? NULL : db_sql_normal_function, - aggregate ? db_sql_normal_function : NULL, - aggregate ? db_sql_finalize_function : NULL - ); - - if (result == SQLITE_OK) { - /* safety measures for userdata field to be present in the stack */ - lua_settop(L, 5 + aggregate); - - /* save registered function in db function list */ - func->db = db; - func->aggregate = aggregate; - func->next = db->func; - db->func = func; - - /* save the setp/normal function callback */ - lua_pushvalue(L, 4); - func->fn_step = luaL_ref(L, LUA_REGISTRYINDEX); - /* save user data */ - lua_pushvalue(L, 5+aggregate); - func->udata = luaL_ref(L, LUA_REGISTRYINDEX); - - if (aggregate) { - lua_pushvalue(L, 5); - func->fn_finalize = luaL_ref(L, LUA_REGISTRYINDEX); - } - else - func->fn_finalize = LUA_NOREF; - } - else { - /* free allocated memory */ - free(func); - } - - lua_pushboolean(L, result == SQLITE_OK ? 1 : 0); - return 1; -} - -static int db_create_function(lua_State *L) { - return db_register_function(L, 0); -} - -static int db_create_aggregate(lua_State *L) { - return db_register_function(L, 1); -} - -/* create_collation; contributed by Thomas Lauer -*/ - -typedef struct { - lua_State *L; - int ref; -} scc; - -static int collwrapper(scc *co,int l1,const void *p1, - int l2,const void *p2) { - int res=0; - lua_State *L=co->L; - lua_rawgeti(L,LUA_REGISTRYINDEX,co->ref); - lua_pushlstring(L,p1,l1); - lua_pushlstring(L,p2,l2); - if (lua_pcall(L,2,1,0)==0) res=(int)lua_tonumber(L,-1); - lua_pop(L,1); - return res; -} - -static void collfree(scc *co) { - if (co) { - luaL_unref(co->L,LUA_REGISTRYINDEX,co->ref); - free(co); - } -} - -static int db_create_collation(lua_State *L) { - sdb *db=lsqlite_checkdb(L,1); - const char *collname=luaL_checkstring(L,2); - scc *co=NULL; - int (*collfunc)(scc *,int,const void *,int,const void *)=NULL; - lua_settop(L,3); /* default args to nil, and exclude extras */ - if (lua_isfunction(L,3)) collfunc=collwrapper; - else if (!lua_isnil(L,3)) - luaL_error(L,"create_collation: function or nil expected"); - if (collfunc != NULL) { - co=(scc *)malloc(sizeof(scc)); /* userdata is a no-no as it - will be garbage-collected */ - if (co) { - co->L=L; - /* lua_settop(L,3) above means we don't need: lua_pushvalue(L,3); */ - co->ref=luaL_ref(L,LUA_REGISTRYINDEX); - } - else luaL_error(L,"create_collation: could not allocate callback"); - } - sqlite3_create_collation_v2(db->db, collname, SQLITE_UTF8, - (void *)co, - (int(*)(void*,int,const void*,int,const void*))collfunc, - (void(*)(void*))collfree); - return 0; -} - -/* -** trace callback: -** Params: database, callback function, userdata -** -** callback function: -** Params: userdata, sql -*/ -static void db_trace_callback(void *user, const char *sql) { - sdb *db = (sdb*)user; - lua_State *L = db->L; - int top = lua_gettop(L); - - /* setup lua callback call */ - lua_rawgeti(L, LUA_REGISTRYINDEX, db->trace_cb); /* get callback */ - lua_rawgeti(L, LUA_REGISTRYINDEX, db->trace_udata); /* get callback user data */ - lua_pushstring(L, sql); /* traced sql statement */ - - /* call lua function */ - lua_pcall(L, 2, 0, 0); - /* ignore any error generated by this function */ - - lua_settop(L, top); -} - -static int db_trace(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - - if (lua_gettop(L) < 2 || lua_isnil(L, 2)) { - luaL_unref(L, LUA_REGISTRYINDEX, db->trace_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->trace_udata); - - db->trace_cb = - db->trace_udata = LUA_NOREF; - - /* clear trace handler */ - sqlite3_trace(db->db, NULL, NULL); - } - else { - luaL_checktype(L, 2, LUA_TFUNCTION); - - /* make sure we have an userdata field (even if nil) */ - lua_settop(L, 3); - - luaL_unref(L, LUA_REGISTRYINDEX, db->trace_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->trace_udata); - - db->trace_udata = luaL_ref(L, LUA_REGISTRYINDEX); - db->trace_cb = luaL_ref(L, LUA_REGISTRYINDEX); - - /* set trace handler */ - sqlite3_trace(db->db, db_trace_callback, db); - } - - return 0; -} - -#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK - -/* -** update_hook callback: -** Params: database, callback function, userdata -** -** callback function: -** Params: userdata, {one of SQLITE_INSERT, SQLITE_DELETE, or SQLITE_UPDATE}, -** database name, table name (containing the affected row), rowid of the row -*/ -static void db_update_hook_callback(void *user, int op, char const *dbname, char const *tblname, sqlite3_int64 rowid) { - sdb *db = (sdb*)user; - lua_State *L = db->L; - int top = lua_gettop(L); - lua_Number n = (lua_Number)rowid; - - /* setup lua callback call */ - lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_cb); /* get callback */ - lua_rawgeti(L, LUA_REGISTRYINDEX, db->update_hook_udata); /* get callback user data */ - lua_pushnumber(L, (lua_Number )op); - lua_pushstring(L, dbname); /* update_hook database name */ - lua_pushstring(L, tblname); /* update_hook database name */ - if (n == rowid) - lua_pushnumber(L, n); - else - lua_pushfstring(L, "%ll", rowid); - - /* call lua function */ - lua_pcall(L, 5, 0, 0); - /* ignore any error generated by this function */ - - lua_settop(L, top); -} - -static int db_update_hook(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - - if (lua_gettop(L) < 2 || lua_isnil(L, 2)) { - luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_udata); - - db->update_hook_cb = - db->update_hook_udata = LUA_NOREF; - - /* clear update_hook handler */ - sqlite3_update_hook(db->db, NULL, NULL); - } - else { - luaL_checktype(L, 2, LUA_TFUNCTION); - - /* make sure we have an userdata field (even if nil) */ - lua_settop(L, 3); - - luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->update_hook_udata); - - db->update_hook_udata = luaL_ref(L, LUA_REGISTRYINDEX); - db->update_hook_cb = luaL_ref(L, LUA_REGISTRYINDEX); - - /* set update_hook handler */ - sqlite3_update_hook(db->db, db_update_hook_callback, db); - } - - return 0; -} - -/* -** commit_hook callback: -** Params: database, callback function, userdata -** -** callback function: -** Params: userdata -** Returned value: Return false or nil to continue the COMMIT operation normally. -** return true (non false, non nil), then the COMMIT is converted into a ROLLBACK. -*/ -static int db_commit_hook_callback(void *user) { - sdb *db = (sdb*)user; - lua_State *L = db->L; - int top = lua_gettop(L); - int rollback = 0; - - /* setup lua callback call */ - lua_rawgeti(L, LUA_REGISTRYINDEX, db->commit_hook_cb); /* get callback */ - lua_rawgeti(L, LUA_REGISTRYINDEX, db->commit_hook_udata); /* get callback user data */ - - /* call lua function */ - if (!lua_pcall(L, 1, 1, 0)) - rollback = lua_toboolean(L, -1); /* use result if there was no error */ - - lua_settop(L, top); - return rollback; -} - -static int db_commit_hook(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - - if (lua_gettop(L) < 2 || lua_isnil(L, 2)) { - luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_udata); - - db->commit_hook_cb = - db->commit_hook_udata = LUA_NOREF; - - /* clear commit_hook handler */ - sqlite3_commit_hook(db->db, NULL, NULL); - } - else { - luaL_checktype(L, 2, LUA_TFUNCTION); - - /* make sure we have an userdata field (even if nil) */ - lua_settop(L, 3); - - luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->commit_hook_udata); - - db->commit_hook_udata = luaL_ref(L, LUA_REGISTRYINDEX); - db->commit_hook_cb = luaL_ref(L, LUA_REGISTRYINDEX); - - /* set commit_hook handler */ - sqlite3_commit_hook(db->db, db_commit_hook_callback, db); - } - - return 0; -} - -/* -** rollback hook callback: -** Params: database, callback function, userdata -** -** callback function: -** Params: userdata -*/ -static void db_rollback_hook_callback(void *user) { - sdb *db = (sdb*)user; - lua_State *L = db->L; - int top = lua_gettop(L); - - /* setup lua callback call */ - lua_rawgeti(L, LUA_REGISTRYINDEX, db->rollback_hook_cb); /* get callback */ - lua_rawgeti(L, LUA_REGISTRYINDEX, db->rollback_hook_udata); /* get callback user data */ - - /* call lua function */ - lua_pcall(L, 1, 0, 0); - /* ignore any error generated by this function */ - - lua_settop(L, top); -} - -static int db_rollback_hook(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - - if (lua_gettop(L) < 2 || lua_isnil(L, 2)) { - luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_udata); - - db->rollback_hook_cb = - db->rollback_hook_udata = LUA_NOREF; - - /* clear rollback_hook handler */ - sqlite3_rollback_hook(db->db, NULL, NULL); - } - else { - luaL_checktype(L, 2, LUA_TFUNCTION); - - /* make sure we have an userdata field (even if nil) */ - lua_settop(L, 3); - - luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->rollback_hook_udata); - - db->rollback_hook_udata = luaL_ref(L, LUA_REGISTRYINDEX); - db->rollback_hook_cb = luaL_ref(L, LUA_REGISTRYINDEX); - - /* set rollback_hook handler */ - sqlite3_rollback_hook(db->db, db_rollback_hook_callback, db); - } - - return 0; -} - -#endif /* #if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK */ - -#if !defined(SQLITE_OMIT_PROGRESS_CALLBACK) || !SQLITE_OMIT_PROGRESS_CALLBACK - -/* -** progress handler: -** Params: database, number of opcodes, callback function, userdata -** -** callback function: -** Params: userdata -** returns: 0 to return immediatly and return SQLITE_ABORT, non-zero to continue -*/ -static int db_progress_callback(void *user) { - int result = 1; /* abort by default */ - sdb *db = (sdb*)user; - lua_State *L = db->L; - int top = lua_gettop(L); - - lua_rawgeti(L, LUA_REGISTRYINDEX, db->progress_cb); - lua_rawgeti(L, LUA_REGISTRYINDEX, db->progress_udata); - - /* call lua function */ - if (!lua_pcall(L, 1, 1, 0)) - result = lua_toboolean(L, -1); - - lua_settop(L, top); - return result; -} - -static int db_progress_handler(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - - if (lua_gettop(L) < 2 || lua_isnil(L, 2)) { - luaL_unref(L, LUA_REGISTRYINDEX, db->progress_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->progress_udata); - - db->progress_cb = - db->progress_udata = LUA_NOREF; - - /* clear busy handler */ - sqlite3_progress_handler(db->db, 0, NULL, NULL); - } - else { - int nop = luaL_checkint(L, 2); /* number of opcodes */ - luaL_checktype(L, 3, LUA_TFUNCTION); - - /* make sure we have an userdata field (even if nil) */ - lua_settop(L, 4); - - luaL_unref(L, LUA_REGISTRYINDEX, db->progress_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->progress_udata); - - db->progress_udata = luaL_ref(L, LUA_REGISTRYINDEX); - db->progress_cb = luaL_ref(L, LUA_REGISTRYINDEX); - - /* set progress callback */ - sqlite3_progress_handler(db->db, nop, db_progress_callback, db); - } - - return 0; -} - -#else /* #if !defined(SQLITE_OMIT_PROGRESS_CALLBACK) || !SQLITE_OMIT_PROGRESS_CALLBACK */ - -static int db_progress_handler(lua_State *L) { - lua_pushliteral(L, "progress callback support disabled at compile time"); - lua_error(L); - return 0; -} - -#endif /* #if !defined(SQLITE_OMIT_PROGRESS_CALLBACK) || !SQLITE_OMIT_PROGRESS_CALLBACK */ - -/* -** busy handler: -** Params: database, callback function, userdata -** -** callback function: -** Params: userdata, number of tries -** returns: 0 to return immediatly and return SQLITE_BUSY, non-zero to try again -*/ -static int db_busy_callback(void *user, int tries) { - int retry = 0; /* abort by default */ - sdb *db = (sdb*)user; - lua_State *L = db->L; - int top = lua_gettop(L); - - lua_rawgeti(L, LUA_REGISTRYINDEX, db->busy_cb); - lua_rawgeti(L, LUA_REGISTRYINDEX, db->busy_udata); - lua_pushnumber(L, tries); - - /* call lua function */ - if (!lua_pcall(L, 2, 1, 0)) - retry = lua_toboolean(L, -1); - - lua_settop(L, top); - return retry; -} - -static int db_busy_handler(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - - if (lua_gettop(L) < 2 || lua_isnil(L, 2)) { - luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata); - - db->busy_cb = - db->busy_udata = LUA_NOREF; - - /* clear busy handler */ - sqlite3_busy_handler(db->db, NULL, NULL); - } - else { - luaL_checktype(L, 2, LUA_TFUNCTION); - /* make sure we have an userdata field (even if nil) */ - lua_settop(L, 3); - - luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata); - - db->busy_udata = luaL_ref(L, LUA_REGISTRYINDEX); - db->busy_cb = luaL_ref(L, LUA_REGISTRYINDEX); - - /* set busy handler */ - sqlite3_busy_handler(db->db, db_busy_callback, db); - } - - return 0; -} - -static int db_busy_timeout(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - int timeout = luaL_checkint(L, 2); - sqlite3_busy_timeout(db->db, timeout); - - /* if there was a timeout callback registered, it is now - ** invalid/useless. free any references we may have */ - luaL_unref(L, LUA_REGISTRYINDEX, db->busy_cb); - luaL_unref(L, LUA_REGISTRYINDEX, db->busy_udata); - db->busy_cb = - db->busy_udata = LUA_NOREF; - - return 0; -} - -/* -** Params: db, sql, callback, user -** returns: code [, errmsg] -** -** Callback: -** Params: user, number of columns, values, names -** Returns: 0 to continue, other value will cause abort -*/ -static int db_exec_callback(void* user, int columns, char **data, char **names) { - int result = SQLITE_ABORT; /* abort by default */ - lua_State *L = (lua_State*)user; - int n; - - int top = lua_gettop(L); - - lua_pushvalue(L, 3); /* function to call */ - lua_pushvalue(L, 4); /* user data */ - lua_pushnumber(L, columns); /* total number of rows in result */ - - /* column values */ - lua_pushvalue(L, 6); - for (n = 0; n < columns;) { - lua_pushstring(L, data[n++]); - lua_rawseti(L, -2, n); - } - - /* columns names */ - lua_pushvalue(L, 5); - if (lua_isnil(L, -1)) { - lua_pop(L, 1); - lua_newtable(L); - lua_pushvalue(L, -1); - lua_replace(L, 5); - for (n = 0; n < columns;) { - lua_pushstring(L, names[n++]); - lua_rawseti(L, -2, n); - } - } - - /* call lua function */ - if (!lua_pcall(L, 4, 1, 0)) { - if (lua_isnumber(L, -1)) - result = (int)lua_tonumber(L, -1); - } - - lua_settop(L, top); - return result; -} - -static int db_exec(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - const char *sql = luaL_checkstring(L, 2); - int result; - - if (!lua_isnoneornil(L, 3)) { - /* stack: - ** 3: callback function - ** 4: userdata - ** 5: column names - ** 6: reusable column values - */ - luaL_checktype(L, 3, LUA_TFUNCTION); - lua_settop(L, 4); /* 'trap' userdata - nil extra parameters */ - lua_pushnil(L); /* column names not known at this point */ - lua_newtable(L); /* column values table */ - - result = sqlite3_exec(db->db, sql, db_exec_callback, L, NULL); - } - else { - /* no callbacks */ - result = sqlite3_exec(db->db, sql, NULL, NULL, NULL); - } - - lua_pushnumber(L, result); - return 1; -} - -/* -** Params: db, sql -** returns: code, compiled length or error message -*/ -static int db_prepare(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - const char *sql = luaL_checkstring(L, 2); - int sql_len = lua_strlen(L, 2); - const char *sqltail; - sdb_vm *svm; - lua_settop(L,2); /* sql is on top of stack for call to newvm */ - svm = newvm(L, db); - - if (sqlite3_prepare(db->db, sql, sql_len, &svm->vm, &sqltail) != SQLITE_OK) { - cleanupvm(L, svm); - - lua_pushnil(L); - lua_pushnumber(L, sqlite3_errcode(db->db)); - return 2; - } - - /* vm already in the stack */ - lua_pushstring(L, sqltail); - return 2; -} - -static int db_do_next_row(lua_State *L, int packed) { - int result; - sdb_vm *svm = lsqlite_checkvm(L, 1); - sqlite3_stmt *vm; - int columns; - int i; - - result = stepvm(L, svm); - vm = svm->vm; /* stepvm may change svm->vm if re-prepare is needed */ - svm->has_values = result == SQLITE_ROW ? 1 : 0; - svm->columns = columns = sqlite3_data_count(vm); - - if (result == SQLITE_ROW) { - if (packed) { - lua_newtable(L); - if (packed == 1) { - for (i = 0; i < columns;) { - vm_push_column(L, vm, i); - lua_rawseti(L, -2, ++i); - } - } - else { - for (i = 0; i < columns; ++i) { - lua_pushstring(L, sqlite3_column_name(vm, i)); - vm_push_column(L, vm, i); - lua_rawset(L, -3); - } - } - return 1; - } - else { - lua_checkstack(L, columns); - for (i = 0; i < columns; ++i) - vm_push_column(L, vm, i); - return svm->columns; - } - } - - if (svm->temp) { - /* finalize and check for errors */ - result = sqlite3_finalize(vm); - svm->vm = NULL; - cleanupvm(L, svm); - } - else if (result == SQLITE_DONE) { - result = sqlite3_reset(vm); - } - - if (result != SQLITE_OK) { - lua_pushstring(L, sqlite3_errmsg(svm->db->db)); - lua_error(L); - } - return 0; -} - -static int db_next_row(lua_State *L) { - return db_do_next_row(L, 0); -} - -static int db_next_packed_row(lua_State *L) { - return db_do_next_row(L, 1); -} - -static int db_next_named_row(lua_State *L) { - return db_do_next_row(L, 2); -} - -static int dbvm_do_rows(lua_State *L, int(*f)(lua_State *)) { - /* sdb_vm *svm = */ - lsqlite_checkvm(L, 1); - lua_pushvalue(L,1); - lua_pushcfunction(L, f); - lua_insert(L, -2); - return 2; -} - -static int dbvm_rows(lua_State *L) { - return dbvm_do_rows(L, db_next_packed_row); -} - -static int dbvm_nrows(lua_State *L) { - return dbvm_do_rows(L, db_next_named_row); -} - -static int dbvm_urows(lua_State *L) { - return dbvm_do_rows(L, db_next_row); -} - -static int db_do_rows(lua_State *L, int(*f)(lua_State *)) { - sdb *db = lsqlite_checkdb(L, 1); - const char *sql = luaL_checkstring(L, 2); - sdb_vm *svm; - lua_settop(L,2); /* sql is on top of stack for call to newvm */ - svm = newvm(L, db); - svm->temp = 1; - - if (sqlite3_prepare(db->db, sql, -1, &svm->vm, NULL) != SQLITE_OK) { - cleanupvm(L, svm); - - lua_pushstring(L, sqlite3_errmsg(svm->db->db)); - lua_error(L); - } - - lua_pushcfunction(L, f); - lua_insert(L, -2); - return 2; -} - -static int db_rows(lua_State *L) { - return db_do_rows(L, db_next_packed_row); -} - -static int db_nrows(lua_State *L) { - return db_do_rows(L, db_next_named_row); -} - -/* unpacked version of db:rows */ -static int db_urows(lua_State *L) { - return db_do_rows(L, db_next_row); -} - -static int db_tostring(lua_State *L) { - char buff[32]; - sdb *db = lsqlite_getdb(L, 1); - if (db->db == NULL) - strcpy(buff, "closed"); - else - sprintf(buff, "%p", lua_touserdata(L, 1)); - lua_pushfstring(L, "sqlite database (%s)", buff); - return 1; -} - -static int db_close(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - lua_pushnumber(L, cleanupdb(L, db)); - return 1; -} - -static int db_close_vm(lua_State *L) { - sdb *db = lsqlite_checkdb(L, 1); - /* cleanup temporary only tables? */ - int temp = lua_toboolean(L, 2); - - /* free associated virtual machines */ - lua_pushlightuserdata(L, db); - lua_rawget(L, LUA_REGISTRYINDEX); - - /* close all used handles */ - lua_pushnil(L); - while (lua_next(L, -2)) { - sdb_vm *svm = lua_touserdata(L, -2); /* key: vm; val: sql text */ - - if ((!temp || svm->temp) && svm->vm) - { - sqlite3_finalize(svm->vm); - svm->vm = NULL; - } - - /* leave key in the stack */ - lua_pop(L, 1); - } - return 0; -} - -static int db_gc(lua_State *L) { - sdb *db = lsqlite_getdb(L, 1); - if (db->db != NULL) /* ignore closed databases */ - cleanupdb(L, db); - return 0; -} - -/* -** ======================================================= -** General library functions -** ======================================================= -*/ - -static int lsqlite_version(lua_State *L) { - lua_pushstring(L, sqlite3_libversion()); - return 1; -} - -static int lsqlite_complete(lua_State *L) { - const char *sql = luaL_checkstring(L, 1); - lua_pushboolean(L, sqlite3_complete(sql)); - return 1; -} - -#ifndef WIN32 -static int lsqlite_temp_directory(lua_State *L) { - const char *oldtemp = sqlite3_temp_directory; - - if (!lua_isnone(L, 1)) { - const char *temp = luaL_optstring(L, 1, NULL); - if (sqlite3_temp_directory) { - sqlite3_free((char*)sqlite3_temp_directory); - } - if (temp) { - sqlite3_temp_directory = sqlite3_mprintf("%s", temp); - } - else { - sqlite3_temp_directory = NULL; - } - } - lua_pushstring(L, oldtemp); - return 1; -} -#endif - -static int lsqlite_do_open(lua_State *L, const char *filename) { - sdb *db = newdb(L); /* create and leave in stack */ - - if (sqlite3_open(filename, &db->db) == SQLITE_OK) { - /* database handle already in the stack - return it */ - return 1; - } - - /* failed to open database */ - lua_pushnil(L); /* push nil */ - lua_pushnumber(L, sqlite3_errcode(db->db)); - lua_pushstring(L, sqlite3_errmsg(db->db)); /* push error message */ - - /* clean things up */ - cleanupdb(L, db); - - /* return */ - return 3; -} - -static int lsqlite_open(lua_State *L) { - const char *filename = luaL_checkstring(L, 1); - return lsqlite_do_open(L, filename); -} - -static int lsqlite_open_memory(lua_State *L) { - return lsqlite_do_open(L, ":memory:"); -} - -static int lsqlite_newindex(lua_State *L) { - lua_pushliteral(L, "attempt to change readonly table"); - lua_error(L); - return 0; -} - -/* -** ======================================================= -** Register functions -** ======================================================= -*/ - -#define SC(s) { #s, SQLITE_ ## s }, -#define LSC(s) { #s, LSQLITE_ ## s }, - -static const struct { - const char* name; - int value; -} sqlite_constants[] = { - /* error codes */ - SC(OK) SC(ERROR) SC(INTERNAL) SC(PERM) - SC(ABORT) SC(BUSY) SC(LOCKED) SC(NOMEM) - SC(READONLY) SC(INTERRUPT) SC(IOERR) SC(CORRUPT) - SC(NOTFOUND) SC(FULL) SC(CANTOPEN) SC(PROTOCOL) - SC(EMPTY) SC(SCHEMA) SC(TOOBIG) SC(CONSTRAINT) - SC(MISMATCH) SC(MISUSE) SC(NOLFS) - SC(FORMAT) SC(NOTADB) - - /* sqlite_step specific return values */ - SC(RANGE) SC(ROW) SC(DONE) - - /* column types */ - SC(INTEGER) SC(FLOAT) SC(TEXT) SC(BLOB) - SC(NULL) - - /* Authorizer Action Codes */ - SC(CREATE_INDEX ) - SC(CREATE_TABLE ) - SC(CREATE_TEMP_INDEX ) - SC(CREATE_TEMP_TABLE ) - SC(CREATE_TEMP_TRIGGER) - SC(CREATE_TEMP_VIEW ) - SC(CREATE_TRIGGER ) - SC(CREATE_VIEW ) - SC(DELETE ) - SC(DROP_INDEX ) - SC(DROP_TABLE ) - SC(DROP_TEMP_INDEX ) - SC(DROP_TEMP_TABLE ) - SC(DROP_TEMP_TRIGGER ) - SC(DROP_TEMP_VIEW ) - SC(DROP_TRIGGER ) - SC(DROP_VIEW ) - SC(INSERT ) - SC(PRAGMA ) - SC(READ ) - SC(SELECT ) - SC(TRANSACTION ) - SC(UPDATE ) - SC(ATTACH ) - SC(DETACH ) - SC(ALTER_TABLE ) - SC(REINDEX ) - SC(ANALYZE ) - SC(CREATE_VTABLE ) - SC(DROP_VTABLE ) - SC(FUNCTION ) - SC(SAVEPOINT ) - - /* terminator */ - { NULL, 0 } -}; - -/* ======================================================= */ - -static const luaL_Reg dblib[] = { - {"isopen", db_isopen }, - {"last_insert_rowid", db_last_insert_rowid }, - {"changes", db_changes }, - {"total_changes", db_total_changes }, - {"errcode", db_errcode }, - {"error_code", db_errcode }, - {"errmsg", db_errmsg }, - {"error_message", db_errmsg }, - {"interrupt", db_interrupt }, - - {"create_function", db_create_function }, - {"create_aggregate", db_create_aggregate }, - {"create_collation", db_create_collation }, - - {"trace", db_trace }, - {"progress_handler", db_progress_handler }, - {"busy_timeout", db_busy_timeout }, - {"busy_handler", db_busy_handler }, -#if !defined(LSQLITE_OMIT_UPDATE_HOOK) || !LSQLITE_OMIT_UPDATE_HOOK - {"update_hook", db_update_hook }, - {"commit_hook", db_commit_hook }, - {"rollback_hook", db_rollback_hook }, -#endif - - {"prepare", db_prepare }, - {"rows", db_rows }, - {"urows", db_urows }, - {"nrows", db_nrows }, - - {"exec", db_exec }, - {"execute", db_exec }, - {"close", db_close }, - {"close_vm", db_close_vm }, - - {"__tostring", db_tostring }, - {"__gc", db_gc }, - - {NULL, NULL} -}; - -static const luaL_Reg vmlib[] = { - {"isopen", dbvm_isopen }, - - {"step", dbvm_step }, - {"reset", dbvm_reset }, - {"finalize", dbvm_finalize }, - - {"columns", dbvm_columns }, - - {"bind", dbvm_bind }, - {"bind_values", dbvm_bind_values }, - {"bind_names", dbvm_bind_names }, - {"bind_blob", dbvm_bind_blob }, - {"bind_parameter_count",dbvm_bind_parameter_count}, - {"bind_parameter_name", dbvm_bind_parameter_name}, - - {"get_value", dbvm_get_value }, - {"get_values", dbvm_get_values }, - {"get_name", dbvm_get_name }, - {"get_names", dbvm_get_names }, - {"get_type", dbvm_get_type }, - {"get_types", dbvm_get_types }, - {"get_uvalues", dbvm_get_uvalues }, - {"get_unames", dbvm_get_unames }, - {"get_utypes", dbvm_get_utypes }, - - {"get_named_values", dbvm_get_named_values }, - {"get_named_types", dbvm_get_named_types }, - - {"rows", dbvm_rows }, - {"urows", dbvm_urows }, - {"nrows", dbvm_nrows }, - - /* compatibility names (added by request) */ - {"idata", dbvm_get_values }, - {"inames", dbvm_get_names }, - {"itypes", dbvm_get_types }, - {"data", dbvm_get_named_values }, - {"type", dbvm_get_named_types }, - - {"__tostring", dbvm_tostring }, - {"__gc", dbvm_gc }, - - { NULL, NULL } -}; - -static const luaL_Reg ctxlib[] = { - {"user_data", lcontext_user_data }, - - {"get_aggregate_data", lcontext_get_aggregate_context }, - {"set_aggregate_data", lcontext_set_aggregate_context }, - {"aggregate_count", lcontext_aggregate_count }, - - {"result", lcontext_result }, - {"result_null", lcontext_result_null }, - {"result_number", lcontext_result_double }, - {"result_double", lcontext_result_double }, - {"result_int", lcontext_result_int }, - {"result_text", lcontext_result_text }, - {"result_blob", lcontext_result_blob }, - {"result_error", lcontext_result_error }, - - {"__tostring", lcontext_tostring }, - {NULL, NULL} -}; - -static const luaL_Reg sqlitelib[] = { - {"version", lsqlite_version }, - {"complete", lsqlite_complete }, -#ifndef WIN32 - {"temp_directory", lsqlite_temp_directory }, -#endif - {"open", lsqlite_open }, - {"open_memory", lsqlite_open_memory }, - - {"__newindex", lsqlite_newindex }, - {NULL, NULL} -}; - -static void create_meta(lua_State *L, const char *name, const luaL_Reg *lib) { - luaL_newmetatable(L, name); - lua_pushstring(L, "__index"); - lua_pushvalue(L, -2); /* push metatable */ - lua_rawset(L, -3); /* metatable.__index = metatable */ - - /* register metatable functions */ - luaL_openlib(L, NULL, lib, 0); - - /* remove metatable from stack */ - lua_pop(L, 1); -} - -LUALIB_API int luaopen_lsqlite3(lua_State *L) { - create_meta(L, sqlite_meta, dblib); - create_meta(L, sqlite_vm_meta, vmlib); - create_meta(L, sqlite_ctx_meta, ctxlib); - - luaL_getmetatable(L, sqlite_ctx_meta); - sqlite_ctx_meta_ref = luaL_ref(L, LUA_REGISTRYINDEX); - - /* register (local) sqlite metatable */ - luaL_register(L, "sqlite3", sqlitelib); - - { - int i = 0; - /* add constants to global table */ - while (sqlite_constants[i].name) { - lua_pushstring(L, sqlite_constants[i].name); - lua_pushnumber(L, sqlite_constants[i].value); - lua_rawset(L, -3); - ++i; - } - } - - /* set sqlite's metatable to itself - set as readonly (__newindex) */ - lua_pushvalue(L, -1); - lua_setmetatable(L, -2); - - return 1; -} - - - - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - - - - diff --git a/source/Server.cpp b/source/Server.cpp deleted file mode 100644 index fe8076631..000000000 --- a/source/Server.cpp +++ /dev/null @@ -1,707 +0,0 @@ -// ReDucTor is an awesome guy who helped me a lot - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "Server.h" -#include "ClientHandle.h" -#include "OSSupport/Timer.h" -#include "Mobs/Monster.h" -#include "OSSupport/Socket.h" -#include "Root.h" -#include "World.h" -#include "ChunkDef.h" -#include "PluginManager.h" -#include "GroupManager.h" -#include "ChatColor.h" -#include "Entities/Player.h" -#include "Inventory.h" -#include "Item.h" -#include "FurnaceRecipe.h" -#include "WebAdmin.h" -#include "Protocol/ProtocolRecognizer.h" -#include "CommandOutput.h" - -#include "MersenneTwister.h" - -#include "../iniFile/iniFile.h" -#include "Vector3f.h" - -#include <fstream> -#include <sstream> -#include <iostream> - -extern "C" { - #include "zlib.h" -} - - - - -// For the "dumpmem" server command: -/// Synchronize this with main.cpp - the leak finder needs initialization before it can be used to dump memory -#define ENABLE_LEAK_FINDER - -#if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER) - #pragma warning(push) - #pragma warning(disable:4100) - #include "LeakFinder.h" - #pragma warning(pop) -#endif - - - - - -typedef std::list< cClientHandle* > ClientList; - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cServer::cTickThread: - -cServer::cTickThread::cTickThread(cServer & a_Server) : - super("ServerTickThread"), - m_Server(a_Server) -{ -} - - - - - -void cServer::cTickThread::Execute(void) -{ - cTimer Timer; - - long long msPerTick = 50; - long long LastTime = Timer.GetNowTime(); - - while (!m_ShouldTerminate) - { - long long NowTime = Timer.GetNowTime(); - float DeltaTime = (float)(NowTime-LastTime); - m_ShouldTerminate = !m_Server.Tick(DeltaTime); - long long TickTime = Timer.GetNowTime() - NowTime; - - if (TickTime < msPerTick) - { - // Stretch tick time until it's at least msPerTick - cSleep::MilliSleep((unsigned int)(msPerTick - TickTime)); - } - - LastTime = NowTime; - } -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cServer: - -cServer::cServer(void) : - m_ListenThreadIPv4(*this, cSocket::IPv4, "Client IPv4"), - m_ListenThreadIPv6(*this, cSocket::IPv6, "Client IPv6"), - m_bIsConnected(false), - m_bRestarting(false), - m_RCONServer(*this), - m_TickThread(*this) -{ -} - - - - - -void cServer::ClientDestroying(const cClientHandle * a_Client) -{ - m_SocketThreads.StopReading(a_Client); -} - - - - - -void cServer::NotifyClientWrite(const cClientHandle * a_Client) -{ - m_NotifyWriteThread.NotifyClientWrite(a_Client); -} - - - - - -void cServer::WriteToClient(const cClientHandle * a_Client, const AString & a_Data) -{ - m_SocketThreads.Write(a_Client, a_Data); -} - - - - - -void cServer::QueueClientClose(const cClientHandle * a_Client) -{ - m_SocketThreads.QueueClose(a_Client); -} - - - - - -void cServer::RemoveClient(const cClientHandle * a_Client) -{ - m_SocketThreads.RemoveClient(a_Client); -} - - - - - -void cServer::ClientMovedToWorld(const cClientHandle * a_Client) -{ - cCSLock Lock(m_CSClients); - m_ClientsToRemove.push_back(const_cast<cClientHandle *>(a_Client)); -} - - - - - -void cServer::PlayerCreated(const cPlayer * a_Player) -{ - // To avoid deadlocks, the player count is not handled directly, but rather posted onto the tick thread - cCSLock Lock(m_CSPlayerCountDiff); - m_PlayerCountDiff += 1; -} - - - - - -void cServer::PlayerDestroying(const cPlayer * a_Player) -{ - // To avoid deadlocks, the player count is not handled directly, but rather posted onto the tick thread - cCSLock Lock(m_CSPlayerCountDiff); - m_PlayerCountDiff -= 1; -} - - - - - -bool cServer::InitServer(cIniFile & a_SettingsIni) -{ - m_Description = a_SettingsIni.GetValueSet("Server", "Description", "MCServer - in C++!").c_str(); - m_MaxPlayers = a_SettingsIni.GetValueSetI("Server", "MaxPlayers", 100); - m_bIsHardcore = a_SettingsIni.GetValueSetB("Server", "HardcoreEnabled", false); - m_PlayerCount = 0; - m_PlayerCountDiff = 0; - - if (m_bIsConnected) - { - LOGERROR("ERROR: Trying to initialize server while server is already running!"); - return false; - } - - LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS); - LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS); - - if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever - { - LOGERROR("WSAStartup() != 0"); - return false; - } - - bool HasAnyPorts = false; - AString Ports = a_SettingsIni.GetValueSet("Server", "Port", "25565"); - m_ListenThreadIPv4.SetReuseAddr(true); - if (m_ListenThreadIPv4.Initialize(Ports)) - { - HasAnyPorts = true; - } - - Ports = a_SettingsIni.GetValueSet("Server", "PortsIPv6", "25565"); - m_ListenThreadIPv6.SetReuseAddr(true); - if (m_ListenThreadIPv6.Initialize(Ports)) - { - HasAnyPorts = true; - } - - if (!HasAnyPorts) - { - LOGERROR("Couldn't open any ports. Aborting the server"); - return false; - } - - m_RCONServer.Initialize(a_SettingsIni); - - m_bIsConnected = true; - - m_ServerID = "-"; - if (a_SettingsIni.GetValueSetB("Authentication", "Authenticate", true)) - { - MTRand mtrand1; - unsigned int r1 = (mtrand1.randInt() % 1147483647) + 1000000000; - unsigned int r2 = (mtrand1.randInt() % 1147483647) + 1000000000; - std::ostringstream sid; - sid << std::hex << r1; - sid << std::hex << r2; - m_ServerID = sid.str(); - m_ServerID.resize(16, '0'); - } - - m_ClientViewDistance = a_SettingsIni.GetValueSetI("Server", "DefaultViewDistance", cClientHandle::DEFAULT_VIEW_DISTANCE); - if (m_ClientViewDistance < cClientHandle::MIN_VIEW_DISTANCE) - { - m_ClientViewDistance = cClientHandle::MIN_VIEW_DISTANCE; - LOGINFO("Setting default viewdistance to the minimum of %d", m_ClientViewDistance); - } - if (m_ClientViewDistance > cClientHandle::MAX_VIEW_DISTANCE) - { - m_ClientViewDistance = cClientHandle::MAX_VIEW_DISTANCE; - LOGINFO("Setting default viewdistance to the maximum of %d", m_ClientViewDistance); - } - - m_NotifyWriteThread.Start(this); - - PrepareKeys(); - - return true; -} - - - - - -int cServer::GetNumPlayers(void) -{ - cCSLock Lock(m_CSPlayerCount); - return m_PlayerCount; -} - - - - - -void cServer::PrepareKeys(void) -{ - // TODO: Save and load key for persistence across sessions - // But generating the key takes only a moment, do we even need that? - - LOGD("Generating protocol encryption keypair..."); - - time_t CurTime = time(NULL); - CryptoPP::RandomPool rng; - rng.Put((const byte *)&CurTime, sizeof(CurTime)); - m_PrivateKey.GenerateRandomWithKeySize(rng, 1024); - CryptoPP::RSA::PublicKey pk(m_PrivateKey); - m_PublicKey = pk; -} - - - - - -void cServer::OnConnectionAccepted(cSocket & a_Socket) -{ - if (!a_Socket.IsValid()) - { - return; - } - - const AString & ClientIP = a_Socket.GetIPString(); - if (ClientIP.empty()) - { - LOGWARN("cServer: A client connected, but didn't present its IP, disconnecting."); - a_Socket.CloseSocket(); - return; - } - - LOGD("Client \"%s\" connected!", ClientIP.c_str()); - - cClientHandle * NewHandle = new cClientHandle(&a_Socket, m_ClientViewDistance); - if (!m_SocketThreads.AddClient(a_Socket, NewHandle)) - { - // For some reason SocketThreads have rejected the handle, clean it up - LOGERROR("Client \"%s\" cannot be handled, server probably unstable", ClientIP.c_str()); - a_Socket.CloseSocket(); - delete NewHandle; - return; - } - - cCSLock Lock(m_CSClients); - m_Clients.push_back(NewHandle); -} - - - - - -bool cServer::Tick(float a_Dt) -{ - // Apply the queued playercount adjustments (postponed to avoid deadlocks) - int PlayerCountDiff = 0; - { - cCSLock Lock(m_CSPlayerCountDiff); - std::swap(PlayerCountDiff, m_PlayerCountDiff); - } - { - cCSLock Lock(m_CSPlayerCount); - m_PlayerCount += PlayerCountDiff; - } - - // Send the tick to the plugins, as well as let the plugin manager reload, if asked to (issue #102): - cPluginManager::Get()->Tick(a_Dt); - - // Let the Root process all the queued commands: - cRoot::Get()->TickCommands(); - - // Tick all clients not yet assigned to a world: - TickClients(a_Dt); - - if (!m_bRestarting) - { - return true; - } - else - { - m_bRestarting = false; - m_RestartEvent.Set(); - return false; - } -} - - - - - -void cServer::TickClients(float a_Dt) -{ - cClientHandleList RemoveClients; - { - cCSLock Lock(m_CSClients); - - // Remove clients that have moved to a world (the world will be ticking them from now on) - for (cClientHandleList::const_iterator itr = m_ClientsToRemove.begin(), end = m_ClientsToRemove.end(); itr != end; ++itr) - { - m_Clients.remove(*itr); - } // for itr - m_ClientsToRemove[] - m_ClientsToRemove.clear(); - - // Tick the remaining clients, take out those that have been destroyed into RemoveClients - for (cClientHandleList::iterator itr = m_Clients.begin(); itr != m_Clients.end();) - { - if ((*itr)->IsDestroyed()) - { - // Remove the client later, when CS is not held, to avoid deadlock ( http://forum.mc-server.org/showthread.php?tid=374 ) - RemoveClients.push_back(*itr); - itr = m_Clients.erase(itr); - continue; - } - (*itr)->Tick(a_Dt); - ++itr; - } // for itr - m_Clients[] - } - - // Delete the clients that have been destroyed - for (cClientHandleList::iterator itr = RemoveClients.begin(); itr != RemoveClients.end(); ++itr) - { - delete *itr; - } // for itr - RemoveClients[] -} - - - - - -bool cServer::Start(void) -{ - if (!m_ListenThreadIPv4.Start()) - { - return false; - } - if (!m_ListenThreadIPv6.Start()) - { - return false; - } - if (!m_TickThread.Start()) - { - return false; - } - return true; -} - - - - - -bool cServer::Command(cClientHandle & a_Client, AString & a_Cmd) -{ - return cRoot::Get()->GetPluginManager()->CallHookChat(a_Client.GetPlayer(), a_Cmd); -} - - - - - -void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output) -{ - AStringVector split = StringSplit(a_Cmd, " "); - if (split.empty()) - { - return; - } - - // Special handling: "stop" and "restart" are built in - if ((split[0].compare("stop") == 0) || (split[0].compare("restart") == 0)) - { - return; - } - - // "help" and "reload" are to be handled by MCS, so that they work no matter what - if (split[0] == "help") - { - PrintHelp(split, a_Output); - return; - } - if (split[0] == "reload") - { - cPluginManager::Get()->ReloadPlugins(); - return; - } - - // There is currently no way a plugin can do these (and probably won't ever be): - if (split[0].compare("chunkstats") == 0) - { - cRoot::Get()->LogChunkStats(a_Output); - a_Output.Finished(); - return; - } - #if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER) - if (split[0].compare("dumpmem") == 0) - { - LeakFinderXmlOutput Output("memdump.xml"); - DumpUsedMemory(&Output); - return; - } - - if (split[0].compare("killmem") == 0) - { - while (true) - { - new char[100 * 1024 * 1024]; // Allocate and leak 100 MiB in a loop -> fill memory and kill MCS - } - } - #endif - - if (cPluginManager::Get()->ExecuteConsoleCommand(split, a_Output)) - { - a_Output.Finished(); - return; - } - - a_Output.Out("Unknown command, type 'help' for all commands."); - a_Output.Finished(); -} - - - - - -void cServer::PrintHelp(const AStringVector & a_Split, cCommandOutputCallback & a_Output) -{ - typedef std::pair<AString, AString> AStringPair; - typedef std::vector<AStringPair> AStringPairs; - - class cCallback : - public cPluginManager::cCommandEnumCallback - { - public: - cCallback(void) : m_MaxLen(0) {} - - virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) override - { - if (!a_HelpString.empty()) - { - m_Commands.push_back(AStringPair(a_Command, a_HelpString)); - if (m_MaxLen < a_Command.length()) - { - m_MaxLen = a_Command.length(); - } - } - return false; - } - - AStringPairs m_Commands; - size_t m_MaxLen; - } Callback; - cPluginManager::Get()->ForEachConsoleCommand(Callback); - std::sort(Callback.m_Commands.begin(), Callback.m_Commands.end()); - for (AStringPairs::const_iterator itr = Callback.m_Commands.begin(), end = Callback.m_Commands.end(); itr != end; ++itr) - { - const AStringPair & cmd = *itr; - a_Output.Out(Printf("%-*s%s\n", Callback.m_MaxLen, cmd.first.c_str(), cmd.second.c_str())); - } // for itr - Callback.m_Commands[] - a_Output.Finished(); -} - - - - - -void cServer::BindBuiltInConsoleCommands(void) -{ - cPluginManager * PlgMgr = cPluginManager::Get(); - PlgMgr->BindConsoleCommand("help", NULL, " - Shows the available commands"); - PlgMgr->BindConsoleCommand("reload", NULL, " - Reloads all plugins"); - PlgMgr->BindConsoleCommand("restart", NULL, " - Restarts the server cleanly"); - PlgMgr->BindConsoleCommand("stop", NULL, " - Stops the server cleanly"); - PlgMgr->BindConsoleCommand("chunkstats", NULL, " - Displays detailed chunk memory statistics"); - #if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER) - PlgMgr->BindConsoleCommand("dumpmem", NULL, " - Dumps all used memory blocks together with their callstacks into memdump.xml"); - #endif -} - - - - - -void cServer::Shutdown(void) -{ - m_ListenThreadIPv4.Stop(); - m_ListenThreadIPv6.Stop(); - - m_bRestarting = true; - m_RestartEvent.Wait(); - - cRoot::Get()->SaveAllChunks(); - - cCSLock Lock(m_CSClients); - for( ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr ) - { - (*itr)->Destroy(); - delete *itr; - } - m_Clients.clear(); -} - - - - - -void cServer::KickUser(int a_ClientID, const AString & a_Reason) -{ - cCSLock Lock(m_CSClients); - for (ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr) - { - if ((*itr)->GetUniqueID() == a_ClientID) - { - (*itr)->Kick(a_Reason); - } - } // for itr - m_Clients[] -} - - - - - -void cServer::AuthenticateUser(int a_ClientID) -{ - cCSLock Lock(m_CSClients); - for (ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr) - { - if ((*itr)->GetUniqueID() == a_ClientID) - { - (*itr)->Authenticate(); - return; - } - } // for itr - m_Clients[] -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cServer::cNotifyWriteThread: - -cServer::cNotifyWriteThread::cNotifyWriteThread(void) : - super("ClientPacketThread"), - m_Server(NULL) -{ -} - - - - - -cServer::cNotifyWriteThread::~cNotifyWriteThread() -{ - m_ShouldTerminate = true; - m_Event.Set(); - Wait(); -} - - - - - -bool cServer::cNotifyWriteThread::Start(cServer * a_Server) -{ - m_Server = a_Server; - return super::Start(); -} - - - - - -void cServer::cNotifyWriteThread::Execute(void) -{ - cClientHandleList Clients; - while (!m_ShouldTerminate) - { - cCSLock Lock(m_CS); - while (m_Clients.size() == 0) - { - cCSUnlock Unlock(Lock); - m_Event.Wait(); - if (m_ShouldTerminate) - { - return; - } - } - - // Copy the clients to notify and unlock the CS: - Clients.splice(Clients.begin(), m_Clients); - Lock.Unlock(); - - for (cClientHandleList::iterator itr = Clients.begin(); itr != Clients.end(); ++itr) - { - m_Server->m_SocketThreads.NotifyWrite(*itr); - } // for itr - Clients[] - Clients.clear(); - } // while (!mShouldTerminate) -} - - - - - -void cServer::cNotifyWriteThread::NotifyClientWrite(const cClientHandle * a_Client) -{ - { - cCSLock Lock(m_CS); - m_Clients.remove(const_cast<cClientHandle *>(a_Client)); // Put it there only once - m_Clients.push_back(const_cast<cClientHandle *>(a_Client)); - } - m_Event.Set(); -} - - - - diff --git a/source/Server.h b/source/Server.h deleted file mode 100644 index 1b4848318..000000000 --- a/source/Server.h +++ /dev/null @@ -1,195 +0,0 @@ - -// cServer.h - -// Interfaces to the cServer object representing the network server - - - - - -#pragma once - -#include "OSSupport/SocketThreads.h" -#include "OSSupport/ListenThread.h" -#include "CryptoPP/rsa.h" -#include "CryptoPP/randpool.h" -#include "RCONServer.h" - - - - - -// fwd: -class cPlayer; -class cClientHandle; -class cIniFile; -class cCommandOutputCallback ; - -typedef std::list<cClientHandle *> cClientHandleList; - - - - - -class cServer // tolua_export - : public cListenThread::cCallback -{ // tolua_export -public: // tolua_export - bool InitServer(cIniFile & a_SettingsIni); - - // tolua_begin - - const AString & GetDescription(void) const {return m_Description; } - - // Player counts: - int GetMaxPlayers(void) const {return m_MaxPlayers; } - int GetNumPlayers(void); - void SetMaxPlayers(int a_MaxPlayers) { m_MaxPlayers = a_MaxPlayers; } - - // Hardcore mode or not: - bool IsHardcore(void) const {return m_bIsHardcore; } - - // tolua_end - - bool Start(void); - - bool Command(cClientHandle & a_Client, AString & a_Cmd); - - /// Executes the console command, sends output through the specified callback - void ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output); - - /// Lists all available console commands and their helpstrings - void PrintHelp(const AStringVector & a_Split, cCommandOutputCallback & a_Output); - - /// Binds the built-in console commands with the plugin manager - static void BindBuiltInConsoleCommands(void); - - void Shutdown(void); - - void KickUser(int a_ClientID, const AString & a_Reason); - void AuthenticateUser(int a_ClientID); // Called by cAuthenticator to auth the specified user - - const AString & GetServerID(void) const { return m_ServerID; } // tolua_export - - void ClientDestroying(const cClientHandle * a_Client); // Called by cClientHandle::Destroy(); stop m_SocketThreads from calling back into a_Client - - void NotifyClientWrite(const cClientHandle * a_Client); // Notifies m_SocketThreads that client has something to be written - - void WriteToClient(const cClientHandle * a_Client, const AString & a_Data); // Queues outgoing data for the client through m_SocketThreads - - void QueueClientClose(const cClientHandle * a_Client); // Queues the clienthandle to close when all its outgoing data is sent - - void RemoveClient(const cClientHandle * a_Client); // Removes the clienthandle from m_SocketThreads - - /// Don't tick a_Client anymore, it will be ticked from its cPlayer instead - void ClientMovedToWorld(const cClientHandle * a_Client); - - /// Notifies the server that a player was created; the server uses this to adjust the number of players - void PlayerCreated(const cPlayer * a_Player); - - /// Notifies the server that a player is being destroyed; the server uses this to adjust the number of players - void PlayerDestroying(const cPlayer * a_Player); - - CryptoPP::RSA::PrivateKey & GetPrivateKey(void) { return m_PrivateKey; } - CryptoPP::RSA::PublicKey & GetPublicKey (void) { return m_PublicKey; } - -private: - - friend class cRoot; // so cRoot can create and destroy cServer - - /// When NotifyClientWrite() is called, it is queued for this thread to process (to avoid deadlocks between cSocketThreads, cClientHandle and cChunkMap) - class cNotifyWriteThread : - public cIsThread - { - typedef cIsThread super; - - cEvent m_Event; // Set when m_Clients gets appended - cServer * m_Server; - - cCriticalSection m_CS; - cClientHandleList m_Clients; - - virtual void Execute(void); - - public: - - cNotifyWriteThread(void); - ~cNotifyWriteThread(); - - bool Start(cServer * a_Server); - - void NotifyClientWrite(const cClientHandle * a_Client); - } ; - - /// The server tick thread takes care of the players who aren't yet spawned in a world - class cTickThread : - public cIsThread - { - typedef cIsThread super; - - public: - cTickThread(cServer & a_Server); - - protected: - cServer & m_Server; - - // cIsThread overrides: - virtual void Execute(void) override; - } ; - - - cNotifyWriteThread m_NotifyWriteThread; - - cListenThread m_ListenThreadIPv4; - cListenThread m_ListenThreadIPv6; - - cCriticalSection m_CSClients; ///< Locks client lists - cClientHandleList m_Clients; ///< Clients that are connected to the server and not yet assigned to a cWorld - cClientHandleList m_ClientsToRemove; ///< Clients that have just been moved into a world and are to be removed from m_Clients in the next Tick() - - cCriticalSection m_CSPlayerCount; ///< Locks the m_PlayerCount - int m_PlayerCount; ///< Number of players currently playing in the server - cCriticalSection m_CSPlayerCountDiff; ///< Locks the m_PlayerCountDiff - int m_PlayerCountDiff; ///< Adjustment to m_PlayerCount to be applied in the Tick thread - - cSocketThreads m_SocketThreads; - - int m_ClientViewDistance; // The default view distance for clients; settable in Settings.ini - - bool m_bIsConnected; // true - connected false - not connected - - bool m_bRestarting; - - CryptoPP::RSA::PrivateKey m_PrivateKey; - CryptoPP::RSA::PublicKey m_PublicKey; - - cRCONServer m_RCONServer; - - AString m_Description; - int m_MaxPlayers; - bool m_bIsHardcore; - - cTickThread m_TickThread; - cEvent m_RestartEvent; - - /// The server ID used for client authentication - AString m_ServerID; - - - cServer(void); - - /// Loads, or generates, if missing, RSA keys for protocol encryption - void PrepareKeys(void); - - bool Tick(float a_Dt); - - /// Ticks the clients in m_Clients, manages the list in respect to removing clients - void TickClients(float a_Dt); - - // cListenThread::cCallback overrides: - virtual void OnConnectionAccepted(cSocket & a_Socket) override; -}; // tolua_export - - - - diff --git a/source/Simulator/Simulator.h b/source/Simulator/Simulator.h deleted file mode 100644 index e1d88f1c5..000000000 --- a/source/Simulator/Simulator.h +++ /dev/null @@ -1,46 +0,0 @@ - -#pragma once - -#include "../Vector3i.h" -#include "../../iniFile/iniFile.h" - - - - - -class cWorld; -class cChunk; - - - - - -class cSimulator -{ -public: - cSimulator(cWorld & a_World); - virtual ~cSimulator(); - - /// Called in each tick, a_Dt is the time passed since the last tick, in msec - virtual void Simulate(float a_Dt) = 0; - - /// Called in each tick for each chunk, a_Dt is the time passed since the last tick, in msec; direct access to chunk data available - virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) {}; - - /// Called when a block changes - virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk); - - virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) = 0; - -protected: - friend class cChunk; // Calls AddBlock() in its WakeUpSimulators() function, to speed things up - - /// Called to simulate a new block - virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) = 0; - - cWorld & m_World; -} ; - - - - diff --git a/source/StringCompression.h b/source/StringCompression.h deleted file mode 100644 index 8afdf59e0..000000000 --- a/source/StringCompression.h +++ /dev/null @@ -1,25 +0,0 @@ - -// StringCompression.h - -// Interfaces to the wrapping functions for compression and decompression using AString as their data - -#include "zlib.h" // Needed for the Z_XXX return values - - - - - -/// Compresses a_Data into a_Compressed using ZLIB; returns Z_XXX error constants same as zlib's compress2() -extern int CompressString(const char * a_Data, int a_Length, AString & a_Compressed); - -/// Uncompresses a_Data into a_Uncompressed; returns Z_XXX error constants same as zlib's decompress() -extern int UncompressString(const char * a_Data, int a_Length, AString & a_Uncompressed, int a_UncompressedSize); - -/// Compresses a_Data into a_Compressed using GZIP; returns Z_OK for success or Z_XXX error constants same as zlib -extern int CompressStringGZIP(const char * a_Data, int a_Length, AString & a_Compressed); - -/// Uncompresses a_Data into a_Uncompressed using GZIP; returns Z_OK for success or Z_XXX error constants same as zlib -extern int UncompressStringGZIP(const char * a_Data, int a_Length, AString & a_Uncompressed); - - - diff --git a/source/WebAdmin.h b/source/WebAdmin.h deleted file mode 100644 index dc6ea850e..000000000 --- a/source/WebAdmin.h +++ /dev/null @@ -1,215 +0,0 @@ - -// WebAdmin.h - -// Declares the cWebAdmin class representing the admin interface over http protocol, and related services (API) - -#pragma once - -#include "OSSupport/Socket.h" -#include "LuaState.h" -#include "../iniFile/iniFile.h" -#include "HTTPServer/HTTPServer.h" -#include "HTTPServer/HTTPFormParser.h" - - - - - -// Disable MSVC warnings: -#if defined(_MSC_VER) - #pragma warning(push) - #pragma warning(disable:4355) // 'this' : used in base member initializer list -#endif - - - - - -// fwd: -class cEvent; -class cWebPlugin; - - - - - -// tolua_begin -struct HTTPFormData -{ - std::string Name; - std::string Value; - std::string Type; -} ; -// tolua_end - - - - -// tolua_begin -struct HTTPRequest -{ - typedef std::map< std::string, std::string > StringStringMap; - typedef std::map< std::string, HTTPFormData > FormDataMap; - - AString Method; - AString Path; - AString Username; - // tolua_end - - /// Parameters given in the URL, after the questionmark - StringStringMap Params; // >> EXPORTED IN MANUALBINDINGS << - - /// Parameters posted as a part of a form - either in the URL (GET method) or in the body (POST method) - StringStringMap PostParams; // >> EXPORTED IN MANUALBINDINGS << - - /// Same as PostParams - FormDataMap FormData; // >> EXPORTED IN MANUALBINDINGS << -} ; // tolua_export - - - - - -// tolua_begin -struct HTTPTemplateRequest -{ - HTTPRequest Request; -} ; -// tolua_end - - - - - -// tolua_begin -struct sWebAdminPage -{ - AString Content; - AString PluginName; - AString TabName; -}; -// tolua_end - - - - - -// tolua_begin -class cWebAdmin : - public cHTTPServer::cCallbacks -{ -public: - // tolua_end - - typedef std::list< cWebPlugin* > PluginList; - - - cWebAdmin(void); - ~cWebAdmin(); - - /// Initializes the object. Returns true if successfully initialized and ready to start - bool Init(void); - - /// Starts the HTTP server taking care of the admin. Returns true if successful - bool Start(void); - - void AddPlugin( cWebPlugin* a_Plugin ); - void RemovePlugin( cWebPlugin* a_Plugin ); - - // TODO: Convert this to the auto-locking callback mechanism used for looping players in worlds and such - PluginList GetPlugins() const { return m_Plugins; } // >> EXPORTED IN MANUALBINDINGS << - - // tolua_begin - - sWebAdminPage GetPage(const HTTPRequest & a_Request); - - /// Returns the contents of the default page - the list of plugins and players - AString GetDefaultPage(void); - - /// Returns the prefix needed for making a link point to the webadmin root from the given URL ("../../../webadmin"-style) - AString GetBaseURL(const AString & a_URL); - - /// Escapes text passed into it, so it can be embedded into html. - static AString GetHTMLEscapedString(const AString & a_Input); - - // tolua_end - - /// Returns the prefix needed for making a link point to the webadmin root from the given URL ("../../../webadmin"-style) - AString GetBaseURL(const AStringVector& a_URLSplit); - -protected: - /// Common base class for request body data handlers - class cRequestData - { - public: - virtual ~cRequestData() {} // Force a virtual destructor in all descendants - - /// Called when a new chunk of body data is received - virtual void OnBody(const char * a_Data, int a_Size) = 0; - } ; - - /// The body handler for requests in the "/webadmin" and "/~webadmin" paths - class cWebadminRequestData : - public cRequestData, - public cHTTPFormParser::cCallbacks - { - public: - cHTTPFormParser m_Form; - - - cWebadminRequestData(cHTTPRequest & a_Request) : - m_Form(a_Request, *this) - { - } - - // cRequestData overrides: - virtual void OnBody(const char * a_Data, int a_Size) override; - - // cHTTPFormParser::cCallbacks overrides. Files are ignored: - virtual void OnFileStart(cHTTPFormParser & a_Parser, const AString & a_FileName) override {} - virtual void OnFileData(cHTTPFormParser & a_Parser, const char * a_Data, int a_Size) override {} - virtual void OnFileEnd(cHTTPFormParser & a_Parser) override {} - } ; - - - /// Set to true if Init() succeeds and the webadmin isn't to be disabled - bool m_IsInitialized; - - /// The webadmin.ini file, used for the settings and allowed logins - cIniFile m_IniFile; - - PluginList m_Plugins; - - /// The Lua template script to provide templates: - cLuaState m_TemplateScript; - - /// The HTTP server which provides the underlying HTTP parsing, serialization and events - cHTTPServer m_HTTPServer; - - - AString GetTemplate(void); - - /// Handles requests coming to the "/webadmin" or "/~webadmin" URLs - void HandleWebadminRequest(cHTTPConnection & a_Connection, cHTTPRequest & a_Request); - - /// Handles requests for the root page - void HandleRootRequest(cHTTPConnection & a_Connection, cHTTPRequest & a_Request); - - // cHTTPServer::cCallbacks overrides: - virtual void OnRequestBegun (cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override; - virtual void OnRequestBody (cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, int a_Size) override; - virtual void OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override; -} ; // tolua_export - - - - - -// Revert MSVC warnings back to orignal state: -#if defined(_MSC_VER) - #pragma warning(pop) -#endif - - - - diff --git a/source/World.cpp b/source/World.cpp deleted file mode 100644 index de64b1c20..000000000 --- a/source/World.cpp +++ /dev/null @@ -1,2745 +0,0 @@ - -#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules - -#include "BlockID.h" -#include "World.h" -#include "ChunkDef.h" -#include "ClientHandle.h" -#include "Server.h" -#include "Item.h" -#include "Root.h" -#include "../iniFile/iniFile.h" -#include "ChunkMap.h" -#include "OSSupport/Timer.h" - -// Entities (except mobs): -#include "Entities/ExpOrb.h" -#include "Entities/Pickup.h" -#include "Entities/Player.h" -#include "Entities/TNTEntity.h" - -// Simulators: -#include "Simulator/SimulatorManager.h" -#include "Simulator/FloodyFluidSimulator.h" -#include "Simulator/FluidSimulator.h" -#include "Simulator/FireSimulator.h" -#include "Simulator/NoopFluidSimulator.h" -#include "Simulator/SandSimulator.h" -#include "Simulator/RedstoneSimulator.h" -#include "Simulator/VaporizeFluidSimulator.h" - -// Mobs: -#include "Mobs/IncludeAllMonsters.h" -#include "MobCensus.h" -#include "MobSpawner.h" - -#include "MersenneTwister.h" -#include "Generating/Trees.h" -#include "PluginManager.h" -#include "Blocks/BlockHandler.h" -#include "Vector3d.h" - -#include "Tracer.h" -#include "tolua++.h" - -// DEBUG: Test out the cLineBlockTracer class by tracing a few lines: -#include "LineBlockTracer.h" - -#ifndef _WIN32 - #include <stdlib.h> -#endif - - - - - -/// Up to this many m_SpreadQueue elements are handled each world tick -const int MAX_LIGHTING_SPREAD_PER_TICK = 10; - -const int TIME_SUNSET = 12000; -const int TIME_NIGHT_START = 13187; -const int TIME_NIGHT_END = 22812; -const int TIME_SUNRISE = 23999; -const int TIME_SPAWN_DIVISOR = 148; - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cWorldLoadProgress: - -/// A simple thread that displays the progress of world loading / saving in cWorld::InitializeSpawn() -class cWorldLoadProgress : - public cIsThread -{ -public: - cWorldLoadProgress(cWorld * a_World) : - cIsThread("cWorldLoadProgress"), - m_World(a_World) - { - Start(); - } - - void Stop(void) - { - m_ShouldTerminate = true; - Wait(); - } - -protected: - - cWorld * m_World; - - virtual void Execute(void) override - { - for (;;) - { - LOG("%d chunks to load, %d chunks to generate", - m_World->GetStorage().GetLoadQueueLength(), - m_World->GetGenerator().GetQueueLength() - ); - - // Wait for 2 sec, but be "reasonably wakeable" when the thread is to finish - for (int i = 0; i < 20; i++) - { - cSleep::MilliSleep(100); - if (m_ShouldTerminate) - { - return; - } - } - } // for (-ever) - } - -} ; - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cWorldLightingProgress: - -/// A simple thread that displays the progress of world lighting in cWorld::InitializeSpawn() -class cWorldLightingProgress : - public cIsThread -{ -public: - cWorldLightingProgress(cLightingThread * a_Lighting) : - cIsThread("cWorldLightingProgress"), - m_Lighting(a_Lighting) - { - Start(); - } - - void Stop(void) - { - m_ShouldTerminate = true; - Wait(); - } - -protected: - - cLightingThread * m_Lighting; - - virtual void Execute(void) override - { - for (;;) - { - LOG("%d chunks remaining to light", m_Lighting->GetQueueLength() - ); - - // Wait for 2 sec, but be "reasonably wakeable" when the thread is to finish - for (int i = 0; i < 20; i++) - { - cSleep::MilliSleep(100); - if (m_ShouldTerminate) - { - return; - } - } - } // for (-ever) - } - -} ; - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cWorld::cLock: - -cWorld::cLock::cLock(cWorld & a_World) : - super(&(a_World.m_ChunkMap->GetCS())) -{ -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cWorld::cTickThread: - -cWorld::cTickThread::cTickThread(cWorld & a_World) : - super(Printf("WorldTickThread: %s", a_World.GetName().c_str())), - m_World(a_World) -{ -} - - - - - -void cWorld::cTickThread::Execute(void) -{ - cTimer Timer; - - long long msPerTick = 50; - long long LastTime = Timer.GetNowTime(); - - while (!m_ShouldTerminate) - { - long long NowTime = Timer.GetNowTime(); - float DeltaTime = (float)(NowTime - LastTime); - m_World.Tick(DeltaTime); - long long TickTime = Timer.GetNowTime() - NowTime; - - if (TickTime < msPerTick) - { - // Stretch tick time until it's at least msPerTick - cSleep::MilliSleep((unsigned int)(msPerTick - TickTime)); - } - - LastTime = NowTime; - } -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cWorld: - -cWorld::cWorld(const AString & a_WorldName) : - m_WorldName(a_WorldName), - m_IniFileName(m_WorldName + "/world.ini"), - m_StorageSchema("Default"), - m_WorldAgeSecs(0), - m_TimeOfDaySecs(0), - m_WorldAge(0), - m_TimeOfDay(0), - m_LastTimeUpdate(0), - m_RSList(0), - m_Weather(eWeather_Sunny), - m_WeatherInterval(24000), // Guaranteed 1 day of sunshine at server start :) - m_TickThread(*this), - m_SkyDarkness(0) -{ - LOGD("cWorld::cWorld(\"%s\")", a_WorldName.c_str()); - - cFile::CreateFolder(FILE_IO_PREFIX + m_WorldName); -} - - - - - -cWorld::~cWorld() -{ - delete m_SimulatorManager; - delete m_SandSimulator; - delete m_WaterSimulator; - delete m_LavaSimulator; - delete m_FireSimulator; - delete m_RedstoneSimulator; - - UnloadUnusedChunks(); - - m_Storage.WaitForFinish(); - - delete m_ChunkMap; -} - - - - - -void cWorld::CastThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) -{ - BroadcastThunderbolt(a_BlockX, a_BlockY, a_BlockZ); -} - - - - - -void cWorld::SetWeather(eWeather a_NewWeather) -{ - // Do the plugins agree? Do they want a different weather? - cRoot::Get()->GetPluginManager()->CallHookWeatherChanging(*this, a_NewWeather); - - // Set new period for the selected weather: - switch (a_NewWeather) - { - case eWeather_Sunny: m_WeatherInterval = 14400 + (m_TickRand.randInt() % 4800); break; // 12 - 16 minutes - case eWeather_Rain: m_WeatherInterval = 9600 + (m_TickRand.randInt() % 7200); break; // 8 - 14 minutes - case eWeather_ThunderStorm: m_WeatherInterval = 2400 + (m_TickRand.randInt() % 4800); break; // 2 - 6 minutes - default: - { - LOGWARNING("Requested unknown weather %d, setting sunny for a minute instead.", a_NewWeather); - a_NewWeather = eWeather_Sunny; - m_WeatherInterval = 1200; - break; - } - } // switch (NewWeather) - m_Weather = a_NewWeather; - BroadcastWeather(m_Weather); - - // Let the plugins know about the change: - cPluginManager::Get()->CallHookWeatherChanged(*this); -} - - - - - -void cWorld::ChangeWeather(void) -{ - // In the next tick the weather will be changed - m_WeatherInterval = 0; -} - - - - - -void cWorld::SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - return m_ChunkMap->SetNextBlockTick(a_BlockX, a_BlockY, a_BlockZ); -} - - - - - -void cWorld::InitializeSpawn(void) -{ - int ChunkX = 0, ChunkY = 0, ChunkZ = 0; - BlockToChunk((int)m_SpawnX, (int)m_SpawnY, (int)m_SpawnZ, ChunkX, ChunkY, ChunkZ); - - // For the debugging builds, don't make the server build too much world upon start: - #if defined(_DEBUG) || defined(ANDROID_NDK) - int ViewDist = 9; - #else - int ViewDist = 20; // Always prepare an area 20 chunks across, no matter what the actual cClientHandle::VIEWDISTANCE is - #endif // _DEBUG - - LOG("Preparing spawn area in world \"%s\"...", m_WorldName.c_str()); - for (int x = 0; x < ViewDist; x++) - { - for (int z = 0; z < ViewDist; z++) - { - m_ChunkMap->TouchChunk(x + ChunkX-(ViewDist - 1) / 2, ZERO_CHUNK_Y, z + ChunkZ-(ViewDist - 1) / 2); // Queue the chunk in the generator / loader - } - } - - { - // Display progress during this process: - cWorldLoadProgress Progress(this); - - // Wait for the loader to finish loading - m_Storage.WaitForQueuesEmpty(); - - // Wait for the generator to finish generating - m_Generator.WaitForQueueEmpty(); - - Progress.Stop(); - } - - // Light all chunks that have been newly generated: - LOG("Lighting spawn area in world \"%s\"...", m_WorldName.c_str()); - - for (int x = 0; x < ViewDist; x++) - { - int ChX = x + ChunkX-(ViewDist - 1) / 2; - for (int z = 0; z < ViewDist; z++) - { - int ChZ = z + ChunkZ-(ViewDist - 1) / 2; - if (!m_ChunkMap->IsChunkLighted(ChX, ChZ)) - { - m_Lighting.QueueChunk(ChX, ChZ); // Queue the chunk in the lighting thread - } - } // for z - } // for x - - { - cWorldLightingProgress Progress(&m_Lighting); - m_Lighting.WaitForQueueEmpty(); - Progress.Stop(); - } - - // TODO: Better spawn detection - move spawn out of the water if it isn't set in the INI already - m_SpawnY = (double)GetHeight((int)m_SpawnX, (int)m_SpawnZ) + 1.6f; // +1.6f eye height - - - #ifdef TEST_LINEBLOCKTRACER - // DEBUG: Test out the cLineBlockTracer class by tracing a few lines: - class cTracerCallbacks : - public cBlockTracer::cCallbacks - { - virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override - { - LOGD("Block {%d, %d, %d}: %d:%d (%s)", - a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, - ItemToString(cItem(a_BlockType, 1, a_BlockMeta)).c_str() - ); - return false; - } - - virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ) override - { - LOGD("Block {%d, %d, %d}: no data available", - a_BlockX, a_BlockY, a_BlockZ - ); - return false; - } - - virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ) override - { - LOGD("Out of world at {%f, %f, %f}", a_BlockX, a_BlockY, a_BlockZ); - return false; - } - - virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ) override - { - LOGD("Into world at {%f, %f, %f}", a_BlockX, a_BlockY, a_BlockZ); - return false; - } - - virtual void OnNoMoreHits(void) override - { - LOGD("No more hits"); - } - } Callbacks; - LOGD("Spawn is at {%f, %f, %f}", m_SpawnX, m_SpawnY, m_SpawnZ); - LOGD("Tracing a line along +X:"); - cLineBlockTracer::Trace(*this, Callbacks, m_SpawnX - 10, m_SpawnY, m_SpawnZ, m_SpawnX + 10, m_SpawnY, m_SpawnZ); - LOGD("Tracing a line along -Z:"); - cLineBlockTracer::Trace(*this, Callbacks, m_SpawnX, m_SpawnY, m_SpawnZ + 10, m_SpawnX, m_SpawnY, m_SpawnZ - 10); - LOGD("Tracing a line along -Y, out of world:"); - cLineBlockTracer::Trace(*this, Callbacks, m_SpawnX, 260, m_SpawnZ, m_SpawnX, -5, m_SpawnZ); - LOGD("Tracing a line along XY:"); - cLineBlockTracer::Trace(*this, Callbacks, m_SpawnX - 10, m_SpawnY - 10, m_SpawnZ, m_SpawnX + 10, m_SpawnY + 10, m_SpawnZ); - LOGD("Tracing a line in generic direction:"); - cLineBlockTracer::Trace(*this, Callbacks, m_SpawnX - 15, m_SpawnY - 5, m_SpawnZ + 7.5, m_SpawnX + 13, m_SpawnY - 10, m_SpawnZ + 8.5); - LOGD("Tracing tests done"); - #endif // TEST_LINEBLOCKTRACER -} - - - - - -void cWorld::Start(void) -{ - // TODO: Find a proper spawn location, based on the biomes (not in ocean) - m_SpawnX = (double)((m_TickRand.randInt() % 1000) - 500); - m_SpawnY = cChunkDef::Height; - m_SpawnZ = (double)((m_TickRand.randInt() % 1000) - 500); - m_GameMode = eGameMode_Creative; - - cIniFile IniFile; - if (!IniFile.ReadFile(m_IniFileName)) - { - LOGWARNING("Cannot read world settings from \"%s\", defaults will be used.", m_IniFileName.c_str()); - } - AString Dimension = IniFile.GetValueSet("General", "Dimension", "Overworld"); - m_Dimension = StringToDimension(Dimension); - switch (m_Dimension) - { - case dimNether: - case dimOverworld: - case dimEnd: - { - break; - } - default: - { - LOGWARNING("Unknown dimension: \"%s\". Setting to Overworld", Dimension.c_str()); - m_Dimension = dimOverworld; - break; - } - } // switch (m_Dimension) - m_SpawnX = IniFile.GetValueSetF("SpawnPosition", "X", m_SpawnX); - m_SpawnY = IniFile.GetValueSetF("SpawnPosition", "Y", m_SpawnY); - m_SpawnZ = IniFile.GetValueSetF("SpawnPosition", "Z", m_SpawnZ); - m_StorageSchema = IniFile.GetValueSet ("Storage", "Schema", m_StorageSchema); - m_MaxCactusHeight = IniFile.GetValueSetI("Plants", "MaxCactusHeight", 3); - m_MaxSugarcaneHeight = IniFile.GetValueSetI("Plants", "MaxSugarcaneHeight", 3); - m_IsCactusBonemealable = IniFile.GetValueSetB("Plants", "IsCactusBonemealable", false); - m_IsCarrotsBonemealable = IniFile.GetValueSetB("Plants", "IsCarrotsBonemealable", true); - m_IsCropsBonemealable = IniFile.GetValueSetB("Plants", "IsCropsBonemealable", true); - m_IsGrassBonemealable = IniFile.GetValueSetB("Plants", "IsGrassBonemealable", true); - m_IsMelonStemBonemealable = IniFile.GetValueSetB("Plants", "IsMelonStemBonemealable", true); - m_IsMelonBonemealable = IniFile.GetValueSetB("Plants", "IsMelonBonemealable", false); - m_IsPotatoesBonemealable = IniFile.GetValueSetB("Plants", "IsPotatoesBonemealable", true); - m_IsPumpkinStemBonemealable = IniFile.GetValueSetB("Plants", "IsPumpkinStemBonemealable", true); - m_IsPumpkinBonemealable = IniFile.GetValueSetB("Plants", "IsPumpkinBonemealable", false); - m_IsSaplingBonemealable = IniFile.GetValueSetB("Plants", "IsSaplingBonemealable", true); - m_IsSugarcaneBonemealable = IniFile.GetValueSetB("Plants", "IsSugarcaneBonemealable", false); - m_bEnabledPVP = IniFile.GetValueSetB("PVP", "Enabled", true); - m_IsDeepSnowEnabled = IniFile.GetValueSetB("Physics", "DeepSnow", false); - - m_GameMode = (eGameMode)IniFile.GetValueSetI("GameMode", "GameMode", m_GameMode); - - // Load allowed mobs: - const char * DefaultMonsters = ""; - switch (m_Dimension) - { - case dimOverworld: DefaultMonsters = "bat, cavespider, chicken, cow, creeper, enderman, horse, mooshroom, ocelot, pig, sheep, silverfish, skeleton, slime, spider, squid, wolf, zombie"; break; - case dimNether: DefaultMonsters = "blaze, ghast, magmacube, skeleton, zombie, zombiepigman"; break; - case dimEnd: DefaultMonsters = "enderman"; break; - default: - { - ASSERT(!"Unhandled world dimension"); - DefaultMonsters = "wither"; - break; - } - } - m_bAnimals = IniFile.GetValueSetB("Monsters", "AnimalsOn", true); - AString AllMonsters = IniFile.GetValueSet("Monsters", "Types", DefaultMonsters); - AStringVector SplitList = StringSplitAndTrim(AllMonsters, ","); - for (AStringVector::const_iterator itr = SplitList.begin(), end = SplitList.end(); itr != end; ++itr) - { - cMonster::eType ToAdd = cMonster::StringToMobType(*itr); - if (ToAdd != cMonster::mtInvalidType) - { - m_AllowedMobs.insert(ToAdd); - LOGD("Allowed mob: %s", itr->c_str()); - } - else - { - LOG("World \"%s\": Unknown mob type: %s", m_WorldName.c_str(), itr->c_str()); - } - } - - m_ChunkMap = new cChunkMap(this); - - m_LastSave = 0; - m_LastUnload = 0; - - // preallocate some memory for ticking blocks so we don't need to allocate that often - m_BlockTickQueue.reserve(1000); - m_BlockTickQueueCopy.reserve(1000); - - // Simulators: - m_SimulatorManager = new cSimulatorManager(*this); - m_WaterSimulator = InitializeFluidSimulator(IniFile, "Water", E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER); - m_LavaSimulator = InitializeFluidSimulator(IniFile, "Lava", E_BLOCK_LAVA, E_BLOCK_STATIONARY_LAVA); - m_SandSimulator = new cSandSimulator(*this, IniFile); - m_FireSimulator = new cFireSimulator(*this, IniFile); - m_RedstoneSimulator = new cRedstoneSimulator(*this); - - // Water and Lava simulators get registered in InitializeFluidSimulator() - m_SimulatorManager->RegisterSimulator(m_SandSimulator, 1); - m_SimulatorManager->RegisterSimulator(m_FireSimulator, 1); - m_SimulatorManager->RegisterSimulator(m_RedstoneSimulator, 1); - - m_Lighting.Start(this); - m_Storage.Start(this, m_StorageSchema); - m_Generator.Start(this, IniFile); - m_ChunkSender.Start(this); - m_TickThread.Start(); - - // Init of the spawn monster time (as they are supposed to have different spawn rate) - m_LastSpawnMonster.insert(std::map<cMonster::eFamily, Int64>::value_type(cMonster::mfHostile, 0)); - m_LastSpawnMonster.insert(std::map<cMonster::eFamily, Int64>::value_type(cMonster::mfPassive, 0)); - m_LastSpawnMonster.insert(std::map<cMonster::eFamily, Int64>::value_type(cMonster::mfAmbient, 0)); - m_LastSpawnMonster.insert(std::map<cMonster::eFamily, Int64>::value_type(cMonster::mfWater, 0)); - - - // Save any changes that the defaults may have done to the ini file: - if (!IniFile.WriteFile(m_IniFileName)) - { - LOGWARNING("Could not write world config to %s", m_IniFileName.c_str()); - } - -} - - - - - -void cWorld::Stop(void) -{ - // Delete the clients that have been in this world: - { - cCSLock Lock(m_CSClients); - for (cClientHandleList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr) - { - (*itr)->Destroy(); - delete *itr; - } // for itr - m_Clients[] - m_Clients.clear(); - } - - m_TickThread.Stop(); - m_Lighting.Stop(); - m_Generator.Stop(); - m_ChunkSender.Stop(); - m_Storage.Stop(); -} - - - - - -void cWorld::Tick(float a_Dt) -{ - // Call the plugins - cPluginManager::Get()->CallHookWorldTick(*this, a_Dt); - - // We need sub-tick precision here, that's why we store the time in seconds and calculate ticks off of it - m_WorldAgeSecs += (double)a_Dt / 1000.0; - m_TimeOfDaySecs += (double)a_Dt / 1000.0; - - // Wrap time of day each 20 minutes (1200 seconds) - if (m_TimeOfDaySecs > 1200.0) - { - m_TimeOfDaySecs -= 1200.0; - } - - m_WorldAge = (Int64)(m_WorldAgeSecs * 20.0); - m_TimeOfDay = (Int64)(m_TimeOfDaySecs * 20.0); - - // Updates the sky darkness based on current time of day - UpdateSkyDarkness(); - - // Broadcast time update every 40 ticks (2 seconds) - if (m_LastTimeUpdate < m_WorldAge - 40) - { - BroadcastTimeUpdate(); - m_LastTimeUpdate = m_WorldAge; - } - - m_ChunkMap->Tick(a_Dt); - - TickClients(a_Dt); - TickQueuedBlocks(); - TickQueuedTasks(); - - GetSimulatorManager()->Simulate(a_Dt); - - TickWeather(a_Dt); - - // Asynchronously set blocks: - sSetBlockList FastSetBlockQueueCopy; - { - cCSLock Lock(m_CSFastSetBlock); - std::swap(FastSetBlockQueueCopy, m_FastSetBlockQueue); - } - m_ChunkMap->FastSetBlocks(FastSetBlockQueueCopy); - if (!FastSetBlockQueueCopy.empty()) - { - // Some blocks failed, store them for next tick: - cCSLock Lock(m_CSFastSetBlock); - m_FastSetBlockQueue.splice(m_FastSetBlockQueue.end(), FastSetBlockQueueCopy); - } - - if (m_WorldAge - m_LastSave > 60 * 5 * 20) // Save each 5 minutes - { - SaveAllChunks(); - } - - if (m_WorldAge - m_LastUnload > 10 * 20) // Unload every 10 seconds - { - UnloadUnusedChunks(); - } - - TickMobs(a_Dt); - - std::vector<int> m_RSList_copy(m_RSList); - - m_RSList.clear(); - - std::vector<int>::const_iterator cii; // FIXME - Please rename this variable, WTF is cii??? Use human readable variable names or common abbreviations (i, idx, itr, iter) - for (cii = m_RSList_copy.begin(); cii != m_RSList_copy.end();) - { - int tempX = *cii; cii++; - int tempY = *cii; cii++; - int tempZ = *cii; cii++; - int state = *cii; cii++; - - if ((state == 11111) && ((int)GetBlock(tempX, tempY, tempZ) == E_BLOCK_REDSTONE_TORCH_OFF)) - { - FastSetBlock(tempX, tempY, tempZ, E_BLOCK_REDSTONE_TORCH_ON, (int)GetBlockMeta(tempX, tempY, tempZ)); - } - else if ((state == 00000) && ((int)GetBlock(tempX, tempY, tempZ) == E_BLOCK_REDSTONE_TORCH_ON)) - { - FastSetBlock(tempX, tempY, tempZ, E_BLOCK_REDSTONE_TORCH_OFF, (int)GetBlockMeta(tempX, tempY, tempZ)); - } - } - m_RSList_copy.erase(m_RSList_copy.begin(),m_RSList_copy.end()); -} - - - - - -void cWorld::TickWeather(float a_Dt) -{ - // There are no weather changes anywhere but in the Overworld: - if (GetDimension() != dimOverworld) - { - return; - } - - if (m_WeatherInterval > 0) - { - // Not yet, wait for the weather period to end - m_WeatherInterval--; - } - else - { - // Change weather: - - // Pick a new weather. Only reasonable transitions allowed: - eWeather NewWeather = m_Weather; - switch (m_Weather) - { - case eWeather_Sunny: NewWeather = eWeather_Rain; break; - case eWeather_ThunderStorm: NewWeather = eWeather_Rain; break; - case eWeather_Rain: - { - // 1/8 chance of turning into a thunderstorm - NewWeather = ((m_TickRand.randInt() % 256) < 32) ? eWeather_ThunderStorm : eWeather_Sunny; - break; - } - - default: - { - LOGWARNING("Unknown current weather: %d. Setting sunny.", m_Weather); - ASSERT(!"Unknown weather"); - NewWeather = eWeather_Sunny; - } - } - - SetWeather(NewWeather); - } // else (m_WeatherInterval > 0) - - if (m_Weather == eWeather_ThunderStorm) - { - // 0.5% chance per tick of thunderbolt - if (m_TickRand.randInt() % 199 == 0) - { - CastThunderbolt(0, 0, 0); // TODO: find random possitions near players to cast thunderbolts. - } - } -} - - - - - -void cWorld::TickMobs(float a_Dt) -{ - // _X 2013_10_22: This is a quick fix for #283 - the world needs to be locked while ticking mobs - cWorld::cLock Lock(*this); - - // before every Mob action, we have to count them depending on the distance to players, on their family ... - cMobCensus MobCensus; - m_ChunkMap->CollectMobCensus(MobCensus); - if (m_bAnimals) - { - // Spawning is enabled, spawn now: - static const cMonster::eFamily AllFamilies[] = - { - cMonster::mfHostile, - cMonster::mfPassive, - cMonster::mfAmbient, - cMonster::mfWater, - } ; - for (int i = 0; i < ARRAYCOUNT(AllFamilies); i++) - { - cMonster::eFamily Family = AllFamilies[i]; - int SpawnDelay = cMonster::GetSpawnDelay(Family); - if ( - (m_LastSpawnMonster[Family] > m_WorldAge - SpawnDelay) || // Not reached the needed ticks before the next round - MobCensus.IsCapped(Family) - ) - { - continue; - } - m_LastSpawnMonster[Family] = m_WorldAge; - cMobSpawner Spawner(Family, m_AllowedMobs); - if (Spawner.CanSpawnAnything()) - { - m_ChunkMap->SpawnMobs(Spawner); - // do the spawn - for (cMobSpawner::tSpawnedContainer::const_iterator itr2 = Spawner.getSpawned().begin(); itr2 != Spawner.getSpawned().end(); itr2++) - { - SpawnMobFinalize(*itr2); - } - } - } // for i - AllFamilies[] - } // if (Spawning enabled) - - // move close mobs - cMobProximityCounter::sIterablePair allCloseEnoughToMoveMobs = MobCensus.GetProximityCounter().getMobWithinThosesDistances(-1, 64 * 16);// MG TODO : deal with this magic number (the 16 is the size of a block) - for(cMobProximityCounter::tDistanceToMonster::const_iterator itr = allCloseEnoughToMoveMobs.m_Begin; itr != allCloseEnoughToMoveMobs.m_End; itr++) - { - itr->second.m_Monster.Tick(a_Dt, itr->second.m_Chunk); - } - - // remove too far mobs - cMobProximityCounter::sIterablePair allTooFarMobs = MobCensus.GetProximityCounter().getMobWithinThosesDistances(128 * 16, -1);// MG TODO : deal with this magic number (the 16 is the size of a block) - for(cMobProximityCounter::tDistanceToMonster::const_iterator itr = allTooFarMobs.m_Begin; itr != allTooFarMobs.m_End; itr++) - { - itr->second.m_Monster.Destroy(true); - } -} - - - - - -void cWorld::TickQueuedTasks(void) -{ - // Make a copy of the tasks to avoid deadlocks on accessing m_Tasks - cTasks Tasks; - { - cCSLock Lock(m_CSTasks); - std::swap(Tasks, m_Tasks); - } - - // Execute and delete each task: - for (cTasks::iterator itr = Tasks.begin(), end = Tasks.end(); itr != end; ++itr) - { - (*itr)->Run(*this); - delete *itr; - } // for itr - m_Tasks[] -} - - - - - -void cWorld::TickClients(float a_Dt) -{ - cClientHandleList RemoveClients; - { - cCSLock Lock(m_CSClients); - - // Remove clients scheduled for removal: - for (cClientHandleList::iterator itr = m_ClientsToRemove.begin(), end = m_ClientsToRemove.end(); itr != end; ++itr) - { - m_Clients.remove(*itr); - } // for itr - m_ClientsToRemove[] - m_ClientsToRemove.clear(); - - // Add clients scheduled for adding: - for (cClientHandleList::iterator itr = m_ClientsToAdd.begin(), end = m_ClientsToAdd.end(); itr != end; ++itr) - { - if (std::find(m_Clients.begin(), m_Clients.end(), *itr) != m_Clients.end()) - { - ASSERT(!"Adding a client that is already in the clientlist"); - continue; - } - m_Clients.push_back(*itr); - } // for itr - m_ClientsToRemove[] - m_ClientsToAdd.clear(); - - // Tick the clients, take out those that have been destroyed into RemoveClients - for (cClientHandleList::iterator itr = m_Clients.begin(); itr != m_Clients.end();) - { - if ((*itr)->IsDestroyed()) - { - // Remove the client later, when CS is not held, to avoid deadlock - RemoveClients.push_back(*itr); - itr = m_Clients.erase(itr); - continue; - } - (*itr)->Tick(a_Dt); - ++itr; - } // for itr - m_Clients[] - } - - // Delete the clients that have been destroyed - for (cClientHandleList::iterator itr = RemoveClients.begin(); itr != RemoveClients.end(); ++itr) - { - delete *itr; - } // for itr - RemoveClients[] -} - - - - - -void cWorld::UpdateSkyDarkness(void) -{ - int TempTime = (int)m_TimeOfDay; - if (TempTime <= TIME_SUNSET) - { - m_SkyDarkness = 0; - } - else if (TempTime <= TIME_NIGHT_START) - { - m_SkyDarkness = (TIME_NIGHT_START - TempTime) / TIME_SPAWN_DIVISOR; - } - else if (TempTime <= TIME_NIGHT_END) - { - m_SkyDarkness = 8; - } - else - { - m_SkyDarkness = (TIME_SUNRISE - TempTime) / TIME_SPAWN_DIVISOR; - } -} - - - - - -void cWorld::WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - return m_ChunkMap->WakeUpSimulators(a_BlockX, a_BlockY, a_BlockZ); -} - - - - - -/// Wakes up the simulators for the specified area of blocks -void cWorld::WakeUpSimulatorsInArea(int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ) -{ - return m_ChunkMap->WakeUpSimulatorsInArea(a_MinBlockX, a_MaxBlockX, a_MinBlockY, a_MaxBlockY, a_MinBlockZ, a_MaxBlockZ); -} - - - - - -bool cWorld::ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, cBlockEntityCallback & a_Callback) -{ - return m_ChunkMap->ForEachBlockEntityInChunk(a_ChunkX, a_ChunkZ, a_Callback); -} - - - - - -bool cWorld::ForEachChestInChunk(int a_ChunkX, int a_ChunkZ, cChestCallback & a_Callback) -{ - return m_ChunkMap->ForEachChestInChunk(a_ChunkX, a_ChunkZ, a_Callback); -} - - - - - -bool cWorld::ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback) -{ - return m_ChunkMap->ForEachDispenserInChunk(a_ChunkX, a_ChunkZ, a_Callback); -} - - - - - -bool cWorld::ForEachDropperInChunk(int a_ChunkX, int a_ChunkZ, cDropperCallback & a_Callback) -{ - return m_ChunkMap->ForEachDropperInChunk(a_ChunkX, a_ChunkZ, a_Callback); -} - - - - - -bool cWorld::ForEachDropSpenserInChunk(int a_ChunkX, int a_ChunkZ, cDropSpenserCallback & a_Callback) -{ - return m_ChunkMap->ForEachDropSpenserInChunk(a_ChunkX, a_ChunkZ, a_Callback); -} - - - - - -bool cWorld::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback) -{ - return m_ChunkMap->ForEachFurnaceInChunk(a_ChunkX, a_ChunkZ, a_Callback); -} - - - - - -void cWorld::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void * a_SourceData) -{ - if (cPluginManager::Get()->CallHookExploding(*this, a_ExplosionSize, a_CanCauseFire, a_BlockX, a_BlockY, a_BlockZ, a_Source, a_SourceData) || (a_ExplosionSize <= 0)) - { - return; - } - - // TODO: Add damage to entities, add support for pickups, and implement block hardiness - Vector3d explosion_pos = Vector3d(a_BlockX, a_BlockY, a_BlockZ); - cVector3iArray BlocksAffected; - m_ChunkMap->DoExplosionAt(a_ExplosionSize, a_BlockX, a_BlockY, a_BlockZ, BlocksAffected); - BroadcastSoundEffect("random.explode", (int)floor(a_BlockX * 8), (int)floor(a_BlockY * 8), (int)floor(a_BlockZ * 8), 1.0f, 0.6f); - { - cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - { - cClientHandle * ch = (*itr)->GetClientHandle(); - if ((ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) - { - continue; - } - Vector3d distance_explosion = (*itr)->GetPosition() - explosion_pos; - if (distance_explosion.SqrLength() < 4096.0) - { - double real_distance = std::max(0.004, sqrt(distance_explosion.SqrLength())); - double power = a_ExplosionSize / real_distance; - if (power <= 1) - { - power = 0; - } - distance_explosion.Normalize(); - distance_explosion *= power; - ch->SendExplosion(a_BlockX, a_BlockY, a_BlockZ, (float)a_ExplosionSize, BlocksAffected, distance_explosion); - } - } - } - cPluginManager::Get()->CallHookExploded(*this, a_ExplosionSize, a_CanCauseFire, a_BlockX, a_BlockY, a_BlockZ, a_Source, a_SourceData); -} - - - - - -bool cWorld::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback) -{ - return m_ChunkMap->DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); -} - - - - - -bool cWorld::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback) -{ - return m_ChunkMap->DoWithChestAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); -} - - - - - -bool cWorld::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback) -{ - return m_ChunkMap->DoWithDispenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); -} - - - - - -bool cWorld::DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback) -{ - return m_ChunkMap->DoWithDropperAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); -} - - - - - -bool cWorld::DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback) -{ - return m_ChunkMap->DoWithDropSpenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); -} - - - - - -bool cWorld::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback) -{ - return m_ChunkMap->DoWithFurnaceAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); -} - - - - - -bool cWorld::GetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4) -{ - return m_ChunkMap->GetSignLines(a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4); -} - - - - - -bool cWorld::DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback & a_Callback) -{ - return m_ChunkMap->DoWithChunk(a_ChunkX, a_ChunkZ, a_Callback); -} - - - - - -void cWorld::GrowTree(int a_X, int a_Y, int a_Z) -{ - if (GetBlock(a_X, a_Y, a_Z) == E_BLOCK_SAPLING) - { - // There is a sapling here, grow a tree according to its type: - GrowTreeFromSapling(a_X, a_Y, a_Z, GetBlockMeta(a_X, a_Y, a_Z)); - } - else - { - // There is nothing here, grow a tree based on the current biome here: - GrowTreeByBiome(a_X, a_Y, a_Z); - } -} - - - - - -void cWorld::GrowTreeFromSapling(int a_X, int a_Y, int a_Z, NIBBLETYPE a_SaplingMeta) -{ - cNoise Noise(m_Generator.GetSeed()); - sSetBlockVector Logs, Other; - switch (a_SaplingMeta & 0x07) - { - case E_META_SAPLING_APPLE: GetAppleTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break; - case E_META_SAPLING_BIRCH: GetBirchTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break; - case E_META_SAPLING_CONIFER: GetConiferTreeImage(a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break; - case E_META_SAPLING_JUNGLE: GetJungleTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break; - } - Other.insert(Other.begin(), Logs.begin(), Logs.end()); - Logs.clear(); - GrowTreeImage(Other); -} - - - - - -void cWorld::GrowTreeByBiome(int a_X, int a_Y, int a_Z) -{ - cNoise Noise(m_Generator.GetSeed()); - sSetBlockVector Logs, Other; - GetTreeImageByBiome(a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), (EMCSBiome)GetBiomeAt(a_X, a_Z), Logs, Other); - Other.insert(Other.begin(), Logs.begin(), Logs.end()); - Logs.clear(); - GrowTreeImage(Other); -} - - - - - -void cWorld::GrowTreeImage(const sSetBlockVector & a_Blocks) -{ - // Check that the tree has place to grow - - // Make a copy of the log blocks: - sSetBlockVector b2; - for (sSetBlockVector::const_iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr) - { - if (itr->BlockType == E_BLOCK_LOG) - { - b2.push_back(*itr); - } - } // for itr - a_Blocks[] - - // Query blocktypes and metas at those log blocks: - if (!GetBlocks(b2, false)) - { - return; - } - - // Check that at each log's coord there's an block allowed to be overwritten: - for (sSetBlockVector::const_iterator itr = b2.begin(); itr != b2.end(); ++itr) - { - switch (itr->BlockType) - { - CASE_TREE_ALLOWED_BLOCKS: - { - break; - } - default: - { - return; - } - } - } // for itr - b2[] - - // All ok, replace blocks with the tree image: - m_ChunkMap->ReplaceTreeBlocks(a_Blocks); -} - - - - - -bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal) -{ - BLOCKTYPE BlockType; - NIBBLETYPE BlockMeta; - GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta); - switch (BlockType) - { - case E_BLOCK_CARROTS: - { - if (a_IsByBonemeal && !m_IsCarrotsBonemealable) - { - return false; - } - if (BlockMeta < 7) - { - FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); - } - return true; - } - - case E_BLOCK_CROPS: - { - if (a_IsByBonemeal && !m_IsCropsBonemealable) - { - return false; - } - if (BlockMeta < 7) - { - FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); - } - return true; - } - - case E_BLOCK_MELON_STEM: - { - if (BlockMeta < 7) - { - if (a_IsByBonemeal && !m_IsMelonStemBonemealable) - { - return false; - } - FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); - } - else - { - if (a_IsByBonemeal && !m_IsMelonBonemealable) - { - return false; - } - GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, BlockType); - } - return true; - } - - case E_BLOCK_POTATOES: - { - if (a_IsByBonemeal && !m_IsPotatoesBonemealable) - { - return false; - } - if (BlockMeta < 7) - { - FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); - } - return true; - } - - case E_BLOCK_PUMPKIN_STEM: - { - if (BlockMeta < 7) - { - if (a_IsByBonemeal && !m_IsPumpkinStemBonemealable) - { - return false; - } - FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); - } - else - { - if (a_IsByBonemeal && !m_IsPumpkinBonemealable) - { - return false; - } - GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, BlockType); - } - return true; - } - - case E_BLOCK_SAPLING: - { - if (a_IsByBonemeal && !m_IsSaplingBonemealable) - { - return false; - } - GrowTreeFromSapling(a_BlockX, a_BlockY, a_BlockZ, BlockMeta); - return true; - } - - case E_BLOCK_GRASS: - { - if (a_IsByBonemeal && !m_IsGrassBonemealable) - { - return false; - } - MTRand r1; - for (int i = 0; i < 60; i++) - { - int OfsX = (r1.randInt(3) + r1.randInt(3) + r1.randInt(3) + r1.randInt(3)) / 2 - 3; - int OfsY = r1.randInt(3) + r1.randInt(3) - 3; - int OfsZ = (r1.randInt(3) + r1.randInt(3) + r1.randInt(3) + r1.randInt(3)) / 2 - 3; - BLOCKTYPE Ground = GetBlock(a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ); - if (Ground != E_BLOCK_GRASS) - { - continue; - } - BLOCKTYPE Above = GetBlock(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ); - if (Above != E_BLOCK_AIR) - { - continue; - } - BLOCKTYPE SpawnType; - NIBBLETYPE SpawnMeta = 0; - switch (r1.randInt(10)) - { - case 0: SpawnType = E_BLOCK_YELLOW_FLOWER; break; - case 1: SpawnType = E_BLOCK_RED_ROSE; break; - default: - { - SpawnType = E_BLOCK_TALL_GRASS; - SpawnMeta = E_META_TALL_GRASS_GRASS; - break; - } - } // switch (random spawn block type) - FastSetBlock(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ, SpawnType, SpawnMeta); - } // for i - 50 times - return true; - } - - case E_BLOCK_SUGARCANE: - { - if (a_IsByBonemeal && !m_IsSugarcaneBonemealable) - { - return false; - } - m_ChunkMap->GrowSugarcane(a_BlockX, a_BlockY, a_BlockZ, m_MaxSugarcaneHeight); - return true; - } - - case E_BLOCK_CACTUS: - { - if (a_IsByBonemeal && !m_IsCactusBonemealable) - { - return false; - } - m_ChunkMap->GrowCactus(a_BlockX, a_BlockY, a_BlockZ, m_MaxCactusHeight); - return true; - } - } // switch (BlockType) - return false; -} - - - - - -void cWorld::GrowCactus(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow) -{ - m_ChunkMap->GrowCactus(a_BlockX, a_BlockY, a_BlockZ, a_NumBlocksToGrow); -} - - - - - -void cWorld::GrowMelonPumpkin(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType) -{ - MTRand Rand; - m_ChunkMap->GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, Rand); -} - - - - - -void cWorld::GrowSugarcane(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow) -{ - m_ChunkMap->GrowSugarcane(a_BlockX, a_BlockY, a_BlockZ, a_NumBlocksToGrow); -} - - - - - -int cWorld::GetBiomeAt (int a_BlockX, int a_BlockZ) -{ - return m_ChunkMap->GetBiomeAt(a_BlockX, a_BlockZ); -} - - - - - -void cWorld::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - if (a_BlockType == E_BLOCK_AIR) - { - BlockHandler(GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnDestroyed(this, a_BlockX, a_BlockY, a_BlockZ); - } - m_ChunkMap->SetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); - - BlockHandler(a_BlockType)->OnPlaced(this, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); -} - - - - - -void cWorld::FastSetBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) -{ - cCSLock Lock(m_CSFastSetBlock); - m_FastSetBlockQueue.push_back(sSetBlock(a_X, a_Y, a_Z, a_BlockType, a_BlockMeta)); -} - - - - - -void cWorld::QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_TickDelay) -{ - m_ChunkMap->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, GetWorldAge() + a_TickDelay); -} - - - - - -BLOCKTYPE cWorld::GetBlock(int a_X, int a_Y, int a_Z) -{ - // First check if it isn't queued in the m_FastSetBlockQueue: - { - int X = a_X, Y = a_Y, Z = a_Z; - int ChunkX, ChunkY, ChunkZ; - AbsoluteToRelative(X, Y, Z, ChunkX, ChunkY, ChunkZ); - - cCSLock Lock(m_CSFastSetBlock); - for (sSetBlockList::iterator itr = m_FastSetBlockQueue.begin(); itr != m_FastSetBlockQueue.end(); ++itr) - { - if ((itr->x == X) && (itr->y == Y) && (itr->z == Z) && (itr->ChunkX == ChunkX) && (itr->ChunkZ == ChunkZ)) - { - return itr->BlockType; - } - } // for itr - m_FastSetBlockQueue[] - } - - return m_ChunkMap->GetBlock(a_X, a_Y, a_Z); -} - - - - - -NIBBLETYPE cWorld::GetBlockMeta(int a_X, int a_Y, int a_Z) -{ - // First check if it isn't queued in the m_FastSetBlockQueue: - { - cCSLock Lock(m_CSFastSetBlock); - for (sSetBlockList::iterator itr = m_FastSetBlockQueue.begin(); itr != m_FastSetBlockQueue.end(); ++itr) - { - if ((itr->x == a_X) && (itr->y == a_Y) && (itr->y == a_Y)) - { - return itr->BlockMeta; - } - } // for itr - m_FastSetBlockQueue[] - } - - return m_ChunkMap->GetBlockMeta(a_X, a_Y, a_Z); -} - - - - - -void cWorld::SetBlockMeta(int a_X, int a_Y, int a_Z, NIBBLETYPE a_MetaData) -{ - m_ChunkMap->SetBlockMeta(a_X, a_Y, a_Z, a_MetaData); -} - - - - - -NIBBLETYPE cWorld::GetBlockSkyLight(int a_X, int a_Y, int a_Z) -{ - return m_ChunkMap->GetBlockSkyLight(a_X, a_Y, a_Z); -} - - - - - -NIBBLETYPE cWorld::GetBlockBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - return m_ChunkMap->GetBlockBlockLight(a_BlockX, a_BlockY, a_BlockZ); -} - - - - - -bool cWorld::GetBlockTypeMeta(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) -{ - return m_ChunkMap->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, (BLOCKTYPE &)a_BlockType, (NIBBLETYPE &)a_BlockMeta); -} - - - - - -bool cWorld::GetBlockInfo(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight) -{ - return m_ChunkMap->GetBlockInfo(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_Meta, a_SkyLight, a_BlockLight); -} - - - - - -bool cWorld::WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) -{ - return m_ChunkMap->WriteBlockArea(a_Area, a_MinBlockX, a_MinBlockY, a_MinBlockZ, a_DataTypes); -} - - - - - -void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_FlyAwaySpeed, bool IsPlayerCreated) -{ - MTRand r1; - a_FlyAwaySpeed /= 1000; // Pre-divide, so that we don't have to divide each time inside the loop - for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr) - { - float SpeedX = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500)); - float SpeedY = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500)); - float SpeedZ = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500)); - - cPickup * Pickup = new cPickup( - a_BlockX, a_BlockY, a_BlockZ, - *itr, IsPlayerCreated, SpeedX, SpeedY, SpeedZ - ); - Pickup->Initialize(this); - } -} - - - - - -void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ, bool IsPlayerCreated) -{ - for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr) - { - cPickup * Pickup = new cPickup( - a_BlockX, a_BlockY, a_BlockZ, - *itr, IsPlayerCreated, (float)a_SpeedX, (float)a_SpeedY, (float)a_SpeedZ - ); - Pickup->Initialize(this); - } -} - - - - - -int cWorld::SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward) -{ - cExpOrb * ExpOrb = new cExpOrb(a_X, a_Y, a_Z, a_Reward); - ExpOrb->Initialize(this); - return ExpOrb->GetUniqueID(); -} - - - - - -void cWorld::SpawnPrimedTNT(double a_X, double a_Y, double a_Z, double a_FuseTimeInSec, double a_InitialVelocityCoeff) -{ - cTNTEntity * TNT = new cTNTEntity(a_X, a_Y, a_Z, a_FuseTimeInSec); - TNT->Initialize(this); - // TODO: Add a bit of speed in horiz and vert axes, based on the a_InitialVelocityCoeff -} - - - - - -void cWorld::ReplaceBlocks(const sSetBlockVector & a_Blocks, BLOCKTYPE a_FilterBlockType) -{ - m_ChunkMap->ReplaceBlocks(a_Blocks, a_FilterBlockType); -} - - - - - -bool cWorld::GetBlocks(sSetBlockVector & a_Blocks, bool a_ContinueOnFailure) -{ - return m_ChunkMap->GetBlocks(a_Blocks, a_ContinueOnFailure); -} - - - - - -bool cWorld::DigBlock(int a_X, int a_Y, int a_Z) -{ - cBlockHandler *Handler = cBlockHandler::GetBlockHandler(GetBlock(a_X, a_Y, a_Z)); - Handler->OnDestroyed(this, a_X, a_Y, a_Z); - return m_ChunkMap->DigBlock(a_X, a_Y, a_Z); -} - - - - - -void cWorld::SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer * a_Player) -{ - m_ChunkMap->SendBlockTo(a_X, a_Y, a_Z, a_Player); -} - - - - - -int cWorld::GetHeight(int a_X, int a_Z) -{ - return m_ChunkMap->GetHeight(a_X, a_Z); -} - - - - - -bool cWorld::TryGetHeight(int a_BlockX, int a_BlockZ, int & a_Height) -{ - return m_ChunkMap->TryGetHeight(a_BlockX, a_BlockZ, a_Height); -} - - - - - -void cWorld::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity * a_Vehicle) -{ - return m_ChunkMap->BroadcastAttachEntity(a_Entity, a_Vehicle); -} - - - - - -void cWorld::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastBlockAction(a_BlockX, a_BlockY, a_BlockZ, a_Byte1, a_Byte2, a_BlockType, a_Exclude); -} - - - - - -void cWorld::BroadcastBlockBreakAnimation(int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastBlockBreakAnimation(a_EntityID, a_BlockX, a_BlockY, a_BlockZ, a_Stage, a_Exclude); -} - - - - - -void cWorld::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Exclude); -} - - - - - -void cWorld::BroadcastChat(const AString & a_Message, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - { - cClientHandle * ch = (*itr)->GetClientHandle(); - if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) - { - continue; - } - ch->SendChat(a_Message); - } -} - - - - - -void cWorld::BroadcastChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastChunkData(a_ChunkX, a_ChunkZ, a_Serializer, a_Exclude); -} - - - - - -void cWorld::BroadcastCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastCollectPickup(a_Pickup, a_Player, a_Exclude); -} - - - - - -void cWorld::BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastDestroyEntity(a_Entity, a_Exclude); -} - - - - - -void cWorld::BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastEntityEquipment(a_Entity, a_SlotNum, a_Item, a_Exclude); -} - - - - - -void cWorld::BroadcastEntityHeadLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastEntityHeadLook(a_Entity, a_Exclude); -} - - - - - -void cWorld::BroadcastEntityLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastEntityLook(a_Entity, a_Exclude); -} - - - - - -void cWorld::BroadcastEntityMetadata(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastEntityMetadata(a_Entity, a_Exclude); -} - - - - - -void cWorld::BroadcastEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastEntityRelMove(a_Entity, a_RelX, a_RelY, a_RelZ, a_Exclude); -} - - - - - -void cWorld::BroadcastEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastEntityRelMoveLook(a_Entity, a_RelX, a_RelY, a_RelZ, a_Exclude); -} - - - - - -void cWorld::BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastEntityStatus(a_Entity, a_Status, a_Exclude); -} - - - - - -void cWorld::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastEntityVelocity(a_Entity, a_Exclude); -} - - - - -void cWorld::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastPlayerAnimation(a_Player, a_Animation, a_Exclude); -} - - - - - -void cWorld::BroadcastPlayerListItem (const cPlayer & a_Player, bool a_IsOnline, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - { - cClientHandle * ch = (*itr)->GetClientHandle(); - if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) - { - continue; - } - ch->SendPlayerListItem(a_Player, a_IsOnline); - } -} - - - - - -void cWorld::BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastSoundEffect(a_SoundName, a_SrcX, a_SrcY, a_SrcZ, a_Volume, a_Pitch, a_Exclude); -} - - - - - -void cWorld::BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastSoundParticleEffect(a_EffectID, a_SrcX, a_SrcY, a_SrcZ, a_Data, a_Exclude); -} - - - - - -void cWorld::BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastSpawnEntity(a_Entity, a_Exclude); -} - - - - - -void cWorld::BroadcastTeleportEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - { - cClientHandle * ch = (*itr)->GetClientHandle(); - if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) - { - continue; - } - ch->SendTeleportEntity(a_Entity); - } -} - - - - - -void cWorld::BroadcastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) -{ - m_ChunkMap->BroadcastThunderbolt(a_BlockX, a_BlockY, a_BlockZ, a_Exclude); -} - - - - - -void cWorld::BroadcastTimeUpdate(const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - { - cClientHandle * ch = (*itr)->GetClientHandle(); - if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) - { - continue; - } - ch->SendTimeUpdate(m_WorldAge, m_TimeOfDay); - } -} - - - - - -void cWorld::BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) -{ - m_ChunkMap->BroadcastUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ); -} - - - - - -void cWorld::BroadcastWeather(eWeather a_Weather, const cClientHandle * a_Exclude) -{ - cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - { - cClientHandle * ch = (*itr)->GetClientHandle(); - if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) - { - continue; - } - ch->SendWeather(a_Weather); - } -} - - - - - -void cWorld::SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client) -{ - m_ChunkMap->SendBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Client); -} - - - - - -void cWorld::MarkChunkDirty (int a_ChunkX, int a_ChunkZ) -{ - m_ChunkMap->MarkChunkDirty (a_ChunkX, a_ChunkZ); -} - - - - - -void cWorld::MarkChunkSaving(int a_ChunkX, int a_ChunkZ) -{ - m_ChunkMap->MarkChunkSaving(a_ChunkX, a_ChunkZ); -} - - - - - -void cWorld::MarkChunkSaved (int a_ChunkX, int a_ChunkZ) -{ - m_ChunkMap->MarkChunkSaved (a_ChunkX, a_ChunkZ); -} - - - - - -void cWorld::SetChunkData( - int a_ChunkX, int a_ChunkZ, - const BLOCKTYPE * a_BlockTypes, - const NIBBLETYPE * a_BlockMeta, - const NIBBLETYPE * a_BlockLight, - const NIBBLETYPE * a_BlockSkyLight, - const cChunkDef::HeightMap * a_HeightMap, - const cChunkDef::BiomeMap * a_BiomeMap, - cEntityList & a_Entities, - cBlockEntityList & a_BlockEntities, - bool a_MarkDirty -) -{ - // Validate biomes, if needed: - cChunkDef::BiomeMap BiomeMap; - const cChunkDef::BiomeMap * Biomes = a_BiomeMap; - if (a_BiomeMap == NULL) - { - // The biomes are not assigned, get them from the generator: - Biomes = &BiomeMap; - m_Generator.GenerateBiomes(a_ChunkX, a_ChunkZ, BiomeMap); - } - - m_ChunkMap->SetChunkData( - a_ChunkX, a_ChunkZ, - a_BlockTypes, a_BlockMeta, a_BlockLight, a_BlockSkyLight, - a_HeightMap, *Biomes, - a_BlockEntities, - a_MarkDirty - ); - - // Initialize the entities (outside the m_ChunkMap's CS, to fix FS #347): - for (cEntityList::iterator itr = a_Entities.begin(), end = a_Entities.end(); itr != end; ++itr) - { - (*itr)->Initialize(this); - } - - // If a client is requesting this chunk, send it to them: - if (m_ChunkMap->HasChunkAnyClients(a_ChunkX, a_ChunkZ)) - { - m_ChunkSender.ChunkReady(a_ChunkX, a_ChunkZ); - } - - // Notify the lighting thread that the chunk has become valid (in case it is a neighbor of a postponed chunk): - m_Lighting.ChunkReady(a_ChunkX, a_ChunkZ); -} - - - - - -void cWorld::ChunkLighted( - int a_ChunkX, int a_ChunkZ, - const cChunkDef::BlockNibbles & a_BlockLight, - const cChunkDef::BlockNibbles & a_SkyLight -) -{ - m_ChunkMap->ChunkLighted(a_ChunkX, a_ChunkZ, a_BlockLight, a_SkyLight); -} - - - - - -bool cWorld::GetChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataCallback & a_Callback) -{ - return m_ChunkMap->GetChunkData(a_ChunkX, a_ChunkZ, a_Callback); -} - - - - - -bool cWorld::GetChunkBlockTypes(int a_ChunkX, int a_ChunkZ, BLOCKTYPE * a_BlockTypes) -{ - return m_ChunkMap->GetChunkBlockTypes(a_ChunkX, a_ChunkZ, a_BlockTypes); -} - - - - - -bool cWorld::IsChunkValid(int a_ChunkX, int a_ChunkZ) const -{ - return m_ChunkMap->IsChunkValid(a_ChunkX, a_ChunkZ); -} - - - - - -bool cWorld::HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) const -{ - return m_ChunkMap->HasChunkAnyClients(a_ChunkX, a_ChunkZ); -} - - - - - -void cWorld::UnloadUnusedChunks(void) -{ - m_LastUnload = m_WorldAge; - m_ChunkMap->UnloadUnusedChunks(); -} - - - - - -void cWorld::CollectPickupsByPlayer(cPlayer * a_Player) -{ - m_ChunkMap->CollectPickupsByPlayer(a_Player); -} - - - - - -void cWorld::AddPlayer(cPlayer * a_Player) -{ - { - cCSLock Lock(m_CSPlayers); - - ASSERT(std::find(m_Players.begin(), m_Players.end(), a_Player) == m_Players.end()); // Is it already in the list? HOW? - - m_Players.remove(a_Player); // Make sure the player is registered only once - m_Players.push_back(a_Player); - } - - // Add the player's client to the list of clients to be ticked: - if (a_Player->GetClientHandle() != NULL) - { - cCSLock Lock(m_CSClients); - m_ClientsToAdd.push_back(a_Player->GetClientHandle()); - } - - // The player has already been added to the chunkmap as the entity, do NOT add again! -} - - - - - -void cWorld::RemovePlayer(cPlayer * a_Player) -{ - m_ChunkMap->RemoveEntity(a_Player); - { - cCSLock Lock(m_CSPlayers); - m_Players.remove(a_Player); - } - - // Remove the player's client from the list of clients to be ticked: - if (a_Player->GetClientHandle() != NULL) - { - cCSLock Lock(m_CSClients); - m_ClientsToRemove.push_back(a_Player->GetClientHandle()); - } -} - - - - - -bool cWorld::ForEachPlayer(cPlayerListCallback & a_Callback) -{ - // Calls the callback for each player in the list - cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(), itr2 = itr; itr != m_Players.end(); itr = itr2) - { - ++itr2; - if (a_Callback.Item(*itr)) - { - return false; - } - } // for itr - m_Players[] - return true; -} - - - - - -bool cWorld::DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback) -{ - // Calls the callback for each player in the list - cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - { - if (NoCaseCompare((*itr)->GetName(), a_PlayerName) == 0) - { - a_Callback.Item(*itr); - return true; - } - } // for itr - m_Players[] - return false; -} - - - - - -bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCallback & a_Callback) -{ - cPlayer * BestMatch = NULL; - unsigned int BestRating = 0; - unsigned int NameLength = a_PlayerNameHint.length(); - - cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - { - unsigned int Rating = RateCompareString (a_PlayerNameHint, (*itr)->GetName()); - if (Rating >= BestRating) - { - BestMatch = *itr; - BestRating = Rating; - } - if (Rating == NameLength) // Perfect match - { - break; - } - } // for itr - m_Players[] - - if (BestMatch != NULL) - { - LOG("Compared %s and %s with rating %i", a_PlayerNameHint.c_str(), BestMatch->GetName().c_str(), BestRating); - return a_Callback.Item (BestMatch); - } - return false; -} - - - - - -// TODO: This interface is dangerous! -cPlayer * cWorld::FindClosestPlayer(const Vector3f & a_Pos, float a_SightLimit) -{ - cTracer LineOfSight(this); - - float ClosestDistance = a_SightLimit; - cPlayer* ClosestPlayer = NULL; - - cCSLock Lock(m_CSPlayers); - for (cPlayerList::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - { - Vector3f Pos = (*itr)->GetPosition(); - float Distance = (Pos - a_Pos).Length(); - - if (Distance < ClosestDistance) - { - if (!LineOfSight.Trace(a_Pos,(Pos - a_Pos),(int)(Pos - a_Pos).Length())) - { - ClosestDistance = Distance; - ClosestPlayer = *itr; - } - } - } - return ClosestPlayer; -} - - - - - -void cWorld::SendPlayerList(cPlayer * a_DestPlayer) -{ - // Sends the playerlist to a_DestPlayer - cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - { - cClientHandle * ch = (*itr)->GetClientHandle(); - if ((ch != NULL) && !ch->IsDestroyed()) - { - a_DestPlayer->GetClientHandle()->SendPlayerListItem(*(*itr), true); - } - } -} - - - - - -bool cWorld::ForEachEntity(cEntityCallback & a_Callback) -{ - return m_ChunkMap->ForEachEntity(a_Callback); -} - - - - - -bool cWorld::ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, cEntityCallback & a_Callback) -{ - return m_ChunkMap->ForEachEntityInChunk(a_ChunkX, a_ChunkZ, a_Callback); -} - - - - - -bool cWorld::DoWithEntityByID(int a_UniqueID, cEntityCallback & a_Callback) -{ - return m_ChunkMap->DoWithEntityByID(a_UniqueID, a_Callback); -} - - - - - -void cWorld::CompareChunkClients(int a_ChunkX1, int a_ChunkZ1, int a_ChunkX2, int a_ChunkZ2, cClientDiffCallback & a_Callback) -{ - m_ChunkMap->CompareChunkClients(a_ChunkX1, a_ChunkZ1, a_ChunkX2, a_ChunkZ2, a_Callback); -} - - - - - -bool cWorld::AddChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) -{ - return m_ChunkMap->AddChunkClient(a_ChunkX, a_ChunkZ, a_Client); -} - - - - - -void cWorld::RemoveChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) -{ - m_ChunkMap->RemoveChunkClient(a_ChunkX, a_ChunkZ, a_Client); -} - - - - - -void cWorld::RemoveClientFromChunks(cClientHandle * a_Client) -{ - m_ChunkMap->RemoveClientFromChunks(a_Client); -} - - - - - -void cWorld::SendChunkTo(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) -{ - m_ChunkSender.QueueSendChunkTo(a_ChunkX, a_ChunkZ, a_Client); -} - - - - - -void cWorld::RemoveClientFromChunkSender(cClientHandle * a_Client) -{ - m_ChunkSender.RemoveClient(a_Client); -} - - - - - -void cWorld::TouchChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) -{ - m_ChunkMap->TouchChunk(a_ChunkX, a_ChunkY, a_ChunkZ); -} - - - - - -bool cWorld::LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) -{ - return m_ChunkMap->LoadChunk(a_ChunkX, a_ChunkY, a_ChunkZ); -} - - - - - -void cWorld::LoadChunks(const cChunkCoordsList & a_Chunks) -{ - m_ChunkMap->LoadChunks(a_Chunks); -} - - - - - -void cWorld::ChunkLoadFailed(int a_ChunkX, int a_ChunkY, int a_ChunkZ) -{ - m_ChunkMap->ChunkLoadFailed(a_ChunkX, a_ChunkY, a_ChunkZ); -} - - - - - -bool cWorld::SetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) -{ - AString Line1(a_Line1); - AString Line2(a_Line2); - AString Line3(a_Line3); - AString Line4(a_Line4); - if (cRoot::Get()->GetPluginManager()->CallHookUpdatingSign(this, a_BlockX, a_BlockY, a_BlockZ, Line1, Line2, Line3, Line4, a_Player)) - { - return false; - } - if (m_ChunkMap->SetSignLines(a_BlockX, a_BlockY, a_BlockZ, Line1, Line2, Line3, Line4)) - { - cRoot::Get()->GetPluginManager()->CallHookUpdatedSign(this, a_BlockX, a_BlockY, a_BlockZ, Line1, Line2, Line3, Line4, a_Player); - return true; - } - return false; -} - - - - - -bool cWorld::UpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) -{ - return SetSignLines(a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, a_Player); -} - - - - - -void cWorld::ChunksStay(const cChunkCoordsList & a_Chunks, bool a_Stay) -{ - m_ChunkMap->ChunksStay(a_Chunks, a_Stay); -} - - - - - -void cWorld::RegenerateChunk(int a_ChunkX, int a_ChunkZ) -{ - m_ChunkMap->MarkChunkRegenerating(a_ChunkX, a_ChunkZ); - - // Trick: use Y=1 to force the chunk generation even though the chunk data is already present - m_Generator.QueueGenerateChunk(a_ChunkX, 1, a_ChunkZ); -} - - - - - -void cWorld::GenerateChunk(int a_ChunkX, int a_ChunkZ) -{ - m_Generator.QueueGenerateChunk(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); -} - - - - - -void cWorld::QueueLightChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback) -{ - m_Lighting.QueueChunk(a_ChunkX, a_ChunkZ, a_Callback); -} - - - - - -bool cWorld::IsChunkLighted(int a_ChunkX, int a_ChunkZ) -{ - return m_ChunkMap->IsChunkLighted(a_ChunkX, a_ChunkZ); -} - - - - - -bool cWorld::ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) -{ - return m_ChunkMap->ForEachChunkInRect(a_MinChunkX, a_MaxChunkX, a_MinChunkZ, a_MaxChunkZ, a_Callback); -} - - - - - -void cWorld::SaveAllChunks(void) -{ - LOGINFO("Saving all chunks..."); - m_LastSave = m_WorldAge; - m_ChunkMap->SaveAllChunks(); - m_Storage.QueueSavedMessage(); -} - - - - - -void cWorld::QueueSaveAllChunks(void) -{ - QueueTask(new cWorld::cTaskSaveAllChunks); -} - - - - - -void cWorld::QueueTask(cTask * a_Task) -{ - cCSLock Lock(m_CSTasks); - m_Tasks.push_back(a_Task); -} - - - - - -void cWorld::AddEntity(cEntity * a_Entity) -{ - m_ChunkMap->AddEntity(a_Entity); -} - - - - - -bool cWorld::HasEntity(int a_UniqueID) -{ - return m_ChunkMap->HasEntity(a_UniqueID); -} - - - - - -void cWorld::RemoveEntity(cEntity * a_Entity) -{ - m_ChunkMap->RemoveEntity(a_Entity); -} - - - - - -/* -unsigned int cWorld::GetNumPlayers(void) -{ - cCSLock Lock(m_CSPlayers); - return m_Players.size(); -} -*/ - - - - - -int cWorld::GetNumChunks(void) const -{ - return m_ChunkMap->GetNumChunks(); -} - - - - - -void cWorld::GetChunkStats(int & a_NumValid, int & a_NumDirty, int & a_NumInLightingQueue) -{ - m_ChunkMap->GetChunkStats(a_NumValid, a_NumDirty); - a_NumInLightingQueue = (int) m_Lighting.GetQueueLength(); -} - - - - - -void cWorld::TickQueuedBlocks(void) -{ - if (m_BlockTickQueue.empty()) - { - return; - } - m_BlockTickQueueCopy.clear(); - m_BlockTickQueue.swap(m_BlockTickQueueCopy); - - for (std::vector<BlockTickQueueItem *>::iterator itr = m_BlockTickQueueCopy.begin(); itr != m_BlockTickQueueCopy.end(); itr++) - { - BlockTickQueueItem *Block = (*itr); - Block->TicksToWait -= 1; - if (Block->TicksToWait <= 0) - { - // TODO: Handle the case when the chunk is already unloaded - BlockHandler(GetBlock(Block->X, Block->Y, Block->Z))->OnUpdate(this, Block->X, Block->Y, Block->Z); - delete Block; // We don't have to remove it from the vector, this will happen automatically on the next tick - } - else - { - m_BlockTickQueue.push_back(Block); // Keep the block in the queue - } - } // for itr - m_BlockTickQueueCopy[] -} - - - - - -void cWorld::QueueBlockForTick(int a_BlockX, int a_BlockY, int a_BlockZ, int a_TicksToWait) -{ - BlockTickQueueItem * Block = new BlockTickQueueItem; - Block->X = a_BlockX; - Block->Y = a_BlockY; - Block->Z = a_BlockZ; - Block->TicksToWait = a_TicksToWait; - - m_BlockTickQueue.push_back(Block); -} - - - - - -bool cWorld::IsBlockDirectlyWatered(int a_BlockX, int a_BlockY, int a_BlockZ) -{ - return ( - IsBlockWater(GetBlock(a_BlockX - 1, a_BlockY, a_BlockZ)) || - IsBlockWater(GetBlock(a_BlockX + 1, a_BlockY, a_BlockZ)) || - IsBlockWater(GetBlock(a_BlockX, a_BlockY, a_BlockZ - 1)) || - IsBlockWater(GetBlock(a_BlockX, a_BlockY, a_BlockZ + 1)) - ); -} - - - - - -int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType) -{ - cMonster * Monster = NULL; - - Monster = cMonster::NewMonsterFromType(a_MonsterType); - if (Monster != NULL) - { - Monster->SetPosition(a_PosX, a_PosY, a_PosZ); - } - - // Because it's logical that ALL mob spawns need spawn effects, not just spawners - BroadcastSoundParticleEffect(2004, (int)a_PosX, (int)a_PosY, (int)a_PosZ, 0); - - return SpawnMobFinalize(Monster); -} - - - - -int cWorld::SpawnMobFinalize(cMonster * a_Monster) -{ - if (!a_Monster) - return -1; - a_Monster->SetHealth(a_Monster->GetMaxHealth()); - if (cPluginManager::Get()->CallHookSpawningMonster(*this, *a_Monster)) - { - delete a_Monster; - return -1; - } - if (!a_Monster->Initialize(this)) - { - delete a_Monster; - return -1; - } - BroadcastSpawnEntity(*a_Monster); - cPluginManager::Get()->CallHookSpawnedMonster(*this, *a_Monster); - - return a_Monster->GetUniqueID(); -} - - - - - -int cWorld::CreateProjectile(double a_PosX, double a_PosY, double a_PosZ, cProjectileEntity::eKind a_Kind, cEntity * a_Creator, const Vector3d * a_Speed) -{ - cProjectileEntity * Projectile = cProjectileEntity::Create(a_Kind, a_Creator, a_PosX, a_PosY, a_PosZ, a_Speed); - if (Projectile == NULL) - { - return -1; - } - if (!Projectile->Initialize(this)) - { - delete Projectile; - return -1; - } - BroadcastSpawnEntity(*Projectile); - return Projectile->GetUniqueID(); -} - - - - - -void cWorld::TabCompleteUserName(const AString & a_Text, AStringVector & a_Results) -{ - cCSLock Lock(m_CSPlayers); - for (cPlayerList::iterator itr = m_Players.begin(), end = m_Players.end(); itr != end; ++itr) - { - size_t LastSpace = a_Text.find_last_of(" "); //Find the position of the last space - - std::string LastWord = a_Text.substr(LastSpace + 1, a_Text.length()); //Find the last word - std::string PlayerName ((*itr)->GetName()); - std::size_t Found = PlayerName.find(LastWord); //Try to find last word in playername - - if (Found!=0) - { - continue; //No match - } - - a_Results.push_back((*itr)->GetName()); //Match! - } -} - - - - - -cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const char * a_FluidName, BLOCKTYPE a_SimulateBlock, BLOCKTYPE a_StationaryBlock) -{ - AString SimulatorNameKey; - Printf(SimulatorNameKey, "%sSimulator", a_FluidName); - AString SimulatorSectionName; - Printf(SimulatorSectionName, "%sSimulator", a_FluidName); - AString SimulatorName = a_IniFile.GetValueSet("Physics", SimulatorNameKey, ""); - if (SimulatorName.empty()) - { - LOGWARNING("[Physics] %s not present or empty in %s, using the default of \"Floody\".", SimulatorNameKey.c_str(), GetIniFileName().c_str()); - SimulatorName = "Floody"; - } - - cFluidSimulator * res = NULL; - bool IsWater = (strcmp(a_FluidName, "Water") == 0); // Used for defaults - int Rate = 1; - if ( - (NoCaseCompare(SimulatorName, "vaporize") == 0) || - (NoCaseCompare(SimulatorName, "vaporise") == 0) - ) - { - res = new cVaporizeFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock); - } - else if ( - (NoCaseCompare(SimulatorName, "noop") == 0) || - (NoCaseCompare(SimulatorName, "nop") == 0) || - (NoCaseCompare(SimulatorName, "null") == 0) || - (NoCaseCompare(SimulatorName, "nil") == 0) - ) - { - res = new cNoopFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock); - } - else - { - if (NoCaseCompare(SimulatorName, "floody") != 0) - { - // The simulator name doesn't match anything we have, issue a warning: - LOGWARNING("%s [Physics]:%s specifies an unknown simulator, using the default \"Floody\".", GetIniFileName().c_str(), SimulatorNameKey.c_str()); - } - int Falloff = a_IniFile.GetValueSetI(SimulatorSectionName, "Falloff", IsWater ? 1 : 2); - int TickDelay = a_IniFile.GetValueSetI(SimulatorSectionName, "TickDelay", IsWater ? 5 : 30); - int NumNeighborsForSource = a_IniFile.GetValueSetI(SimulatorSectionName, "NumNeighborsForSource", IsWater ? 2 : -1); - res = new cFloodyFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, Falloff, TickDelay, NumNeighborsForSource); - } - - m_SimulatorManager->RegisterSimulator(res, Rate); - - return res; -} - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cWorld::cTaskSaveAllChunks: - -void cWorld::cTaskSaveAllChunks::Run(cWorld & a_World) -{ - a_World.SaveAllChunks(); -} - - - - - diff --git a/source/WorldStorage/WSSAnvil.cpp b/source/WorldStorage/WSSAnvil.cpp deleted file mode 100644 index b2e104a78..000000000 --- a/source/WorldStorage/WSSAnvil.cpp +++ /dev/null @@ -1,1555 +0,0 @@ - -// WSSAnvil.cpp - -// Implements the cWSSAnvil class representing the Anvil world storage scheme - -#include "Globals.h" -#include "WSSAnvil.h" -#include "NBTChunkSerializer.h" -#include "../World.h" -#include "zlib.h" -#include "../BlockID.h" -#include "../BlockEntities/ChestEntity.h" -#include "../BlockEntities/DispenserEntity.h" -#include "../BlockEntities/DropperEntity.h" -#include "../BlockEntities/FurnaceEntity.h" -#include "../BlockEntities/HopperEntity.h" -#include "../BlockEntities/JukeboxEntity.h" -#include "../BlockEntities/NoteEntity.h" -#include "../BlockEntities/SignEntity.h" -#include "../Item.h" -#include "../ItemGrid.h" -#include "../StringCompression.h" -#include "FastNBT.h" -#include "../Mobs/Monster.h" -#include "../Entities/Boat.h" -#include "../Entities/FallingBlock.h" -#include "../Entities/Minecart.h" -#include "../Entities/Pickup.h" -#include "../Entities/ProjectileEntity.h" - - - - - -/** If defined, the BlockSkyLight values will be copied over to BlockLight upon chunk saving, -thus making skylight visible in Minutor's Lighting mode -*/ -// #define DEBUG_SKYLIGHT - -/** Maximum number of MCA files that are cached in memory. -Since only the header is actually in the memory, this number can be high, but still, each file means an OS FS handle. -*/ -#define MAX_MCA_FILES 32 - -/// The maximum size of an inflated chunk; raw chunk data is 192 KiB, allow 64 KiB more of entities -#define CHUNK_INFLATE_MAX 256 KiB - - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cWSSAnvil: - -cWSSAnvil::cWSSAnvil(cWorld * a_World) : - super(a_World) -{ - // Create a level.dat file for mapping tools, if it doesn't already exist: - AString fnam; - Printf(fnam, "%s/level.dat", a_World->GetName().c_str()); - if (!cFile::Exists(fnam)) - { - cFastNBTWriter Writer; - Writer.BeginCompound(""); - Writer.AddInt("SpawnX", (int)(a_World->GetSpawnX())); - Writer.AddInt("SpawnY", (int)(a_World->GetSpawnY())); - Writer.AddInt("SpawnZ", (int)(a_World->GetSpawnZ())); - Writer.EndCompound(); - Writer.Finish(); - - #ifdef _DEBUG - cParsedNBT TestParse(Writer.GetResult().data(), Writer.GetResult().size()); - ASSERT(TestParse.IsValid()); - #endif // _DEBUG - - gzFile gz = gzopen((FILE_IO_PREFIX + fnam).c_str(), "wb"); - if (gz != NULL) - { - gzwrite(gz, Writer.GetResult().data(), Writer.GetResult().size()); - } - gzclose(gz); - } -} - - - - - -cWSSAnvil::~cWSSAnvil() -{ - cCSLock Lock(m_CS); - for (cMCAFiles::iterator itr = m_Files.begin(); itr != m_Files.end(); ++itr) - { - delete *itr; - } // for itr - m_Files[] -} - - - - - -bool cWSSAnvil::LoadChunk(const cChunkCoords & a_Chunk) -{ - AString ChunkData; - if (!GetChunkData(a_Chunk, ChunkData)) - { - // The reason for failure is already printed in GetChunkData() - return false; - } - - return LoadChunkFromData(a_Chunk, ChunkData); -} - - - - - -bool cWSSAnvil::SaveChunk(const cChunkCoords & a_Chunk) -{ - AString ChunkData; - if (!SaveChunkToData(a_Chunk, ChunkData)) - { - LOGWARNING("Cannot serialize chunk [%d, %d] into data", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ); - return false; - } - if (!SetChunkData(a_Chunk, ChunkData)) - { - LOGWARNING("Cannot store chunk [%d, %d] data", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ); - return false; - } - - // Everything successful - return true; -} - - - - - -bool cWSSAnvil::GetChunkData(const cChunkCoords & a_Chunk, AString & a_Data) -{ - cCSLock Lock(m_CS); - cMCAFile * File = LoadMCAFile(a_Chunk); - if (File == NULL) - { - return false; - } - return File->GetChunkData(a_Chunk, a_Data); -} - - - - - -bool cWSSAnvil::SetChunkData(const cChunkCoords & a_Chunk, const AString & a_Data) -{ - cCSLock Lock(m_CS); - cMCAFile * File = LoadMCAFile(a_Chunk); - if (File == NULL) - { - return false; - } - return File->SetChunkData(a_Chunk, a_Data); -} - - - - - -cWSSAnvil::cMCAFile * cWSSAnvil::LoadMCAFile(const cChunkCoords & a_Chunk) -{ - // ASSUME m_CS is locked - ASSERT(m_CS.IsLocked()); - - const int RegionX = FAST_FLOOR_DIV(a_Chunk.m_ChunkX, 32); - const int RegionZ = FAST_FLOOR_DIV(a_Chunk.m_ChunkZ, 32); - ASSERT(a_Chunk.m_ChunkX - RegionX * 32 >= 0); - ASSERT(a_Chunk.m_ChunkZ - RegionZ * 32 >= 0); - ASSERT(a_Chunk.m_ChunkX - RegionX * 32 < 32); - ASSERT(a_Chunk.m_ChunkZ - RegionZ * 32 < 32); - - // Is it already cached? - for (cMCAFiles::iterator itr = m_Files.begin(); itr != m_Files.end(); ++itr) - { - if (((*itr) != NULL) && ((*itr)->GetRegionX() == RegionX) && ((*itr)->GetRegionZ() == RegionZ)) - { - // Move the file to front and return it: - cMCAFile * f = *itr; - if (itr != m_Files.begin()) - { - m_Files.erase(itr); - m_Files.push_front(f); - } - return f; - } - } - - // Load it anew: - AString FileName; - Printf(FileName, "%s/region", m_World->GetName().c_str()); - cFile::CreateFolder(FILE_IO_PREFIX + FileName); - AppendPrintf(FileName, "/r.%d.%d.mca", RegionX, RegionZ); - cMCAFile * f = new cMCAFile(FileName, RegionX, RegionZ); - if (f == NULL) - { - return NULL; - } - m_Files.push_front(f); - - // If there are too many MCA files cached, delete the last one used: - if (m_Files.size() > MAX_MCA_FILES) - { - delete m_Files.back(); - m_Files.pop_back(); - } - return f; -} - - - - - -bool cWSSAnvil::LoadChunkFromData(const cChunkCoords & a_Chunk, const AString & a_Data) -{ - // Decompress the data: - char Uncompressed[CHUNK_INFLATE_MAX]; - z_stream strm; - strm.zalloc = (alloc_func)NULL; - strm.zfree = (free_func)NULL; - strm.opaque = NULL; - inflateInit(&strm); - strm.next_out = (Bytef *)Uncompressed; - strm.avail_out = sizeof(Uncompressed); - strm.next_in = (Bytef *)a_Data.data(); - strm.avail_in = a_Data.size(); - int res = inflate(&strm, Z_FINISH); - inflateEnd(&strm); - if (res != Z_STREAM_END) - { - return false; - } - - // Parse the NBT data: - cParsedNBT NBT(Uncompressed, strm.total_out); - if (!NBT.IsValid()) - { - // NBT Parsing failed - return false; - } - - // Load the data from NBT: - return LoadChunkFromNBT(a_Chunk, NBT); -} - - - - - -bool cWSSAnvil::SaveChunkToData(const cChunkCoords & a_Chunk, AString & a_Data) -{ - cFastNBTWriter Writer; - if (!SaveChunkToNBT(a_Chunk, Writer)) - { - LOGWARNING("Cannot save chunk [%d, %d] to NBT", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ); - return false; - } - Writer.Finish(); - - CompressString(Writer.GetResult().data(), Writer.GetResult().size(), a_Data); - return true; -} - - - - - -bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, const cParsedNBT & a_NBT) -{ - // The data arrays, in MCA-native y/z/x ordering (will be reordered for the final chunk data) - cChunkDef::BlockTypes BlockTypes; - cChunkDef::BlockNibbles MetaData; - cChunkDef::BlockNibbles BlockLight; - cChunkDef::BlockNibbles SkyLight; - - memset(BlockTypes, E_BLOCK_AIR, sizeof(BlockTypes)); - memset(MetaData, 0, sizeof(MetaData)); - memset(SkyLight, 0xff, sizeof(SkyLight)); // By default, data not present in the NBT means air, which means full skylight - memset(BlockLight, 0x00, sizeof(BlockLight)); - - // Load the blockdata, blocklight and skylight: - int Level = a_NBT.FindChildByName(0, "Level"); - if (Level < 0) - { - return false; - } - int Sections = a_NBT.FindChildByName(Level, "Sections"); - if ((Sections < 0) || (a_NBT.GetType(Sections) != TAG_List) || (a_NBT.GetChildrenType(Sections) != TAG_Compound)) - { - return false; - } - for (int Child = a_NBT.GetFirstChild(Sections); Child >= 0; Child = a_NBT.GetNextSibling(Child)) - { - int y = 0; - int SectionY = a_NBT.FindChildByName(Child, "Y"); - if ((SectionY < 0) || (a_NBT.GetType(SectionY) != TAG_Byte)) - { - continue; - } - y = a_NBT.GetByte(SectionY); - if ((y < 0) || (y > 15)) - { - continue; - } - CopyNBTData(a_NBT, Child, "Blocks", (char *)&(BlockTypes[y * 4096]), 4096); - CopyNBTData(a_NBT, Child, "Data", (char *)&(MetaData[y * 2048]), 2048); - CopyNBTData(a_NBT, Child, "SkyLight", (char *)&(SkyLight[y * 2048]), 2048); - CopyNBTData(a_NBT, Child, "BlockLight", (char *)&(BlockLight[y * 2048]), 2048); - } // for itr - LevelSections[] - - // Load the biomes from NBT, if present and valid. First try MCS-style, then Vanilla-style: - cChunkDef::BiomeMap BiomeMap; - cChunkDef::BiomeMap * Biomes = LoadBiomeMapFromNBT(&BiomeMap, a_NBT, a_NBT.FindChildByName(Level, "MCSBiomes")); - if (Biomes == NULL) - { - // MCS-style biomes not available, load vanilla-style: - Biomes = LoadVanillaBiomeMapFromNBT(&BiomeMap, a_NBT, a_NBT.FindChildByName(Level, "Biomes")); - } - - // Load the entities from NBT: - cEntityList Entities; - cBlockEntityList BlockEntities; - LoadEntitiesFromNBT (Entities, a_NBT, a_NBT.FindChildByName(Level, "Entities")); - LoadBlockEntitiesFromNBT(BlockEntities, a_NBT, a_NBT.FindChildByName(Level, "TileEntities"), BlockTypes, MetaData); - - bool IsLightValid = (a_NBT.FindChildByName(Level, "MCSIsLightValid") > 0); - - /* - // Uncomment this block for really cool stuff :) - // DEBUG magic: Invert the underground, so that we can see the MC generator in action :) - bool ShouldInvert[cChunkDef::Width * cChunkDef::Width]; - memset(ShouldInvert, 0, sizeof(ShouldInvert)); - for (int y = cChunkDef::Height - 1; y >= 0; y--) - { - for (int x = 0; x < cChunkDef::Width; x++) for (int z = 0; z < cChunkDef::Width; z++) - { - int Index = cChunkDef::MakeIndexNoCheck(x, y, z); - if (ShouldInvert[x + cChunkDef::Width * z]) - { - BlockTypes[Index] = (BlockTypes[Index] == E_BLOCK_AIR) ? E_BLOCK_STONE : E_BLOCK_AIR; - } - else - { - switch (BlockTypes[Index]) - { - case E_BLOCK_AIR: - case E_BLOCK_LEAVES: - { - // nothing needed - break; - } - default: - { - ShouldInvert[x + cChunkDef::Width * z] = true; - } - } - BlockTypes[Index] = E_BLOCK_AIR; - } - } - } // for y - //*/ - - m_World->SetChunkData( - a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, - BlockTypes, MetaData, - IsLightValid ? BlockLight : NULL, - IsLightValid ? SkyLight : NULL, - NULL, Biomes, - Entities, BlockEntities, - false - ); - return true; -} - - - - -void cWSSAnvil::CopyNBTData(const cParsedNBT & a_NBT, int a_Tag, const AString & a_ChildName, char * a_Destination, int a_Length) -{ - int Child = a_NBT.FindChildByName(a_Tag, a_ChildName); - if ((Child >= 0) && (a_NBT.GetType(Child) == TAG_ByteArray) && (a_NBT.GetDataLength(Child) == a_Length)) - { - memcpy(a_Destination, a_NBT.GetData(Child), a_Length); - } -} - - - - - -bool cWSSAnvil::SaveChunkToNBT(const cChunkCoords & a_Chunk, cFastNBTWriter & a_Writer) -{ - a_Writer.BeginCompound("Level"); - a_Writer.AddInt("xPos", a_Chunk.m_ChunkX); - a_Writer.AddInt("zPos", a_Chunk.m_ChunkZ); - cNBTChunkSerializer Serializer(a_Writer); - if (!m_World->GetChunkData(a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, Serializer)) - { - LOGWARNING("Cannot get chunk [%d, %d] data for NBT saving", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ); - return false; - } - Serializer.Finish(); // Close NBT tags - - // Save biomes, both MCS (IntArray) and MC-vanilla (ByteArray): - if (Serializer.m_BiomesAreValid) - { - a_Writer.AddByteArray("Biomes", (const char *)(Serializer.m_VanillaBiomes), ARRAYCOUNT(Serializer.m_VanillaBiomes)); - a_Writer.AddIntArray ("MCSBiomes", (const int *)(Serializer.m_Biomes), ARRAYCOUNT(Serializer.m_Biomes)); - } - - // Save blockdata: - a_Writer.BeginList("Sections", TAG_Compound); - int SliceSizeBlock = cChunkDef::Width * cChunkDef::Width * 16; - int SliceSizeNibble = SliceSizeBlock / 2; - const char * BlockTypes = (const char *)(Serializer.m_BlockTypes); - const char * BlockMetas = (const char *)(Serializer.m_BlockMetas); - #ifdef DEBUG_SKYLIGHT - const char * BlockLight = (const char *)(Serializer.m_BlockSkyLight); - #else - const char * BlockLight = (const char *)(Serializer.m_BlockLight); - #endif - const char * BlockSkyLight = (const char *)(Serializer.m_BlockSkyLight); - for (int Y = 0; Y < 16; Y++) - { - a_Writer.BeginCompound(""); - a_Writer.AddByteArray("Blocks", BlockTypes + Y * SliceSizeBlock, SliceSizeBlock); - a_Writer.AddByteArray("Data", BlockMetas + Y * SliceSizeNibble, SliceSizeNibble); - a_Writer.AddByteArray("SkyLight", BlockSkyLight + Y * SliceSizeNibble, SliceSizeNibble); - a_Writer.AddByteArray("BlockLight", BlockLight + Y * SliceSizeNibble, SliceSizeNibble); - a_Writer.AddByte("Y", (unsigned char)Y); - a_Writer.EndCompound(); - } - a_Writer.EndList(); // "Sections" - - // Store the information that the lighting is valid. - // For compatibility reason, the default is "invalid" (missing) - this means older data is re-lighted upon loading. - if (Serializer.IsLightValid()) - { - a_Writer.AddByte("MCSIsLightValid", 1); - } - - a_Writer.EndCompound(); // "Level" - return true; -} - - - - - -cChunkDef::BiomeMap * cWSSAnvil::LoadVanillaBiomeMapFromNBT(cChunkDef::BiomeMap * a_BiomeMap, const cParsedNBT & a_NBT, int a_TagIdx) -{ - if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_ByteArray)) - { - return NULL; - } - if (a_NBT.GetDataLength(a_TagIdx) != 16 * 16) - { - // The biomes stored don't match in size - return NULL; - } - const unsigned char * VanillaBiomeData = (const unsigned char *)(a_NBT.GetData(a_TagIdx)); - for (int i = 0; i < ARRAYCOUNT(*a_BiomeMap); i++) - { - if ((VanillaBiomeData)[i] == 0xff) - { - // Unassigned biomes - return NULL; - } - (*a_BiomeMap)[i] = (EMCSBiome)(VanillaBiomeData[i]); - } - return a_BiomeMap; -} - - - - - -cChunkDef::BiomeMap * cWSSAnvil::LoadBiomeMapFromNBT(cChunkDef::BiomeMap * a_BiomeMap, const cParsedNBT & a_NBT, int a_TagIdx) -{ - if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_IntArray)) - { - return NULL; - } - if (a_NBT.GetDataLength(a_TagIdx) != sizeof(*a_BiomeMap)) - { - // The biomes stored don't match in size - return NULL; - } - const int * BiomeData = (const int *)(a_NBT.GetData(a_TagIdx)); - for (int i = 0; i < ARRAYCOUNT(*a_BiomeMap); i++) - { - (*a_BiomeMap)[i] = (EMCSBiome)(ntohl(BiomeData[i])); - if ((*a_BiomeMap)[i] == 0xff) - { - // Unassigned biomes - return NULL; - } - } - return a_BiomeMap; -} - - - - - -void cWSSAnvil::LoadEntitiesFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_List)) - { - return; - } - - for (int Child = a_NBT.GetFirstChild(a_TagIdx); Child != -1; Child = a_NBT.GetNextSibling(Child)) - { - if (a_NBT.GetType(Child) != TAG_Compound) - { - continue; - } - int sID = a_NBT.FindChildByName(Child, "id"); - if (sID < 0) - { - continue; - } - LoadEntityFromNBT(a_Entities, a_NBT, Child, a_NBT.GetData(sID), a_NBT.GetDataLength(sID)); - } // for Child - a_NBT[] -} - - - - - -void cWSSAnvil::LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE * a_BlockTypes, NIBBLETYPE * a_BlockMetas) -{ - if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_List)) - { - return; - } - - for (int Child = a_NBT.GetFirstChild(a_TagIdx); Child != -1; Child = a_NBT.GetNextSibling(Child)) - { - if (a_NBT.GetType(Child) != TAG_Compound) - { - continue; - } - int sID = a_NBT.FindChildByName(Child, "id"); - if (sID < 0) - { - continue; - } - if (strncmp(a_NBT.GetData(sID), "Chest", a_NBT.GetDataLength(sID)) == 0) - { - LoadChestFromNBT(a_BlockEntities, a_NBT, Child); - } - else if (strncmp(a_NBT.GetData(sID), "Dropper", a_NBT.GetDataLength(sID)) == 0) - { - LoadDropperFromNBT(a_BlockEntities, a_NBT, Child); - } - else if (strncmp(a_NBT.GetData(sID), "Furnace", a_NBT.GetDataLength(sID)) == 0) - { - LoadFurnaceFromNBT(a_BlockEntities, a_NBT, Child, a_BlockTypes, a_BlockMetas); - } - else if (strncmp(a_NBT.GetData(sID), "Hopper", a_NBT.GetDataLength(sID)) == 0) - { - LoadHopperFromNBT(a_BlockEntities, a_NBT, Child); - } - else if (strncmp(a_NBT.GetData(sID), "Music", a_NBT.GetDataLength(sID)) == 0) - { - LoadNoteFromNBT(a_BlockEntities, a_NBT, Child); - } - else if (strncmp(a_NBT.GetData(sID), "RecordPlayer", a_NBT.GetDataLength(sID)) == 0) - { - LoadJukeboxFromNBT(a_BlockEntities, a_NBT, Child); - } - else if (strncmp(a_NBT.GetData(sID), "Sign", a_NBT.GetDataLength(sID)) == 0) - { - LoadSignFromNBT(a_BlockEntities, a_NBT, Child); - } - else if (strncmp(a_NBT.GetData(sID), "Trap", a_NBT.GetDataLength(sID)) == 0) - { - LoadDispenserFromNBT(a_BlockEntities, a_NBT, Child); - } - // TODO: Other block entities - } // for Child - tag children -} - - - - - -bool cWSSAnvil::LoadItemFromNBT(cItem & a_Item, const cParsedNBT & a_NBT, int a_TagIdx) -{ - int ID = a_NBT.FindChildByName(a_TagIdx, "id"); - if ((ID < 0) || (a_NBT.GetType(ID) != TAG_Short)) - { - return false; - } - a_Item.m_ItemType = (ENUM_ITEM_ID)(a_NBT.GetShort(ID)); - - int Damage = a_NBT.FindChildByName(a_TagIdx, "Damage"); - if ((Damage < 0) || (a_NBT.GetType(Damage) != TAG_Short)) - { - return false; - } - a_Item.m_ItemDamage = a_NBT.GetShort(Damage); - - int Count = a_NBT.FindChildByName(a_TagIdx, "Count"); - if ((Count < 0) || (a_NBT.GetType(Count) != TAG_Byte)) - { - return false; - } - a_Item.m_ItemCount = a_NBT.GetByte(Count); - - // Find the "tag" tag, used for enchantments and other extra data - int TagTag = a_NBT.FindChildByName(a_TagIdx, "tag"); - if (TagTag <= 0) - { - // No extra data - return true; - } - - // Load enchantments: - const char * EnchName = (a_Item.m_ItemType == E_ITEM_BOOK) ? "StoredEnchantments" : "ench"; - int EnchTag = a_NBT.FindChildByName(TagTag, EnchName); - if (EnchTag > 0) - { - a_Item.m_Enchantments.ParseFromNBT(a_NBT, EnchTag); - } - - return true; -} - - - - - -void cWSSAnvil::LoadItemGridFromNBT(cItemGrid & a_ItemGrid, const cParsedNBT & a_NBT, int a_ItemsTagIdx, int a_SlotOffset) -{ - int NumSlots = a_ItemGrid.GetNumSlots(); - for (int Child = a_NBT.GetFirstChild(a_ItemsTagIdx); Child != -1; Child = a_NBT.GetNextSibling(Child)) - { - int SlotTag = a_NBT.FindChildByName(Child, "Slot"); - if ((SlotTag < 0) || (a_NBT.GetType(SlotTag) != TAG_Byte)) - { - continue; - } - int SlotNum = (int)(a_NBT.GetByte(SlotTag)) - a_SlotOffset; - if ((SlotNum < 0) || (SlotNum >= NumSlots)) - { - // SlotNum outside of the range - continue; - } - cItem Item; - if (LoadItemFromNBT(Item, a_NBT, Child)) - { - a_ItemGrid.SetSlot(SlotNum, Item); - } - } // for itr - ItemDefs[] -} - - - - - -void cWSSAnvil::LoadChestFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); - int x, y, z; - if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) - { - return; - } - int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); - if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) - { - return; // Make it an empty chest - the chunk loader will provide an empty cChestEntity for this - } - std::auto_ptr<cChestEntity> Chest(new cChestEntity(x, y, z, m_World)); - LoadItemGridFromNBT(Chest->GetContents(), a_NBT, Items); - a_BlockEntities.push_back(Chest.release()); -} - - - - - -void cWSSAnvil::LoadDispenserFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); - int x, y, z; - if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) - { - return; - } - int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); - if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) - { - return; // Make it an empty dispenser - the chunk loader will provide an empty cDispenserEntity for this - } - std::auto_ptr<cDispenserEntity> Dispenser(new cDispenserEntity(x, y, z, m_World)); - LoadItemGridFromNBT(Dispenser->GetContents(), a_NBT, Items); - a_BlockEntities.push_back(Dispenser.release()); -} - - - - - -void cWSSAnvil::LoadDropperFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); - int x, y, z; - if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) - { - return; - } - int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); - if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) - { - return; // Make it an empty dropper - the chunk loader will provide an empty cDropperEntity for this - } - std::auto_ptr<cDropperEntity> Dropper(new cDropperEntity(x, y, z, m_World)); - LoadItemGridFromNBT(Dropper->GetContents(), a_NBT, Items); - a_BlockEntities.push_back(Dropper.release()); -} - - - - - -void cWSSAnvil::LoadFurnaceFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE * a_BlockTypes, NIBBLETYPE * a_BlockMetas) -{ - ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); - int x, y, z; - if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) - { - return; - } - int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); - if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) - { - return; // Make it an empty furnace - the chunk loader will provide an empty cFurnaceEntity for this - } - - // Convert coords to relative: - int RelX = x; - int RelZ = z; - int ChunkX, ChunkZ; - cChunkDef::AbsoluteToRelative(RelX, y, RelZ, ChunkX, ChunkZ); - - // Create the furnace entity, with proper BlockType and BlockMeta info: - BLOCKTYPE BlockType = cChunkDef::GetBlock(a_BlockTypes, RelX, y, RelZ); - NIBBLETYPE BlockMeta = cChunkDef::GetNibble(a_BlockMetas, RelX, y, RelZ); - std::auto_ptr<cFurnaceEntity> Furnace(new cFurnaceEntity(x, y, z, BlockType, BlockMeta, m_World)); - - // Load slots: - for (int Child = a_NBT.GetFirstChild(Items); Child != -1; Child = a_NBT.GetNextSibling(Child)) - { - int Slot = a_NBT.FindChildByName(Child, "Slot"); - if ((Slot < 0) || (a_NBT.GetType(Slot) != TAG_Byte)) - { - continue; - } - cItem Item; - if (LoadItemFromNBT(Item, a_NBT, Child)) - { - Furnace->SetSlot(a_NBT.GetByte(Slot), Item); - } - } // for itr - ItemDefs[] - - // Load burn time: - int BurnTime = a_NBT.FindChildByName(a_TagIdx, "BurnTime"); - if (BurnTime >= 0) - { - Int16 bt = a_NBT.GetShort(BurnTime); - // Anvil doesn't store the time that the fuel can burn. We simply "reset" the current value to be the 100% - Furnace->SetBurnTimes(bt, 0); - } - - // Load cook time: - int CookTime = a_NBT.FindChildByName(a_TagIdx, "CookTime"); - if (CookTime >= 0) - { - Int16 ct = a_NBT.GetShort(CookTime); - // Anvil doesn't store the time that an item takes to cook. We simply use the default - 10 seconds (200 ticks) - Furnace->SetCookTimes(200, ct); - } - - // Restart cooking: - Furnace->ContinueCooking(); - a_BlockEntities.push_back(Furnace.release()); -} - - - - - -void cWSSAnvil::LoadHopperFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); - int x, y, z; - if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) - { - return; - } - int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); - if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) - { - return; // Make it an empty hopper - the chunk loader will provide an empty cHopperEntity for this - } - std::auto_ptr<cHopperEntity> Hopper(new cHopperEntity(x, y, z, m_World)); - LoadItemGridFromNBT(Hopper->GetContents(), a_NBT, Items); - a_BlockEntities.push_back(Hopper.release()); -} - - - - - -void cWSSAnvil::LoadJukeboxFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); - int x, y, z; - if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) - { - return; - } - std::auto_ptr<cJukeboxEntity> Jukebox(new cJukeboxEntity(x, y, z, m_World)); - int Record = a_NBT.FindChildByName(a_TagIdx, "Record"); - if (Record >= 0) - { - Jukebox->SetRecord(a_NBT.GetInt(Record)); - } - a_BlockEntities.push_back(Jukebox.release()); -} - - - - - -void cWSSAnvil::LoadNoteFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); - int x, y, z; - if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) - { - return; - } - std::auto_ptr<cNoteEntity> Note(new cNoteEntity(x, y, z, m_World)); - int note = a_NBT.FindChildByName(a_TagIdx, "note"); - if (note >= 0) - { - Note->SetPitch(a_NBT.GetByte(note)); - } - a_BlockEntities.push_back(Note.release()); -} - - - - - -void cWSSAnvil::LoadSignFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); - int x, y, z; - if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) - { - return; - } - std::auto_ptr<cSignEntity> Sign(new cSignEntity(E_BLOCK_SIGN_POST, x, y, z, m_World)); - - int currentLine = a_NBT.FindChildByName(a_TagIdx, "Text1"); - if (currentLine >= 0) - { - Sign->SetLine(0, a_NBT.GetString(currentLine)); - } - - currentLine = a_NBT.FindChildByName(a_TagIdx, "Text2"); - if (currentLine >= 0) - { - Sign->SetLine(1, a_NBT.GetString(currentLine)); - } - - currentLine = a_NBT.FindChildByName(a_TagIdx, "Text3"); - if (currentLine >= 0) - { - Sign->SetLine(2, a_NBT.GetString(currentLine)); - } - - currentLine = a_NBT.FindChildByName(a_TagIdx, "Text4"); - if (currentLine >= 0) - { - Sign->SetLine(3, a_NBT.GetString(currentLine)); - } - - a_BlockEntities.push_back(Sign.release()); -} - - - - - -void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_EntityTagIdx, const char * a_IDTag, int a_IDTagLength) -{ - if (strncmp(a_IDTag, "Boat", a_IDTagLength) == 0) - { - LoadBoatFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "FallingBlock", a_IDTagLength) == 0) - { - LoadFallingBlockFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "Minecart", a_IDTagLength) == 0) - { - // It is a minecart, old style, find out the type: - int TypeTag = a_NBT.FindChildByName(a_EntityTagIdx, "Type"); - if ((TypeTag < 0) || (a_NBT.GetType(TypeTag) != TAG_Int)) - { - return; - } - switch (a_NBT.GetInt(TypeTag)) - { - case 0: LoadMinecartRFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Rideable minecart - case 1: LoadMinecartCFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Minecart with chest - case 2: LoadMinecartFFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Minecart with furnace - case 3: LoadMinecartTFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Minecart with TNT - case 4: LoadMinecartHFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Minecart with Hopper - } - } - else if (strncmp(a_IDTag, "MinecartRideable", a_IDTagLength) == 0) - { - LoadMinecartRFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "MinecartChest", a_IDTagLength) == 0) - { - LoadMinecartCFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "MinecartFurnace", a_IDTagLength) == 0) - { - LoadMinecartFFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "MinecartTNT", a_IDTagLength) == 0) - { - LoadMinecartTFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "MinecartHopper", a_IDTagLength) == 0) - { - LoadMinecartHFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "Item", a_IDTagLength) == 0) - { - LoadPickupFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "Arrow", a_IDTagLength) == 0) - { - LoadArrowFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "Snowball", a_IDTagLength) == 0) - { - LoadSnowballFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "Egg", a_IDTagLength) == 0) - { - LoadEggFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "Fireball", a_IDTagLength) == 0) - { - LoadFireballFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "SmallFireball", a_IDTagLength) == 0) - { - LoadFireChargeFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - else if (strncmp(a_IDTag, "ThrownEnderpearl", a_IDTagLength) == 0) - { - LoadThrownEnderpearlFromNBT(a_Entities, a_NBT, a_EntityTagIdx); - } - // TODO: other entities -} - - - - - -void cWSSAnvil::LoadBoatFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - std::auto_ptr<cBoat> Boat(new cBoat(0, 0, 0)); - if (!LoadEntityBaseFromNBT(*Boat.get(), a_NBT, a_TagIdx)) - { - return; - } - a_Entities.push_back(Boat.release()); -} - - - - - -void cWSSAnvil::LoadFallingBlockFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - // TODO -} - - - - - -void cWSSAnvil::LoadMinecartRFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - std::auto_ptr<cEmptyMinecart> Minecart(new cEmptyMinecart(0, 0, 0)); - if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx)) - { - return; - } - a_Entities.push_back(Minecart.release()); -} - - - - - -void cWSSAnvil::LoadMinecartCFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); - if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) - { - return; // Make it an empty chest - the chunk loader will provide an empty cChestEntity for this - } - std::auto_ptr<cMinecartWithChest> Minecart(new cMinecartWithChest(0, 0, 0)); - if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx)) - { - return; - } - for (int Child = a_NBT.GetFirstChild(Items); Child != -1; Child = a_NBT.GetNextSibling(Child)) - { - int Slot = a_NBT.FindChildByName(Child, "Slot"); - if ((Slot < 0) || (a_NBT.GetType(Slot) != TAG_Byte)) - { - continue; - } - cItem Item; - if (LoadItemFromNBT(Item, a_NBT, Child)) - { - Minecart->SetSlot(a_NBT.GetByte(Slot), Item); - } - } // for itr - ItemDefs[] - a_Entities.push_back(Minecart.release()); -} - - - - - -void cWSSAnvil::LoadMinecartFFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - std::auto_ptr<cMinecartWithFurnace> Minecart(new cMinecartWithFurnace(0, 0, 0)); - if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx)) - { - return; - } - - // TODO: Load the Push and Fuel tags - - a_Entities.push_back(Minecart.release()); -} - - - - - -void cWSSAnvil::LoadMinecartTFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - std::auto_ptr<cMinecartWithTNT> Minecart(new cMinecartWithTNT(0, 0, 0)); - if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx)) - { - return; - } - - // TODO: Everything to do with TNT carts - - a_Entities.push_back(Minecart.release()); -} - - - - - -void cWSSAnvil::LoadMinecartHFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - std::auto_ptr<cMinecartWithHopper> Minecart(new cMinecartWithHopper(0, 0, 0)); - if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx)) - { - return; - } - - // TODO: Everything to do with hopper carts - - a_Entities.push_back(Minecart.release()); -} - - - - - -void cWSSAnvil::LoadPickupFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - int ItemTag = a_NBT.FindChildByName(a_TagIdx, "Item"); - if ((ItemTag < 0) || (a_NBT.GetType(ItemTag) != TAG_Compound)) - { - return; - } - cItem Item; - if (!LoadItemFromNBT(Item, a_NBT, ItemTag)) - { - return; - } - std::auto_ptr<cPickup> Pickup(new cPickup(0, 0, 0, Item, false)); // Pickup delay doesn't matter, just say false - if (!LoadEntityBaseFromNBT(*Pickup.get(), a_NBT, a_TagIdx)) - { - return; - } - a_Entities.push_back(Pickup.release()); -} - - - - - -void cWSSAnvil::LoadArrowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - std::auto_ptr<cArrowEntity> Arrow(new cArrowEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0))); - if (!LoadProjectileBaseFromNBT(*Arrow.get(), a_NBT, a_TagIdx)) - { - return; - } - - // Load pickup state: - int PickupIdx = a_NBT.FindChildByName(a_TagIdx, "pickup"); - if (PickupIdx > 0) - { - Arrow->SetPickupState((cArrowEntity::ePickupState)a_NBT.GetByte(PickupIdx)); - } - else - { - // Try the older "player" tag: - int PlayerIdx = a_NBT.FindChildByName(a_TagIdx, "player"); - if (PlayerIdx > 0) - { - Arrow->SetPickupState((a_NBT.GetByte(PlayerIdx) == 0) ? cArrowEntity::psNoPickup : cArrowEntity::psInSurvivalOrCreative); - } - } - - // Load damage: - int DamageIdx = a_NBT.FindChildByName(a_TagIdx, "damage"); - if (DamageIdx > 0) - { - Arrow->SetDamageCoeff(a_NBT.GetDouble(DamageIdx)); - } - - // Store the new arrow in the entities list: - a_Entities.push_back(Arrow.release()); -} - - - - - -void cWSSAnvil::LoadSnowballFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - std::auto_ptr<cThrownSnowballEntity> Snowball(new cThrownSnowballEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0))); - if (!LoadProjectileBaseFromNBT(*Snowball.get(), a_NBT, a_TagIdx)) - { - return; - } - - // Store the new snowball in the entities list: - a_Entities.push_back(Snowball.release()); -} - - - - - -void cWSSAnvil::LoadEggFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - std::auto_ptr<cThrownEggEntity> Egg(new cThrownEggEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0))); - if (!LoadProjectileBaseFromNBT(*Egg.get(), a_NBT, a_TagIdx)) - { - return; - } - - // Store the new egg in the entities list: - a_Entities.push_back(Egg.release()); -} - - - - - -void cWSSAnvil::LoadFireballFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - std::auto_ptr<cGhastFireballEntity> Fireball(new cGhastFireballEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0))); - if (!LoadProjectileBaseFromNBT(*Fireball.get(), a_NBT, a_TagIdx)) - { - return; - } - - // Store the new fireball in the entities list: - a_Entities.push_back(Fireball.release()); -} - - - - - -void cWSSAnvil::LoadFireChargeFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - std::auto_ptr<cFireChargeEntity> FireCharge(new cFireChargeEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0))); - if (!LoadProjectileBaseFromNBT(*FireCharge.get(), a_NBT, a_TagIdx)) - { - return; - } - - // Store the new FireCharge in the entities list: - a_Entities.push_back(FireCharge.release()); -} - - - - - -void cWSSAnvil::LoadThrownEnderpearlFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) -{ - std::auto_ptr<cThrownEnderPearlEntity> Enderpearl(new cThrownEnderPearlEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0))); - if (!LoadProjectileBaseFromNBT(*Enderpearl.get(), a_NBT, a_TagIdx)) - { - return; - } - - // Store the new enderpearl in the entities list: - a_Entities.push_back(Enderpearl.release()); -} - - - - - -bool cWSSAnvil::LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_NBT, int a_TagIdx) -{ - double Pos[3]; - if (!LoadDoublesListFromNBT(Pos, 3, a_NBT, a_NBT.FindChildByName(a_TagIdx, "Pos"))) - { - return false; - } - a_Entity.SetPosition(Pos[0], Pos[1], Pos[2]); - - double Speed[3]; - if (!LoadDoublesListFromNBT(Speed, 3, a_NBT, a_NBT.FindChildByName(a_TagIdx, "Motion"))) - { - return false; - } - a_Entity.SetSpeed(Speed[0], Speed[1], Speed[2]); - - double Rotation[3]; - if (!LoadDoublesListFromNBT(Rotation, 2, a_NBT, a_NBT.FindChildByName(a_TagIdx, "Rotation"))) - { - return false; - } - a_Entity.SetRotation(Rotation[0]); - a_Entity.SetRoll (Rotation[1]); - - return true; -} - - - - - -bool cWSSAnvil::LoadProjectileBaseFromNBT(cProjectileEntity & a_Entity, const cParsedNBT & a_NBT, int a_TagIdx) -{ - if (!LoadEntityBaseFromNBT(a_Entity, a_NBT, a_TagIdx)) - { - return false; - } - - bool IsInGround = false; - int InGroundIdx = a_NBT.FindChildByName(a_TagIdx, "inGround"); - if (InGroundIdx > 0) - { - IsInGround = (a_NBT.GetByte(InGroundIdx) != 0); - } - a_Entity.SetIsInGround(IsInGround); - - // TODO: Load inTile, TileCoords - - return true; -} - - - - - -bool cWSSAnvil::LoadDoublesListFromNBT(double * a_Doubles, int a_NumDoubles, const cParsedNBT & a_NBT, int a_TagIdx) -{ - if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_List) || (a_NBT.GetChildrenType(a_TagIdx) != TAG_Double)) - { - return false; - } - int idx = 0; - for (int Tag = a_NBT.GetFirstChild(a_TagIdx); (Tag > 0) && (idx < a_NumDoubles); Tag = a_NBT.GetNextSibling(Tag), ++idx) - { - a_Doubles[idx] = a_NBT.GetDouble(Tag); - } // for Tag - PosTag[] - return (idx == a_NumDoubles); // Did we read enough doubles? -} - - - - - -bool cWSSAnvil::GetBlockEntityNBTPos(const cParsedNBT & a_NBT, int a_TagIdx, int & a_X, int & a_Y, int & a_Z) -{ - int x = a_NBT.FindChildByName(a_TagIdx, "x"); - if ((x < 0) || (a_NBT.GetType(x) != TAG_Int)) - { - return false; - } - int y = a_NBT.FindChildByName(a_TagIdx, "y"); - if ((y < 0) || (a_NBT.GetType(y) != TAG_Int)) - { - return false; - } - int z = a_NBT.FindChildByName(a_TagIdx, "z"); - if ((z < 0) || (a_NBT.GetType(z) != TAG_Int)) - { - return false; - } - a_X = a_NBT.GetInt(x); - a_Y = a_NBT.GetInt(y); - a_Z = a_NBT.GetInt(z); - return true; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cWSSAnvil::cMCAFile: - -cWSSAnvil::cMCAFile::cMCAFile(const AString & a_FileName, int a_RegionX, int a_RegionZ) : - m_RegionX(a_RegionX), - m_RegionZ(a_RegionZ), - m_FileName(a_FileName) -{ -} - - - - - -bool cWSSAnvil::cMCAFile::OpenFile(bool a_IsForReading) -{ - if (m_File.IsOpen()) - { - // Already open - return true; - } - - if (a_IsForReading) - { - if (!cFile::Exists(m_FileName)) - { - // We want to read and the file doesn't exist. Fail. - return false; - } - } - - if (!m_File.Open(m_FileName, cFile::fmReadWrite)) - { - // The file failed to open - return false; - } - - // Load the header: - if (m_File.Read(m_Header, sizeof(m_Header)) != sizeof(m_Header)) - { - // Cannot read the header - perhaps the file has just been created? - // Try writing a NULL header (both chunk offsets and timestamps): - memset(m_Header, 0, sizeof(m_Header)); - if ( - (m_File.Write(m_Header, sizeof(m_Header)) != sizeof(m_Header)) || // Real header - chunk offsets - (m_File.Write(m_Header, sizeof(m_Header)) != sizeof(m_Header)) // Bogus data for the chunk timestamps - ) - { - LOGWARNING("Cannot process MCA header in file \"%s\", chunks in that file will be lost", m_FileName.c_str()); - m_File.Close(); - return false; - } - } - return true; -} - - - - - -bool cWSSAnvil::cMCAFile::GetChunkData(const cChunkCoords & a_Chunk, AString & a_Data) -{ - if (!OpenFile(true)) - { - return false; - } - - int LocalX = a_Chunk.m_ChunkX % 32; - if (LocalX < 0) - { - LocalX = 32 + LocalX; - } - int LocalZ = a_Chunk.m_ChunkZ % 32; - if (LocalZ < 0) - { - LocalZ = 32 + LocalZ; - } - unsigned ChunkLocation = ntohl(m_Header[LocalX + 32 * LocalZ]); - unsigned ChunkOffset = ChunkLocation >> 8; - - m_File.Seek(ChunkOffset * 4096); - - int ChunkSize = 0; - if (m_File.Read(&ChunkSize, 4) != 4) - { - return false; - } - ChunkSize = ntohl(ChunkSize); - char CompressionType = 0; - if (m_File.Read(&CompressionType, 1) != 1) - { - return false; - } - if (CompressionType != 2) - { - // Chunk is in an unknown compression - return false; - } - ChunkSize--; - - // HACK: This depends on the internal knowledge that AString's data() function returns the internal buffer directly - a_Data.assign(ChunkSize, '\0'); - return (m_File.Read((void *)a_Data.data(), ChunkSize) == ChunkSize); -} - - - - - -bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AString & a_Data) -{ - if (!OpenFile(false)) - { - LOGWARNING("Cannot save chunk [%d, %d], opening file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); - return false; - } - - int LocalX = a_Chunk.m_ChunkX % 32; - if (LocalX < 0) - { - LocalX = 32 + LocalX; - } - int LocalZ = a_Chunk.m_ChunkZ % 32; - if (LocalZ < 0) - { - LocalZ = 32 + LocalZ; - } - - unsigned ChunkSector = FindFreeLocation(LocalX, LocalZ, a_Data); - - // Store the chunk data: - m_File.Seek(ChunkSector * 4096); - unsigned ChunkSize = htonl(a_Data.size() + 1); - if (m_File.Write(&ChunkSize, 4) != 4) - { - LOGWARNING("Cannot save chunk [%d, %d], writing(1) data to file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); - return false; - } - char CompressionType = 2; - if (m_File.Write(&CompressionType, 1) != 1) - { - LOGWARNING("Cannot save chunk [%d, %d], writing(2) data to file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); - return false; - } - if (m_File.Write(a_Data.data(), a_Data.size()) != (int)(a_Data.size())) - { - LOGWARNING("Cannot save chunk [%d, %d], writing(3) data to file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); - return false; - } - - // Store the header: - ChunkSize = (a_Data.size() + MCA_CHUNK_HEADER_LENGTH + 4095) / 4096; // Round data size *up* to nearest 4KB sector, make it a sector number - ASSERT(ChunkSize < 256); - m_Header[LocalX + 32 * LocalZ] = htonl((ChunkSector << 8) | ChunkSize); - if (m_File.Seek(0) < 0) - { - LOGWARNING("Cannot save chunk [%d, %d], seeking in file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); - return false; - } - if (m_File.Write(m_Header, sizeof(m_Header)) != sizeof(m_Header)) - { - LOGWARNING("Cannot save chunk [%d, %d], writing header to file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); - return false; - } - - return true; -} - - - - - -unsigned cWSSAnvil::cMCAFile::FindFreeLocation(int a_LocalX, int a_LocalZ, const AString & a_Data) -{ - // See if it fits the current location: - unsigned ChunkLocation = ntohl(m_Header[a_LocalX + 32 * a_LocalZ]); - unsigned ChunkLen = ChunkLocation & 0xff; - if (a_Data.size() + MCA_CHUNK_HEADER_LENGTH <= (ChunkLen * 4096)) - { - return ChunkLocation >> 8; - } - - // Doesn't fit, append to the end of file (we're wasting a lot of space, TODO: fix this later) - unsigned MaxLocation = 2 << 8; // Minimum sector is #2 - after the headers - for (int i = 0; i < ARRAYCOUNT(m_Header); i++) - { - ChunkLocation = ntohl(m_Header[i]); - ChunkLocation = ChunkLocation + ((ChunkLocation & 0xff) << 8); // Add the number of sectors used; don't care about the 4th byte - if (MaxLocation < ChunkLocation) - { - MaxLocation = ChunkLocation; - } - } // for i - m_Header[] - return MaxLocation >> 8; -} - - - - diff --git a/source/WorldStorage/WSSCompact.cpp b/source/WorldStorage/WSSCompact.cpp deleted file mode 100644 index 694f3ed1d..000000000 --- a/source/WorldStorage/WSSCompact.cpp +++ /dev/null @@ -1,1009 +0,0 @@ - -// WSSCompact.cpp - -// Interfaces to the cWSSCompact class representing the "compact" storage schema (PAK-files) - -#include "Globals.h" -#include "WSSCompact.h" -#include "../World.h" -#include "zlib.h" -#include <json/json.h> -#include "../StringCompression.h" -#include "../BlockEntities/ChestEntity.h" -#include "../BlockEntities/DispenserEntity.h" -#include "../BlockEntities/FurnaceEntity.h" -#include "../BlockEntities/JukeboxEntity.h" -#include "../BlockEntities/NoteEntity.h" -#include "../BlockEntities/SignEntity.h" - - - - - -#pragma pack(push, 1) -/// The chunk header, as stored in the file: -struct cWSSCompact::sChunkHeader -{ - int m_ChunkX; - int m_ChunkZ; - int m_CompressedSize; - int m_UncompressedSize; -} ; -#pragma pack(pop) - - - - - -/// The maximum number of PAK files that are cached -const int MAX_PAK_FILES = 16; - -/// The maximum number of unsaved chunks before the cPAKFile saves them to disk -const int MAX_DIRTY_CHUNKS = 16; - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cJsonChunkSerializer: - -cJsonChunkSerializer::cJsonChunkSerializer(void) : - m_HasJsonData(false) -{ -} - - - - - -void cJsonChunkSerializer::Entity(cEntity * a_Entity) -{ - // TODO: a_Entity->SaveToJson(m_Root); -} - - - - - -void cJsonChunkSerializer::BlockEntity(cBlockEntity * a_BlockEntity) -{ - const char * SaveInto = NULL; - switch (a_BlockEntity->GetBlockType()) - { - case E_BLOCK_CHEST: SaveInto = "Chests"; break; - case E_BLOCK_DISPENSER: SaveInto = "Dispensers"; break; - case E_BLOCK_DROPPER: SaveInto = "Droppers"; break; - case E_BLOCK_FURNACE: SaveInto = "Furnaces"; break; - case E_BLOCK_SIGN_POST: SaveInto = "Signs"; break; - case E_BLOCK_WALLSIGN: SaveInto = "Signs"; break; - case E_BLOCK_NOTE_BLOCK: SaveInto = "Notes"; break; - case E_BLOCK_JUKEBOX: SaveInto = "Jukeboxes"; break; - - default: - { - ASSERT(!"Unhandled blocktype in BlockEntities list while saving to JSON"); - break; - } - } // switch (BlockEntity->GetBlockType()) - if (SaveInto == NULL) - { - return; - } - - Json::Value val; - a_BlockEntity->SaveToJson(val); - m_Root[SaveInto].append(val); - m_HasJsonData = true; -} - - - - - -bool cJsonChunkSerializer::LightIsValid(bool a_IsLightValid) -{ - if (!a_IsLightValid) - { - return false; - } - m_Root["IsLightValid"] = true; - m_HasJsonData = true; - return true; -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cWSSCompact: - -cWSSCompact::~cWSSCompact() -{ - for (cPAKFiles::iterator itr = m_PAKFiles.begin(); itr != m_PAKFiles.end(); ++itr) - { - delete *itr; - } -} - - - - - -bool cWSSCompact::LoadChunk(const cChunkCoords & a_Chunk) -{ - AString ChunkData; - int UncompressedSize = 0; - if (!GetChunkData(a_Chunk, UncompressedSize, ChunkData)) - { - // The reason for failure is already printed in GetChunkData() - return false; - } - - return LoadChunkFromData(a_Chunk, UncompressedSize, ChunkData, m_World); -} - - - - - -bool cWSSCompact::SaveChunk(const cChunkCoords & a_Chunk) -{ - cCSLock Lock(m_CS); - - cPAKFile * f = LoadPAKFile(a_Chunk); - if (f == NULL) - { - // For some reason we couldn't locate the file - LOG("Cannot locate a proper PAK file for chunk [%d, %d]", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ); - return false; - } - return f->SaveChunk(a_Chunk, m_World); -} - - - - - -cWSSCompact::cPAKFile * cWSSCompact::LoadPAKFile(const cChunkCoords & a_Chunk) -{ - // ASSUMES that m_CS has been locked - - // We need to retain this weird conversion code, because some edge chunks are in the wrong PAK file - const int LayerX = FAST_FLOOR_DIV(a_Chunk.m_ChunkX, 32); - const int LayerZ = FAST_FLOOR_DIV(a_Chunk.m_ChunkZ, 32); - - // Is it already cached? - for (cPAKFiles::iterator itr = m_PAKFiles.begin(); itr != m_PAKFiles.end(); ++itr) - { - if (((*itr) != NULL) && ((*itr)->GetLayerX() == LayerX) && ((*itr)->GetLayerZ() == LayerZ)) - { - // Move the file to front and return it: - cPAKFile * f = *itr; - if (itr != m_PAKFiles.begin()) - { - m_PAKFiles.erase(itr); - m_PAKFiles.push_front(f); - } - return f; - } - } - - // Load it anew: - AString FileName; - Printf(FileName, "%s/X%i_Z%i.pak", m_World->GetName().c_str(), LayerX, LayerZ ); - cPAKFile * f = new cPAKFile(FileName, LayerX, LayerZ); - if (f == NULL) - { - return NULL; - } - m_PAKFiles.push_front(f); - - // If there are too many PAK files cached, delete the last one used: - if (m_PAKFiles.size() > MAX_PAK_FILES) - { - delete m_PAKFiles.back(); - m_PAKFiles.pop_back(); - } - return f; -} - - - - - -bool cWSSCompact::GetChunkData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, AString & a_Data) -{ - cCSLock Lock(m_CS); - cPAKFile * f = LoadPAKFile(a_Chunk); - if (f == NULL) - { - return false; - } - return f->GetChunkData(a_Chunk, a_UncompressedSize, a_Data); -} - - - - - -/* -// TODO: Rewrite saving to use the same principles as loading -bool cWSSCompact::SetChunkData(const cChunkCoords & a_Chunk, int a_UncompressedSize, const AString & a_Data) -{ - cCSLock Lock(m_CS); - cPAKFile * f = LoadPAKFile(a_Chunk); - if (f == NULL) - { - return false; - } - return f->SetChunkData(a_Chunk, a_UncompressedSize, a_Data); -} -*/ - - - - - -bool cWSSCompact::EraseChunkData(const cChunkCoords & a_Chunk) -{ - cCSLock Lock(m_CS); - cPAKFile * f = LoadPAKFile(a_Chunk); - if (f == NULL) - { - return false; - } - return f->EraseChunkData(a_Chunk); -} - - - - - -void cWSSCompact::LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities, cWorld * a_World) -{ - // Load chests - Json::Value AllChests = a_Value.get("Chests", Json::nullValue); - if (!AllChests.empty()) - { - for (Json::Value::iterator itr = AllChests.begin(); itr != AllChests.end(); ++itr ) - { - Json::Value & Chest = *itr; - cChestEntity * ChestEntity = new cChestEntity(0,0,0, a_World); - if (!ChestEntity->LoadFromJson( Chest ) ) - { - LOGERROR("ERROR READING CHEST FROM JSON!" ); - delete ChestEntity; - } - else - { - a_BlockEntities.push_back( ChestEntity ); - } - } // for itr - AllChests[] - } - - // Load dispensers - Json::Value AllDispensers = a_Value.get("Dispensers", Json::nullValue); - if( !AllDispensers.empty() ) - { - for( Json::Value::iterator itr = AllDispensers.begin(); itr != AllDispensers.end(); ++itr ) - { - Json::Value & Dispenser = *itr; - cDispenserEntity * DispenserEntity = new cDispenserEntity(0,0,0, a_World); - if( !DispenserEntity->LoadFromJson( Dispenser ) ) - { - LOGERROR("ERROR READING DISPENSER FROM JSON!" ); - delete DispenserEntity; - } - else - { - a_BlockEntities.push_back( DispenserEntity ); - } - } // for itr - AllDispensers[] - } - - // Load furnaces - Json::Value AllFurnaces = a_Value.get("Furnaces", Json::nullValue); - if( !AllFurnaces.empty() ) - { - for( Json::Value::iterator itr = AllFurnaces.begin(); itr != AllFurnaces.end(); ++itr ) - { - Json::Value & Furnace = *itr; - // TODO: The block type and meta aren't correct, there's no way to get them here - cFurnaceEntity * FurnaceEntity = new cFurnaceEntity(0, 0, 0, E_BLOCK_FURNACE, 0, a_World); - if (!FurnaceEntity->LoadFromJson(Furnace)) - { - LOGERROR("ERROR READING FURNACE FROM JSON!" ); - delete FurnaceEntity; - } - else - { - a_BlockEntities.push_back(FurnaceEntity); - } - } // for itr - AllFurnaces[] - } - - // Load signs - Json::Value AllSigns = a_Value.get("Signs", Json::nullValue); - if( !AllSigns.empty() ) - { - for( Json::Value::iterator itr = AllSigns.begin(); itr != AllSigns.end(); ++itr ) - { - Json::Value & Sign = *itr; - cSignEntity * SignEntity = new cSignEntity( E_BLOCK_SIGN_POST, 0,0,0, a_World); - if ( !SignEntity->LoadFromJson( Sign ) ) - { - LOGERROR("ERROR READING SIGN FROM JSON!" ); - delete SignEntity; - } - else - { - a_BlockEntities.push_back( SignEntity ); - } - } // for itr - AllSigns[] - } - - // Load note blocks - Json::Value AllNotes = a_Value.get("Notes", Json::nullValue); - if( !AllNotes.empty() ) - { - for( Json::Value::iterator itr = AllNotes.begin(); itr != AllNotes.end(); ++itr ) - { - Json::Value & Note = *itr; - cNoteEntity * NoteEntity = new cNoteEntity(0, 0, 0, a_World); - if ( !NoteEntity->LoadFromJson( Note ) ) - { - LOGERROR("ERROR READING NOTE BLOCK FROM JSON!" ); - delete NoteEntity; - } - else - { - a_BlockEntities.push_back( NoteEntity ); - } - } // for itr - AllNotes[] - } - - // Load jukeboxes - Json::Value AllJukeboxes = a_Value.get("Jukeboxes", Json::nullValue); - if( !AllJukeboxes.empty() ) - { - for( Json::Value::iterator itr = AllJukeboxes.begin(); itr != AllJukeboxes.end(); ++itr ) - { - Json::Value & Jukebox = *itr; - cJukeboxEntity * JukeboxEntity = new cJukeboxEntity(0, 0, 0, a_World); - if ( !JukeboxEntity->LoadFromJson( Jukebox ) ) - { - LOGERROR("ERROR READING JUKEBOX FROM JSON!" ); - delete JukeboxEntity; - } - else - { - a_BlockEntities.push_back( JukeboxEntity ); - } - } // for itr - AllJukeboxes[] - } -} - - - - - -/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// cWSSCompact::cPAKFile - -#define READ(Var) \ - if (f.Read(&Var, sizeof(Var)) != sizeof(Var)) \ - { \ - LOGERROR("ERROR READING %s FROM FILE %s (line %d); file offset %d", #Var, m_FileName.c_str(), __LINE__, f.Tell()); \ - return; \ - } - -cWSSCompact::cPAKFile::cPAKFile(const AString & a_FileName, int a_LayerX, int a_LayerZ) : - m_FileName(a_FileName), - m_LayerX(a_LayerX), - m_LayerZ(a_LayerZ), - m_NumDirty(0), - m_ChunkVersion( CHUNK_VERSION ), // Init with latest version - m_PakVersion( PAK_VERSION ) -{ - cFile f; - if (!f.Open(m_FileName, cFile::fmRead)) - { - return; - } - - // Read headers: - READ(m_PakVersion); - if (m_PakVersion != 1) - { - LOGERROR("File \"%s\" is in an unknown pak format (%d)", m_FileName.c_str(), m_PakVersion); - return; - } - - READ(m_ChunkVersion); - switch( m_ChunkVersion ) - { - case 1: - m_ChunkSize.Set(16, 128, 16); - break; - case 2: - case 3: - m_ChunkSize.Set(16, 256, 16); - break; - default: - LOGERROR("File \"%s\" is in an unknown chunk format (%d)", m_FileName.c_str(), m_ChunkVersion); - return; - }; - - short NumChunks = 0; - READ(NumChunks); - - // Read chunk headers: - for (int i = 0; i < NumChunks; i++) - { - sChunkHeader * Header = new sChunkHeader; - READ(*Header); - m_ChunkHeaders.push_back(Header); - } // for i - chunk headers - - // Read chunk data: - if (f.ReadRestOfFile(m_DataContents) == -1) - { - LOGERROR("Cannot read file \"%s\" contents", m_FileName.c_str()); - return; - } - - if( m_ChunkVersion == 1 ) // Convert chunks to version 2 - { - UpdateChunk1To2(); - } -#if AXIS_ORDER == AXIS_ORDER_XZY - if( m_ChunkVersion == 2 ) // Convert chunks to version 3 - { - UpdateChunk2To3(); - } -#endif -} - - - - - -cWSSCompact::cPAKFile::~cPAKFile() -{ - if (m_NumDirty > 0) - { - SynchronizeFile(); - } - for (sChunkHeaders::iterator itr = m_ChunkHeaders.begin(); itr != m_ChunkHeaders.end(); ++itr) - { - delete *itr; - } -} - - - - - -bool cWSSCompact::cPAKFile::GetChunkData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, AString & a_Data) -{ - int ChunkX = a_Chunk.m_ChunkX; - int ChunkZ = a_Chunk.m_ChunkZ; - sChunkHeader * Header = NULL; - int Offset = 0; - for (sChunkHeaders::iterator itr = m_ChunkHeaders.begin(); itr != m_ChunkHeaders.end(); ++itr) - { - if (((*itr)->m_ChunkX == ChunkX) && ((*itr)->m_ChunkZ == ChunkZ)) - { - Header = *itr; - break; - } - Offset += (*itr)->m_CompressedSize; - } - if ((Header == NULL) || (Offset + Header->m_CompressedSize > (int)m_DataContents.size())) - { - // Chunk not found / data invalid - return false; - } - - a_UncompressedSize = Header->m_UncompressedSize; - a_Data.assign(m_DataContents, Offset, Header->m_CompressedSize); - return true; -} - - - - - -bool cWSSCompact::cPAKFile::SaveChunk(const cChunkCoords & a_Chunk, cWorld * a_World) -{ - if (!SaveChunkToData(a_Chunk, a_World)) - { - return false; - } - if (m_NumDirty > MAX_DIRTY_CHUNKS) - { - SynchronizeFile(); - } - return true; -} - - - - - -void cWSSCompact::cPAKFile::UpdateChunk1To2() -{ - int Offset = 0; - AString NewDataContents; - int ChunksConverted = 0; - for (sChunkHeaders::iterator itr = m_ChunkHeaders.begin(); itr != m_ChunkHeaders.end(); ++itr) - { - sChunkHeader * Header = *itr; - - if( ChunksConverted % 32 == 0 ) - { - LOGINFO("Updating \"%s\" version 1 to version 2: %d %%", m_FileName.c_str(), (ChunksConverted * 100) / m_ChunkHeaders.size() ); - } - ChunksConverted++; - - AString Data; - int UncompressedSize = Header->m_UncompressedSize; - Data.assign(m_DataContents, Offset, Header->m_CompressedSize); - Offset += Header->m_CompressedSize; - - // Crude data integrity check: - int ExpectedSize = (16*128*16)*2 + (16*128*16)/2; // For version 1 - if (UncompressedSize < ExpectedSize) - { - LOGWARNING("Chunk [%d, %d] has too short decompressed data (%d bytes out of %d needed), erasing", - Header->m_ChunkX, Header->m_ChunkZ, - UncompressedSize, ExpectedSize - ); - Offset += Header->m_CompressedSize; - continue; - } - - // Decompress the data: - AString UncompressedData; - { - int errorcode = UncompressString(Data.data(), Data.size(), UncompressedData, UncompressedSize); - if (errorcode != Z_OK) - { - LOGERROR("Error %d decompressing data for chunk [%d, %d]", - errorcode, - Header->m_ChunkX, Header->m_ChunkZ - ); - Offset += Header->m_CompressedSize; - continue; - } - } - - if (UncompressedSize != (int)UncompressedData.size()) - { - LOGWARNING("Uncompressed data size differs (exp %d bytes, got %d) for chunk [%d, %d]", - UncompressedSize, UncompressedData.size(), - Header->m_ChunkX, Header->m_ChunkZ - ); - Offset += Header->m_CompressedSize; - continue; - } - - - // Old version is 128 blocks high with YZX axis order - char ConvertedData[cChunkDef::BlockDataSize]; - int Index = 0; - unsigned int InChunkOffset = 0; - for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) - { - for( int y = 0; y < 128; ++y ) - { - ConvertedData[Index++] = UncompressedData[y + z * 128 + x * 128 * 16 + InChunkOffset]; - } - // Add 128 empty blocks after an old y column - memset(ConvertedData + Index, E_BLOCK_AIR, 128); - Index += 128; - } - InChunkOffset += (16 * 128 * 16); - for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) // Metadata - { - for( int y = 0; y < 64; ++y ) - { - ConvertedData[Index++] = UncompressedData[y + z * 64 + x * 64 * 16 + InChunkOffset]; - } - memset(ConvertedData + Index, 0, 64); - Index += 64; - } - InChunkOffset += (16 * 128 * 16) / 2; - for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) // Block light - { - for( int y = 0; y < 64; ++y ) - { - ConvertedData[Index++] = UncompressedData[y + z * 64 + x * 64 * 16 + InChunkOffset]; - } - memset(ConvertedData + Index, 0, 64); - Index += 64; - } - InChunkOffset += (16*128*16)/2; - for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) // Sky light - { - for( int y = 0; y < 64; ++y ) - { - ConvertedData[Index++] = UncompressedData[y + z * 64 + x * 64 * 16 + InChunkOffset]; - } - memset(ConvertedData + Index, 0, 64); - Index += 64; - } - InChunkOffset += (16 * 128 * 16) / 2; - - AString Converted(ConvertedData, ARRAYCOUNT(ConvertedData)); - - // Add JSON data afterwards - if (UncompressedData.size() > InChunkOffset) - { - Converted.append( UncompressedData.begin() + InChunkOffset, UncompressedData.end() ); - } - - // Re-compress data - AString CompressedData; - { - int errorcode = CompressString(Converted.data(), Converted.size(), CompressedData); - if (errorcode != Z_OK) - { - LOGERROR("Error %d compressing data for chunk [%d, %d]", - errorcode, - Header->m_ChunkX, Header->m_ChunkZ - ); - continue; - } - } - - // Save into file's cache - Header->m_UncompressedSize = Converted.size(); - Header->m_CompressedSize = CompressedData.size(); - NewDataContents.append( CompressedData ); - } - - // Done converting - m_DataContents = NewDataContents; - m_ChunkVersion = 2; - SynchronizeFile(); - - LOGINFO("Updated \"%s\" version 1 to version 2", m_FileName.c_str() ); -} - - - - - -void cWSSCompact::cPAKFile::UpdateChunk2To3() -{ - int Offset = 0; - AString NewDataContents; - int ChunksConverted = 0; - for (sChunkHeaders::iterator itr = m_ChunkHeaders.begin(); itr != m_ChunkHeaders.end(); ++itr) - { - sChunkHeader * Header = *itr; - - if( ChunksConverted % 32 == 0 ) - { - LOGINFO("Updating \"%s\" version 2 to version 3: %d %%", m_FileName.c_str(), (ChunksConverted * 100) / m_ChunkHeaders.size() ); - } - ChunksConverted++; - - AString Data; - int UncompressedSize = Header->m_UncompressedSize; - Data.assign(m_DataContents, Offset, Header->m_CompressedSize); - Offset += Header->m_CompressedSize; - - // Crude data integrity check: - const int ExpectedSize = (16*256*16)*2 + (16*256*16)/2; // For version 2 - if (UncompressedSize < ExpectedSize) - { - LOGWARNING("Chunk [%d, %d] has too short decompressed data (%d bytes out of %d needed), erasing", - Header->m_ChunkX, Header->m_ChunkZ, - UncompressedSize, ExpectedSize - ); - Offset += Header->m_CompressedSize; - continue; - } - - // Decompress the data: - AString UncompressedData; - { - int errorcode = UncompressString(Data.data(), Data.size(), UncompressedData, UncompressedSize); - if (errorcode != Z_OK) - { - LOGERROR("Error %d decompressing data for chunk [%d, %d]", - errorcode, - Header->m_ChunkX, Header->m_ChunkZ - ); - Offset += Header->m_CompressedSize; - continue; - } - } - - if (UncompressedSize != (int)UncompressedData.size()) - { - LOGWARNING("Uncompressed data size differs (exp %d bytes, got %d) for chunk [%d, %d]", - UncompressedSize, UncompressedData.size(), - Header->m_ChunkX, Header->m_ChunkZ - ); - Offset += Header->m_CompressedSize; - continue; - } - - char ConvertedData[ExpectedSize]; - memset(ConvertedData, 0, ExpectedSize); - - // Cannot use cChunk::MakeIndex because it might change again????????? - // For compatibility, use what we know is current - #define MAKE_2_INDEX( x, y, z ) ( y + (z * 256) + (x * 256 * 16) ) - #define MAKE_3_INDEX( x, y, z ) ( x + (z * 16) + (y * 16 * 16) ) - - unsigned int InChunkOffset = 0; - for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) for( int y = 0; y < 256; ++y ) // YZX Loop order is important, in 1.1 Y was first then Z then X - { - ConvertedData[ MAKE_3_INDEX(x, y, z) ] = UncompressedData[InChunkOffset]; - ++InChunkOffset; - } // for y, z, x - - - unsigned int index2 = 0; - for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) for( int y = 0; y < 256; ++y ) - { - ConvertedData[ InChunkOffset + MAKE_3_INDEX(x, y, z)/2 ] |= ( (UncompressedData[ InChunkOffset + index2/2 ] >> ((index2&1)*4) ) & 0x0f ) << ((x&1)*4); - ++index2; - } - InChunkOffset += index2 / 2; - index2 = 0; - - for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) for( int y = 0; y < 256; ++y ) - { - ConvertedData[ InChunkOffset + MAKE_3_INDEX(x, y, z)/2 ] |= ( (UncompressedData[ InChunkOffset + index2/2 ] >> ((index2&1)*4) ) & 0x0f ) << ((x&1)*4); - ++index2; - } - InChunkOffset += index2 / 2; - index2 = 0; - - for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) for( int y = 0; y < 256; ++y ) - { - ConvertedData[ InChunkOffset + MAKE_3_INDEX(x, y, z)/2 ] |= ( (UncompressedData[ InChunkOffset + index2/2 ] >> ((index2&1)*4) ) & 0x0f ) << ((x&1)*4); - ++index2; - } - InChunkOffset += index2 / 2; - index2 = 0; - - AString Converted(ConvertedData, ExpectedSize); - - // Add JSON data afterwards - if (UncompressedData.size() > InChunkOffset) - { - Converted.append( UncompressedData.begin() + InChunkOffset, UncompressedData.end() ); - } - - // Re-compress data - AString CompressedData; - { - int errorcode = CompressString(Converted.data(), Converted.size(), CompressedData); - if (errorcode != Z_OK) - { - LOGERROR("Error %d compressing data for chunk [%d, %d]", - errorcode, - Header->m_ChunkX, Header->m_ChunkZ - ); - continue; - } - } - - // Save into file's cache - Header->m_UncompressedSize = Converted.size(); - Header->m_CompressedSize = CompressedData.size(); - NewDataContents.append( CompressedData ); - } - - // Done converting - m_DataContents = NewDataContents; - m_ChunkVersion = 3; - SynchronizeFile(); - - LOGINFO("Updated \"%s\" version 2 to version 3", m_FileName.c_str() ); -} - - - - - -bool cWSSCompact::LoadChunkFromData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, const AString & a_Data, cWorld * a_World) -{ - // Crude data integrity check: - if (a_UncompressedSize < cChunkDef::BlockDataSize) - { - LOGWARNING("Chunk [%d, %d] has too short decompressed data (%d bytes out of %d needed), erasing", - a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, - a_UncompressedSize, cChunkDef::BlockDataSize - ); - EraseChunkData(a_Chunk); - return false; - } - - // Decompress the data: - AString UncompressedData; - int errorcode = UncompressString(a_Data.data(), a_Data.size(), UncompressedData, a_UncompressedSize); - if (errorcode != Z_OK) - { - LOGERROR("Error %d decompressing data for chunk [%d, %d]", - errorcode, - a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ - ); - return false; - } - - if (a_UncompressedSize != (int)UncompressedData.size()) - { - LOGWARNING("Uncompressed data size differs (exp %d bytes, got %d) for chunk [%d, %d]", - a_UncompressedSize, UncompressedData.size(), - a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ - ); - return false; - } - - cEntityList Entities; - cBlockEntityList BlockEntities; - bool IsLightValid = false; - - if (a_UncompressedSize > cChunkDef::BlockDataSize) - { - Json::Value root; // will contain the root value after parsing. - Json::Reader reader; - if ( !reader.parse( UncompressedData.data() + cChunkDef::BlockDataSize, root, false ) ) - { - LOGERROR("Failed to parse trailing JSON in chunk [%d, %d]!", - a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ - ); - } - else - { - LoadEntitiesFromJson(root, Entities, BlockEntities, a_World); - IsLightValid = root.get("IsLightValid", false).asBool(); - } - } - - BLOCKTYPE * BlockData = (BLOCKTYPE *)UncompressedData.data(); - NIBBLETYPE * MetaData = (NIBBLETYPE *)(BlockData + cChunkDef::MetaOffset); - NIBBLETYPE * BlockLight = (NIBBLETYPE *)(BlockData + cChunkDef::LightOffset); - NIBBLETYPE * SkyLight = (NIBBLETYPE *)(BlockData + cChunkDef::SkyLightOffset); - - a_World->SetChunkData( - a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, - BlockData, MetaData, - IsLightValid ? BlockLight : NULL, - IsLightValid ? SkyLight : NULL, - NULL, NULL, - Entities, BlockEntities, - false - ); - - return true; -} - - - - - -bool cWSSCompact::cPAKFile::EraseChunkData(const cChunkCoords & a_Chunk) -{ - int ChunkX = a_Chunk.m_ChunkX; - int ChunkZ = a_Chunk.m_ChunkZ; - int Offset = 0; - for (sChunkHeaders::iterator itr = m_ChunkHeaders.begin(); itr != m_ChunkHeaders.end(); ++itr) - { - if (((*itr)->m_ChunkX == ChunkX) && ((*itr)->m_ChunkZ == ChunkZ)) - { - m_DataContents.erase(Offset, (*itr)->m_CompressedSize); - delete *itr; - itr = m_ChunkHeaders.erase(itr); - return true; - } - Offset += (*itr)->m_CompressedSize; - } - - return false; -} - - - - - -bool cWSSCompact::cPAKFile::SaveChunkToData(const cChunkCoords & a_Chunk, cWorld * a_World) -{ - // Serialize the chunk: - cJsonChunkSerializer Serializer; - if (!a_World->GetChunkData(a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, Serializer)) - { - // Chunk not valid - LOG("cWSSCompact: Trying to save chunk [%d, %d, %d] that has no data, ignoring request.", a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ); - return false; - } - - AString Data; - Data.assign((const char *)Serializer.GetBlockData(), cChunkDef::BlockDataSize); - if (Serializer.HasJsonData()) - { - AString JsonData; - Json::StyledWriter writer; - JsonData = writer.write(Serializer.GetRoot()); - Data.append(JsonData); - } - - // Compress the data: - AString CompressedData; - int errorcode = CompressString(Data.data(), Data.size(), CompressedData); - if ( errorcode != Z_OK ) - { - LOGERROR("Error %i compressing data for chunk [%d, %d, %d]", errorcode, a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ); - return false; - } - - // Erase any existing data for the chunk: - EraseChunkData(a_Chunk); - - // Save the header: - sChunkHeader * Header = new sChunkHeader; - if (Header == NULL) - { - LOGWARNING("Cannot create a new chunk header to save chunk [%d, %d, %d]", a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ); - return false; - } - Header->m_CompressedSize = (int)CompressedData.size(); - Header->m_ChunkX = a_Chunk.m_ChunkX; - Header->m_ChunkZ = a_Chunk.m_ChunkZ; - Header->m_UncompressedSize = (int)Data.size(); - m_ChunkHeaders.push_back(Header); - - m_DataContents.append(CompressedData.data(), CompressedData.size()); - - m_NumDirty++; - return true; -} - - - - - -#define WRITE(Var) \ - if (f.Write(&Var, sizeof(Var)) != sizeof(Var)) \ - { \ - LOGERROR("cWSSCompact: ERROR writing %s to file \"%s\" (line %d); file offset %d", #Var, m_FileName.c_str(), __LINE__, f.Tell()); \ - return; \ - } - -void cWSSCompact::cPAKFile::SynchronizeFile(void) -{ - cFile f; - if (!f.Open(m_FileName, cFile::fmWrite)) - { - LOGERROR("Cannot open PAK file \"%s\" for writing", m_FileName.c_str()); - return; - } - - WRITE(m_PakVersion); - WRITE(m_ChunkVersion); - short NumChunks = (short)m_ChunkHeaders.size(); - WRITE(NumChunks); - for (sChunkHeaders::iterator itr = m_ChunkHeaders.begin(); itr != m_ChunkHeaders.end(); ++itr) - { - WRITE(**itr); - } - if (f.Write(m_DataContents.data(), m_DataContents.size()) != (int)m_DataContents.size()) - { - LOGERROR("cWSSCompact: ERROR writing chunk contents to file \"%s\" (line %d); file offset %d", m_FileName.c_str(), __LINE__, f.Tell()); - return; - } - m_NumDirty = 0; -} - - - - diff --git a/source/WorldStorage/WorldStorage.h b/source/WorldStorage/WorldStorage.h deleted file mode 100644 index bf8dbd3d5..000000000 --- a/source/WorldStorage/WorldStorage.h +++ /dev/null @@ -1,135 +0,0 @@ - -// WorldStorage.h - -// Interfaces to the cWorldStorage class representing the chunk loading / saving thread -// This class decides which storage schema to use for saving; it queries all available schemas for loading -// Also declares the base class for all storage schemas, cWSSchema -// Helper serialization class cJsonChunkSerializer is declared as well - - - - - -#pragma once -#ifndef WORLDSTORAGE_H_INCLUDED -#define WORLDSTORAGE_H_INCLUDED - -#include "../ChunkDef.h" -#include "../OSSupport/IsThread.h" -#include <json/json.h> - - - - - -// fwd: -class cWorld; - - - - - -/// Interface that all the world storage schemas need to implement -class cWSSchema abstract -{ -public: - cWSSchema(cWorld * a_World) : m_World(a_World) {} - virtual ~cWSSchema() {} // Force the descendants' destructors to be virtual - - virtual bool LoadChunk(const cChunkCoords & a_Chunk) = 0; - virtual bool SaveChunk(const cChunkCoords & a_Chunk) = 0; - virtual const AString GetName(void) const = 0; - -protected: - - cWorld * m_World; -} ; - -typedef std::list<cWSSchema *> cWSSchemaList; - - - - - -/// The actual world storage class -class cWorldStorage : - public cIsThread -{ - typedef cIsThread super; - -public: - - cWorldStorage(void); - ~cWorldStorage(); - - void QueueLoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, bool a_Generate); // Queues the chunk for loading; if not loaded, the chunk will be generated if a_Generate is true - void QueueSaveChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ); - - /// Signals that a message should be output to the console when all the chunks have been saved - void QueueSavedMessage(void); - - /// Loads the chunk specified; returns true on success, false on failure - bool LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ); - - void UnqueueLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ); - void UnqueueSave(const cChunkCoords & a_Chunk); - - bool Start(cWorld * a_World, const AString & a_StorageSchemaName); // Hide the cIsThread's Start() method, we need to provide args - void Stop(void); // Hide the cIsThread's Stop() method, we need to signal the event - void WaitForFinish(void); - void WaitForQueuesEmpty(void); - - int GetLoadQueueLength(void); - int GetSaveQueueLength(void); - -protected: - - struct sChunkLoad - { - int m_ChunkX; - int m_ChunkY; - int m_ChunkZ; - bool m_Generate; // If true, the chunk will be generated if it cannot be loaded - - sChunkLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ, bool a_Generate) : m_ChunkX(a_ChunkX), m_ChunkY(a_ChunkY), m_ChunkZ(a_ChunkZ), m_Generate(a_Generate) {} - } ; - - typedef std::list<sChunkLoad> sChunkLoadQueue; - - cWorld * m_World; - AString m_StorageSchemaName; - - // Both queues are locked by the same CS - cCriticalSection m_CSQueues; - sChunkLoadQueue m_LoadQueue; - cChunkCoordsList m_SaveQueue; - - cEvent m_Event; // Set when there's any addition to the queues - cEvent m_evtRemoved; // Set when an item has been removed from the queue, either by the worker thread or the Unqueue methods - - /// All the storage schemas (all used for loading) - cWSSchemaList m_Schemas; - - /// The one storage schema used for saving - cWSSchema * m_SaveSchema; - - void InitSchemas(void); - - virtual void Execute(void) override; - - /// Loads one chunk from the queue (if any queued); returns true if there are more chunks in the load queue - bool LoadOneChunk(void); - - /// Saves one chunk from the queue (if any queued); returns true if there are more chunks in the save queue - bool SaveOneChunk(void); -} ; - - - - - -#endif // WORLDSTORAGE_H_INCLUDED - - - - diff --git a/source/tolua++.h b/source/tolua++.h deleted file mode 100644 index ed5344926..000000000 --- a/source/tolua++.h +++ /dev/null @@ -1,186 +0,0 @@ -/* tolua -** Support code for Lua bindings. -** Written by Waldemar Celes -** TeCGraf/PUC-Rio -** Apr 2003 -** $Id: $ -*/ - -/* This code is free software; you can redistribute it and/or modify it. -** The software provided hereunder is on an "as is" basis, and -** the author has no obligation to provide maintenance, support, updates, -** enhancements, or modifications. -*/ - - -#ifndef TOLUA_H -#define TOLUA_H - -#ifndef TOLUA_API -#define TOLUA_API extern -#endif - -#define TOLUA_VERSION "tolua++-1.0.92" - -#ifdef __cplusplus -extern "C" { -#endif - -#define tolua_pushcppstring(x,y) tolua_pushstring(x,y.c_str()) -#define tolua_iscppstring tolua_isstring - -#define tolua_iscppstringarray tolua_isstringarray -#define tolua_pushfieldcppstring(L,lo,idx,s) tolua_pushfieldstring(L, lo, idx, s.c_str()) - -#ifndef TEMPLATE_BIND - #define TEMPLATE_BIND(p) -#endif - -#define TOLUA_TEMPLATE_BIND(p) - -#define TOLUA_PROTECTED_DESTRUCTOR -#define TOLUA_PROPERTY_TYPE(p) - -typedef int lua_Object; - -#include "lua.h" -#include "lauxlib.h" - -struct tolua_Error -{ - int index; - int array; - const char* type; -}; -typedef struct tolua_Error tolua_Error; - -#define TOLUA_NOPEER LUA_REGISTRYINDEX /* for lua 5.1 */ - -TOLUA_API const char* tolua_typename (lua_State* L, int lo); -TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err); -TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err); -TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err); -TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err); -TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err); -TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err); -TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err); -TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err); -TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err); -TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err); -TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err); -TOLUA_API int tolua_isvaluearray - (lua_State* L, int lo, int dim, int def, tolua_Error* err); -TOLUA_API int tolua_isbooleanarray - (lua_State* L, int lo, int dim, int def, tolua_Error* err); -TOLUA_API int tolua_isnumberarray - (lua_State* L, int lo, int dim, int def, tolua_Error* err); -TOLUA_API int tolua_isstringarray - (lua_State* L, int lo, int dim, int def, tolua_Error* err); -TOLUA_API int tolua_istablearray - (lua_State* L, int lo, int dim, int def, tolua_Error* err); -TOLUA_API int tolua_isuserdataarray - (lua_State* L, int lo, int dim, int def, tolua_Error* err); -TOLUA_API int tolua_isusertypearray - (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err); - -TOLUA_API void tolua_open (lua_State* L); - -TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size); -TOLUA_API int tolua_register_gc (lua_State* L, int lo); -TOLUA_API int tolua_default_collect (lua_State* tolua_S); - -TOLUA_API void tolua_usertype (lua_State* L, const char* type); -TOLUA_API void tolua_beginmodule (lua_State* L, const char* name); -TOLUA_API void tolua_endmodule (lua_State* L); -TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar); -TOLUA_API void tolua_class (lua_State* L, const char* name, const char* base); -TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col); -TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func); -TOLUA_API void tolua_constant (lua_State* L, const char* name, lua_Number value); -TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set); -TOLUA_API void tolua_array (lua_State* L,const char* name, lua_CFunction get, lua_CFunction set); - -/* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type); */ -/* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */ - -TOLUA_API void tolua_pushvalue (lua_State* L, int lo); -TOLUA_API void tolua_pushboolean (lua_State* L, int value); -TOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value); -TOLUA_API void tolua_pushstring (lua_State* L, const char* value); -TOLUA_API void tolua_pushuserdata (lua_State* L, void* value); -TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type); -TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type); -TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v); -TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v); -TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v); -TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v); -TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v); -TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type); -TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type); - -TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def); -TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def); -TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def); -TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def); -TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def); -TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def); -TOLUA_API lua_Number tolua_tofieldnumber (lua_State* L, int lo, int index, lua_Number def); -TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def); -TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def); -TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def); -TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def); -TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def); - -TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name); - -TOLUA_API int class_gc_event (lua_State* L); - -#ifdef __cplusplus -static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) { - - const char* s = tolua_tostring(L, narg, def); - return s?s:""; -}; - -static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) { - - const char* s = tolua_tofieldstring(L, lo, index, def); - return s?s:""; -}; - -#else -#define tolua_tocppstring tolua_tostring -#define tolua_tofieldcppstring tolua_tofieldstring -#endif - -TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index); - -#ifndef Mtolua_new -#define Mtolua_new(EXP) new EXP -#endif - -#ifndef Mtolua_delete -#define Mtolua_delete(EXP) delete EXP -#endif - -#ifndef Mtolua_new_dim -#define Mtolua_new_dim(EXP, len) new EXP[len] -#endif - -#ifndef Mtolua_delete_dim -#define Mtolua_delete_dim(EXP) delete [] EXP -#endif - -#ifndef tolua_outside -#define tolua_outside -#endif - -#ifndef tolua_owned -#define tolua_owned -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/source/AllToLua.bat b/src/AllToLua.bat index f7867fadb..f7867fadb 100644 --- a/source/AllToLua.bat +++ b/src/AllToLua.bat diff --git a/src/AllToLua.pkg b/src/AllToLua.pkg new file mode 100644 index 000000000..fe9217104 --- /dev/null +++ b/src/AllToLua.pkg @@ -0,0 +1,81 @@ + +$#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +$#include "tolua_base.h" + +// Typedefs from Globals.h, so that we don't have to include that file: +typedef long long Int64; +typedef int Int32; +typedef short Int16; + +typedef unsigned long long UInt64; +typedef unsigned int UInt32; +typedef unsigned short UInt16; + + +$cfile "ChunkDef.h" + +$cfile "../lib/inifile/iniFile.h" + +$cfile "OSSupport/File.h" + +$cfile "BlockID.h" +$cfile "StringUtils.h" +$cfile "Defines.h" +$cfile "LuaFunctions.h" +$cfile "ChatColor.h" +$cfile "ClientHandle.h" +$cfile "Entities/Entity.h" +$cfile "Entities/Pawn.h" +$cfile "Entities/Player.h" +$cfile "Entities/Pickup.h" +$cfile "Entities/ProjectileEntity.h" +$cfile "PluginManager.h" +$cfile "Plugin.h" +$cfile "PluginLua.h" +$cfile "Server.h" +$cfile "World.h" +$cfile "Inventory.h" +$cfile "Enchantments.h" +$cfile "Item.h" +$cfile "ItemGrid.h" +$cfile "BlockEntities/BlockEntity.h" +$cfile "BlockEntities/BlockEntityWithItems.h" +$cfile "BlockEntities/ChestEntity.h" +$cfile "BlockEntities/DropSpenserEntity.h" +$cfile "BlockEntities/DispenserEntity.h" +$cfile "BlockEntities/DropperEntity.h" +$cfile "BlockEntities/FurnaceEntity.h" +$cfile "BlockEntities/HopperEntity.h" +$cfile "BlockEntities/JukeboxEntity.h" +$cfile "BlockEntities/NoteEntity.h" +$cfile "BlockEntities/SignEntity.h" +$cfile "WebAdmin.h" +$cfile "WebPlugin.h" +$cfile "Root.h" +$cfile "Vector3f.h" +$cfile "Vector3d.h" +$cfile "Vector3i.h" +$cfile "Matrix4f.h" +$cfile "Cuboid.h" +$cfile "BoundingBox.h" +$cfile "Tracer.h" +$cfile "Group.h" +$cfile "BlockArea.h" +$cfile "Generating/ChunkDesc.h" +$cfile "CraftingRecipes.h" +$cfile "UI/Window.h" +$cfile "LuaWindow.h" +$cfile "Mobs/Monster.h" + + + + + +// Need to declare this class so that the usertype is properly registered in Bindings.cpp - +// it seems impossible to register a usertype in ManualBindings.cpp +class cLineBlockTracer; + + + + diff --git a/source/AllToLua.sh b/src/AllToLua.sh index 887c2490c..887c2490c 100755 --- a/source/AllToLua.sh +++ b/src/AllToLua.sh diff --git a/src/Authenticator.cpp b/src/Authenticator.cpp new file mode 100644 index 000000000..4cbe3beed --- /dev/null +++ b/src/Authenticator.cpp @@ -0,0 +1,267 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Authenticator.h" +#include "OSSupport/BlockingTCPLink.h" +#include "Root.h" +#include "Server.h" + +#include "inifile/iniFile.h" + +#include <sstream> + + + + + +#define DEFAULT_AUTH_SERVER "session.minecraft.net" +#define DEFAULT_AUTH_ADDRESS "/game/checkserver.jsp?user=%USERNAME%&serverId=%SERVERID%" +#define MAX_REDIRECTS 10 + + + + + +cAuthenticator::cAuthenticator(void) : + super("cAuthenticator"), + m_Server(DEFAULT_AUTH_SERVER), + m_Address(DEFAULT_AUTH_ADDRESS), + m_ShouldAuthenticate(true) +{ +} + + + + + +cAuthenticator::~cAuthenticator() +{ + Stop(); +} + + + + + +/// Read custom values from INI +void cAuthenticator::ReadINI(cIniFile & IniFile) +{ + m_Server = IniFile.GetValueSet("Authentication", "Server", DEFAULT_AUTH_SERVER); + m_Address = IniFile.GetValueSet("Authentication", "Address", DEFAULT_AUTH_ADDRESS); + m_ShouldAuthenticate = IniFile.GetValueSetB("Authentication", "Authenticate", true); +} + + + + + +/// Queues a request for authenticating a user. If the auth fails, the user is kicked +void cAuthenticator::Authenticate(int a_ClientID, const AString & a_UserName, const AString & a_ServerHash) +{ + if (!m_ShouldAuthenticate) + { + cRoot::Get()->AuthenticateUser(a_ClientID); + return; + } + + cCSLock Lock(m_CS); + m_Queue.push_back(cUser(a_ClientID, a_UserName, a_ServerHash)); + m_QueueNonempty.Set(); +} + + + + + +void cAuthenticator::Start(cIniFile & IniFile) +{ + ReadINI(IniFile); + m_ShouldTerminate = false; + super::Start(); +} + + + + + +void cAuthenticator::Stop(void) +{ + m_ShouldTerminate = true; + m_QueueNonempty.Set(); + Wait(); +} + + + + + +void cAuthenticator::Execute(void) +{ + for (;;) + { + cCSLock Lock(m_CS); + while (!m_ShouldTerminate && (m_Queue.size() == 0)) + { + cCSUnlock Unlock(Lock); + m_QueueNonempty.Wait(); + } + if (m_ShouldTerminate) + { + return; + } + ASSERT(!m_Queue.empty()); + + int ClientID = m_Queue.front().m_ClientID; + AString UserName = m_Queue.front().m_Name; + AString ActualAddress = m_Address; + ReplaceString(ActualAddress, "%USERNAME%", UserName); + ReplaceString(ActualAddress, "%SERVERID%", m_Queue.front().m_ServerID); + m_Queue.pop_front(); + Lock.Unlock(); + + if (!AuthFromAddress(m_Server, ActualAddress, UserName)) + { + cRoot::Get()->KickUser(ClientID, "Failed to authenticate account!"); + } + else + { + cRoot::Get()->AuthenticateUser(ClientID); + } + } // for (-ever) +} + + + + + +bool cAuthenticator::AuthFromAddress(const AString & a_Server, const AString & a_Address, const AString & a_UserName, int a_Level /* = 1 */) +{ + // Returns true if the user authenticated okay, false on error; iLevel is the recursion deptht (bails out if too deep) + + cBlockingTCPLink Link; + if (!Link.Connect(a_Server.c_str(), 80)) + { + LOGERROR("cAuthenticator: cannot connect to auth server \"%s\", kicking user \"%s\"", a_Server.c_str(), a_Server.c_str()); + return false; + } + + Link.SendMessage( AString( "GET " + a_Address + " HTTP/1.1\r\n" ).c_str()); + Link.SendMessage( AString( "User-Agent: MCServer\r\n" ).c_str()); + Link.SendMessage( AString( "Host: " + a_Server + "\r\n" ).c_str()); + //Link.SendMessage( AString( "Host: session.minecraft.net\r\n" ).c_str()); + Link.SendMessage( AString( "Accept: */*\r\n" ).c_str()); + Link.SendMessage( AString( "Connection: close\r\n" ).c_str()); //Close so we don´t have to mess with the Content-Length :) + Link.SendMessage( AString( "\r\n" ).c_str()); + AString DataRecvd; + Link.ReceiveData(DataRecvd); + Link.CloseSocket(); + + std::stringstream ss(DataRecvd); + + // Parse the data received: + std::string temp; + ss >> temp; + bool bRedirect = false; + bool bOK = false; + if ((temp.compare("HTTP/1.1") == 0) || (temp.compare("HTTP/1.0") == 0)) + { + int code; + ss >> code; + if (code == 302) + { + // redirect blabla + LOGINFO("Need to redirect!"); + if (a_Level > MAX_REDIRECTS) + { + LOGERROR("cAuthenticator: received too many levels of redirection from auth server \"%s\" for user \"%s\", bailing out and kicking the user", a_Server.c_str(), a_UserName.c_str()); + return false; + } + bRedirect = true; + } + else if (code == 200) + { + LOGD("cAuthenticator: Received status 200 OK! :D"); + bOK = true; + } + } + else + { + LOGERROR("cAuthenticator: cannot parse auth reply from server \"%s\" for user \"%s\", kicking the user.", a_Server.c_str(), a_UserName.c_str()); + return false; + } + + if( bRedirect ) + { + AString Location; + // Search for "Location:" + bool bFoundLocation = false; + while( !bFoundLocation && ss.good() ) + { + char c = 0; + while( c != '\n' ) + { + ss.get( c ); + } + AString Name; + ss >> Name; + if (Name.compare("Location:") == 0) + { + bFoundLocation = true; + ss >> Location; + } + } + if (!bFoundLocation) + { + LOGERROR("cAuthenticator: received invalid redirection from auth server \"%s\" for user \"%s\", kicking user.", a_Server.c_str(), a_UserName.c_str()); + return false; + } + + Location = Location.substr(strlen("http://"), std::string::npos); // Strip http:// + std::string Server = Location.substr( 0, Location.find( "/" ) ); // Only leave server address + Location = Location.substr( Server.length(), std::string::npos); + return AuthFromAddress(Server, Location, a_UserName, a_Level + 1); + } + + if (!bOK) + { + LOGERROR("cAuthenticator: received an error from auth server \"%s\" for user \"%s\", kicking user.", a_Server.c_str(), a_UserName.c_str()); + return false; + } + + // Header says OK, so receive the rest. + // Go past header, double \n means end of headers + char c = 0; + while (ss.good()) + { + while (c != '\n') + { + ss.get(c); + } + ss.get(c); + if( c == '\n' || c == '\r' || ss.peek() == '\r' || ss.peek() == '\n' ) + break; + } + if (!ss.good()) + { + LOGERROR("cAuthenticator: error while parsing response body from auth server \"%s\" for user \"%s\", kicking user.", a_Server.c_str(), a_UserName.c_str()); + return false; + } + + std::string Result; + ss >> Result; + LOGD("cAuthenticator: Authentication result was %s", Result.c_str()); + + if (Result.compare("YES") == 0) //Works well + { + LOGINFO("Authentication result \"YES\", player authentication success!"); + return true; + } + + + LOGINFO("Authentication result was \"%s\", player authentication failure!", Result.c_str()); + return false; +} + + + + diff --git a/source/Authenticator.h b/src/Authenticator.h index 02cd6f4c5..02cd6f4c5 100644 --- a/source/Authenticator.h +++ b/src/Authenticator.h diff --git a/src/Bindings.cpp b/src/Bindings.cpp new file mode 100644 index 000000000..f06fb4c03 --- /dev/null +++ b/src/Bindings.cpp @@ -0,0 +1,31660 @@ +/* +** Lua binding: AllToLua +** Generated automatically by tolua++-1.0.92 on 11/26/13 22:11:10. +*/ + +#ifndef __cplusplus +#include "stdlib.h" +#endif +#include "string.h" + +#include "tolua++.h" + +/* Exported function */ +TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S); + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules +#include "tolua_base.h" +#include "ChunkDef.h" +#include "inifile/iniFile.h" +#include "OSSupport/File.h" +#include "BlockID.h" +#include "StringUtils.h" +#include "Defines.h" +#include "LuaFunctions.h" +#include "ChatColor.h" +#include "ClientHandle.h" +#include "Entities/Entity.h" +#include "Entities/Pawn.h" +#include "Entities/Player.h" +#include "Entities/Pickup.h" +#include "Entities/ProjectileEntity.h" +#include "PluginManager.h" +#include "Plugin.h" +#include "PluginLua.h" +#include "Server.h" +#include "World.h" +#include "Inventory.h" +#include "Enchantments.h" +#include "Item.h" +#include "ItemGrid.h" +#include "BlockEntities/BlockEntity.h" +#include "BlockEntities/BlockEntityWithItems.h" +#include "BlockEntities/ChestEntity.h" +#include "BlockEntities/DropSpenserEntity.h" +#include "BlockEntities/DispenserEntity.h" +#include "BlockEntities/DropperEntity.h" +#include "BlockEntities/FurnaceEntity.h" +#include "BlockEntities/HopperEntity.h" +#include "BlockEntities/JukeboxEntity.h" +#include "BlockEntities/NoteEntity.h" +#include "BlockEntities/SignEntity.h" +#include "WebAdmin.h" +#include "WebPlugin.h" +#include "Root.h" +#include "Vector3f.h" +#include "Vector3d.h" +#include "Vector3i.h" +#include "Matrix4f.h" +#include "Cuboid.h" +#include "BoundingBox.h" +#include "Tracer.h" +#include "Group.h" +#include "BlockArea.h" +#include "Generating/ChunkDesc.h" +#include "CraftingRecipes.h" +#include "UI/Window.h" +#include "LuaWindow.h" +#include "Mobs/Monster.h" + +/* function to release collected object via destructor */ +#ifdef __cplusplus + +static int tolua_collect_sWebAdminPage (lua_State* tolua_S) +{ + sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cBoundingBox (lua_State* tolua_S) +{ + cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cItem (lua_State* tolua_S) +{ + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_Vector3f (lua_State* tolua_S) +{ + Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cIniFile (lua_State* tolua_S) +{ + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cPickup (lua_State* tolua_S) +{ + cPickup* self = (cPickup*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cItems (lua_State* tolua_S) +{ + cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cBlockArea (lua_State* tolua_S) +{ + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cTracer (lua_State* tolua_S) +{ + cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cCraftingGrid (lua_State* tolua_S) +{ + cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cCuboid (lua_State* tolua_S) +{ + cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cBlockEntity (lua_State* tolua_S) +{ + cBlockEntity* self = (cBlockEntity*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_Vector3i (lua_State* tolua_S) +{ + Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cEnchantments (lua_State* tolua_S) +{ + cEnchantments* self = (cEnchantments*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_cLuaWindow (lua_State* tolua_S) +{ + cLuaWindow* self = (cLuaWindow*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} + +static int tolua_collect_Vector3d (lua_State* tolua_S) +{ + Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); + Mtolua_delete(self); + return 0; +} +#endif + + +/* function to register type */ +static void tolua_reg_types (lua_State* tolua_S) +{ + tolua_usertype(tolua_S,"cThrownEnderPearlEntity"); + tolua_usertype(tolua_S,"cFurnaceEntity"); + tolua_usertype(tolua_S,"cEntity"); + tolua_usertype(tolua_S,"cExpBottleEntity"); + tolua_usertype(tolua_S,"cEnchantments"); + tolua_usertype(tolua_S,"cMonster"); + tolua_usertype(tolua_S,"cPluginLua"); + tolua_usertype(tolua_S,"cRoot"); + tolua_usertype(tolua_S,"std::vector<cIniFile::key>"); + tolua_usertype(tolua_S,"cPickup"); + tolua_usertype(tolua_S,"sWebAdminPage"); + tolua_usertype(tolua_S,"cFireChargeEntity"); + tolua_usertype(tolua_S,"cClientHandle"); + tolua_usertype(tolua_S,"cChunkDesc"); + tolua_usertype(tolua_S,"cPluginManager"); + tolua_usertype(tolua_S,"Vector3f"); + tolua_usertype(tolua_S,"cCraftingRecipes"); + tolua_usertype(tolua_S,"cJukeboxEntity"); + tolua_usertype(tolua_S,"cChestEntity"); + tolua_usertype(tolua_S,"cDispenserEntity"); + tolua_usertype(tolua_S,"cGhastFireballEntity"); + tolua_usertype(tolua_S,"cLineBlockTracer"); + tolua_usertype(tolua_S,"cListeners"); + tolua_usertype(tolua_S,"cThrownSnowballEntity"); + tolua_usertype(tolua_S,"cFireworkEntity"); + tolua_usertype(tolua_S,"TakeDamageInfo"); + tolua_usertype(tolua_S,"cCraftingRecipe"); + tolua_usertype(tolua_S,"cPlugin"); + tolua_usertype(tolua_S,"cItemGrid"); + tolua_usertype(tolua_S,"cHTTPServer::cCallbacks"); + tolua_usertype(tolua_S,"cLuaWindow"); + tolua_usertype(tolua_S,"cServer"); + tolua_usertype(tolua_S,"cHopperEntity"); + tolua_usertype(tolua_S,"std::vector<AString>"); + tolua_usertype(tolua_S,"cBlockEntityWithItems"); + tolua_usertype(tolua_S,"cWindow"); + tolua_usertype(tolua_S,"cCraftingGrid"); + tolua_usertype(tolua_S,"cWorld"); + tolua_usertype(tolua_S,"cBlockArea"); + tolua_usertype(tolua_S,"cItem"); + tolua_usertype(tolua_S,"cGroup"); + tolua_usertype(tolua_S,"cArrowEntity"); + tolua_usertype(tolua_S,"cDropSpenserEntity"); + tolua_usertype(tolua_S,"cTracer"); + tolua_usertype(tolua_S,"cBoundingBox"); + tolua_usertype(tolua_S,"cCuboid"); + tolua_usertype(tolua_S,"cNoteEntity"); + tolua_usertype(tolua_S,"Vector3i"); + tolua_usertype(tolua_S,"cBlockEntity"); + tolua_usertype(tolua_S,"cCriticalSection"); + tolua_usertype(tolua_S,"HTTPTemplateRequest"); + tolua_usertype(tolua_S,"Vector3d"); + tolua_usertype(tolua_S,"cFile"); + tolua_usertype(tolua_S,"cItems"); + tolua_usertype(tolua_S,"cWebPlugin"); + tolua_usertype(tolua_S,"cWebAdmin"); + tolua_usertype(tolua_S,"cChatColor"); + tolua_usertype(tolua_S,"cIniFile"); + tolua_usertype(tolua_S,"HTTPRequest"); + tolua_usertype(tolua_S,"HTTPFormData"); + tolua_usertype(tolua_S,"cPawn"); + tolua_usertype(tolua_S,"cPlayer"); + tolua_usertype(tolua_S,"cGroupManager"); + tolua_usertype(tolua_S,"cSignEntity"); + tolua_usertype(tolua_S,"cItemGrid::cListener"); + tolua_usertype(tolua_S,"cProjectileEntity"); + tolua_usertype(tolua_S,"cDropperEntity"); + tolua_usertype(tolua_S,"cInventory"); + tolua_usertype(tolua_S,"cThrownEggEntity"); +} + +/* method: new of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_new00 +static int tolua_AllToLua_cIniFile_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cIniFile* tolua_ret = (cIniFile*) Mtolua_new((cIniFile)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cIniFile"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_new00_local +static int tolua_AllToLua_cIniFile_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cIniFile* tolua_ret = (cIniFile*) Mtolua_new((cIniFile)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cIniFile"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CaseSensitive of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_CaseSensitive00 +static int tolua_AllToLua_cIniFile_CaseSensitive00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CaseSensitive'", NULL); +#endif + { + self->CaseSensitive(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CaseSensitive'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CaseInsensitive of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_CaseInsensitive00 +static int tolua_AllToLua_cIniFile_CaseInsensitive00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CaseInsensitive'", NULL); +#endif + { + self->CaseInsensitive(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CaseInsensitive'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ReadFile of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_ReadFile00 +static int tolua_AllToLua_cIniFile_ReadFile00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isboolean(tolua_S,3,1,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); + bool a_AllowExampleRedirect = ((bool) tolua_toboolean(tolua_S,3,true)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ReadFile'", NULL); +#endif + { + bool tolua_ret = (bool) self->ReadFile(a_FileName,a_AllowExampleRedirect); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_FileName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ReadFile'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: WriteFile of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_WriteFile00 +static int tolua_AllToLua_cIniFile_WriteFile00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'WriteFile'", NULL); +#endif + { + bool tolua_ret = (bool) self->WriteFile(a_FileName); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_FileName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'WriteFile'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Clear of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_Clear00 +static int tolua_AllToLua_cIniFile_Clear00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); +#endif + { + self->Clear(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FindKey of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_FindKey00 +static int tolua_AllToLua_cIniFile_FindKey00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FindKey'", NULL); +#endif + { + int tolua_ret = (int) self->FindKey(keyname); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'FindKey'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FindValue of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_FindValue00 +static int tolua_AllToLua_cIniFile_FindValue00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FindValue'", NULL); +#endif + { + int tolua_ret = (int) self->FindValue(keyID,valuename); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'FindValue'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNumKeys of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumKeys00 +static int tolua_AllToLua_cIniFile_GetNumKeys00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumKeys'", NULL); +#endif + { + int tolua_ret = (int) self->GetNumKeys(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetNumKeys'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddKeyName of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_AddKeyName00 +static int tolua_AllToLua_cIniFile_AddKeyName00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddKeyName'", NULL); +#endif + { + int tolua_ret = (int) self->AddKeyName(keyname); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddKeyName'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetKeyName of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetKeyName00 +static int tolua_AllToLua_cIniFile_GetKeyName00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetKeyName'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetKeyName(keyID); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetKeyName'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNumValues of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumValues00 +static int tolua_AllToLua_cIniFile_GetNumValues00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumValues'", NULL); +#endif + { + int tolua_ret = (int) self->GetNumValues(keyname); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetNumValues'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNumValues of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumValues01 +static int tolua_AllToLua_cIniFile_GetNumValues01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumValues'", NULL); +#endif + { + int tolua_ret = (int) self->GetNumValues(keyID); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cIniFile_GetNumValues00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValueName of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueName00 +static int tolua_AllToLua_cIniFile_GetValueName00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueName'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetValueName(keyname,valueID); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetValueName'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValueName of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueName01 +static int tolua_AllToLua_cIniFile_GetValueName01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueName'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetValueName(keyID,valueID); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cIniFile_GetValueName00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValue of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValue00 +static int tolua_AllToLua_cIniFile_GetValue00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValue'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetValue(keyname,valuename); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetValue'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValue of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValue01 +static int tolua_AllToLua_cIniFile_GetValue01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_iscppstring(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const AString defValue = ((const AString) tolua_tocppstring(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValue'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetValue(keyname,valuename,defValue); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + tolua_pushcppstring(tolua_S,(const char*)defValue); + } + } + return 4; +tolua_lerror: + return tolua_AllToLua_cIniFile_GetValue00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValue of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValue02 +static int tolua_AllToLua_cIniFile_GetValue02(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValue'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetValue(keyID,valueID); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cIniFile_GetValue01(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValue of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValue03 +static int tolua_AllToLua_cIniFile_GetValue03(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_iscppstring(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); + const AString defValue = ((const AString) tolua_tocppstring(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValue'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetValue(keyID,valueID,defValue); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)defValue); + } + } + return 2; +tolua_lerror: + return tolua_AllToLua_cIniFile_GetValue02(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValueF of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueF00 +static int tolua_AllToLua_cIniFile_GetValueF00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,1,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const double defValue = ((const double) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueF'", NULL); +#endif + { + double tolua_ret = (double) self->GetValueF(keyname,valuename,defValue); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetValueF'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValueI of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueI00 +static int tolua_AllToLua_cIniFile_GetValueI00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,1,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const int defValue = ((const int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueI'", NULL); +#endif + { + int tolua_ret = (int) self->GetValueI(keyname,valuename,defValue); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetValueI'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValueB of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueB00 +static int tolua_AllToLua_cIniFile_GetValueB00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isboolean(tolua_S,4,1,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const bool defValue = ((const bool) tolua_toboolean(tolua_S,4,false)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueB'", NULL); +#endif + { + bool tolua_ret = (bool) self->GetValueB(keyname,valuename,defValue); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetValueB'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValueSet of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueSet00 +static int tolua_AllToLua_cIniFile_GetValueSet00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueSet'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetValueSet(keyname,valuename); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetValueSet'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValueSet of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueSet01 +static int tolua_AllToLua_cIniFile_GetValueSet01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_iscppstring(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const AString defValue = ((const AString) tolua_tocppstring(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueSet'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetValueSet(keyname,valuename,defValue); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + tolua_pushcppstring(tolua_S,(const char*)defValue); + } + } + return 4; +tolua_lerror: + return tolua_AllToLua_cIniFile_GetValueSet00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValueSetF of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueSetF00 +static int tolua_AllToLua_cIniFile_GetValueSetF00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,1,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const double defValue = ((const double) tolua_tonumber(tolua_S,4,0.0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueSetF'", NULL); +#endif + { + double tolua_ret = (double) self->GetValueSetF(keyname,valuename,defValue); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetValueSetF'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValueSetI of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueSetI00 +static int tolua_AllToLua_cIniFile_GetValueSetI00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,1,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const int defValue = ((const int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueSetI'", NULL); +#endif + { + int tolua_ret = (int) self->GetValueSetI(keyname,valuename,defValue); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetValueSetI'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetValueSetB of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetValueSetB00 +static int tolua_AllToLua_cIniFile_GetValueSetB00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isboolean(tolua_S,4,1,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const bool defValue = ((const bool) tolua_toboolean(tolua_S,4,false)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetValueSetB'", NULL); +#endif + { + bool tolua_ret = (bool) self->GetValueSetB(keyname,valuename,defValue); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetValueSetB'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetValue of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_SetValue00 +static int tolua_AllToLua_cIniFile_SetValue00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_iscppstring(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); + const AString value = ((const AString) tolua_tocppstring(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValue'", NULL); +#endif + { + bool tolua_ret = (bool) self->SetValue(keyID,valueID,value); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)value); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetValue'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetValue of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_SetValue01 +static int tolua_AllToLua_cIniFile_SetValue01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_iscppstring(tolua_S,4,0,&tolua_err) || + !tolua_isboolean(tolua_S,5,1,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const AString value = ((const AString) tolua_tocppstring(tolua_S,4,0)); + const bool create = ((const bool) tolua_toboolean(tolua_S,5,true)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValue'", NULL); +#endif + { + bool tolua_ret = (bool) self->SetValue(keyname,valuename,value,create); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + tolua_pushcppstring(tolua_S,(const char*)value); + } + } + return 4; +tolua_lerror: + return tolua_AllToLua_cIniFile_SetValue00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetValueI of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_SetValueI00 +static int tolua_AllToLua_cIniFile_SetValueI00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isboolean(tolua_S,5,1,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const int value = ((const int) tolua_tonumber(tolua_S,4,0)); + const bool create = ((const bool) tolua_toboolean(tolua_S,5,true)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValueI'", NULL); +#endif + { + bool tolua_ret = (bool) self->SetValueI(keyname,valuename,value,create); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetValueI'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetValueB of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_SetValueB00 +static int tolua_AllToLua_cIniFile_SetValueB00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isboolean(tolua_S,4,0,&tolua_err) || + !tolua_isboolean(tolua_S,5,1,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const bool value = ((const bool) tolua_toboolean(tolua_S,4,0)); + const bool create = ((const bool) tolua_toboolean(tolua_S,5,true)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValueB'", NULL); +#endif + { + bool tolua_ret = (bool) self->SetValueB(keyname,valuename,value,create); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetValueB'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetValueF of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_SetValueF00 +static int tolua_AllToLua_cIniFile_SetValueF00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isboolean(tolua_S,5,1,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const double value = ((const double) tolua_tonumber(tolua_S,4,0)); + const bool create = ((const bool) tolua_toboolean(tolua_S,5,true)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetValueF'", NULL); +#endif + { + bool tolua_ret = (bool) self->SetValueF(keyname,valuename,value,create); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetValueF'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DeleteValueByID of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteValueByID00 +static int tolua_AllToLua_cIniFile_DeleteValueByID00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int valueID = ((const int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteValueByID'", NULL); +#endif + { + bool tolua_ret = (bool) self->DeleteValueByID(keyID,valueID); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DeleteValueByID'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DeleteValue of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteValue00 +static int tolua_AllToLua_cIniFile_DeleteValue00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString valuename = ((const AString) tolua_tocppstring(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteValue'", NULL); +#endif + { + bool tolua_ret = (bool) self->DeleteValue(keyname,valuename); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)valuename); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DeleteValue'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DeleteKey of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteKey00 +static int tolua_AllToLua_cIniFile_DeleteKey00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKey'", NULL); +#endif + { + bool tolua_ret = (bool) self->DeleteKey(keyname); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DeleteKey'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNumHeaderComments of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumHeaderComments00 +static int tolua_AllToLua_cIniFile_GetNumHeaderComments00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumHeaderComments'", NULL); +#endif + { + int tolua_ret = (int) self->GetNumHeaderComments(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetNumHeaderComments'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddHeaderComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_AddHeaderComment00 +static int tolua_AllToLua_cIniFile_AddHeaderComment00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString comment = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddHeaderComment'", NULL); +#endif + { + self->AddHeaderComment(comment); + tolua_pushcppstring(tolua_S,(const char*)comment); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddHeaderComment'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetHeaderComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetHeaderComment00 +static int tolua_AllToLua_cIniFile_GetHeaderComment00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const int commentID = ((const int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeaderComment'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetHeaderComment(commentID); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHeaderComment'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DeleteHeaderComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteHeaderComment00 +static int tolua_AllToLua_cIniFile_DeleteHeaderComment00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + int commentID = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteHeaderComment'", NULL); +#endif + { + bool tolua_ret = (bool) self->DeleteHeaderComment(commentID); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DeleteHeaderComment'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DeleteHeaderComments of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteHeaderComments00 +static int tolua_AllToLua_cIniFile_DeleteHeaderComments00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteHeaderComments'", NULL); +#endif + { + self->DeleteHeaderComments(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DeleteHeaderComments'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNumKeyComments of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumKeyComments00 +static int tolua_AllToLua_cIniFile_GetNumKeyComments00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumKeyComments'", NULL); +#endif + { + int tolua_ret = (int) self->GetNumKeyComments(keyID); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetNumKeyComments'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNumKeyComments of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetNumKeyComments01 +static int tolua_AllToLua_cIniFile_GetNumKeyComments01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumKeyComments'", NULL); +#endif + { + int tolua_ret = (int) self->GetNumKeyComments(keyname); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + } + } + return 2; +tolua_lerror: + return tolua_AllToLua_cIniFile_GetNumKeyComments00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddKeyComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_AddKeyComment00 +static int tolua_AllToLua_cIniFile_AddKeyComment00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const AString comment = ((const AString) tolua_tocppstring(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddKeyComment'", NULL); +#endif + { + bool tolua_ret = (bool) self->AddKeyComment(keyID,comment); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)comment); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddKeyComment'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddKeyComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_AddKeyComment01 +static int tolua_AllToLua_cIniFile_AddKeyComment01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString comment = ((const AString) tolua_tocppstring(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddKeyComment'", NULL); +#endif + { + bool tolua_ret = (bool) self->AddKeyComment(keyname,comment); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + tolua_pushcppstring(tolua_S,(const char*)comment); + } + } + return 3; +tolua_lerror: + return tolua_AllToLua_cIniFile_AddKeyComment00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetKeyComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetKeyComment00 +static int tolua_AllToLua_cIniFile_GetKeyComment00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int commentID = ((const int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetKeyComment'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetKeyComment(keyID,commentID); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetKeyComment'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetKeyComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_GetKeyComment01 +static int tolua_AllToLua_cIniFile_GetKeyComment01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + const cIniFile* self = (const cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const int commentID = ((const int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetKeyComment'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetKeyComment(keyname,commentID); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + } + } + return 2; +tolua_lerror: + return tolua_AllToLua_cIniFile_GetKeyComment00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DeleteKeyComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteKeyComment00 +static int tolua_AllToLua_cIniFile_DeleteKeyComment00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); + const int commentID = ((const int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKeyComment'", NULL); +#endif + { + bool tolua_ret = (bool) self->DeleteKeyComment(keyID,commentID); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DeleteKeyComment'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DeleteKeyComment of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteKeyComment01 +static int tolua_AllToLua_cIniFile_DeleteKeyComment01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const int commentID = ((const int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKeyComment'", NULL); +#endif + { + bool tolua_ret = (bool) self->DeleteKeyComment(keyname,commentID); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + } + } + return 2; +tolua_lerror: + return tolua_AllToLua_cIniFile_DeleteKeyComment00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DeleteKeyComments of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteKeyComments00 +static int tolua_AllToLua_cIniFile_DeleteKeyComments00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const int keyID = ((const int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKeyComments'", NULL); +#endif + { + bool tolua_ret = (bool) self->DeleteKeyComments(keyID); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DeleteKeyComments'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DeleteKeyComments of class cIniFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cIniFile_DeleteKeyComments01 +static int tolua_AllToLua_cIniFile_DeleteKeyComments01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + cIniFile* self = (cIniFile*) tolua_tousertype(tolua_S,1,0); + const AString keyname = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeleteKeyComments'", NULL); +#endif + { + bool tolua_ret = (bool) self->DeleteKeyComments(keyname); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)keyname); + } + } + return 2; +tolua_lerror: + return tolua_AllToLua_cIniFile_DeleteKeyComments00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Exists of class cFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_Exists00 +static int tolua_AllToLua_cFile_Exists00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + bool tolua_ret = (bool) cFile::Exists(a_FileName); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_FileName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Exists'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Delete of class cFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_Delete00 +static int tolua_AllToLua_cFile_Delete00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + bool tolua_ret = (bool) cFile::Delete(a_FileName); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_FileName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Delete'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Rename of class cFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_Rename00 +static int tolua_AllToLua_cFile_Rename00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_OrigPath = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString a_NewPath = ((const AString) tolua_tocppstring(tolua_S,3,0)); + { + bool tolua_ret = (bool) cFile::Rename(a_OrigPath,a_NewPath); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_OrigPath); + tolua_pushcppstring(tolua_S,(const char*)a_NewPath); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Rename'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Copy of class cFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_Copy00 +static int tolua_AllToLua_cFile_Copy00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_SrcFileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString a_DstFileName = ((const AString) tolua_tocppstring(tolua_S,3,0)); + { + bool tolua_ret = (bool) cFile::Copy(a_SrcFileName,a_DstFileName); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_SrcFileName); + tolua_pushcppstring(tolua_S,(const char*)a_DstFileName); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Copy'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsFolder of class cFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_IsFolder00 +static int tolua_AllToLua_cFile_IsFolder00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_Path = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + bool tolua_ret = (bool) cFile::IsFolder(a_Path); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Path); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsFolder'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsFile of class cFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_IsFile00 +static int tolua_AllToLua_cFile_IsFile00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_Path = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + bool tolua_ret = (bool) cFile::IsFile(a_Path); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Path); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsFile'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSize of class cFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_GetSize00 +static int tolua_AllToLua_cFile_GetSize00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + int tolua_ret = (int) cFile::GetSize(a_FileName); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_FileName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSize'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CreateFolder of class cFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_CreateFolder00 +static int tolua_AllToLua_cFile_CreateFolder00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_FolderPath = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + bool tolua_ret = (bool) cFile::CreateFolder(a_FolderPath); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_FolderPath); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CreateFolder'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ReadWholeFile of class cFile */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFile_ReadWholeFile00 +static int tolua_AllToLua_cFile_ReadWholeFile00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cFile",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + AString tolua_ret = (AString) cFile::ReadWholeFile(a_FileName); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_FileName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ReadWholeFile'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: BlockStringToType */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_BlockStringToType00 +static int tolua_AllToLua_BlockStringToType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_BlockTypeString = ((const AString) tolua_tocppstring(tolua_S,1,0)); + { + unsigned char tolua_ret = ( unsigned char) BlockStringToType(a_BlockTypeString); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_BlockTypeString); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'BlockStringToType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: StringToItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_StringToItem00 +static int tolua_AllToLua_StringToItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_ItemTypeString = ((const AString) tolua_tocppstring(tolua_S,1,0)); + cItem* a_Item = ((cItem*) tolua_tousertype(tolua_S,2,0)); + { + bool tolua_ret = (bool) StringToItem(a_ItemTypeString,*a_Item); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_ItemTypeString); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'StringToItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemToString */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemToString00 +static int tolua_AllToLua_ItemToString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + (tolua_isvaluenil(tolua_S,1,&tolua_err) || !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,1,0)); + { + AString tolua_ret = (AString) ItemToString(*a_Item); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ItemToString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemTypeToString */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemTypeToString00 +static int tolua_AllToLua_ItemTypeToString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short a_ItemType = ((short) tolua_tonumber(tolua_S,1,0)); + { + AString tolua_ret = (AString) ItemTypeToString(a_ItemType); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ItemTypeToString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemToFullString */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemToFullString00 +static int tolua_AllToLua_ItemToFullString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + (tolua_isvaluenil(tolua_S,1,&tolua_err) || !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,1,0)); + { + AString tolua_ret = (AString) ItemToFullString(*a_Item); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ItemToFullString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: StringToBiome */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_StringToBiome00 +static int tolua_AllToLua_StringToBiome00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_BiomeString = ((const AString) tolua_tocppstring(tolua_S,1,0)); + { + EMCSBiome tolua_ret = (EMCSBiome) StringToBiome(a_BiomeString); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_BiomeString); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'StringToBiome'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: StringToMobType */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_StringToMobType00 +static int tolua_AllToLua_StringToMobType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_MobString = ((const AString) tolua_tocppstring(tolua_S,1,0)); + { + int tolua_ret = (int) StringToMobType(a_MobString); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_MobString); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'StringToMobType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: StringToDimension */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_StringToDimension00 +static int tolua_AllToLua_StringToDimension00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_DimensionString = ((const AString) tolua_tocppstring(tolua_S,1,0)); + { + eDimension tolua_ret = (eDimension) StringToDimension(a_DimensionString); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_DimensionString); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'StringToDimension'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: DamageTypeToString */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_DamageTypeToString00 +static int tolua_AllToLua_DamageTypeToString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + eDamageType a_DamageType = ((eDamageType) (int) tolua_tonumber(tolua_S,1,0)); + { + AString tolua_ret = (AString) DamageTypeToString(a_DamageType); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DamageTypeToString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: StringToDamageType */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_StringToDamageType00 +static int tolua_AllToLua_StringToDamageType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_DamageString = ((const AString) tolua_tocppstring(tolua_S,1,0)); + { + eDamageType tolua_ret = (eDamageType) StringToDamageType(a_DamageString); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_DamageString); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'StringToDamageType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: GetIniItemSet */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_GetIniItemSet00 +static int tolua_AllToLua_GetIniItemSet00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + (tolua_isvaluenil(tolua_S,1,&tolua_err) || !tolua_isusertype(tolua_S,1,"cIniFile",0,&tolua_err)) || + !tolua_isstring(tolua_S,2,0,&tolua_err) || + !tolua_isstring(tolua_S,3,0,&tolua_err) || + !tolua_isstring(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cIniFile* a_IniFile = ((cIniFile*) tolua_tousertype(tolua_S,1,0)); + const char* a_Section = ((const char*) tolua_tostring(tolua_S,2,0)); + const char* a_Key = ((const char*) tolua_tostring(tolua_S,3,0)); + const char* a_Default = ((const char*) tolua_tostring(tolua_S,4,0)); + { + cItem tolua_ret = (cItem) GetIniItemSet(*a_IniFile,a_Section,a_Key,a_Default); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetIniItemSet'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: TrimString */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_TrimString00 +static int tolua_AllToLua_TrimString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString str = ((const AString) tolua_tocppstring(tolua_S,1,0)); + { + AString tolua_ret = (AString) TrimString(str); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)str); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'TrimString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: NoCaseCompare */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_NoCaseCompare00 +static int tolua_AllToLua_NoCaseCompare00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString s1 = ((const AString) tolua_tocppstring(tolua_S,1,0)); + const AString s2 = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + int tolua_ret = (int) NoCaseCompare(s1,s2); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)s1); + tolua_pushcppstring(tolua_S,(const char*)s2); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'NoCaseCompare'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ReplaceString */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ReplaceString00 +static int tolua_AllToLua_ReplaceString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + AString iHayStack = ((AString) tolua_tocppstring(tolua_S,1,0)); + const AString iNeedle = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString iReplaceWith = ((const AString) tolua_tocppstring(tolua_S,3,0)); + { + ReplaceString(iHayStack,iNeedle,iReplaceWith); + tolua_pushcppstring(tolua_S,(const char*)iHayStack); + tolua_pushcppstring(tolua_S,(const char*)iNeedle); + tolua_pushcppstring(tolua_S,(const char*)iReplaceWith); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ReplaceString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: EscapeString */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_EscapeString00 +static int tolua_AllToLua_EscapeString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,1,0)); + { + AString tolua_ret = (AString) EscapeString(a_Message); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Message); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'EscapeString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: StripColorCodes */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_StripColorCodes00 +static int tolua_AllToLua_StripColorCodes00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,1,0)); + { + AString tolua_ret = (AString) StripColorCodes(a_Message); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Message); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'StripColorCodes'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: g_BlockLightValue */ +#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockLightValue +static int tolua_get_AllToLua_g_BlockLightValue(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)g_BlockLightValue[tolua_index]); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: g_BlockLightValue */ +#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockLightValue +static int tolua_set_AllToLua_g_BlockLightValue(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + g_BlockLightValue[tolua_index] = ((unsigned char) tolua_tonumber(tolua_S,3,0)); + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: g_BlockSpreadLightFalloff */ +#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockSpreadLightFalloff +static int tolua_get_AllToLua_g_BlockSpreadLightFalloff(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)g_BlockSpreadLightFalloff[tolua_index]); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: g_BlockSpreadLightFalloff */ +#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockSpreadLightFalloff +static int tolua_set_AllToLua_g_BlockSpreadLightFalloff(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + g_BlockSpreadLightFalloff[tolua_index] = ((unsigned char) tolua_tonumber(tolua_S,3,0)); + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: g_BlockTransparent */ +#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockTransparent +static int tolua_get_AllToLua_g_BlockTransparent(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + tolua_pushboolean(tolua_S,(bool)g_BlockTransparent[tolua_index]); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: g_BlockTransparent */ +#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockTransparent +static int tolua_set_AllToLua_g_BlockTransparent(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + g_BlockTransparent[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: g_BlockOneHitDig */ +#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockOneHitDig +static int tolua_get_AllToLua_g_BlockOneHitDig(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + tolua_pushboolean(tolua_S,(bool)g_BlockOneHitDig[tolua_index]); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: g_BlockOneHitDig */ +#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockOneHitDig +static int tolua_set_AllToLua_g_BlockOneHitDig(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + g_BlockOneHitDig[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: g_BlockPistonBreakable */ +#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockPistonBreakable +static int tolua_get_AllToLua_g_BlockPistonBreakable(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0 || tolua_index>=256) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + tolua_pushboolean(tolua_S,(bool)g_BlockPistonBreakable[tolua_index]); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: g_BlockPistonBreakable */ +#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockPistonBreakable +static int tolua_set_AllToLua_g_BlockPistonBreakable(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0 || tolua_index>=256) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + g_BlockPistonBreakable[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: g_BlockIsSnowable */ +#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockIsSnowable +static int tolua_get_AllToLua_g_BlockIsSnowable(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0 || tolua_index>=256) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + tolua_pushboolean(tolua_S,(bool)g_BlockIsSnowable[tolua_index]); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: g_BlockIsSnowable */ +#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockIsSnowable +static int tolua_set_AllToLua_g_BlockIsSnowable(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0 || tolua_index>=256) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + g_BlockIsSnowable[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: g_BlockRequiresSpecialTool */ +#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockRequiresSpecialTool +static int tolua_get_AllToLua_g_BlockRequiresSpecialTool(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0 || tolua_index>=256) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + tolua_pushboolean(tolua_S,(bool)g_BlockRequiresSpecialTool[tolua_index]); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: g_BlockRequiresSpecialTool */ +#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockRequiresSpecialTool +static int tolua_set_AllToLua_g_BlockRequiresSpecialTool(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0 || tolua_index>=256) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + g_BlockRequiresSpecialTool[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: g_BlockIsSolid */ +#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockIsSolid +static int tolua_get_AllToLua_g_BlockIsSolid(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0 || tolua_index>=256) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + tolua_pushboolean(tolua_S,(bool)g_BlockIsSolid[tolua_index]); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: g_BlockIsSolid */ +#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockIsSolid +static int tolua_set_AllToLua_g_BlockIsSolid(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0 || tolua_index>=256) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + g_BlockIsSolid[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: g_BlockIsTorchPlaceable */ +#ifndef TOLUA_DISABLE_tolua_get_AllToLua_g_BlockIsTorchPlaceable +static int tolua_get_AllToLua_g_BlockIsTorchPlaceable(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0 || tolua_index>=256) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + tolua_pushboolean(tolua_S,(bool)g_BlockIsTorchPlaceable[tolua_index]); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: g_BlockIsTorchPlaceable */ +#ifndef TOLUA_DISABLE_tolua_set_AllToLua_g_BlockIsTorchPlaceable +static int tolua_set_AllToLua_g_BlockIsTorchPlaceable(lua_State* tolua_S) +{ + int tolua_index; +#ifndef TOLUA_RELEASE + { + tolua_Error tolua_err; + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err); + } +#endif + tolua_index = (int)tolua_tonumber(tolua_S,2,0); +#ifndef TOLUA_RELEASE + if (tolua_index<0 || tolua_index>=256) + tolua_error(tolua_S,"array indexing out of range.",NULL); +#endif + g_BlockIsTorchPlaceable[tolua_index] = ((bool) tolua_toboolean(tolua_S,3,0)); + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ClickActionToString */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ClickActionToString00 +static int tolua_AllToLua_ClickActionToString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + eClickAction a_ClickAction = ((eClickAction) (int) tolua_tonumber(tolua_S,1,0)); + { + const char* tolua_ret = (const char*) ClickActionToString(a_ClickAction); + tolua_pushstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ClickActionToString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: IsValidBlock */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_IsValidBlock00 +static int tolua_AllToLua_IsValidBlock00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + int a_BlockType = ((int) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) IsValidBlock(a_BlockType); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsValidBlock'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: IsValidItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_IsValidItem00 +static int tolua_AllToLua_IsValidItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + int a_ItemType = ((int) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) IsValidItem(a_ItemType); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsValidItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: AddFaceDirection */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_AddFaceDirection00 +static int tolua_AllToLua_AddFaceDirection00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isboolean(tolua_S,5,1,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + int a_BlockX = ((int) tolua_tonumber(tolua_S,1,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,3,0)); + char a_BlockFace = ((char) tolua_tonumber(tolua_S,4,0)); + bool a_bInverse = ((bool) tolua_toboolean(tolua_S,5,false)); + { + AddFaceDirection(a_BlockX,a_BlockY,a_BlockZ,a_BlockFace,a_bInverse); + tolua_pushnumber(tolua_S,(lua_Number)a_BlockX); + tolua_pushnumber(tolua_S,(lua_Number)a_BlockY); + tolua_pushnumber(tolua_S,(lua_Number)a_BlockZ); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddFaceDirection'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemCategory::IsPickaxe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsPickaxe00 +static int tolua_AllToLua_ItemCategory_IsPickaxe00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short a_ItemID = ((short) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) ItemCategory::IsPickaxe(a_ItemID); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsPickaxe'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemCategory::IsAxe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsAxe00 +static int tolua_AllToLua_ItemCategory_IsAxe00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short a_ItemID = ((short) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) ItemCategory::IsAxe(a_ItemID); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsAxe'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemCategory::IsSword */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsSword00 +static int tolua_AllToLua_ItemCategory_IsSword00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short a_ItemID = ((short) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) ItemCategory::IsSword(a_ItemID); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsSword'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemCategory::IsHoe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsHoe00 +static int tolua_AllToLua_ItemCategory_IsHoe00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short a_ItemID = ((short) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) ItemCategory::IsHoe(a_ItemID); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsHoe'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemCategory::IsShovel */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsShovel00 +static int tolua_AllToLua_ItemCategory_IsShovel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short a_ItemID = ((short) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) ItemCategory::IsShovel(a_ItemID); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsShovel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemCategory::IsTool */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsTool00 +static int tolua_AllToLua_ItemCategory_IsTool00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short a_ItemID = ((short) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) ItemCategory::IsTool(a_ItemID); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsTool'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemCategory::IsHelmet */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsHelmet00 +static int tolua_AllToLua_ItemCategory_IsHelmet00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short a_ItemType = ((short) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) ItemCategory::IsHelmet(a_ItemType); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsHelmet'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemCategory::IsChestPlate */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsChestPlate00 +static int tolua_AllToLua_ItemCategory_IsChestPlate00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short a_ItemType = ((short) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) ItemCategory::IsChestPlate(a_ItemType); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsChestPlate'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemCategory::IsLeggings */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsLeggings00 +static int tolua_AllToLua_ItemCategory_IsLeggings00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short a_ItemType = ((short) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) ItemCategory::IsLeggings(a_ItemType); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsLeggings'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemCategory::IsBoots */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsBoots00 +static int tolua_AllToLua_ItemCategory_IsBoots00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short a_ItemType = ((short) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) ItemCategory::IsBoots(a_ItemType); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsBoots'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: ItemCategory::IsArmor */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_ItemCategory_IsArmor00 +static int tolua_AllToLua_ItemCategory_IsArmor00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnumber(tolua_S,1,0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short a_ItemType = ((short) tolua_tonumber(tolua_S,1,0)); + { + bool tolua_ret = (bool) ItemCategory::IsArmor(a_ItemType); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsArmor'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: GetTime */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_GetTime00 +static int tolua_AllToLua_GetTime00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isnoobj(tolua_S,1,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + unsigned int tolua_ret = (unsigned int) GetTime(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetTime'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* function: GetChar */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_GetChar00 +static int tolua_AllToLua_GetChar00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_iscppstring(tolua_S,1,0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + std::string a_Str = ((std::string) tolua_tocppstring(tolua_S,1,0)); + unsigned int a_Idx = ((unsigned int) tolua_tonumber(tolua_S,2,0)); + { + std::string tolua_ret = (std::string) GetChar(a_Str,a_Idx); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Str); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetChar'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Color of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Color +static int tolua_get_cChatColor_Color(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Color); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Delimiter of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Delimiter +static int tolua_get_cChatColor_Delimiter(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Delimiter); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Black of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Black +static int tolua_get_cChatColor_Black(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Black); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Navy of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Navy +static int tolua_get_cChatColor_Navy(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Navy); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Green of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Green +static int tolua_get_cChatColor_Green(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Green); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Blue of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Blue +static int tolua_get_cChatColor_Blue(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Blue); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Red of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Red +static int tolua_get_cChatColor_Red(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Red); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Purple of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Purple +static int tolua_get_cChatColor_Purple(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Purple); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Gold of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Gold +static int tolua_get_cChatColor_Gold(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Gold); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: LightGray of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_LightGray +static int tolua_get_cChatColor_LightGray(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::LightGray); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Gray of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Gray +static int tolua_get_cChatColor_Gray(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Gray); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: DarkPurple of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_DarkPurple +static int tolua_get_cChatColor_DarkPurple(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::DarkPurple); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: LightGreen of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_LightGreen +static int tolua_get_cChatColor_LightGreen(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::LightGreen); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: LightBlue of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_LightBlue +static int tolua_get_cChatColor_LightBlue(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::LightBlue); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Rose of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Rose +static int tolua_get_cChatColor_Rose(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Rose); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: LightPurple of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_LightPurple +static int tolua_get_cChatColor_LightPurple(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::LightPurple); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Yellow of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Yellow +static int tolua_get_cChatColor_Yellow(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Yellow); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: White of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_White +static int tolua_get_cChatColor_White(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::White); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Random of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Random +static int tolua_get_cChatColor_Random(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Random); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Bold of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Bold +static int tolua_get_cChatColor_Bold(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Bold); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Strikethrough of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Strikethrough +static int tolua_get_cChatColor_Strikethrough(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Strikethrough); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Underlined of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Underlined +static int tolua_get_cChatColor_Underlined(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Underlined); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Italic of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Italic +static int tolua_get_cChatColor_Italic(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Italic); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Plain of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_get_cChatColor_Plain +static int tolua_get_cChatColor_Plain(lua_State* tolua_S) +{ + tolua_pushcppstring(tolua_S,(const char*)cChatColor::Plain); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* method: MakeColor of class cChatColor */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChatColor_MakeColor00 +static int tolua_AllToLua_cChatColor_MakeColor00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cChatColor",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + char a_Color = ((char) tolua_tonumber(tolua_S,2,0)); + { + const std::string tolua_ret = (const std::string) cChatColor::MakeColor(a_Color); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'MakeColor'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPlayer of class cClientHandle */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_GetPlayer00 +static int tolua_AllToLua_cClientHandle_GetPlayer00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cClientHandle",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cClientHandle* self = (cClientHandle*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPlayer'", NULL); +#endif + { + cPlayer* tolua_ret = (cPlayer*) self->GetPlayer(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPlayer"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPlayer'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Kick of class cClientHandle */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_Kick00 +static int tolua_AllToLua_cClientHandle_Kick00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cClientHandle",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cClientHandle* self = (cClientHandle*) tolua_tousertype(tolua_S,1,0); + const AString a_Reason = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Kick'", NULL); +#endif + { + self->Kick(a_Reason); + tolua_pushcppstring(tolua_S,(const char*)a_Reason); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Kick'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SendBlockChange of class cClientHandle */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_SendBlockChange00 +static int tolua_AllToLua_cClientHandle_SendBlockChange00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cClientHandle",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cClientHandle* self = (cClientHandle*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SendBlockChange'", NULL); +#endif + { + self->SendBlockChange(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SendBlockChange'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetUsername of class cClientHandle */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_GetUsername00 +static int tolua_AllToLua_cClientHandle_GetUsername00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cClientHandle",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cClientHandle* self = (const cClientHandle*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetUsername'", NULL); +#endif + { + const AString tolua_ret = (const AString) self->GetUsername(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetUsername'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetUsername of class cClientHandle */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_SetUsername00 +static int tolua_AllToLua_cClientHandle_SetUsername00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cClientHandle",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cClientHandle* self = (cClientHandle*) tolua_tousertype(tolua_S,1,0); + const AString a_Username = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUsername'", NULL); +#endif + { + self->SetUsername(a_Username); + tolua_pushcppstring(tolua_S,(const char*)a_Username); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetUsername'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPing of class cClientHandle */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_GetPing00 +static int tolua_AllToLua_cClientHandle_GetPing00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cClientHandle",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cClientHandle* self = (const cClientHandle*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPing'", NULL); +#endif + { + short tolua_ret = (short) self->GetPing(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPing'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetViewDistance of class cClientHandle */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_SetViewDistance00 +static int tolua_AllToLua_cClientHandle_SetViewDistance00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cClientHandle",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cClientHandle* self = (cClientHandle*) tolua_tousertype(tolua_S,1,0); + int a_ViewDistance = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetViewDistance'", NULL); +#endif + { + self->SetViewDistance(a_ViewDistance); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetViewDistance'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetViewDistance of class cClientHandle */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_GetViewDistance00 +static int tolua_AllToLua_cClientHandle_GetViewDistance00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cClientHandle",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cClientHandle* self = (const cClientHandle*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetViewDistance'", NULL); +#endif + { + int tolua_ret = (int) self->GetViewDistance(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetViewDistance'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetUniqueID of class cClientHandle */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cClientHandle_GetUniqueID00 +static int tolua_AllToLua_cClientHandle_GetUniqueID00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cClientHandle",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cClientHandle* self = (const cClientHandle*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetUniqueID'", NULL); +#endif + { + int tolua_ret = (int) self->GetUniqueID(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetUniqueID'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: DamageType of class TakeDamageInfo */ +#ifndef TOLUA_DISABLE_tolua_get_TakeDamageInfo_DamageType +static int tolua_get_TakeDamageInfo_DamageType(lua_State* tolua_S) +{ + TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'DamageType'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->DamageType); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: DamageType of class TakeDamageInfo */ +#ifndef TOLUA_DISABLE_tolua_set_TakeDamageInfo_DamageType +static int tolua_set_TakeDamageInfo_DamageType(lua_State* tolua_S) +{ + TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'DamageType'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->DamageType = ((eDamageType) (int) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Attacker of class TakeDamageInfo */ +#ifndef TOLUA_DISABLE_tolua_get_TakeDamageInfo_Attacker_ptr +static int tolua_get_TakeDamageInfo_Attacker_ptr(lua_State* tolua_S) +{ + TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Attacker'",NULL); +#endif + tolua_pushusertype(tolua_S,(void*)self->Attacker,"cEntity"); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: Attacker of class TakeDamageInfo */ +#ifndef TOLUA_DISABLE_tolua_set_TakeDamageInfo_Attacker_ptr +static int tolua_set_TakeDamageInfo_Attacker_ptr(lua_State* tolua_S) +{ + TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Attacker'",NULL); + if (!tolua_isusertype(tolua_S,2,"cEntity",0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->Attacker = ((cEntity*) tolua_tousertype(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: RawDamage of class TakeDamageInfo */ +#ifndef TOLUA_DISABLE_tolua_get_TakeDamageInfo_RawDamage +static int tolua_get_TakeDamageInfo_RawDamage(lua_State* tolua_S) +{ + TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'RawDamage'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->RawDamage); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: RawDamage of class TakeDamageInfo */ +#ifndef TOLUA_DISABLE_tolua_set_TakeDamageInfo_RawDamage +static int tolua_set_TakeDamageInfo_RawDamage(lua_State* tolua_S) +{ + TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'RawDamage'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->RawDamage = ((int) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: FinalDamage of class TakeDamageInfo */ +#ifndef TOLUA_DISABLE_tolua_get_TakeDamageInfo_FinalDamage +static int tolua_get_TakeDamageInfo_FinalDamage(lua_State* tolua_S) +{ + TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'FinalDamage'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->FinalDamage); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: FinalDamage of class TakeDamageInfo */ +#ifndef TOLUA_DISABLE_tolua_set_TakeDamageInfo_FinalDamage +static int tolua_set_TakeDamageInfo_FinalDamage(lua_State* tolua_S) +{ + TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'FinalDamage'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->FinalDamage = ((int) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Knockback of class TakeDamageInfo */ +#ifndef TOLUA_DISABLE_tolua_get_TakeDamageInfo_Knockback +static int tolua_get_TakeDamageInfo_Knockback(lua_State* tolua_S) +{ + TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Knockback'",NULL); +#endif + tolua_pushusertype(tolua_S,(void*)&self->Knockback,"Vector3d"); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: Knockback of class TakeDamageInfo */ +#ifndef TOLUA_DISABLE_tolua_set_TakeDamageInfo_Knockback +static int tolua_set_TakeDamageInfo_Knockback(lua_State* tolua_S) +{ + TakeDamageInfo* self = (TakeDamageInfo*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Knockback'",NULL); + if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3d",0,&tolua_err))) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->Knockback = *((Vector3d*) tolua_tousertype(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEntityType of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetEntityType00 +static int tolua_AllToLua_cEntity_GetEntityType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEntityType'", NULL); +#endif + { + cEntity::eEntityType tolua_ret = (cEntity::eEntityType) self->GetEntityType(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEntityType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsPlayer of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsPlayer00 +static int tolua_AllToLua_cEntity_IsPlayer00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsPlayer'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsPlayer(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsPlayer'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsPickup of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsPickup00 +static int tolua_AllToLua_cEntity_IsPickup00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsPickup'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsPickup(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsPickup'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsMob of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsMob00 +static int tolua_AllToLua_cEntity_IsMob00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsMob'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsMob(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsMob'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsFallingBlock of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsFallingBlock00 +static int tolua_AllToLua_cEntity_IsFallingBlock00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsFallingBlock'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsFallingBlock(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsFallingBlock'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsMinecart of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsMinecart00 +static int tolua_AllToLua_cEntity_IsMinecart00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsMinecart'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsMinecart(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsMinecart'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsBoat of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsBoat00 +static int tolua_AllToLua_cEntity_IsBoat00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsBoat'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsBoat(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsBoat'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsTNT of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsTNT00 +static int tolua_AllToLua_cEntity_IsTNT00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsTNT'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsTNT(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsTNT'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsProjectile of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsProjectile00 +static int tolua_AllToLua_cEntity_IsProjectile00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsProjectile'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsProjectile(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsProjectile'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsA of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsA00 +static int tolua_AllToLua_cEntity_IsA00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); + const char* a_ClassName = ((const char*) tolua_tostring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsA'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsA(a_ClassName); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsA'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetClass of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetClass00 +static int tolua_AllToLua_cEntity_GetClass00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetClass'", NULL); +#endif + { + const char* tolua_ret = (const char*) self->GetClass(); + tolua_pushstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetClass'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetClassStatic of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetClassStatic00 +static int tolua_AllToLua_cEntity_GetClassStatic00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + const char* tolua_ret = (const char*) cEntity::GetClassStatic(); + tolua_pushstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetClassStatic'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetParentClass of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetParentClass00 +static int tolua_AllToLua_cEntity_GetParentClass00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetParentClass'", NULL); +#endif + { + const char* tolua_ret = (const char*) self->GetParentClass(); + tolua_pushstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetParentClass'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWorld of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetWorld00 +static int tolua_AllToLua_cEntity_GetWorld00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWorld'", NULL); +#endif + { + cWorld* tolua_ret = (cWorld*) self->GetWorld(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWorld"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWorld'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetHeadYaw of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetHeadYaw00 +static int tolua_AllToLua_cEntity_GetHeadYaw00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeadYaw'", NULL); +#endif + { + double tolua_ret = (double) self->GetHeadYaw(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHeadYaw'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetHeight of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetHeight00 +static int tolua_AllToLua_cEntity_GetHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeight'", NULL); +#endif + { + double tolua_ret = (double) self->GetHeight(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMass of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetMass00 +static int tolua_AllToLua_cEntity_GetMass00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMass'", NULL); +#endif + { + double tolua_ret = (double) self->GetMass(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMass'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPosition of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetPosition00 +static int tolua_AllToLua_cEntity_GetPosition00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosition'", NULL); +#endif + { + const Vector3d& tolua_ret = (const Vector3d&) self->GetPosition(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const Vector3d"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPosition'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPosX of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetPosX00 +static int tolua_AllToLua_cEntity_GetPosX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosX'", NULL); +#endif + { + double tolua_ret = (double) self->GetPosX(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPosX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPosY of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetPosY00 +static int tolua_AllToLua_cEntity_GetPosY00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosY'", NULL); +#endif + { + double tolua_ret = (double) self->GetPosY(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPosY'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPosZ of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetPosZ00 +static int tolua_AllToLua_cEntity_GetPosZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosZ'", NULL); +#endif + { + double tolua_ret = (double) self->GetPosZ(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPosZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetRot of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetRot00 +static int tolua_AllToLua_cEntity_GetRot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRot'", NULL); +#endif + { + const Vector3d& tolua_ret = (const Vector3d&) self->GetRot(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const Vector3d"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetRot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetRotation of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetRotation00 +static int tolua_AllToLua_cEntity_GetRotation00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRotation'", NULL); +#endif + { + double tolua_ret = (double) self->GetRotation(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetRotation'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetYaw of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetYaw00 +static int tolua_AllToLua_cEntity_GetYaw00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetYaw'", NULL); +#endif + { + double tolua_ret = (double) self->GetYaw(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetYaw'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPitch of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetPitch00 +static int tolua_AllToLua_cEntity_GetPitch00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPitch'", NULL); +#endif + { + double tolua_ret = (double) self->GetPitch(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPitch'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetRoll of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetRoll00 +static int tolua_AllToLua_cEntity_GetRoll00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRoll'", NULL); +#endif + { + double tolua_ret = (double) self->GetRoll(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetRoll'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetLookVector of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetLookVector00 +static int tolua_AllToLua_cEntity_GetLookVector00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLookVector'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->GetLookVector(); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetLookVector'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSpeed of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetSpeed00 +static int tolua_AllToLua_cEntity_GetSpeed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpeed'", NULL); +#endif + { + const Vector3d& tolua_ret = (const Vector3d&) self->GetSpeed(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const Vector3d"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSpeed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSpeedX of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetSpeedX00 +static int tolua_AllToLua_cEntity_GetSpeedX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpeedX'", NULL); +#endif + { + double tolua_ret = (double) self->GetSpeedX(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSpeedX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSpeedY of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetSpeedY00 +static int tolua_AllToLua_cEntity_GetSpeedY00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpeedY'", NULL); +#endif + { + double tolua_ret = (double) self->GetSpeedY(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSpeedY'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSpeedZ of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetSpeedZ00 +static int tolua_AllToLua_cEntity_GetSpeedZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpeedZ'", NULL); +#endif + { + double tolua_ret = (double) self->GetSpeedZ(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSpeedZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWidth of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetWidth00 +static int tolua_AllToLua_cEntity_GetWidth00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWidth'", NULL); +#endif + { + double tolua_ret = (double) self->GetWidth(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWidth'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetChunkX of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetChunkX00 +static int tolua_AllToLua_cEntity_GetChunkX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetChunkX'", NULL); +#endif + { + int tolua_ret = (int) self->GetChunkX(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetChunkX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetChunkZ of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetChunkZ00 +static int tolua_AllToLua_cEntity_GetChunkZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetChunkZ'", NULL); +#endif + { + int tolua_ret = (int) self->GetChunkZ(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetChunkZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetHeadYaw of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetHeadYaw00 +static int tolua_AllToLua_cEntity_SetHeadYaw00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_HeadYaw = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetHeadYaw'", NULL); +#endif + { + self->SetHeadYaw(a_HeadYaw); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetHeadYaw'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetHeight of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetHeight00 +static int tolua_AllToLua_cEntity_SetHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_Height = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetHeight'", NULL); +#endif + { + self->SetHeight(a_Height); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetMass of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetMass00 +static int tolua_AllToLua_cEntity_SetMass00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_Mass = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetMass'", NULL); +#endif + { + self->SetMass(a_Mass); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetMass'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetPosX of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPosX00 +static int tolua_AllToLua_cEntity_SetPosX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPosX'", NULL); +#endif + { + self->SetPosX(a_PosX); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetPosX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetPosY of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPosY00 +static int tolua_AllToLua_cEntity_SetPosY00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_PosY = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPosY'", NULL); +#endif + { + self->SetPosY(a_PosY); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetPosY'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetPosZ of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPosZ00 +static int tolua_AllToLua_cEntity_SetPosZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_PosZ = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPosZ'", NULL); +#endif + { + self->SetPosZ(a_PosZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetPosZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetPosition of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPosition00 +static int tolua_AllToLua_cEntity_SetPosition00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_PosY = ((double) tolua_tonumber(tolua_S,3,0)); + double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPosition'", NULL); +#endif + { + self->SetPosition(a_PosX,a_PosY,a_PosZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetPosition'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetPosition of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPosition01 +static int tolua_AllToLua_cEntity_SetPosition01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_Pos = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPosition'", NULL); +#endif + { + self->SetPosition(*a_Pos); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cEntity_SetPosition00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetRot of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetRot00 +static int tolua_AllToLua_cEntity_SetRot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + const Vector3f* a_Rot = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRot'", NULL); +#endif + { + self->SetRot(*a_Rot); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetRot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetRotation of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetRotation00 +static int tolua_AllToLua_cEntity_SetRotation00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_Rotation = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRotation'", NULL); +#endif + { + self->SetRotation(a_Rotation); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetRotation'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetYaw of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetYaw00 +static int tolua_AllToLua_cEntity_SetYaw00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_Yaw = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetYaw'", NULL); +#endif + { + self->SetYaw(a_Yaw); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetYaw'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetPitch of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPitch00 +static int tolua_AllToLua_cEntity_SetPitch00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_Pitch = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPitch'", NULL); +#endif + { + self->SetPitch(a_Pitch); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetPitch'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetRoll of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetRoll00 +static int tolua_AllToLua_cEntity_SetRoll00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_Roll = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRoll'", NULL); +#endif + { + self->SetRoll(a_Roll); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetRoll'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSpeed of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetSpeed00 +static int tolua_AllToLua_cEntity_SetSpeed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_SpeedX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_SpeedY = ((double) tolua_tonumber(tolua_S,3,0)); + double a_SpeedZ = ((double) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSpeed'", NULL); +#endif + { + self->SetSpeed(a_SpeedX,a_SpeedY,a_SpeedZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetSpeed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSpeed of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetSpeed01 +static int tolua_AllToLua_cEntity_SetSpeed01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_Speed = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSpeed'", NULL); +#endif + { + self->SetSpeed(*a_Speed); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cEntity_SetSpeed00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSpeedX of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetSpeedX00 +static int tolua_AllToLua_cEntity_SetSpeedX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_SpeedX = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSpeedX'", NULL); +#endif + { + self->SetSpeedX(a_SpeedX); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetSpeedX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSpeedY of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetSpeedY00 +static int tolua_AllToLua_cEntity_SetSpeedY00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_SpeedY = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSpeedY'", NULL); +#endif + { + self->SetSpeedY(a_SpeedY); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetSpeedY'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSpeedZ of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetSpeedZ00 +static int tolua_AllToLua_cEntity_SetSpeedZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_SpeedZ = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSpeedZ'", NULL); +#endif + { + self->SetSpeedZ(a_SpeedZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetSpeedZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetWidth of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetWidth00 +static int tolua_AllToLua_cEntity_SetWidth00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_Width = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetWidth'", NULL); +#endif + { + self->SetWidth(a_Width); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetWidth'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddPosX of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddPosX00 +static int tolua_AllToLua_cEntity_AddPosX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_AddPosX = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddPosX'", NULL); +#endif + { + self->AddPosX(a_AddPosX); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddPosX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddPosY of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddPosY00 +static int tolua_AllToLua_cEntity_AddPosY00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_AddPosY = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddPosY'", NULL); +#endif + { + self->AddPosY(a_AddPosY); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddPosY'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddPosZ of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddPosZ00 +static int tolua_AllToLua_cEntity_AddPosZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_AddPosZ = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddPosZ'", NULL); +#endif + { + self->AddPosZ(a_AddPosZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddPosZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddPosition of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddPosition00 +static int tolua_AllToLua_cEntity_AddPosition00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_AddPosX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_AddPosY = ((double) tolua_tonumber(tolua_S,3,0)); + double a_AddPosZ = ((double) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddPosition'", NULL); +#endif + { + self->AddPosition(a_AddPosX,a_AddPosY,a_AddPosZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddPosition'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddPosition of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddPosition01 +static int tolua_AllToLua_cEntity_AddPosition01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_AddPos = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddPosition'", NULL); +#endif + { + self->AddPosition(*a_AddPos); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cEntity_AddPosition00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddSpeed of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddSpeed00 +static int tolua_AllToLua_cEntity_AddSpeed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_AddSpeedX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_AddSpeedY = ((double) tolua_tonumber(tolua_S,3,0)); + double a_AddSpeedZ = ((double) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddSpeed'", NULL); +#endif + { + self->AddSpeed(a_AddSpeedX,a_AddSpeedY,a_AddSpeedZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddSpeed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddSpeed of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddSpeed01 +static int tolua_AllToLua_cEntity_AddSpeed01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_AddSpeed = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddSpeed'", NULL); +#endif + { + self->AddSpeed(*a_AddSpeed); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cEntity_AddSpeed00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddSpeedX of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddSpeedX00 +static int tolua_AllToLua_cEntity_AddSpeedX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_AddSpeedX = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddSpeedX'", NULL); +#endif + { + self->AddSpeedX(a_AddSpeedX); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddSpeedX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddSpeedY of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddSpeedY00 +static int tolua_AllToLua_cEntity_AddSpeedY00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_AddSpeedY = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddSpeedY'", NULL); +#endif + { + self->AddSpeedY(a_AddSpeedY); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddSpeedY'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddSpeedZ of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_AddSpeedZ00 +static int tolua_AllToLua_cEntity_AddSpeedZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_AddSpeedZ = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddSpeedZ'", NULL); +#endif + { + self->AddSpeedZ(a_AddSpeedZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddSpeedZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SteerVehicle of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SteerVehicle00 +static int tolua_AllToLua_cEntity_SteerVehicle00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + float a_Forward = ((float) tolua_tonumber(tolua_S,2,0)); + float a_Sideways = ((float) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SteerVehicle'", NULL); +#endif + { + self->SteerVehicle(a_Forward,a_Sideways); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SteerVehicle'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetUniqueID of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetUniqueID00 +static int tolua_AllToLua_cEntity_GetUniqueID00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetUniqueID'", NULL); +#endif + { + int tolua_ret = (int) self->GetUniqueID(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetUniqueID'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsDestroyed of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsDestroyed00 +static int tolua_AllToLua_cEntity_IsDestroyed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsDestroyed'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsDestroyed(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsDestroyed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Destroy of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_Destroy00 +static int tolua_AllToLua_cEntity_Destroy00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,1,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + bool a_ShouldBroadcast = ((bool) tolua_toboolean(tolua_S,2,true)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Destroy'", NULL); +#endif + { + self->Destroy(a_ShouldBroadcast); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Destroy'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: TakeDamage of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_TakeDamage00 +static int tolua_AllToLua_cEntity_TakeDamage00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cEntity",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + cEntity* a_Attacker = ((cEntity*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TakeDamage'", NULL); +#endif + { + self->TakeDamage(*a_Attacker); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'TakeDamage'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: TakeDamage of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_TakeDamage01 +static int tolua_AllToLua_cEntity_TakeDamage01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isusertype(tolua_S,3,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + eDamageType a_DamageType = ((eDamageType) (int) tolua_tonumber(tolua_S,2,0)); + cEntity* a_Attacker = ((cEntity*) tolua_tousertype(tolua_S,3,0)); + int a_RawDamage = ((int) tolua_tonumber(tolua_S,4,0)); + double a_KnockbackAmount = ((double) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TakeDamage'", NULL); +#endif + { + self->TakeDamage(a_DamageType,a_Attacker,a_RawDamage,a_KnockbackAmount); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cEntity_TakeDamage00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: TakeDamage of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_TakeDamage02 +static int tolua_AllToLua_cEntity_TakeDamage02(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isusertype(tolua_S,3,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + eDamageType a_DamageType = ((eDamageType) (int) tolua_tonumber(tolua_S,2,0)); + cEntity* a_Attacker = ((cEntity*) tolua_tousertype(tolua_S,3,0)); + int a_RawDamage = ((int) tolua_tonumber(tolua_S,4,0)); + int a_FinalDamage = ((int) tolua_tonumber(tolua_S,5,0)); + double a_KnockbackAmount = ((double) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TakeDamage'", NULL); +#endif + { + self->TakeDamage(a_DamageType,a_Attacker,a_RawDamage,a_FinalDamage,a_KnockbackAmount); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cEntity_TakeDamage01(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetGravity of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetGravity00 +static int tolua_AllToLua_cEntity_GetGravity00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetGravity'", NULL); +#endif + { + float tolua_ret = (float) self->GetGravity(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetGravity'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetGravity of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetGravity00 +static int tolua_AllToLua_cEntity_SetGravity00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + float a_Gravity = ((float) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetGravity'", NULL); +#endif + { + self->SetGravity(a_Gravity); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetGravity'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetRotationFromSpeed of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetRotationFromSpeed00 +static int tolua_AllToLua_cEntity_SetRotationFromSpeed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRotationFromSpeed'", NULL); +#endif + { + self->SetRotationFromSpeed(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetRotationFromSpeed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetPitchFromSpeed of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetPitchFromSpeed00 +static int tolua_AllToLua_cEntity_SetPitchFromSpeed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPitchFromSpeed'", NULL); +#endif + { + self->SetPitchFromSpeed(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetPitchFromSpeed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetRawDamageAgainst of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetRawDamageAgainst00 +static int tolua_AllToLua_cEntity_GetRawDamageAgainst00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cEntity",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + const cEntity* a_Receiver = ((const cEntity*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRawDamageAgainst'", NULL); +#endif + { + int tolua_ret = (int) self->GetRawDamageAgainst(*a_Receiver); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetRawDamageAgainst'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetArmorCoverAgainst of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetArmorCoverAgainst00 +static int tolua_AllToLua_cEntity_GetArmorCoverAgainst00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + const cEntity* a_Attacker = ((const cEntity*) tolua_tousertype(tolua_S,2,0)); + eDamageType a_DamageType = ((eDamageType) (int) tolua_tonumber(tolua_S,3,0)); + int a_RawDamage = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetArmorCoverAgainst'", NULL); +#endif + { + int tolua_ret = (int) self->GetArmorCoverAgainst(a_Attacker,a_DamageType,a_RawDamage); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetArmorCoverAgainst'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetKnockbackAmountAgainst of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetKnockbackAmountAgainst00 +static int tolua_AllToLua_cEntity_GetKnockbackAmountAgainst00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cEntity",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + const cEntity* a_Receiver = ((const cEntity*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetKnockbackAmountAgainst'", NULL); +#endif + { + double tolua_ret = (double) self->GetKnockbackAmountAgainst(*a_Receiver); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetKnockbackAmountAgainst'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEquippedWeapon of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetEquippedWeapon00 +static int tolua_AllToLua_cEntity_GetEquippedWeapon00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedWeapon'", NULL); +#endif + { + cItem tolua_ret = (cItem) self->GetEquippedWeapon(); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEquippedWeapon'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEquippedHelmet of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetEquippedHelmet00 +static int tolua_AllToLua_cEntity_GetEquippedHelmet00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedHelmet'", NULL); +#endif + { + cItem tolua_ret = (cItem) self->GetEquippedHelmet(); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEquippedHelmet'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEquippedChestplate of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetEquippedChestplate00 +static int tolua_AllToLua_cEntity_GetEquippedChestplate00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedChestplate'", NULL); +#endif + { + cItem tolua_ret = (cItem) self->GetEquippedChestplate(); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEquippedChestplate'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEquippedLeggings of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetEquippedLeggings00 +static int tolua_AllToLua_cEntity_GetEquippedLeggings00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedLeggings'", NULL); +#endif + { + cItem tolua_ret = (cItem) self->GetEquippedLeggings(); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEquippedLeggings'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEquippedBoots of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetEquippedBoots00 +static int tolua_AllToLua_cEntity_GetEquippedBoots00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedBoots'", NULL); +#endif + { + cItem tolua_ret = (cItem) self->GetEquippedBoots(); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEquippedBoots'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: KilledBy of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_KilledBy00 +static int tolua_AllToLua_cEntity_KilledBy00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + cEntity* a_Killer = ((cEntity*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'KilledBy'", NULL); +#endif + { + self->KilledBy(a_Killer); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'KilledBy'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Heal of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_Heal00 +static int tolua_AllToLua_cEntity_Heal00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + int a_HitPoints = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Heal'", NULL); +#endif + { + self->Heal(a_HitPoints); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Heal'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetHealth of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetHealth00 +static int tolua_AllToLua_cEntity_GetHealth00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHealth'", NULL); +#endif + { + int tolua_ret = (int) self->GetHealth(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHealth'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetHealth of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetHealth00 +static int tolua_AllToLua_cEntity_SetHealth00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + int a_Health = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetHealth'", NULL); +#endif + { + self->SetHealth(a_Health); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetHealth'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetMaxHealth of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_SetMaxHealth00 +static int tolua_AllToLua_cEntity_SetMaxHealth00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + int a_MaxHealth = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetMaxHealth'", NULL); +#endif + { + self->SetMaxHealth(a_MaxHealth); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetMaxHealth'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMaxHealth of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_GetMaxHealth00 +static int tolua_AllToLua_cEntity_GetMaxHealth00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxHealth'", NULL); +#endif + { + int tolua_ret = (int) self->GetMaxHealth(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMaxHealth'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: StartBurning of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_StartBurning00 +static int tolua_AllToLua_cEntity_StartBurning00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + int a_TicksLeftBurning = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'StartBurning'", NULL); +#endif + { + self->StartBurning(a_TicksLeftBurning); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'StartBurning'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: StopBurning of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_StopBurning00 +static int tolua_AllToLua_cEntity_StopBurning00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'StopBurning'", NULL); +#endif + { + self->StopBurning(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'StopBurning'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: TeleportToEntity of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_TeleportToEntity00 +static int tolua_AllToLua_cEntity_TeleportToEntity00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cEntity",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + cEntity* a_Entity = ((cEntity*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TeleportToEntity'", NULL); +#endif + { + self->TeleportToEntity(*a_Entity); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'TeleportToEntity'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: TeleportToCoords of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_TeleportToCoords00 +static int tolua_AllToLua_cEntity_TeleportToCoords00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEntity* self = (cEntity*) tolua_tousertype(tolua_S,1,0); + double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_PosY = ((double) tolua_tonumber(tolua_S,3,0)); + double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TeleportToCoords'", NULL); +#endif + { + self->TeleportToCoords(a_PosX,a_PosY,a_PosZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'TeleportToCoords'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsOnFire of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsOnFire00 +static int tolua_AllToLua_cEntity_IsOnFire00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsOnFire'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsOnFire(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsOnFire'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsCrouched of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsCrouched00 +static int tolua_AllToLua_cEntity_IsCrouched00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsCrouched'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsCrouched(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsCrouched'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsRiding of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsRiding00 +static int tolua_AllToLua_cEntity_IsRiding00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsRiding'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsRiding(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsRiding'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsSprinting of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsSprinting00 +static int tolua_AllToLua_cEntity_IsSprinting00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSprinting'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsSprinting(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsSprinting'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsRclking of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsRclking00 +static int tolua_AllToLua_cEntity_IsRclking00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsRclking'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsRclking(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsRclking'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsInvisible of class cEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEntity_IsInvisible00 +static int tolua_AllToLua_cEntity_IsInvisible00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEntity* self = (const cEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInvisible'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsInvisible(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsInvisible'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetCurrentExperience of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetCurrentExperience00 +static int tolua_AllToLua_cPlayer_SetCurrentExperience00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + short a_XpTotal = ((short) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetCurrentExperience'", NULL); +#endif + { + bool tolua_ret = (bool) self->SetCurrentExperience(a_XpTotal); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetCurrentExperience'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DeltaExperience of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_DeltaExperience00 +static int tolua_AllToLua_cPlayer_DeltaExperience00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + short a_Xp_delta = ((short) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DeltaExperience'", NULL); +#endif + { + short tolua_ret = (short) self->DeltaExperience(a_Xp_delta); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DeltaExperience'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetXpLifetimeTotal of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetXpLifetimeTotal00 +static int tolua_AllToLua_cPlayer_GetXpLifetimeTotal00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetXpLifetimeTotal'", NULL); +#endif + { + short tolua_ret = (short) self->GetXpLifetimeTotal(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetXpLifetimeTotal'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetCurrentXp of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetCurrentXp00 +static int tolua_AllToLua_cPlayer_GetCurrentXp00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCurrentXp'", NULL); +#endif + { + short tolua_ret = (short) self->GetCurrentXp(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetCurrentXp'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetXpLevel of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetXpLevel00 +static int tolua_AllToLua_cPlayer_GetXpLevel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetXpLevel'", NULL); +#endif + { + short tolua_ret = (short) self->GetXpLevel(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetXpLevel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetXpPercentage of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetXpPercentage00 +static int tolua_AllToLua_cPlayer_GetXpPercentage00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetXpPercentage'", NULL); +#endif + { + float tolua_ret = (float) self->GetXpPercentage(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetXpPercentage'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: XpForLevel of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_XpForLevel00 +static int tolua_AllToLua_cPlayer_XpForLevel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short int a_Level = ((short int) tolua_tonumber(tolua_S,2,0)); + { + short tolua_ret = (short) cPlayer::XpForLevel(a_Level); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'XpForLevel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CalcLevelFromXp of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_CalcLevelFromXp00 +static int tolua_AllToLua_cPlayer_CalcLevelFromXp00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + short int a_CurrentXp = ((short int) tolua_tonumber(tolua_S,2,0)); + { + short tolua_ret = (short) cPlayer::CalcLevelFromXp(a_CurrentXp); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CalcLevelFromXp'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEyeHeight of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetEyeHeight00 +static int tolua_AllToLua_cPlayer_GetEyeHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEyeHeight'", NULL); +#endif + { + double tolua_ret = (double) self->GetEyeHeight(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEyeHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEyePosition of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetEyePosition00 +static int tolua_AllToLua_cPlayer_GetEyePosition00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEyePosition'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->GetEyePosition(); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEyePosition'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsOnGround of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsOnGround00 +static int tolua_AllToLua_cPlayer_IsOnGround00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsOnGround'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsOnGround(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsOnGround'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetStance of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetStance00 +static int tolua_AllToLua_cPlayer_GetStance00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetStance'", NULL); +#endif + { + const double tolua_ret = (const double) self->GetStance(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetStance'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetInventory of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetInventory00 +static int tolua_AllToLua_cPlayer_GetInventory00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetInventory'", NULL); +#endif + { + cInventory& tolua_ret = (cInventory&) self->GetInventory(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cInventory"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetInventory'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEquippedItem of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetEquippedItem00 +static int tolua_AllToLua_cPlayer_GetEquippedItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedItem'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetEquippedItem(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEquippedItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetThrowStartPos of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetThrowStartPos00 +static int tolua_AllToLua_cPlayer_GetThrowStartPos00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetThrowStartPos'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->GetThrowStartPos(); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetThrowStartPos'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetThrowSpeed of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetThrowSpeed00 +static int tolua_AllToLua_cPlayer_GetThrowSpeed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); + double a_SpeedCoeff = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetThrowSpeed'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->GetThrowSpeed(a_SpeedCoeff); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetThrowSpeed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetGameMode of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetGameMode00 +static int tolua_AllToLua_cPlayer_GetGameMode00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetGameMode'", NULL); +#endif + { + eGameMode tolua_ret = (eGameMode) self->GetGameMode(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetGameMode'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEffectiveGameMode of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetEffectiveGameMode00 +static int tolua_AllToLua_cPlayer_GetEffectiveGameMode00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEffectiveGameMode'", NULL); +#endif + { + eGameMode tolua_ret = (eGameMode) self->GetEffectiveGameMode(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEffectiveGameMode'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetGameMode of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetGameMode00 +static int tolua_AllToLua_cPlayer_SetGameMode00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + eGameMode a_GameMode = ((eGameMode) (int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetGameMode'", NULL); +#endif + { + self->SetGameMode(a_GameMode); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetGameMode'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsGameModeCreative of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsGameModeCreative00 +static int tolua_AllToLua_cPlayer_IsGameModeCreative00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsGameModeCreative'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsGameModeCreative(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsGameModeCreative'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsGameModeSurvival of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsGameModeSurvival00 +static int tolua_AllToLua_cPlayer_IsGameModeSurvival00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsGameModeSurvival'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsGameModeSurvival(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsGameModeSurvival'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsGameModeAdventure of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsGameModeAdventure00 +static int tolua_AllToLua_cPlayer_IsGameModeAdventure00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsGameModeAdventure'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsGameModeAdventure(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsGameModeAdventure'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetIP of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetIP00 +static int tolua_AllToLua_cPlayer_GetIP00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetIP'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetIP(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetIP'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: MoveTo of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_MoveTo00 +static int tolua_AllToLua_cPlayer_MoveTo00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_NewPos = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MoveTo'", NULL); +#endif + { + self->MoveTo(*a_NewPos); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'MoveTo'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWindow of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetWindow00 +static int tolua_AllToLua_cPlayer_GetWindow00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWindow'", NULL); +#endif + { + cWindow* tolua_ret = (cWindow*) self->GetWindow(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWindow"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWindow'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CloseWindow of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_CloseWindow00 +static int tolua_AllToLua_cPlayer_CloseWindow00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,1,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + bool a_CanRefuse = ((bool) tolua_toboolean(tolua_S,2,true)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CloseWindow'", NULL); +#endif + { + self->CloseWindow(a_CanRefuse); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CloseWindow'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CloseWindowIfID of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_CloseWindowIfID00 +static int tolua_AllToLua_cPlayer_CloseWindowIfID00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isboolean(tolua_S,3,1,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + char a_WindowID = ((char) tolua_tonumber(tolua_S,2,0)); + bool a_CanRefuse = ((bool) tolua_toboolean(tolua_S,3,true)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CloseWindowIfID'", NULL); +#endif + { + self->CloseWindowIfID(a_WindowID,a_CanRefuse); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CloseWindowIfID'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetClientHandle of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetClientHandle00 +static int tolua_AllToLua_cPlayer_GetClientHandle00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetClientHandle'", NULL); +#endif + { + cClientHandle* tolua_ret = (cClientHandle*) self->GetClientHandle(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cClientHandle"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetClientHandle'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SendMessage of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SendMessage00 +static int tolua_AllToLua_cPlayer_SendMessage00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SendMessage'", NULL); +#endif + { + self->SendMessage(a_Message); + tolua_pushcppstring(tolua_S,(const char*)a_Message); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SendMessage'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetName of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetName00 +static int tolua_AllToLua_cPlayer_GetName00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetName'", NULL); +#endif + { + const AString tolua_ret = (const AString) self->GetName(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetName'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetName of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetName00 +static int tolua_AllToLua_cPlayer_SetName00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + const AString a_Name = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetName'", NULL); +#endif + { + self->SetName(a_Name); + tolua_pushcppstring(tolua_S,(const char*)a_Name); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetName'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddToGroup of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_AddToGroup00 +static int tolua_AllToLua_cPlayer_AddToGroup00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + const AString a_GroupName = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddToGroup'", NULL); +#endif + { + self->AddToGroup(a_GroupName); + tolua_pushcppstring(tolua_S,(const char*)a_GroupName); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddToGroup'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: RemoveFromGroup of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_RemoveFromGroup00 +static int tolua_AllToLua_cPlayer_RemoveFromGroup00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + const AString a_GroupName = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RemoveFromGroup'", NULL); +#endif + { + self->RemoveFromGroup(a_GroupName); + tolua_pushcppstring(tolua_S,(const char*)a_GroupName); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'RemoveFromGroup'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CanUseCommand of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_CanUseCommand00 +static int tolua_AllToLua_cPlayer_CanUseCommand00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CanUseCommand'", NULL); +#endif + { + bool tolua_ret = (bool) self->CanUseCommand(a_Command); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Command); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CanUseCommand'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HasPermission of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_HasPermission00 +static int tolua_AllToLua_cPlayer_HasPermission00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + const AString a_Permission = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasPermission'", NULL); +#endif + { + bool tolua_ret = (bool) self->HasPermission(a_Permission); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Permission); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HasPermission'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsInGroup of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsInGroup00 +static int tolua_AllToLua_cPlayer_IsInGroup00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + const AString a_Group = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInGroup'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsInGroup(a_Group); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Group); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsInGroup'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetColor of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetColor00 +static int tolua_AllToLua_cPlayer_GetColor00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetColor'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetColor(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetColor'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: TossItem of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_TossItem00 +static int tolua_AllToLua_cPlayer_TossItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,1,&tolua_err) || + !tolua_isnumber(tolua_S,4,1,&tolua_err) || + !tolua_isnumber(tolua_S,5,1,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + bool a_bDraggingItem = ((bool) tolua_toboolean(tolua_S,2,0)); + char a_Amount = ((char) tolua_tonumber(tolua_S,3,1)); + short a_CreateType = ((short) tolua_tonumber(tolua_S,4,0)); + short a_CreateHealth = ((short) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'TossItem'", NULL); +#endif + { + self->TossItem(a_bDraggingItem,a_Amount,a_CreateType,a_CreateHealth); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'TossItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Heal of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_Heal00 +static int tolua_AllToLua_cPlayer_Heal00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + int a_Health = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Heal'", NULL); +#endif + { + self->Heal(a_Health); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Heal'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetFoodLevel of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetFoodLevel00 +static int tolua_AllToLua_cPlayer_GetFoodLevel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFoodLevel'", NULL); +#endif + { + int tolua_ret = (int) self->GetFoodLevel(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetFoodLevel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetFoodSaturationLevel of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetFoodSaturationLevel00 +static int tolua_AllToLua_cPlayer_GetFoodSaturationLevel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFoodSaturationLevel'", NULL); +#endif + { + double tolua_ret = (double) self->GetFoodSaturationLevel(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetFoodSaturationLevel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetFoodTickTimer of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetFoodTickTimer00 +static int tolua_AllToLua_cPlayer_GetFoodTickTimer00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFoodTickTimer'", NULL); +#endif + { + int tolua_ret = (int) self->GetFoodTickTimer(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetFoodTickTimer'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetFoodExhaustionLevel of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetFoodExhaustionLevel00 +static int tolua_AllToLua_cPlayer_GetFoodExhaustionLevel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFoodExhaustionLevel'", NULL); +#endif + { + double tolua_ret = (double) self->GetFoodExhaustionLevel(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetFoodExhaustionLevel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetFoodPoisonedTicksRemaining of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetFoodPoisonedTicksRemaining00 +static int tolua_AllToLua_cPlayer_GetFoodPoisonedTicksRemaining00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFoodPoisonedTicksRemaining'", NULL); +#endif + { + int tolua_ret = (int) self->GetFoodPoisonedTicksRemaining(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetFoodPoisonedTicksRemaining'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetAirLevel of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetAirLevel00 +static int tolua_AllToLua_cPlayer_GetAirLevel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetAirLevel'", NULL); +#endif + { + int tolua_ret = (int) self->GetAirLevel(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetAirLevel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsSatiated of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsSatiated00 +static int tolua_AllToLua_cPlayer_IsSatiated00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSatiated'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsSatiated(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsSatiated'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetFoodLevel of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetFoodLevel00 +static int tolua_AllToLua_cPlayer_SetFoodLevel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + int a_FoodLevel = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFoodLevel'", NULL); +#endif + { + self->SetFoodLevel(a_FoodLevel); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetFoodLevel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetFoodSaturationLevel of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetFoodSaturationLevel00 +static int tolua_AllToLua_cPlayer_SetFoodSaturationLevel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + double a_FoodSaturationLevel = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFoodSaturationLevel'", NULL); +#endif + { + self->SetFoodSaturationLevel(a_FoodSaturationLevel); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetFoodSaturationLevel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetFoodTickTimer of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetFoodTickTimer00 +static int tolua_AllToLua_cPlayer_SetFoodTickTimer00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + int a_FoodTickTimer = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFoodTickTimer'", NULL); +#endif + { + self->SetFoodTickTimer(a_FoodTickTimer); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetFoodTickTimer'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetFoodExhaustionLevel of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetFoodExhaustionLevel00 +static int tolua_AllToLua_cPlayer_SetFoodExhaustionLevel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + double a_FoodExhaustionLevel = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFoodExhaustionLevel'", NULL); +#endif + { + self->SetFoodExhaustionLevel(a_FoodExhaustionLevel); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetFoodExhaustionLevel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetFoodPoisonedTicksRemaining of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetFoodPoisonedTicksRemaining00 +static int tolua_AllToLua_cPlayer_SetFoodPoisonedTicksRemaining00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + int a_FoodPoisonedTicksRemaining = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFoodPoisonedTicksRemaining'", NULL); +#endif + { + self->SetFoodPoisonedTicksRemaining(a_FoodPoisonedTicksRemaining); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetFoodPoisonedTicksRemaining'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Feed of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_Feed00 +static int tolua_AllToLua_cPlayer_Feed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + int a_Food = ((int) tolua_tonumber(tolua_S,2,0)); + double a_Saturation = ((double) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Feed'", NULL); +#endif + { + bool tolua_ret = (bool) self->Feed(a_Food,a_Saturation); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Feed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddFoodExhaustion of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_AddFoodExhaustion00 +static int tolua_AllToLua_cPlayer_AddFoodExhaustion00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + double a_Exhaustion = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddFoodExhaustion'", NULL); +#endif + { + self->AddFoodExhaustion(a_Exhaustion); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddFoodExhaustion'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FoodPoison of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_FoodPoison00 +static int tolua_AllToLua_cPlayer_FoodPoison00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + int a_NumTicks = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FoodPoison'", NULL); +#endif + { + self->FoodPoison(a_NumTicks); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'FoodPoison'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsEating of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsEating00 +static int tolua_AllToLua_cPlayer_IsEating00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsEating'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsEating(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsEating'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Respawn of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_Respawn00 +static int tolua_AllToLua_cPlayer_Respawn00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Respawn'", NULL); +#endif + { + self->Respawn(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Respawn'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetVisible of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetVisible00 +static int tolua_AllToLua_cPlayer_SetVisible00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + bool a_bVisible = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetVisible'", NULL); +#endif + { + self->SetVisible(a_bVisible); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetVisible'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsVisible of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsVisible00 +static int tolua_AllToLua_cPlayer_IsVisible00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsVisible'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsVisible(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsVisible'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: MoveToWorld of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_MoveToWorld00 +static int tolua_AllToLua_cPlayer_MoveToWorld00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + const char* a_WorldName = ((const char*) tolua_tostring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MoveToWorld'", NULL); +#endif + { + bool tolua_ret = (bool) self->MoveToWorld(a_WorldName); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'MoveToWorld'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: LoadPermissionsFromDisk of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_LoadPermissionsFromDisk00 +static int tolua_AllToLua_cPlayer_LoadPermissionsFromDisk00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'LoadPermissionsFromDisk'", NULL); +#endif + { + self->LoadPermissionsFromDisk(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'LoadPermissionsFromDisk'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMaxSpeed of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetMaxSpeed00 +static int tolua_AllToLua_cPlayer_GetMaxSpeed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxSpeed'", NULL); +#endif + { + double tolua_ret = (double) self->GetMaxSpeed(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMaxSpeed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNormalMaxSpeed of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetNormalMaxSpeed00 +static int tolua_AllToLua_cPlayer_GetNormalMaxSpeed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNormalMaxSpeed'", NULL); +#endif + { + double tolua_ret = (double) self->GetNormalMaxSpeed(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetNormalMaxSpeed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSprintingMaxSpeed of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_GetSprintingMaxSpeed00 +static int tolua_AllToLua_cPlayer_GetSprintingMaxSpeed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSprintingMaxSpeed'", NULL); +#endif + { + double tolua_ret = (double) self->GetSprintingMaxSpeed(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSprintingMaxSpeed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetNormalMaxSpeed of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetNormalMaxSpeed00 +static int tolua_AllToLua_cPlayer_SetNormalMaxSpeed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + double a_Speed = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetNormalMaxSpeed'", NULL); +#endif + { + self->SetNormalMaxSpeed(a_Speed); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetNormalMaxSpeed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSprintingMaxSpeed of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetSprintingMaxSpeed00 +static int tolua_AllToLua_cPlayer_SetSprintingMaxSpeed00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + double a_Speed = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSprintingMaxSpeed'", NULL); +#endif + { + self->SetSprintingMaxSpeed(a_Speed); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetSprintingMaxSpeed'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetCrouch of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetCrouch00 +static int tolua_AllToLua_cPlayer_SetCrouch00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + bool a_IsCrouched = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetCrouch'", NULL); +#endif + { + self->SetCrouch(a_IsCrouched); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetCrouch'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSprint of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_SetSprint00 +static int tolua_AllToLua_cPlayer_SetSprint00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlayer",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlayer* self = (cPlayer*) tolua_tousertype(tolua_S,1,0); + bool a_IsSprinting = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSprint'", NULL); +#endif + { + self->SetSprint(a_IsSprinting); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetSprint'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsSwimming of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsSwimming00 +static int tolua_AllToLua_cPlayer_IsSwimming00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSwimming'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsSwimming(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsSwimming'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsSubmerged of class cPlayer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlayer_IsSubmerged00 +static int tolua_AllToLua_cPlayer_IsSubmerged00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlayer* self = (const cPlayer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSubmerged'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsSubmerged(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsSubmerged'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cPickup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_new00 +static int tolua_AllToLua_cPickup_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cPickup",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,5,&tolua_err) || !tolua_isusertype(tolua_S,5,"const cItem",0,&tolua_err)) || + !tolua_isboolean(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,1,&tolua_err) || + !tolua_isnumber(tolua_S,8,1,&tolua_err) || + !tolua_isnumber(tolua_S,9,1,&tolua_err) || + !tolua_isnoobj(tolua_S,10,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_PosY = ((double) tolua_tonumber(tolua_S,3,0)); + double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,5,0)); + bool IsPlayerCreated = ((bool) tolua_toboolean(tolua_S,6,0)); + float a_SpeedX = ((float) tolua_tonumber(tolua_S,7,0.f)); + float a_SpeedY = ((float) tolua_tonumber(tolua_S,8,0.f)); + float a_SpeedZ = ((float) tolua_tonumber(tolua_S,9,0.f)); + { + cPickup* tolua_ret = (cPickup*) Mtolua_new((cPickup)(a_PosX,a_PosY,a_PosZ,*a_Item,IsPlayerCreated,a_SpeedX,a_SpeedY,a_SpeedZ)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPickup"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cPickup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_new00_local +static int tolua_AllToLua_cPickup_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cPickup",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,5,&tolua_err) || !tolua_isusertype(tolua_S,5,"const cItem",0,&tolua_err)) || + !tolua_isboolean(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,1,&tolua_err) || + !tolua_isnumber(tolua_S,8,1,&tolua_err) || + !tolua_isnumber(tolua_S,9,1,&tolua_err) || + !tolua_isnoobj(tolua_S,10,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_PosY = ((double) tolua_tonumber(tolua_S,3,0)); + double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,5,0)); + bool IsPlayerCreated = ((bool) tolua_toboolean(tolua_S,6,0)); + float a_SpeedX = ((float) tolua_tonumber(tolua_S,7,0.f)); + float a_SpeedY = ((float) tolua_tonumber(tolua_S,8,0.f)); + float a_SpeedZ = ((float) tolua_tonumber(tolua_S,9,0.f)); + { + cPickup* tolua_ret = (cPickup*) Mtolua_new((cPickup)(a_PosX,a_PosY,a_PosZ,*a_Item,IsPlayerCreated,a_SpeedX,a_SpeedY,a_SpeedZ)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPickup"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetItem of class cPickup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_GetItem00 +static int tolua_AllToLua_cPickup_GetItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPickup",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPickup* self = (cPickup*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetItem'", NULL); +#endif + { + cItem& tolua_ret = (cItem&) self->GetItem(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CollectedBy of class cPickup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_CollectedBy00 +static int tolua_AllToLua_cPickup_CollectedBy00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPickup",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPickup* self = (cPickup*) tolua_tousertype(tolua_S,1,0); + cPlayer* a_Dest = ((cPlayer*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CollectedBy'", NULL); +#endif + { + bool tolua_ret = (bool) self->CollectedBy(a_Dest); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CollectedBy'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetAge of class cPickup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_GetAge00 +static int tolua_AllToLua_cPickup_GetAge00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPickup",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPickup* self = (const cPickup*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetAge'", NULL); +#endif + { + int tolua_ret = (int) self->GetAge(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetAge'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsCollected of class cPickup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_IsCollected00 +static int tolua_AllToLua_cPickup_IsCollected00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPickup",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPickup* self = (const cPickup*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsCollected'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsCollected(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsCollected'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsPlayerCreated of class cPickup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPickup_IsPlayerCreated00 +static int tolua_AllToLua_cPickup_IsPlayerCreated00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPickup",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPickup* self = (const cPickup*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsPlayerCreated'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsPlayerCreated(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsPlayerCreated'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetProjectileKind of class cProjectileEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_GetProjectileKind00 +static int tolua_AllToLua_cProjectileEntity_GetProjectileKind00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cProjectileEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cProjectileEntity* self = (const cProjectileEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetProjectileKind'", NULL); +#endif + { + cProjectileEntity::eKind tolua_ret = (cProjectileEntity::eKind) self->GetProjectileKind(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetProjectileKind'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetCreator of class cProjectileEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_GetCreator00 +static int tolua_AllToLua_cProjectileEntity_GetCreator00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cProjectileEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cProjectileEntity* self = (cProjectileEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCreator'", NULL); +#endif + { + cEntity* tolua_ret = (cEntity*) self->GetCreator(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cEntity"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetCreator'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMCAClassName of class cProjectileEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_GetMCAClassName00 +static int tolua_AllToLua_cProjectileEntity_GetMCAClassName00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cProjectileEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cProjectileEntity* self = (const cProjectileEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMCAClassName'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetMCAClassName(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMCAClassName'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsInGround of class cProjectileEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cProjectileEntity_IsInGround00 +static int tolua_AllToLua_cProjectileEntity_IsInGround00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cProjectileEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cProjectileEntity* self = (const cProjectileEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInGround'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsInGround(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsInGround'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPickupState of class cArrowEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_GetPickupState00 +static int tolua_AllToLua_cArrowEntity_GetPickupState00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cArrowEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cArrowEntity* self = (const cArrowEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPickupState'", NULL); +#endif + { + cArrowEntity::ePickupState tolua_ret = (cArrowEntity::ePickupState) self->GetPickupState(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPickupState'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetPickupState of class cArrowEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_SetPickupState00 +static int tolua_AllToLua_cArrowEntity_SetPickupState00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cArrowEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cArrowEntity* self = (cArrowEntity*) tolua_tousertype(tolua_S,1,0); + cArrowEntity::ePickupState a_PickupState = ((cArrowEntity::ePickupState) (int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPickupState'", NULL); +#endif + { + self->SetPickupState(a_PickupState); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetPickupState'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetDamageCoeff of class cArrowEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_GetDamageCoeff00 +static int tolua_AllToLua_cArrowEntity_GetDamageCoeff00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cArrowEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cArrowEntity* self = (const cArrowEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDamageCoeff'", NULL); +#endif + { + double tolua_ret = (double) self->GetDamageCoeff(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetDamageCoeff'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetDamageCoeff of class cArrowEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_SetDamageCoeff00 +static int tolua_AllToLua_cArrowEntity_SetDamageCoeff00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cArrowEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cArrowEntity* self = (cArrowEntity*) tolua_tousertype(tolua_S,1,0); + double a_DamageCoeff = ((double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetDamageCoeff'", NULL); +#endif + { + self->SetDamageCoeff(a_DamageCoeff); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetDamageCoeff'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CanPickup of class cArrowEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_CanPickup00 +static int tolua_AllToLua_cArrowEntity_CanPickup00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cArrowEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cPlayer",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cArrowEntity* self = (const cArrowEntity*) tolua_tousertype(tolua_S,1,0); + const cPlayer* a_Player = ((const cPlayer*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CanPickup'", NULL); +#endif + { + bool tolua_ret = (bool) self->CanPickup(*a_Player); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CanPickup'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsCritical of class cArrowEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_IsCritical00 +static int tolua_AllToLua_cArrowEntity_IsCritical00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cArrowEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cArrowEntity* self = (const cArrowEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsCritical'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsCritical(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsCritical'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetIsCritical of class cArrowEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cArrowEntity_SetIsCritical00 +static int tolua_AllToLua_cArrowEntity_SetIsCritical00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cArrowEntity",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cArrowEntity* self = (cArrowEntity*) tolua_tousertype(tolua_S,1,0); + bool a_IsCritical = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetIsCritical'", NULL); +#endif + { + self->SetIsCritical(a_IsCritical); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetIsCritical'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Get of class cPluginManager */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_Get00 +static int tolua_AllToLua_cPluginManager_Get00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cPluginManager",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cPluginManager* tolua_ret = (cPluginManager*) cPluginManager::Get(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPluginManager"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Get'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPlugin of class cPluginManager */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_GetPlugin00 +static int tolua_AllToLua_cPluginManager_GetPlugin00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPluginManager",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPluginManager* self = (const cPluginManager*) tolua_tousertype(tolua_S,1,0); + const AString a_Plugin = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPlugin'", NULL); +#endif + { + cPlugin* tolua_ret = (cPlugin*) self->GetPlugin(a_Plugin); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPlugin"); + tolua_pushcppstring(tolua_S,(const char*)a_Plugin); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPlugin'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FindPlugins of class cPluginManager */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_FindPlugins00 +static int tolua_AllToLua_cPluginManager_FindPlugins00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FindPlugins'", NULL); +#endif + { + self->FindPlugins(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'FindPlugins'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ReloadPlugins of class cPluginManager */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_ReloadPlugins00 +static int tolua_AllToLua_cPluginManager_ReloadPlugins00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ReloadPlugins'", NULL); +#endif + { + self->ReloadPlugins(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ReloadPlugins'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNumPlugins of class cPluginManager */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_GetNumPlugins00 +static int tolua_AllToLua_cPluginManager_GetNumPlugins00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPluginManager",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPluginManager* self = (const cPluginManager*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumPlugins'", NULL); +#endif + { + unsigned int tolua_ret = (unsigned int) self->GetNumPlugins(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetNumPlugins'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DisablePlugin of class cPluginManager */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_DisablePlugin00 +static int tolua_AllToLua_cPluginManager_DisablePlugin00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); + const AString a_PluginName = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DisablePlugin'", NULL); +#endif + { + bool tolua_ret = (bool) self->DisablePlugin(a_PluginName); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_PluginName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DisablePlugin'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: LoadPlugin of class cPluginManager */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_LoadPlugin00 +static int tolua_AllToLua_cPluginManager_LoadPlugin00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); + const AString a_PluginName = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'LoadPlugin'", NULL); +#endif + { + bool tolua_ret = (bool) self->LoadPlugin(a_PluginName); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_PluginName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'LoadPlugin'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsCommandBound of class cPluginManager */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_IsCommandBound00 +static int tolua_AllToLua_cPluginManager_IsCommandBound00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); + const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsCommandBound'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsCommandBound(a_Command); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Command); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsCommandBound'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetCommandPermission of class cPluginManager */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_GetCommandPermission00 +static int tolua_AllToLua_cPluginManager_GetCommandPermission00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); + const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCommandPermission'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetCommandPermission(a_Command); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Command); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetCommandPermission'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ExecuteCommand of class cPluginManager */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_ExecuteCommand00 +static int tolua_AllToLua_cPluginManager_ExecuteCommand00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); + cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0)); + const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ExecuteCommand'", NULL); +#endif + { + bool tolua_ret = (bool) self->ExecuteCommand(a_Player,a_Command); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Command); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ExecuteCommand'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ForceExecuteCommand of class cPluginManager */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_ForceExecuteCommand00 +static int tolua_AllToLua_cPluginManager_ForceExecuteCommand00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); + cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0)); + const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ForceExecuteCommand'", NULL); +#endif + { + bool tolua_ret = (bool) self->ForceExecuteCommand(a_Player,a_Command); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Command); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ForceExecuteCommand'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsConsoleCommandBound of class cPluginManager */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPluginManager_IsConsoleCommandBound00 +static int tolua_AllToLua_cPluginManager_IsConsoleCommandBound00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPluginManager",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPluginManager* self = (cPluginManager*) tolua_tousertype(tolua_S,1,0); + const AString a_Command = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsConsoleCommandBound'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsConsoleCommandBound(a_Command); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Command); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsConsoleCommandBound'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetName of class cPlugin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_GetName00 +static int tolua_AllToLua_cPlugin_GetName00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlugin",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlugin* self = (const cPlugin*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetName'", NULL); +#endif + { + const AString tolua_ret = (const AString) self->GetName(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetName'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetName of class cPlugin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_SetName00 +static int tolua_AllToLua_cPlugin_SetName00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlugin",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0); + const AString a_Name = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetName'", NULL); +#endif + { + self->SetName(a_Name); + tolua_pushcppstring(tolua_S,(const char*)a_Name); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetName'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetVersion of class cPlugin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_GetVersion00 +static int tolua_AllToLua_cPlugin_GetVersion00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlugin",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlugin* self = (const cPlugin*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetVersion'", NULL); +#endif + { + int tolua_ret = (int) self->GetVersion(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetVersion'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetVersion of class cPlugin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_SetVersion00 +static int tolua_AllToLua_cPlugin_SetVersion00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cPlugin",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cPlugin* self = (cPlugin*) tolua_tousertype(tolua_S,1,0); + int a_Version = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetVersion'", NULL); +#endif + { + self->SetVersion(a_Version); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetVersion'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetDirectory of class cPlugin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_GetDirectory00 +static int tolua_AllToLua_cPlugin_GetDirectory00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlugin",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlugin* self = (const cPlugin*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDirectory'", NULL); +#endif + { + const AString tolua_ret = (const AString) self->GetDirectory(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetDirectory'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetLocalDirectory of class cPlugin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_GetLocalDirectory00 +static int tolua_AllToLua_cPlugin_GetLocalDirectory00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlugin",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlugin* self = (const cPlugin*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLocalDirectory'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetLocalDirectory(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetLocalDirectory'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetLocalFolder of class cPlugin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cPlugin_GetLocalFolder00 +static int tolua_AllToLua_cPlugin_GetLocalFolder00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cPlugin",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cPlugin* self = (const cPlugin*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLocalFolder'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetLocalFolder(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetLocalFolder'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: __cWebPlugin__ of class cPluginLua */ +#ifndef TOLUA_DISABLE_tolua_get_cPluginLua___cWebPlugin__ +static int tolua_get_cPluginLua___cWebPlugin__(lua_State* tolua_S) +{ + cPluginLua* self = (cPluginLua*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable '__cWebPlugin__'",NULL); +#endif +#ifdef __cplusplus + tolua_pushusertype(tolua_S,(void*)static_cast<cWebPlugin*>(self), "cWebPlugin"); +#else + tolua_pushusertype(tolua_S,(void*)((cWebPlugin*)self), "cWebPlugin"); +#endif + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetDescription of class cServer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_GetDescription00 +static int tolua_AllToLua_cServer_GetDescription00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cServer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cServer* self = (const cServer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDescription'", NULL); +#endif + { + const AString tolua_ret = (const AString) self->GetDescription(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetDescription'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMaxPlayers of class cServer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_GetMaxPlayers00 +static int tolua_AllToLua_cServer_GetMaxPlayers00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cServer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cServer* self = (const cServer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxPlayers'", NULL); +#endif + { + int tolua_ret = (int) self->GetMaxPlayers(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMaxPlayers'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNumPlayers of class cServer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_GetNumPlayers00 +static int tolua_AllToLua_cServer_GetNumPlayers00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cServer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cServer* self = (cServer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumPlayers'", NULL); +#endif + { + int tolua_ret = (int) self->GetNumPlayers(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetNumPlayers'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetMaxPlayers of class cServer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_SetMaxPlayers00 +static int tolua_AllToLua_cServer_SetMaxPlayers00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cServer",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cServer* self = (cServer*) tolua_tousertype(tolua_S,1,0); + int a_MaxPlayers = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetMaxPlayers'", NULL); +#endif + { + self->SetMaxPlayers(a_MaxPlayers); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetMaxPlayers'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsHardcore of class cServer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_IsHardcore00 +static int tolua_AllToLua_cServer_IsHardcore00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cServer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cServer* self = (const cServer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsHardcore'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsHardcore(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsHardcore'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetServerID of class cServer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cServer_GetServerID00 +static int tolua_AllToLua_cServer_GetServerID00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cServer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cServer* self = (const cServer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetServerID'", NULL); +#endif + { + const AString tolua_ret = (const AString) self->GetServerID(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetServerID'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetTicksUntilWeatherChange of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetTicksUntilWeatherChange00 +static int tolua_AllToLua_cWorld_GetTicksUntilWeatherChange00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetTicksUntilWeatherChange'", NULL); +#endif + { + int tolua_ret = (int) self->GetTicksUntilWeatherChange(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetTicksUntilWeatherChange'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWorldAge of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetWorldAge00 +static int tolua_AllToLua_cWorld_GetWorldAge00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWorldAge'", NULL); +#endif + { + long long tolua_ret = ( long long) self->GetWorldAge(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWorldAge'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetTimeOfDay of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetTimeOfDay00 +static int tolua_AllToLua_cWorld_GetTimeOfDay00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetTimeOfDay'", NULL); +#endif + { + long long tolua_ret = ( long long) self->GetTimeOfDay(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetTimeOfDay'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetTicksUntilWeatherChange of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetTicksUntilWeatherChange00 +static int tolua_AllToLua_cWorld_SetTicksUntilWeatherChange00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_WeatherInterval = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetTicksUntilWeatherChange'", NULL); +#endif + { + self->SetTicksUntilWeatherChange(a_WeatherInterval); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetTicksUntilWeatherChange'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetTimeOfDay of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetTimeOfDay00 +static int tolua_AllToLua_cWorld_SetTimeOfDay00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + long long a_TimeOfDay = (( long long) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetTimeOfDay'", NULL); +#endif + { + self->SetTimeOfDay(a_TimeOfDay); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetTimeOfDay'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetGameMode of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetGameMode00 +static int tolua_AllToLua_cWorld_GetGameMode00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetGameMode'", NULL); +#endif + { + eGameMode tolua_ret = (eGameMode) self->GetGameMode(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetGameMode'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsGameModeCreative of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsGameModeCreative00 +static int tolua_AllToLua_cWorld_IsGameModeCreative00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsGameModeCreative'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsGameModeCreative(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsGameModeCreative'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsGameModeSurvival of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsGameModeSurvival00 +static int tolua_AllToLua_cWorld_IsGameModeSurvival00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsGameModeSurvival'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsGameModeSurvival(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsGameModeSurvival'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsGameModeAdventure of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsGameModeAdventure00 +static int tolua_AllToLua_cWorld_IsGameModeAdventure00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsGameModeAdventure'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsGameModeAdventure(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsGameModeAdventure'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsPVPEnabled of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsPVPEnabled00 +static int tolua_AllToLua_cWorld_IsPVPEnabled00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsPVPEnabled'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsPVPEnabled(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsPVPEnabled'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsDeepSnowEnabled of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsDeepSnowEnabled00 +static int tolua_AllToLua_cWorld_IsDeepSnowEnabled00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsDeepSnowEnabled'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsDeepSnowEnabled(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsDeepSnowEnabled'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetDimension of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetDimension00 +static int tolua_AllToLua_cWorld_GetDimension00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDimension'", NULL); +#endif + { + eDimension tolua_ret = (eDimension) self->GetDimension(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetDimension'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetHeight of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetHeight00 +static int tolua_AllToLua_cWorld_GetHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeight'", NULL); +#endif + { + int tolua_ret = (int) self->GetHeight(a_BlockX,a_BlockZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: BroadcastChat of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_BroadcastChat00 +static int tolua_AllToLua_cWorld_BroadcastChat00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isusertype(tolua_S,3,"const cClientHandle",1,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const cClientHandle* a_Exclude = ((const cClientHandle*) tolua_tousertype(tolua_S,3,NULL)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'BroadcastChat'", NULL); +#endif + { + self->BroadcastChat(a_Message,a_Exclude); + tolua_pushcppstring(tolua_S,(const char*)a_Message); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'BroadcastChat'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: BroadcastSoundEffect of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_BroadcastSoundEffect00 +static int tolua_AllToLua_cWorld_BroadcastSoundEffect00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isusertype(tolua_S,8,"const cClientHandle",1,&tolua_err) || + !tolua_isnoobj(tolua_S,9,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + const AString a_SoundName = ((const AString) tolua_tocppstring(tolua_S,2,0)); + int a_SrcX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_SrcY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_SrcZ = ((int) tolua_tonumber(tolua_S,5,0)); + float a_Volume = ((float) tolua_tonumber(tolua_S,6,0)); + float a_Pitch = ((float) tolua_tonumber(tolua_S,7,0)); + const cClientHandle* a_Exclude = ((const cClientHandle*) tolua_tousertype(tolua_S,8,NULL)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'BroadcastSoundEffect'", NULL); +#endif + { + self->BroadcastSoundEffect(a_SoundName,a_SrcX,a_SrcY,a_SrcZ,a_Volume,a_Pitch,a_Exclude); + tolua_pushcppstring(tolua_S,(const char*)a_SoundName); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'BroadcastSoundEffect'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: BroadcastSoundParticleEffect of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_BroadcastSoundParticleEffect00 +static int tolua_AllToLua_cWorld_BroadcastSoundParticleEffect00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isusertype(tolua_S,7,"const cClientHandle",1,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_EffectID = ((int) tolua_tonumber(tolua_S,2,0)); + int a_SrcX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_SrcY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_SrcZ = ((int) tolua_tonumber(tolua_S,5,0)); + int a_Data = ((int) tolua_tonumber(tolua_S,6,0)); + const cClientHandle* a_Exclude = ((const cClientHandle*) tolua_tousertype(tolua_S,7,NULL)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'BroadcastSoundParticleEffect'", NULL); +#endif + { + self->BroadcastSoundParticleEffect(a_EffectID,a_SrcX,a_SrcY,a_SrcZ,a_Data,a_Exclude); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'BroadcastSoundParticleEffect'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: UnloadUnusedChunks of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_UnloadUnusedChunks00 +static int tolua_AllToLua_cWorld_UnloadUnusedChunks00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'UnloadUnusedChunks'", NULL); +#endif + { + self->UnloadUnusedChunks(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'UnloadUnusedChunks'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: RegenerateChunk of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_RegenerateChunk00 +static int tolua_AllToLua_cWorld_RegenerateChunk00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_ChunkX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_ChunkZ = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RegenerateChunk'", NULL); +#endif + { + self->RegenerateChunk(a_ChunkX,a_ChunkZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'RegenerateChunk'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GenerateChunk of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GenerateChunk00 +static int tolua_AllToLua_cWorld_GenerateChunk00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_ChunkX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_ChunkZ = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GenerateChunk'", NULL); +#endif + { + self->GenerateChunk(a_ChunkX,a_ChunkZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GenerateChunk'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBlock of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetBlock00 +static int tolua_AllToLua_cWorld_SetBlock00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlock'", NULL); +#endif + { + self->SetBlock(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetBlock'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FastSetBlock of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_FastSetBlock00 +static int tolua_AllToLua_cWorld_FastSetBlock00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FastSetBlock'", NULL); +#endif + { + self->FastSetBlock(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'FastSetBlock'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: QueueSetBlock of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_QueueSetBlock00 +static int tolua_AllToLua_cWorld_QueueSetBlock00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BLockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); + int a_TickDelay = ((int) tolua_tonumber(tolua_S,7,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'QueueSetBlock'", NULL); +#endif + { + self->QueueSetBlock(a_BlockX,a_BLockY,a_BlockZ,a_BlockType,a_BlockMeta,a_TickDelay); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'QueueSetBlock'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlock of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlock00 +static int tolua_AllToLua_cWorld_GetBlock00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlock'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlock(a_BlockX,a_BlockY,a_BlockZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlock'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockMeta of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlockMeta00 +static int tolua_AllToLua_cWorld_GetBlockMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockMeta'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlockMeta(a_BlockX,a_BlockY,a_BlockZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBlockMeta of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetBlockMeta00 +static int tolua_AllToLua_cWorld_SetBlockMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_MetaData = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockMeta'", NULL); +#endif + { + self->SetBlockMeta(a_BlockX,a_BlockY,a_BlockZ,a_MetaData); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetBlockMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockSkyLight of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlockSkyLight00 +static int tolua_AllToLua_cWorld_GetBlockSkyLight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockSkyLight'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlockSkyLight(a_BlockX,a_BlockY,a_BlockZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockSkyLight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockBlockLight of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlockBlockLight00 +static int tolua_AllToLua_cWorld_GetBlockBlockLight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockBlockLight'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlockBlockLight(a_BlockX,a_BlockY,a_BlockZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockBlockLight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FastSetBlock of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_FastSetBlock01 +static int tolua_AllToLua_cWorld_FastSetBlock01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + const Vector3i* a_Pos = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,3,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FastSetBlock'", NULL); +#endif + { + self->FastSetBlock(*a_Pos,a_BlockType,a_BlockMeta); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cWorld_FastSetBlock00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlock of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlock01 +static int tolua_AllToLua_cWorld_GetBlock01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + const Vector3i* a_Pos = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlock'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlock(*a_Pos); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cWorld_GetBlock00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockMeta of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBlockMeta01 +static int tolua_AllToLua_cWorld_GetBlockMeta01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + const Vector3i* a_Pos = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockMeta'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlockMeta(*a_Pos); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cWorld_GetBlockMeta00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBlockMeta of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetBlockMeta01 +static int tolua_AllToLua_cWorld_SetBlockMeta01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + const Vector3i* a_Pos = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); + unsigned char a_MetaData = (( unsigned char) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockMeta'", NULL); +#endif + { + self->SetBlockMeta(*a_Pos,a_MetaData); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cWorld_SetBlockMeta00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SpawnItemPickups of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SpawnItemPickups00 +static int tolua_AllToLua_cWorld_SpawnItemPickups00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItems",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,1,&tolua_err) || + !tolua_isboolean(tolua_S,7,1,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + const cItems* a_Pickups = ((const cItems*) tolua_tousertype(tolua_S,2,0)); + double a_BlockX = ((double) tolua_tonumber(tolua_S,3,0)); + double a_BlockY = ((double) tolua_tonumber(tolua_S,4,0)); + double a_BlockZ = ((double) tolua_tonumber(tolua_S,5,0)); + double a_FlyAwaySpeed = ((double) tolua_tonumber(tolua_S,6,1.0)); + bool IsPlayerCreated = ((bool) tolua_toboolean(tolua_S,7,false)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnItemPickups'", NULL); +#endif + { + self->SpawnItemPickups(*a_Pickups,a_BlockX,a_BlockY,a_BlockZ,a_FlyAwaySpeed,IsPlayerCreated); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SpawnItemPickups'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SpawnItemPickups of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SpawnItemPickups01 +static int tolua_AllToLua_cWorld_SpawnItemPickups01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItems",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnumber(tolua_S,8,0,&tolua_err) || + !tolua_isboolean(tolua_S,9,1,&tolua_err) || + !tolua_isnoobj(tolua_S,10,&tolua_err) + ) + goto tolua_lerror; + else + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + const cItems* a_Pickups = ((const cItems*) tolua_tousertype(tolua_S,2,0)); + double a_BlockX = ((double) tolua_tonumber(tolua_S,3,0)); + double a_BlockY = ((double) tolua_tonumber(tolua_S,4,0)); + double a_BlockZ = ((double) tolua_tonumber(tolua_S,5,0)); + double a_SpeedX = ((double) tolua_tonumber(tolua_S,6,0)); + double a_SpeedY = ((double) tolua_tonumber(tolua_S,7,0)); + double a_SpeedZ = ((double) tolua_tonumber(tolua_S,8,0)); + bool IsPlayerCreated = ((bool) tolua_toboolean(tolua_S,9,false)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnItemPickups'", NULL); +#endif + { + self->SpawnItemPickups(*a_Pickups,a_BlockX,a_BlockY,a_BlockZ,a_SpeedX,a_SpeedY,a_SpeedZ,IsPlayerCreated); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cWorld_SpawnItemPickups00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SpawnExperienceOrb of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SpawnExperienceOrb00 +static int tolua_AllToLua_cWorld_SpawnExperienceOrb00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + double a_X = ((double) tolua_tonumber(tolua_S,2,0)); + double a_Y = ((double) tolua_tonumber(tolua_S,3,0)); + double a_Z = ((double) tolua_tonumber(tolua_S,4,0)); + int a_Reward = ((int) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnExperienceOrb'", NULL); +#endif + { + int tolua_ret = (int) self->SpawnExperienceOrb(a_X,a_Y,a_Z,a_Reward); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SpawnExperienceOrb'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SpawnPrimedTNT of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SpawnPrimedTNT00 +static int tolua_AllToLua_cWorld_SpawnPrimedTNT00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,1,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + double a_X = ((double) tolua_tonumber(tolua_S,2,0)); + double a_Y = ((double) tolua_tonumber(tolua_S,3,0)); + double a_Z = ((double) tolua_tonumber(tolua_S,4,0)); + double a_FuseTimeInSec = ((double) tolua_tonumber(tolua_S,5,0)); + double a_InitialVelocityCoeff = ((double) tolua_tonumber(tolua_S,6,1)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnPrimedTNT'", NULL); +#endif + { + self->SpawnPrimedTNT(a_X,a_Y,a_Z,a_FuseTimeInSec,a_InitialVelocityCoeff); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SpawnPrimedTNT'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DigBlock of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_DigBlock00 +static int tolua_AllToLua_cWorld_DigBlock00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DigBlock'", NULL); +#endif + { + bool tolua_ret = (bool) self->DigBlock(a_X,a_Y,a_Z); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DigBlock'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SendBlockTo of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SendBlockTo00 +static int tolua_AllToLua_cWorld_SendBlockTo00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isusertype(tolua_S,5,"cPlayer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); + cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SendBlockTo'", NULL); +#endif + { + self->SendBlockTo(a_X,a_Y,a_Z,a_Player); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SendBlockTo'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSpawnX of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetSpawnX00 +static int tolua_AllToLua_cWorld_GetSpawnX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpawnX'", NULL); +#endif + { + double tolua_ret = (double) self->GetSpawnX(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSpawnX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSpawnY of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetSpawnY00 +static int tolua_AllToLua_cWorld_GetSpawnY00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpawnY'", NULL); +#endif + { + double tolua_ret = (double) self->GetSpawnY(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSpawnY'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSpawnZ of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetSpawnZ00 +static int tolua_AllToLua_cWorld_GetSpawnZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSpawnZ'", NULL); +#endif + { + double tolua_ret = (double) self->GetSpawnZ(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSpawnZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: WakeUpSimulators of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_WakeUpSimulators00 +static int tolua_AllToLua_cWorld_WakeUpSimulators00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'WakeUpSimulators'", NULL); +#endif + { + self->WakeUpSimulators(a_BlockX,a_BlockY,a_BlockZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'WakeUpSimulators'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: WakeUpSimulatorsInArea of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_WakeUpSimulatorsInArea00 +static int tolua_AllToLua_cWorld_WakeUpSimulatorsInArea00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_MinBlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_MaxBlockX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_MinBlockY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_MaxBlockY = ((int) tolua_tonumber(tolua_S,5,0)); + int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,6,0)); + int a_MaxBlockZ = ((int) tolua_tonumber(tolua_S,7,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'WakeUpSimulatorsInArea'", NULL); +#endif + { + self->WakeUpSimulatorsInArea(a_MinBlockX,a_MaxBlockX,a_MinBlockY,a_MaxBlockY,a_MinBlockZ,a_MaxBlockZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'WakeUpSimulatorsInArea'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DoExplosionAt of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_DoExplosionAt00 +static int tolua_AllToLua_cWorld_DoExplosionAt00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isboolean(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isuserdata(tolua_S,8,0,&tolua_err) || + !tolua_isnoobj(tolua_S,9,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + double a_ExplosionSize = ((double) tolua_tonumber(tolua_S,2,0)); + double a_BlockX = ((double) tolua_tonumber(tolua_S,3,0)); + double a_BlockY = ((double) tolua_tonumber(tolua_S,4,0)); + double a_BlockZ = ((double) tolua_tonumber(tolua_S,5,0)); + bool a_CanCauseFire = ((bool) tolua_toboolean(tolua_S,6,0)); + eExplosionSource a_Source = ((eExplosionSource) (int) tolua_tonumber(tolua_S,7,0)); + void* a_SourceData = ((void*) tolua_touserdata(tolua_S,8,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DoExplosionAt'", NULL); +#endif + { + self->DoExplosionAt(a_ExplosionSize,a_BlockX,a_BlockY,a_BlockZ,a_CanCauseFire,a_Source,a_SourceData); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DoExplosionAt'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: UseBlockEntity of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_UseBlockEntity00 +static int tolua_AllToLua_cWorld_UseBlockEntity00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0)); + int a_BlockX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'UseBlockEntity'", NULL); +#endif + { + self->UseBlockEntity(a_Player,a_BlockX,a_BlockY,a_BlockZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'UseBlockEntity'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GrowTree of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowTree00 +static int tolua_AllToLua_cWorld_GrowTree00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowTree'", NULL); +#endif + { + self->GrowTree(a_BlockX,a_BlockY,a_BlockZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GrowTree'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GrowTreeFromSapling of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowTreeFromSapling00 +static int tolua_AllToLua_cWorld_GrowTreeFromSapling00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_SaplingMeta = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowTreeFromSapling'", NULL); +#endif + { + self->GrowTreeFromSapling(a_BlockX,a_BlockY,a_BlockZ,a_SaplingMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GrowTreeFromSapling'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GrowTreeByBiome of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowTreeByBiome00 +static int tolua_AllToLua_cWorld_GrowTreeByBiome00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowTreeByBiome'", NULL); +#endif + { + self->GrowTreeByBiome(a_BlockX,a_BlockY,a_BlockZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GrowTreeByBiome'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GrowRipePlant of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowRipePlant00 +static int tolua_AllToLua_cWorld_GrowRipePlant00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isboolean(tolua_S,5,1,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + bool a_IsByBonemeal = ((bool) tolua_toboolean(tolua_S,5,false)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowRipePlant'", NULL); +#endif + { + bool tolua_ret = (bool) self->GrowRipePlant(a_BlockX,a_BlockY,a_BlockZ,a_IsByBonemeal); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GrowRipePlant'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GrowCactus of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowCactus00 +static int tolua_AllToLua_cWorld_GrowCactus00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + int a_NumBlocksToGrow = ((int) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowCactus'", NULL); +#endif + { + self->GrowCactus(a_BlockX,a_BlockY,a_BlockZ,a_NumBlocksToGrow); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GrowCactus'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GrowMelonPumpkin of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowMelonPumpkin00 +static int tolua_AllToLua_cWorld_GrowMelonPumpkin00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowMelonPumpkin'", NULL); +#endif + { + self->GrowMelonPumpkin(a_BlockX,a_BlockY,a_BlockZ,a_BlockType); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GrowMelonPumpkin'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GrowSugarcane of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GrowSugarcane00 +static int tolua_AllToLua_cWorld_GrowSugarcane00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + int a_NumBlocksToGrow = ((int) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GrowSugarcane'", NULL); +#endif + { + self->GrowSugarcane(a_BlockX,a_BlockY,a_BlockZ,a_NumBlocksToGrow); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GrowSugarcane'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBiomeAt of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetBiomeAt00 +static int tolua_AllToLua_cWorld_GetBiomeAt00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBiomeAt'", NULL); +#endif + { + int tolua_ret = (int) self->GetBiomeAt(a_BlockX,a_BlockZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBiomeAt'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetName of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetName00 +static int tolua_AllToLua_cWorld_GetName00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetName'", NULL); +#endif + { + const AString tolua_ret = (const AString) self->GetName(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetName'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetIniFileName of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetIniFileName00 +static int tolua_AllToLua_cWorld_GetIniFileName00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetIniFileName'", NULL); +#endif + { + const AString tolua_ret = (const AString) self->GetIniFileName(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetIniFileName'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: QueueSaveAllChunks of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_QueueSaveAllChunks00 +static int tolua_AllToLua_cWorld_QueueSaveAllChunks00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'QueueSaveAllChunks'", NULL); +#endif + { + self->QueueSaveAllChunks(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'QueueSaveAllChunks'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNumChunks of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetNumChunks00 +static int tolua_AllToLua_cWorld_GetNumChunks00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumChunks'", NULL); +#endif + { + int tolua_ret = (int) self->GetNumChunks(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetNumChunks'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetGeneratorQueueLength of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetGeneratorQueueLength00 +static int tolua_AllToLua_cWorld_GetGeneratorQueueLength00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetGeneratorQueueLength'", NULL); +#endif + { + int tolua_ret = (int) self->GetGeneratorQueueLength(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetGeneratorQueueLength'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetLightingQueueLength of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetLightingQueueLength00 +static int tolua_AllToLua_cWorld_GetLightingQueueLength00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLightingQueueLength'", NULL); +#endif + { + int tolua_ret = (int) self->GetLightingQueueLength(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetLightingQueueLength'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetStorageLoadQueueLength of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetStorageLoadQueueLength00 +static int tolua_AllToLua_cWorld_GetStorageLoadQueueLength00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetStorageLoadQueueLength'", NULL); +#endif + { + int tolua_ret = (int) self->GetStorageLoadQueueLength(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetStorageLoadQueueLength'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetStorageSaveQueueLength of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetStorageSaveQueueLength00 +static int tolua_AllToLua_cWorld_GetStorageSaveQueueLength00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetStorageSaveQueueLength'", NULL); +#endif + { + int tolua_ret = (int) self->GetStorageSaveQueueLength(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetStorageSaveQueueLength'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: QueueBlockForTick of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_QueueBlockForTick00 +static int tolua_AllToLua_cWorld_QueueBlockForTick00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + int a_TicksToWait = ((int) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'QueueBlockForTick'", NULL); +#endif + { + self->QueueBlockForTick(a_BlockX,a_BlockY,a_BlockZ,a_TicksToWait); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'QueueBlockForTick'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CastThunderbolt of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_CastThunderbolt00 +static int tolua_AllToLua_cWorld_CastThunderbolt00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CastThunderbolt'", NULL); +#endif + { + self->CastThunderbolt(a_BlockX,a_BlockY,a_BlockZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CastThunderbolt'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetWeather of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetWeather00 +static int tolua_AllToLua_cWorld_SetWeather00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + eWeather a_NewWeather = ((eWeather) (int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetWeather'", NULL); +#endif + { + self->SetWeather(a_NewWeather); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetWeather'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ChangeWeather of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_ChangeWeather00 +static int tolua_AllToLua_cWorld_ChangeWeather00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ChangeWeather'", NULL); +#endif + { + self->ChangeWeather(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ChangeWeather'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWeather of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetWeather00 +static int tolua_AllToLua_cWorld_GetWeather00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWeather'", NULL); +#endif + { + eWeather tolua_ret = (eWeather) self->GetWeather(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWeather'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsWeatherSunny of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherSunny00 +static int tolua_AllToLua_cWorld_IsWeatherSunny00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherSunny'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsWeatherSunny(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsWeatherSunny'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsWeatherRain of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherRain00 +static int tolua_AllToLua_cWorld_IsWeatherRain00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherRain'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsWeatherRain(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsWeatherRain'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsWeatherStorm of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherStorm00 +static int tolua_AllToLua_cWorld_IsWeatherStorm00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherStorm'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsWeatherStorm(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsWeatherStorm'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsWeatherWet of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsWeatherWet00 +static int tolua_AllToLua_cWorld_IsWeatherWet00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsWeatherWet'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsWeatherWet(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsWeatherWet'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetNextBlockTick of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SetNextBlockTick00 +static int tolua_AllToLua_cWorld_SetNextBlockTick00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetNextBlockTick'", NULL); +#endif + { + self->SetNextBlockTick(a_BlockX,a_BlockY,a_BlockZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetNextBlockTick'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMaxSugarcaneHeight of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetMaxSugarcaneHeight00 +static int tolua_AllToLua_cWorld_GetMaxSugarcaneHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxSugarcaneHeight'", NULL); +#endif + { + int tolua_ret = (int) self->GetMaxSugarcaneHeight(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMaxSugarcaneHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMaxCactusHeight of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_GetMaxCactusHeight00 +static int tolua_AllToLua_cWorld_GetMaxCactusHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWorld* self = (const cWorld*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxCactusHeight'", NULL); +#endif + { + int tolua_ret = (int) self->GetMaxCactusHeight(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMaxCactusHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsBlockDirectlyWatered of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_IsBlockDirectlyWatered00 +static int tolua_AllToLua_cWorld_IsBlockDirectlyWatered00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsBlockDirectlyWatered'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsBlockDirectlyWatered(a_BlockX,a_BlockY,a_BlockZ); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsBlockDirectlyWatered'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SpawnMob of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_SpawnMob00 +static int tolua_AllToLua_cWorld_SpawnMob00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_PosY = ((double) tolua_tonumber(tolua_S,3,0)); + double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0)); + cMonster::eType a_MonsterType = ((cMonster::eType) (int) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SpawnMob'", NULL); +#endif + { + int tolua_ret = (int) self->SpawnMob(a_PosX,a_PosY,a_PosZ,a_MonsterType); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SpawnMob'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CreateProjectile of class cWorld */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_CreateProjectile00 +static int tolua_AllToLua_cWorld_CreateProjectile00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isusertype(tolua_S,6,"cEntity",0,&tolua_err) || + !tolua_isusertype(tolua_S,7,"const Vector3d",1,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0); + double a_PosX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_PosY = ((double) tolua_tonumber(tolua_S,3,0)); + double a_PosZ = ((double) tolua_tonumber(tolua_S,4,0)); + cProjectileEntity::eKind a_Kind = ((cProjectileEntity::eKind) (int) tolua_tonumber(tolua_S,5,0)); + cEntity* a_Creator = ((cEntity*) tolua_tousertype(tolua_S,6,0)); + const Vector3d* a_Speed = ((const Vector3d*) tolua_tousertype(tolua_S,7,NULL)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CreateProjectile'", NULL); +#endif + { + int tolua_ret = (int) self->CreateProjectile(a_PosX,a_PosY,a_PosZ,a_Kind,a_Creator,a_Speed); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CreateProjectile'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Clear of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_Clear00 +static int tolua_AllToLua_cInventory_Clear00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); +#endif + { + self->Clear(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HowManyCanFit of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_HowManyCanFit00 +static int tolua_AllToLua_cInventory_HowManyCanFit00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isboolean(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + const cItem* a_ItemStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); + bool a_ConsiderEmptySlots = ((bool) tolua_toboolean(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HowManyCanFit'", NULL); +#endif + { + int tolua_ret = (int) self->HowManyCanFit(*a_ItemStack,a_ConsiderEmptySlots); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HowManyCanFit'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HowManyCanFit of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_HowManyCanFit01 +static int tolua_AllToLua_cInventory_HowManyCanFit01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isboolean(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + const cItem* a_ItemStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); + int a_BeginSlotNum = ((int) tolua_tonumber(tolua_S,3,0)); + int a_EndSlotNum = ((int) tolua_tonumber(tolua_S,4,0)); + bool a_ConsiderEmptySlots = ((bool) tolua_toboolean(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HowManyCanFit'", NULL); +#endif + { + int tolua_ret = (int) self->HowManyCanFit(*a_ItemStack,a_BeginSlotNum,a_EndSlotNum,a_ConsiderEmptySlots); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cInventory_HowManyCanFit00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddItem of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_AddItem00 +static int tolua_AllToLua_cInventory_AddItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isboolean(tolua_S,3,1,&tolua_err) || + !tolua_isboolean(tolua_S,4,1,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + const cItem* a_ItemStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); + bool a_AllowNewStacks = ((bool) tolua_toboolean(tolua_S,3,true)); + bool a_tryToFillEquippedFirst = ((bool) tolua_toboolean(tolua_S,4,false)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddItem'", NULL); +#endif + { + int tolua_ret = (int) self->AddItem(*a_ItemStack,a_AllowNewStacks,a_tryToFillEquippedFirst); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddItems of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_AddItems00 +static int tolua_AllToLua_cInventory_AddItems00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cItems",0,&tolua_err)) || + !tolua_isboolean(tolua_S,3,0,&tolua_err) || + !tolua_isboolean(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + cItems* a_ItemStackList = ((cItems*) tolua_tousertype(tolua_S,2,0)); + bool a_AllowNewStacks = ((bool) tolua_toboolean(tolua_S,3,0)); + bool a_tryToFillEquippedFirst = ((bool) tolua_toboolean(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddItems'", NULL); +#endif + { + int tolua_ret = (int) self->AddItems(*a_ItemStackList,a_AllowNewStacks,a_tryToFillEquippedFirst); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddItems'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: RemoveOneEquippedItem of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_RemoveOneEquippedItem00 +static int tolua_AllToLua_cInventory_RemoveOneEquippedItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RemoveOneEquippedItem'", NULL); +#endif + { + bool tolua_ret = (bool) self->RemoveOneEquippedItem(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'RemoveOneEquippedItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HowManyItems of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_HowManyItems00 +static int tolua_AllToLua_cInventory_HowManyItems00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HowManyItems'", NULL); +#endif + { + int tolua_ret = (int) self->HowManyItems(*a_Item); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HowManyItems'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HasItems of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_HasItems00 +static int tolua_AllToLua_cInventory_HasItems00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + const cItem* a_ItemStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasItems'", NULL); +#endif + { + bool tolua_ret = (bool) self->HasItems(*a_ItemStack); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HasItems'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetArmorGrid of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetArmorGrid00 +static int tolua_AllToLua_cInventory_GetArmorGrid00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetArmorGrid'", NULL); +#endif + { + cItemGrid& tolua_ret = (cItemGrid&) self->GetArmorGrid(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItemGrid"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetArmorGrid'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetInventoryGrid of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetInventoryGrid00 +static int tolua_AllToLua_cInventory_GetInventoryGrid00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetInventoryGrid'", NULL); +#endif + { + cItemGrid& tolua_ret = (cItemGrid&) self->GetInventoryGrid(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItemGrid"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetInventoryGrid'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetHotbarGrid of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetHotbarGrid00 +static int tolua_AllToLua_cInventory_GetHotbarGrid00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHotbarGrid'", NULL); +#endif + { + cItemGrid& tolua_ret = (cItemGrid&) self->GetHotbarGrid(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItemGrid"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHotbarGrid'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetOwner of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetOwner00 +static int tolua_AllToLua_cInventory_GetOwner00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOwner'", NULL); +#endif + { + cPlayer& tolua_ret = (cPlayer&) self->GetOwner(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cPlayer"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetOwner'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CopyToItems of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_CopyToItems00 +static int tolua_AllToLua_cInventory_CopyToItems00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cItems",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + cItems* a_Items = ((cItems*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CopyToItems'", NULL); +#endif + { + self->CopyToItems(*a_Items); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CopyToItems'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSlot of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetSlot00 +static int tolua_AllToLua_cInventory_GetSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlot'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetSlot(a_SlotNum); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetArmorSlot of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetArmorSlot00 +static int tolua_AllToLua_cInventory_GetArmorSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); + int a_ArmorSlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetArmorSlot'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetArmorSlot(a_ArmorSlotNum); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetArmorSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetInventorySlot of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetInventorySlot00 +static int tolua_AllToLua_cInventory_GetInventorySlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); + int a_InventorySlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetInventorySlot'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetInventorySlot(a_InventorySlotNum); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetInventorySlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetHotbarSlot of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetHotbarSlot00 +static int tolua_AllToLua_cInventory_GetHotbarSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); + int a_HotBarSlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHotbarSlot'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetHotbarSlot(a_HotBarSlotNum); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHotbarSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEquippedItem of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetEquippedItem00 +static int tolua_AllToLua_cInventory_GetEquippedItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedItem'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetEquippedItem(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEquippedItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSlot of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_SetSlot00 +static int tolua_AllToLua_cInventory_SetSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); +#endif + { + self->SetSlot(a_SlotNum,*a_Item); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetArmorSlot of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_SetArmorSlot00 +static int tolua_AllToLua_cInventory_SetArmorSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + int a_ArmorSlotNum = ((int) tolua_tonumber(tolua_S,2,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetArmorSlot'", NULL); +#endif + { + self->SetArmorSlot(a_ArmorSlotNum,*a_Item); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetArmorSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetInventorySlot of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_SetInventorySlot00 +static int tolua_AllToLua_cInventory_SetInventorySlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + int a_InventorySlotNum = ((int) tolua_tonumber(tolua_S,2,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetInventorySlot'", NULL); +#endif + { + self->SetInventorySlot(a_InventorySlotNum,*a_Item); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetInventorySlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetHotbarSlot of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_SetHotbarSlot00 +static int tolua_AllToLua_cInventory_SetHotbarSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + int a_HotBarSlotNum = ((int) tolua_tonumber(tolua_S,2,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetHotbarSlot'", NULL); +#endif + { + self->SetHotbarSlot(a_HotBarSlotNum,*a_Item); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetHotbarSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetEquippedSlotNum of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_SetEquippedSlotNum00 +static int tolua_AllToLua_cInventory_SetEquippedSlotNum00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetEquippedSlotNum'", NULL); +#endif + { + self->SetEquippedSlotNum(a_SlotNum); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetEquippedSlotNum'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEquippedSlotNum of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetEquippedSlotNum00 +static int tolua_AllToLua_cInventory_GetEquippedSlotNum00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedSlotNum'", NULL); +#endif + { + int tolua_ret = (int) self->GetEquippedSlotNum(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEquippedSlotNum'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ChangeSlotCount of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_ChangeSlotCount00 +static int tolua_AllToLua_cInventory_ChangeSlotCount00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); + int a_AddToCount = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ChangeSlotCount'", NULL); +#endif + { + int tolua_ret = (int) self->ChangeSlotCount(a_SlotNum,a_AddToCount); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ChangeSlotCount'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DamageItem of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_DamageItem00 +static int tolua_AllToLua_cInventory_DamageItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); + short a_Amount = ((short) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DamageItem'", NULL); +#endif + { + bool tolua_ret = (bool) self->DamageItem(a_SlotNum,a_Amount); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DamageItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DamageEquippedItem of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_DamageEquippedItem00 +static int tolua_AllToLua_cInventory_DamageEquippedItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cInventory",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,1,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cInventory* self = (cInventory*) tolua_tousertype(tolua_S,1,0); + short a_Amount = ((short) tolua_tonumber(tolua_S,2,1)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DamageEquippedItem'", NULL); +#endif + { + bool tolua_ret = (bool) self->DamageEquippedItem(a_Amount); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DamageEquippedItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEquippedHelmet of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetEquippedHelmet00 +static int tolua_AllToLua_cInventory_GetEquippedHelmet00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedHelmet'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetEquippedHelmet(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEquippedHelmet'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEquippedChestplate of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetEquippedChestplate00 +static int tolua_AllToLua_cInventory_GetEquippedChestplate00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedChestplate'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetEquippedChestplate(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEquippedChestplate'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEquippedLeggings of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetEquippedLeggings00 +static int tolua_AllToLua_cInventory_GetEquippedLeggings00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedLeggings'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetEquippedLeggings(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEquippedLeggings'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetEquippedBoots of class cInventory */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cInventory_GetEquippedBoots00 +static int tolua_AllToLua_cInventory_GetEquippedBoots00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cInventory",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cInventory* self = (const cInventory*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetEquippedBoots'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetEquippedBoots(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetEquippedBoots'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cEnchantments */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_new00 +static int tolua_AllToLua_cEnchantments_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cEnchantments",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cEnchantments* tolua_ret = (cEnchantments*) Mtolua_new((cEnchantments)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cEnchantments"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cEnchantments */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_new00_local +static int tolua_AllToLua_cEnchantments_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cEnchantments",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cEnchantments* tolua_ret = (cEnchantments*) Mtolua_new((cEnchantments)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cEnchantments"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cEnchantments */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_new01 +static int tolua_AllToLua_cEnchantments_new01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cEnchantments",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const AString a_StringSpec = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + cEnchantments* tolua_ret = (cEnchantments*) Mtolua_new((cEnchantments)(a_StringSpec)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cEnchantments"); + tolua_pushcppstring(tolua_S,(const char*)a_StringSpec); + } + } + return 2; +tolua_lerror: + return tolua_AllToLua_cEnchantments_new00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cEnchantments */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_new01_local +static int tolua_AllToLua_cEnchantments_new01_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cEnchantments",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const AString a_StringSpec = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + cEnchantments* tolua_ret = (cEnchantments*) Mtolua_new((cEnchantments)(a_StringSpec)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cEnchantments"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + tolua_pushcppstring(tolua_S,(const char*)a_StringSpec); + } + } + return 2; +tolua_lerror: + return tolua_AllToLua_cEnchantments_new00_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddFromString of class cEnchantments */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_AddFromString00 +static int tolua_AllToLua_cEnchantments_AddFromString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEnchantments",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEnchantments* self = (cEnchantments*) tolua_tousertype(tolua_S,1,0); + const AString a_StringSpec = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddFromString'", NULL); +#endif + { + self->AddFromString(a_StringSpec); + tolua_pushcppstring(tolua_S,(const char*)a_StringSpec); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddFromString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ToString of class cEnchantments */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_ToString00 +static int tolua_AllToLua_cEnchantments_ToString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEnchantments",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEnchantments* self = (const cEnchantments*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ToString'", NULL); +#endif + { + AString tolua_ret = (AString) self->ToString(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ToString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetLevel of class cEnchantments */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_GetLevel00 +static int tolua_AllToLua_cEnchantments_GetLevel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEnchantments",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEnchantments* self = (const cEnchantments*) tolua_tousertype(tolua_S,1,0); + int a_EnchantmentID = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLevel'", NULL); +#endif + { + int tolua_ret = (int) self->GetLevel(a_EnchantmentID); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetLevel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetLevel of class cEnchantments */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_SetLevel00 +static int tolua_AllToLua_cEnchantments_SetLevel00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEnchantments",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEnchantments* self = (cEnchantments*) tolua_tousertype(tolua_S,1,0); + int a_EnchantmentID = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Level = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetLevel'", NULL); +#endif + { + self->SetLevel(a_EnchantmentID,a_Level); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetLevel'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Clear of class cEnchantments */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_Clear00 +static int tolua_AllToLua_cEnchantments_Clear00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cEnchantments",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cEnchantments* self = (cEnchantments*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); +#endif + { + self->Clear(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsEmpty of class cEnchantments */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_IsEmpty00 +static int tolua_AllToLua_cEnchantments_IsEmpty00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEnchantments",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEnchantments* self = (const cEnchantments*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsEmpty'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsEmpty(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsEmpty'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: StringToEnchantmentID of class cEnchantments */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments_StringToEnchantmentID00 +static int tolua_AllToLua_cEnchantments_StringToEnchantmentID00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cEnchantments",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_EnchantmentName = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + int tolua_ret = (int) cEnchantments::StringToEnchantmentID(a_EnchantmentName); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_EnchantmentName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'StringToEnchantmentID'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator== of class cEnchantments */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cEnchantments__eq00 +static int tolua_AllToLua_cEnchantments__eq00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cEnchantments",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cEnchantments",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cEnchantments* self = (const cEnchantments*) tolua_tousertype(tolua_S,1,0); + const cEnchantments* a_Other = ((const cEnchantments*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator=='", NULL); +#endif + { + bool tolua_ret = (bool) self->operator==(*a_Other); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function '.eq'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new00 +static int tolua_AllToLua_cItem_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cItem* tolua_ret = (cItem*) Mtolua_new((cItem)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new00_local +static int tolua_AllToLua_cItem_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cItem* tolua_ret = (cItem*) Mtolua_new((cItem)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new01 +static int tolua_AllToLua_cItem_new01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,1,&tolua_err) || + !tolua_isnumber(tolua_S,4,1,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + short a_ItemType = ((short) tolua_tonumber(tolua_S,2,0)); + char a_ItemCount = ((char) tolua_tonumber(tolua_S,3,1)); + short a_ItemDamage = ((short) tolua_tonumber(tolua_S,4,0)); + { + cItem* tolua_ret = (cItem*) Mtolua_new((cItem)(a_ItemType,a_ItemCount,a_ItemDamage)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cItem_new00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new01_local +static int tolua_AllToLua_cItem_new01_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,1,&tolua_err) || + !tolua_isnumber(tolua_S,4,1,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + short a_ItemType = ((short) tolua_tonumber(tolua_S,2,0)); + char a_ItemCount = ((char) tolua_tonumber(tolua_S,3,1)); + short a_ItemDamage = ((short) tolua_tonumber(tolua_S,4,0)); + { + cItem* tolua_ret = (cItem*) Mtolua_new((cItem)(a_ItemType,a_ItemCount,a_ItemDamage)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cItem_new00_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new02 +static int tolua_AllToLua_cItem_new02(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_iscppstring(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else + { + short a_ItemType = ((short) tolua_tonumber(tolua_S,2,0)); + char a_ItemCount = ((char) tolua_tonumber(tolua_S,3,0)); + short a_ItemDamage = ((short) tolua_tonumber(tolua_S,4,0)); + const AString a_Enchantments = ((const AString) tolua_tocppstring(tolua_S,5,0)); + { + cItem* tolua_ret = (cItem*) Mtolua_new((cItem)(a_ItemType,a_ItemCount,a_ItemDamage,a_Enchantments)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); + tolua_pushcppstring(tolua_S,(const char*)a_Enchantments); + } + } + return 2; +tolua_lerror: + return tolua_AllToLua_cItem_new01(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new02_local +static int tolua_AllToLua_cItem_new02_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_iscppstring(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else + { + short a_ItemType = ((short) tolua_tonumber(tolua_S,2,0)); + char a_ItemCount = ((char) tolua_tonumber(tolua_S,3,0)); + short a_ItemDamage = ((short) tolua_tonumber(tolua_S,4,0)); + const AString a_Enchantments = ((const AString) tolua_tocppstring(tolua_S,5,0)); + { + cItem* tolua_ret = (cItem*) Mtolua_new((cItem)(a_ItemType,a_ItemCount,a_ItemDamage,a_Enchantments)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + tolua_pushcppstring(tolua_S,(const char*)a_Enchantments); + } + } + return 2; +tolua_lerror: + return tolua_AllToLua_cItem_new01_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new03 +static int tolua_AllToLua_cItem_new03(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const cItem* a_CopyFrom = ((const cItem*) tolua_tousertype(tolua_S,2,0)); + { + cItem* tolua_ret = (cItem*) Mtolua_new((cItem)(*a_CopyFrom)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cItem_new02(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_new03_local +static int tolua_AllToLua_cItem_new03_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cItem",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const cItem* a_CopyFrom = ((const cItem*) tolua_tousertype(tolua_S,2,0)); + { + cItem* tolua_ret = (cItem*) Mtolua_new((cItem)(*a_CopyFrom)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cItem_new02_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Empty of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_Empty00 +static int tolua_AllToLua_cItem_Empty00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItem",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Empty'", NULL); +#endif + { + self->Empty(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Empty'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Clear of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_Clear00 +static int tolua_AllToLua_cItem_Clear00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItem",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); +#endif + { + self->Clear(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsEmpty of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_IsEmpty00 +static int tolua_AllToLua_cItem_IsEmpty00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsEmpty'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsEmpty(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsEmpty'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsEqual of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_IsEqual00 +static int tolua_AllToLua_cItem_IsEqual00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsEqual'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsEqual(*a_Item); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsEqual'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsSameType of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_IsSameType00 +static int tolua_AllToLua_cItem_IsSameType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSameType'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsSameType(*a_Item); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsSameType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CopyOne of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_CopyOne00 +static int tolua_AllToLua_cItem_CopyOne00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CopyOne'", NULL); +#endif + { + cItem tolua_ret = (cItem) self->CopyOne(); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CopyOne'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddCount of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_AddCount00 +static int tolua_AllToLua_cItem_AddCount00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItem",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); + char a_AmountToAdd = ((char) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddCount'", NULL); +#endif + { + cItem& tolua_ret = (cItem&) self->AddCount(a_AmountToAdd); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddCount'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMaxDamage of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_GetMaxDamage00 +static int tolua_AllToLua_cItem_GetMaxDamage00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxDamage'", NULL); +#endif + { + short tolua_ret = (short) self->GetMaxDamage(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMaxDamage'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DamageItem of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_DamageItem00 +static int tolua_AllToLua_cItem_DamageItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItem",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,1,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); + short a_Amount = ((short) tolua_tonumber(tolua_S,2,1)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DamageItem'", NULL); +#endif + { + bool tolua_ret = (bool) self->DamageItem(a_Amount); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DamageItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsDamageable of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_IsDamageable00 +static int tolua_AllToLua_cItem_IsDamageable00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsDamageable'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsDamageable(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsDamageable'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsStackableWith of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_IsStackableWith00 +static int tolua_AllToLua_cItem_IsStackableWith00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); + const cItem* a_OtherStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsStackableWith'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsStackableWith(*a_OtherStack); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsStackableWith'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsFullStack of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_IsFullStack00 +static int tolua_AllToLua_cItem_IsFullStack00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsFullStack'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsFullStack(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsFullStack'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMaxStackSize of class cItem */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItem_GetMaxStackSize00 +static int tolua_AllToLua_cItem_GetMaxStackSize00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItem",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* self = (const cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxStackSize'", NULL); +#endif + { + char tolua_ret = (char) self->GetMaxStackSize(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMaxStackSize'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: m_ItemType of class cItem */ +#ifndef TOLUA_DISABLE_tolua_get_cItem_m_ItemType +static int tolua_get_cItem_m_ItemType(lua_State* tolua_S) +{ + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_ItemType'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->m_ItemType); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: m_ItemType of class cItem */ +#ifndef TOLUA_DISABLE_tolua_set_cItem_m_ItemType +static int tolua_set_cItem_m_ItemType(lua_State* tolua_S) +{ + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_ItemType'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->m_ItemType = ((short) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: m_ItemCount of class cItem */ +#ifndef TOLUA_DISABLE_tolua_get_cItem_m_ItemCount +static int tolua_get_cItem_m_ItemCount(lua_State* tolua_S) +{ + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_ItemCount'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->m_ItemCount); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: m_ItemCount of class cItem */ +#ifndef TOLUA_DISABLE_tolua_set_cItem_m_ItemCount +static int tolua_set_cItem_m_ItemCount(lua_State* tolua_S) +{ + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_ItemCount'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->m_ItemCount = ((char) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: m_ItemDamage of class cItem */ +#ifndef TOLUA_DISABLE_tolua_get_cItem_m_ItemDamage +static int tolua_get_cItem_m_ItemDamage(lua_State* tolua_S) +{ + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_ItemDamage'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->m_ItemDamage); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: m_ItemDamage of class cItem */ +#ifndef TOLUA_DISABLE_tolua_set_cItem_m_ItemDamage +static int tolua_set_cItem_m_ItemDamage(lua_State* tolua_S) +{ + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_ItemDamage'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->m_ItemDamage = ((short) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: m_Enchantments of class cItem */ +#ifndef TOLUA_DISABLE_tolua_get_cItem_m_Enchantments +static int tolua_get_cItem_m_Enchantments(lua_State* tolua_S) +{ + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_Enchantments'",NULL); +#endif + tolua_pushusertype(tolua_S,(void*)&self->m_Enchantments,"cEnchantments"); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: m_Enchantments of class cItem */ +#ifndef TOLUA_DISABLE_tolua_set_cItem_m_Enchantments +static int tolua_set_cItem_m_Enchantments(lua_State* tolua_S) +{ + cItem* self = (cItem*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'm_Enchantments'",NULL); + if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cEnchantments",0,&tolua_err))) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->m_Enchantments = *((cEnchantments*) tolua_tousertype(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_new00 +static int tolua_AllToLua_cItems_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cItems",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cItems* tolua_ret = (cItems*) Mtolua_new((cItems)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItems"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_new00_local +static int tolua_AllToLua_cItems_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cItems",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cItems* tolua_ret = (cItems*) Mtolua_new((cItems)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItems"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Get of class cItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Get00 +static int tolua_AllToLua_cItems_Get00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); + int a_Idx = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Get'", NULL); +#endif + { + cItem* tolua_ret = (cItem*) self->Get(a_Idx); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Get'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Set of class cItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Set00 +static int tolua_AllToLua_cItems_Set00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); + int a_Idx = ((int) tolua_tonumber(tolua_S,2,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL); +#endif + { + self->Set(a_Idx,*a_Item); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Set'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Add of class cItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Add00 +static int tolua_AllToLua_cItems_Add00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Add'", NULL); +#endif + { + self->Add(*a_Item); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Add'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Delete of class cItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Delete00 +static int tolua_AllToLua_cItems_Delete00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); + int a_Idx = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Delete'", NULL); +#endif + { + self->Delete(a_Idx); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Delete'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Clear of class cItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Clear00 +static int tolua_AllToLua_cItems_Clear00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); +#endif + { + self->Clear(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Size of class cItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Size00 +static int tolua_AllToLua_cItems_Size00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Size'", NULL); +#endif + { + int tolua_ret = (int) self->Size(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Size'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Set of class cItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Set01 +static int tolua_AllToLua_cItems_Set01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else + { + cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); + int a_Idx = ((int) tolua_tonumber(tolua_S,2,0)); + ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,3,0)); + char a_ItemCount = ((char) tolua_tonumber(tolua_S,4,0)); + short a_ItemDamage = ((short) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL); +#endif + { + self->Set(a_Idx,a_ItemType,a_ItemCount,a_ItemDamage); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cItems_Set00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Add of class cItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItems_Add01 +static int tolua_AllToLua_cItems_Add01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItems",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + cItems* self = (cItems*) tolua_tousertype(tolua_S,1,0); + ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,2,0)); + char a_ItemCount = ((char) tolua_tonumber(tolua_S,3,0)); + short a_ItemDamage = ((short) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Add'", NULL); +#endif + { + self->Add(a_ItemType,a_ItemCount,a_ItemDamage); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cItems_Add00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWidth of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetWidth00 +static int tolua_AllToLua_cItemGrid_GetWidth00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWidth'", NULL); +#endif + { + int tolua_ret = (int) self->GetWidth(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWidth'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetHeight of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetHeight00 +static int tolua_AllToLua_cItemGrid_GetHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeight'", NULL); +#endif + { + int tolua_ret = (int) self->GetHeight(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNumSlots of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetNumSlots00 +static int tolua_AllToLua_cItemGrid_GetNumSlots00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNumSlots'", NULL); +#endif + { + int tolua_ret = (int) self->GetNumSlots(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetNumSlots'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSlotNum of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetSlotNum00 +static int tolua_AllToLua_cItemGrid_GetSlotNum00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlotNum'", NULL); +#endif + { + int tolua_ret = (int) self->GetSlotNum(a_X,a_Y); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSlotNum'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetSlot00 +static int tolua_AllToLua_cItemGrid_GetSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlot'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetSlot(a_X,a_Y); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetSlot01 +static int tolua_AllToLua_cItemGrid_GetSlot01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlot'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetSlot(a_SlotNum); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cItemGrid_GetSlot00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_SetSlot00 +static int tolua_AllToLua_cItemGrid_SetSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); +#endif + { + self->SetSlot(a_X,a_Y,*a_Item); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_SetSlot01 +static int tolua_AllToLua_cItemGrid_SetSlot01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); + short a_ItemType = ((short) tolua_tonumber(tolua_S,4,0)); + char a_ItemCount = ((char) tolua_tonumber(tolua_S,5,0)); + short a_ItemDamage = ((short) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); +#endif + { + self->SetSlot(a_X,a_Y,a_ItemType,a_ItemCount,a_ItemDamage); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cItemGrid_SetSlot00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_SetSlot02 +static int tolua_AllToLua_cItemGrid_SetSlot02(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); +#endif + { + self->SetSlot(a_SlotNum,*a_Item); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cItemGrid_SetSlot01(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_SetSlot03 +static int tolua_AllToLua_cItemGrid_SetSlot03(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); + short a_ItemType = ((short) tolua_tonumber(tolua_S,3,0)); + char a_ItemCount = ((char) tolua_tonumber(tolua_S,4,0)); + short a_ItemDamage = ((short) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); +#endif + { + self->SetSlot(a_SlotNum,a_ItemType,a_ItemCount,a_ItemDamage); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cItemGrid_SetSlot02(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: EmptySlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_EmptySlot00 +static int tolua_AllToLua_cItemGrid_EmptySlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'EmptySlot'", NULL); +#endif + { + self->EmptySlot(a_X,a_Y); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'EmptySlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: EmptySlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_EmptySlot01 +static int tolua_AllToLua_cItemGrid_EmptySlot01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'EmptySlot'", NULL); +#endif + { + self->EmptySlot(a_SlotNum); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cItemGrid_EmptySlot00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsSlotEmpty of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_IsSlotEmpty00 +static int tolua_AllToLua_cItemGrid_IsSlotEmpty00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSlotEmpty'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsSlotEmpty(a_SlotNum); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsSlotEmpty'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsSlotEmpty of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_IsSlotEmpty01 +static int tolua_AllToLua_cItemGrid_IsSlotEmpty01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSlotEmpty'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsSlotEmpty(a_X,a_Y); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cItemGrid_IsSlotEmpty00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Clear of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_Clear00 +static int tolua_AllToLua_cItemGrid_Clear00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); +#endif + { + self->Clear(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HowManyCanFit of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_HowManyCanFit00 +static int tolua_AllToLua_cItemGrid_HowManyCanFit00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isboolean(tolua_S,3,1,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + const cItem* a_ItemStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); + bool a_AllowNewStacks = ((bool) tolua_toboolean(tolua_S,3,true)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HowManyCanFit'", NULL); +#endif + { + int tolua_ret = (int) self->HowManyCanFit(*a_ItemStack,a_AllowNewStacks); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HowManyCanFit'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddItem of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_AddItem00 +static int tolua_AllToLua_cItemGrid_AddItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cItem",0,&tolua_err)) || + !tolua_isboolean(tolua_S,3,1,&tolua_err) || + !tolua_isnumber(tolua_S,4,1,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + cItem* a_ItemStack = ((cItem*) tolua_tousertype(tolua_S,2,0)); + bool a_AllowNewStacks = ((bool) tolua_toboolean(tolua_S,3,true)); + int a_PrioritarySlot = ((int) tolua_tonumber(tolua_S,4,-1)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddItem'", NULL); +#endif + { + int tolua_ret = (int) self->AddItem(*a_ItemStack,a_AllowNewStacks,a_PrioritarySlot); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddItems of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_AddItems00 +static int tolua_AllToLua_cItemGrid_AddItems00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cItems",0,&tolua_err)) || + !tolua_isboolean(tolua_S,3,1,&tolua_err) || + !tolua_isnumber(tolua_S,4,1,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + cItems* a_ItemStackList = ((cItems*) tolua_tousertype(tolua_S,2,0)); + bool a_AllowNewStacks = ((bool) tolua_toboolean(tolua_S,3,true)); + int a_PrioritarySlot = ((int) tolua_tonumber(tolua_S,4,-1)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddItems'", NULL); +#endif + { + int tolua_ret = (int) self->AddItems(*a_ItemStackList,a_AllowNewStacks,a_PrioritarySlot); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddItems'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ChangeSlotCount of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_ChangeSlotCount00 +static int tolua_AllToLua_cItemGrid_ChangeSlotCount00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); + int a_AddToCount = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ChangeSlotCount'", NULL); +#endif + { + int tolua_ret = (int) self->ChangeSlotCount(a_SlotNum,a_AddToCount); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ChangeSlotCount'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ChangeSlotCount of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_ChangeSlotCount01 +static int tolua_AllToLua_cItemGrid_ChangeSlotCount01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); + int a_AddToCount = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ChangeSlotCount'", NULL); +#endif + { + int tolua_ret = (int) self->ChangeSlotCount(a_X,a_Y,a_AddToCount); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cItemGrid_ChangeSlotCount00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: RemoveOneItem of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_RemoveOneItem00 +static int tolua_AllToLua_cItemGrid_RemoveOneItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RemoveOneItem'", NULL); +#endif + { + cItem tolua_ret = (cItem) self->RemoveOneItem(a_SlotNum); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'RemoveOneItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: RemoveOneItem of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_RemoveOneItem01 +static int tolua_AllToLua_cItemGrid_RemoveOneItem01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RemoveOneItem'", NULL); +#endif + { + cItem tolua_ret = (cItem) self->RemoveOneItem(a_X,a_Y); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((cItem)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cItem)); + tolua_pushusertype(tolua_S,tolua_obj,"cItem"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cItemGrid_RemoveOneItem00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HowManyItems of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_HowManyItems00 +static int tolua_AllToLua_cItemGrid_HowManyItems00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HowManyItems'", NULL); +#endif + { + int tolua_ret = (int) self->HowManyItems(*a_Item); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HowManyItems'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HasItems of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_HasItems00 +static int tolua_AllToLua_cItemGrid_HasItems00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + const cItem* a_ItemStack = ((const cItem*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasItems'", NULL); +#endif + { + bool tolua_ret = (bool) self->HasItems(*a_ItemStack); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HasItems'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetFirstEmptySlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetFirstEmptySlot00 +static int tolua_AllToLua_cItemGrid_GetFirstEmptySlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFirstEmptySlot'", NULL); +#endif + { + int tolua_ret = (int) self->GetFirstEmptySlot(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetFirstEmptySlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetFirstUsedSlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetFirstUsedSlot00 +static int tolua_AllToLua_cItemGrid_GetFirstUsedSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFirstUsedSlot'", NULL); +#endif + { + int tolua_ret = (int) self->GetFirstUsedSlot(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetFirstUsedSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetLastEmptySlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetLastEmptySlot00 +static int tolua_AllToLua_cItemGrid_GetLastEmptySlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLastEmptySlot'", NULL); +#endif + { + int tolua_ret = (int) self->GetLastEmptySlot(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetLastEmptySlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetLastUsedSlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetLastUsedSlot00 +static int tolua_AllToLua_cItemGrid_GetLastUsedSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLastUsedSlot'", NULL); +#endif + { + int tolua_ret = (int) self->GetLastUsedSlot(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetLastUsedSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNextEmptySlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetNextEmptySlot00 +static int tolua_AllToLua_cItemGrid_GetNextEmptySlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_StartFrom = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNextEmptySlot'", NULL); +#endif + { + int tolua_ret = (int) self->GetNextEmptySlot(a_StartFrom); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetNextEmptySlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetNextUsedSlot of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_GetNextUsedSlot00 +static int tolua_AllToLua_cItemGrid_GetNextUsedSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_StartFrom = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetNextUsedSlot'", NULL); +#endif + { + int tolua_ret = (int) self->GetNextUsedSlot(a_StartFrom); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetNextUsedSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CopyToItems of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_CopyToItems00 +static int tolua_AllToLua_cItemGrid_CopyToItems00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cItemGrid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cItems",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItemGrid* self = (const cItemGrid*) tolua_tousertype(tolua_S,1,0); + cItems* a_Items = ((cItems*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CopyToItems'", NULL); +#endif + { + self->CopyToItems(*a_Items); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CopyToItems'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DamageItem of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_DamageItem00 +static int tolua_AllToLua_cItemGrid_DamageItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); + short a_Amount = ((short) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DamageItem'", NULL); +#endif + { + bool tolua_ret = (bool) self->DamageItem(a_SlotNum,a_Amount); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DamageItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DamageItem of class cItemGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cItemGrid_DamageItem01 +static int tolua_AllToLua_cItemGrid_DamageItem01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cItemGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + cItemGrid* self = (cItemGrid*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); + short a_Amount = ((short) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DamageItem'", NULL); +#endif + { + bool tolua_ret = (bool) self->DamageItem(a_X,a_Y,a_Amount); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cItemGrid_DamageItem00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPosX of class cBlockEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetPosX00 +static int tolua_AllToLua_cBlockEntity_GetPosX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosX'", NULL); +#endif + { + int tolua_ret = (int) self->GetPosX(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPosX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPosY of class cBlockEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetPosY00 +static int tolua_AllToLua_cBlockEntity_GetPosY00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosY'", NULL); +#endif + { + int tolua_ret = (int) self->GetPosY(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPosY'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPosZ of class cBlockEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetPosZ00 +static int tolua_AllToLua_cBlockEntity_GetPosZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPosZ'", NULL); +#endif + { + int tolua_ret = (int) self->GetPosZ(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPosZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockType of class cBlockEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetBlockType00 +static int tolua_AllToLua_cBlockEntity_GetBlockType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockType'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlockType(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWorld of class cBlockEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetWorld00 +static int tolua_AllToLua_cBlockEntity_GetWorld00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWorld'", NULL); +#endif + { + cWorld* tolua_ret = (cWorld*) self->GetWorld(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWorld"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWorld'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetChunkX of class cBlockEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetChunkX00 +static int tolua_AllToLua_cBlockEntity_GetChunkX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetChunkX'", NULL); +#endif + { + int tolua_ret = (int) self->GetChunkX(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetChunkX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetChunkZ of class cBlockEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetChunkZ00 +static int tolua_AllToLua_cBlockEntity_GetChunkZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetChunkZ'", NULL); +#endif + { + int tolua_ret = (int) self->GetChunkZ(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetChunkZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetRelX of class cBlockEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetRelX00 +static int tolua_AllToLua_cBlockEntity_GetRelX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelX'", NULL); +#endif + { + int tolua_ret = (int) self->GetRelX(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetRelX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetRelZ of class cBlockEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntity_GetRelZ00 +static int tolua_AllToLua_cBlockEntity_GetRelZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockEntity* self = (const cBlockEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelZ'", NULL); +#endif + { + int tolua_ret = (int) self->GetRelZ(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetRelZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSlot of class cBlockEntityWithItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntityWithItems_GetSlot00 +static int tolua_AllToLua_cBlockEntityWithItems_GetSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockEntityWithItems",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockEntityWithItems* self = (const cBlockEntityWithItems*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlot'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetSlot(a_SlotNum); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSlot of class cBlockEntityWithItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntityWithItems_GetSlot01 +static int tolua_AllToLua_cBlockEntityWithItems_GetSlot01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockEntityWithItems",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + const cBlockEntityWithItems* self = (const cBlockEntityWithItems*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlot'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetSlot(a_X,a_Y); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBlockEntityWithItems_GetSlot00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSlot of class cBlockEntityWithItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntityWithItems_SetSlot00 +static int tolua_AllToLua_cBlockEntityWithItems_SetSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockEntityWithItems",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockEntityWithItems* self = (cBlockEntityWithItems*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); +#endif + { + self->SetSlot(a_SlotNum,*a_Item); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSlot of class cBlockEntityWithItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntityWithItems_SetSlot01 +static int tolua_AllToLua_cBlockEntityWithItems_SetSlot01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockEntityWithItems",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + cBlockEntityWithItems* self = (cBlockEntityWithItems*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); +#endif + { + self->SetSlot(a_X,a_Y,*a_Item); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cBlockEntityWithItems_SetSlot00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetContents of class cBlockEntityWithItems */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockEntityWithItems_GetContents00 +static int tolua_AllToLua_cBlockEntityWithItems_GetContents00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockEntityWithItems",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockEntityWithItems* self = (cBlockEntityWithItems*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetContents'", NULL); +#endif + { + cItemGrid& tolua_ret = (cItemGrid&) self->GetContents(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItemGrid"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetContents'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddDropSpenserDir of class cDropSpenserEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cDropSpenserEntity_AddDropSpenserDir00 +static int tolua_AllToLua_cDropSpenserEntity_AddDropSpenserDir00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cDropSpenserEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cDropSpenserEntity* self = (cDropSpenserEntity*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_Direction = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddDropSpenserDir'", NULL); +#endif + { + self->AddDropSpenserDir(a_BlockX,a_BlockY,a_BlockZ,a_Direction); + tolua_pushnumber(tolua_S,(lua_Number)a_BlockX); + tolua_pushnumber(tolua_S,(lua_Number)a_BlockY); + tolua_pushnumber(tolua_S,(lua_Number)a_BlockZ); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddDropSpenserDir'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Activate of class cDropSpenserEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cDropSpenserEntity_Activate00 +static int tolua_AllToLua_cDropSpenserEntity_Activate00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cDropSpenserEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cDropSpenserEntity* self = (cDropSpenserEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Activate'", NULL); +#endif + { + self->Activate(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Activate'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetRedstonePower of class cDropSpenserEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cDropSpenserEntity_SetRedstonePower00 +static int tolua_AllToLua_cDropSpenserEntity_SetRedstonePower00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cDropSpenserEntity",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cDropSpenserEntity* self = (cDropSpenserEntity*) tolua_tousertype(tolua_S,1,0); + bool a_IsPowered = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRedstonePower'", NULL); +#endif + { + self->SetRedstonePower(a_IsPowered); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetRedstonePower'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetInputSlot of class cFurnaceEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetInputSlot00 +static int tolua_AllToLua_cFurnaceEntity_GetInputSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetInputSlot'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetInputSlot(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetInputSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetFuelSlot of class cFurnaceEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetFuelSlot00 +static int tolua_AllToLua_cFurnaceEntity_GetFuelSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFuelSlot'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetFuelSlot(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetFuelSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetOutputSlot of class cFurnaceEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetOutputSlot00 +static int tolua_AllToLua_cFurnaceEntity_GetOutputSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOutputSlot'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetOutputSlot(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetOutputSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetInputSlot of class cFurnaceEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_SetInputSlot00 +static int tolua_AllToLua_cFurnaceEntity_SetInputSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cFurnaceEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cFurnaceEntity* self = (cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetInputSlot'", NULL); +#endif + { + self->SetInputSlot(*a_Item); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetInputSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetFuelSlot of class cFurnaceEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_SetFuelSlot00 +static int tolua_AllToLua_cFurnaceEntity_SetFuelSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cFurnaceEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cFurnaceEntity* self = (cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetFuelSlot'", NULL); +#endif + { + self->SetFuelSlot(*a_Item); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetFuelSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetOutputSlot of class cFurnaceEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_SetOutputSlot00 +static int tolua_AllToLua_cFurnaceEntity_SetOutputSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cFurnaceEntity",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cFurnaceEntity* self = (cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetOutputSlot'", NULL); +#endif + { + self->SetOutputSlot(*a_Item); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetOutputSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetTimeCooked of class cFurnaceEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetTimeCooked00 +static int tolua_AllToLua_cFurnaceEntity_GetTimeCooked00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetTimeCooked'", NULL); +#endif + { + int tolua_ret = (int) self->GetTimeCooked(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetTimeCooked'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetCookTimeLeft of class cFurnaceEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetCookTimeLeft00 +static int tolua_AllToLua_cFurnaceEntity_GetCookTimeLeft00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCookTimeLeft'", NULL); +#endif + { + int tolua_ret = (int) self->GetCookTimeLeft(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetCookTimeLeft'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetFuelBurnTimeLeft of class cFurnaceEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_GetFuelBurnTimeLeft00 +static int tolua_AllToLua_cFurnaceEntity_GetFuelBurnTimeLeft00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetFuelBurnTimeLeft'", NULL); +#endif + { + int tolua_ret = (int) self->GetFuelBurnTimeLeft(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetFuelBurnTimeLeft'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HasFuelTimeLeft of class cFurnaceEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cFurnaceEntity_HasFuelTimeLeft00 +static int tolua_AllToLua_cFurnaceEntity_HasFuelTimeLeft00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cFurnaceEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cFurnaceEntity* self = (const cFurnaceEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasFuelTimeLeft'", NULL); +#endif + { + bool tolua_ret = (bool) self->HasFuelTimeLeft(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HasFuelTimeLeft'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetRecord of class cJukeboxEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cJukeboxEntity_GetRecord00 +static int tolua_AllToLua_cJukeboxEntity_GetRecord00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cJukeboxEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cJukeboxEntity* self = (cJukeboxEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRecord'", NULL); +#endif + { + int tolua_ret = (int) self->GetRecord(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetRecord'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetRecord of class cJukeboxEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cJukeboxEntity_SetRecord00 +static int tolua_AllToLua_cJukeboxEntity_SetRecord00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cJukeboxEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cJukeboxEntity* self = (cJukeboxEntity*) tolua_tousertype(tolua_S,1,0); + int a_Record = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRecord'", NULL); +#endif + { + self->SetRecord(a_Record); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetRecord'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: PlayRecord of class cJukeboxEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cJukeboxEntity_PlayRecord00 +static int tolua_AllToLua_cJukeboxEntity_PlayRecord00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cJukeboxEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cJukeboxEntity* self = (cJukeboxEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'PlayRecord'", NULL); +#endif + { + self->PlayRecord(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'PlayRecord'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: EjectRecord of class cJukeboxEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cJukeboxEntity_EjectRecord00 +static int tolua_AllToLua_cJukeboxEntity_EjectRecord00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cJukeboxEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cJukeboxEntity* self = (cJukeboxEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'EjectRecord'", NULL); +#endif + { + self->EjectRecord(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'EjectRecord'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPitch of class cNoteEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cNoteEntity_GetPitch00 +static int tolua_AllToLua_cNoteEntity_GetPitch00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cNoteEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cNoteEntity* self = (cNoteEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPitch'", NULL); +#endif + { + char tolua_ret = (char) self->GetPitch(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPitch'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetPitch of class cNoteEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cNoteEntity_SetPitch00 +static int tolua_AllToLua_cNoteEntity_SetPitch00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cNoteEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cNoteEntity* self = (cNoteEntity*) tolua_tousertype(tolua_S,1,0); + char a_Pitch = ((char) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPitch'", NULL); +#endif + { + self->SetPitch(a_Pitch); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetPitch'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IncrementPitch of class cNoteEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cNoteEntity_IncrementPitch00 +static int tolua_AllToLua_cNoteEntity_IncrementPitch00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cNoteEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cNoteEntity* self = (cNoteEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IncrementPitch'", NULL); +#endif + { + self->IncrementPitch(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IncrementPitch'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: MakeSound of class cNoteEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cNoteEntity_MakeSound00 +static int tolua_AllToLua_cNoteEntity_MakeSound00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cNoteEntity",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cNoteEntity* self = (cNoteEntity*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MakeSound'", NULL); +#endif + { + self->MakeSound(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'MakeSound'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetLines of class cSignEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cSignEntity_SetLines00 +static int tolua_AllToLua_cSignEntity_SetLines00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cSignEntity",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_iscppstring(tolua_S,4,0,&tolua_err) || + !tolua_iscppstring(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cSignEntity* self = (cSignEntity*) tolua_tousertype(tolua_S,1,0); + const AString a_Line1 = ((const AString) tolua_tocppstring(tolua_S,2,0)); + const AString a_Line2 = ((const AString) tolua_tocppstring(tolua_S,3,0)); + const AString a_Line3 = ((const AString) tolua_tocppstring(tolua_S,4,0)); + const AString a_Line4 = ((const AString) tolua_tocppstring(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetLines'", NULL); +#endif + { + self->SetLines(a_Line1,a_Line2,a_Line3,a_Line4); + tolua_pushcppstring(tolua_S,(const char*)a_Line1); + tolua_pushcppstring(tolua_S,(const char*)a_Line2); + tolua_pushcppstring(tolua_S,(const char*)a_Line3); + tolua_pushcppstring(tolua_S,(const char*)a_Line4); + } + } + return 4; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetLines'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetLine of class cSignEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cSignEntity_SetLine00 +static int tolua_AllToLua_cSignEntity_SetLine00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cSignEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_iscppstring(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cSignEntity* self = (cSignEntity*) tolua_tousertype(tolua_S,1,0); + int a_Index = ((int) tolua_tonumber(tolua_S,2,0)); + const AString a_Line = ((const AString) tolua_tocppstring(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetLine'", NULL); +#endif + { + self->SetLine(a_Index,a_Line); + tolua_pushcppstring(tolua_S,(const char*)a_Line); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetLine'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetLine of class cSignEntity */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cSignEntity_GetLine00 +static int tolua_AllToLua_cSignEntity_GetLine00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cSignEntity",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cSignEntity* self = (const cSignEntity*) tolua_tousertype(tolua_S,1,0); + int a_Index = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetLine'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetLine(a_Index); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetLine'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Name of class HTTPFormData */ +#ifndef TOLUA_DISABLE_tolua_get_HTTPFormData_Name +static int tolua_get_HTTPFormData_Name(lua_State* tolua_S) +{ + HTTPFormData* self = (HTTPFormData*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Name'",NULL); +#endif + tolua_pushcppstring(tolua_S,(const char*)self->Name); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: Name of class HTTPFormData */ +#ifndef TOLUA_DISABLE_tolua_set_HTTPFormData_Name +static int tolua_set_HTTPFormData_Name(lua_State* tolua_S) +{ + HTTPFormData* self = (HTTPFormData*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Name'",NULL); + if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->Name = ((std::string) tolua_tocppstring(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Value of class HTTPFormData */ +#ifndef TOLUA_DISABLE_tolua_get_HTTPFormData_Value +static int tolua_get_HTTPFormData_Value(lua_State* tolua_S) +{ + HTTPFormData* self = (HTTPFormData*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Value'",NULL); +#endif + tolua_pushcppstring(tolua_S,(const char*)self->Value); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: Value of class HTTPFormData */ +#ifndef TOLUA_DISABLE_tolua_set_HTTPFormData_Value +static int tolua_set_HTTPFormData_Value(lua_State* tolua_S) +{ + HTTPFormData* self = (HTTPFormData*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Value'",NULL); + if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->Value = ((std::string) tolua_tocppstring(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Type of class HTTPFormData */ +#ifndef TOLUA_DISABLE_tolua_get_HTTPFormData_Type +static int tolua_get_HTTPFormData_Type(lua_State* tolua_S) +{ + HTTPFormData* self = (HTTPFormData*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Type'",NULL); +#endif + tolua_pushcppstring(tolua_S,(const char*)self->Type); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: Type of class HTTPFormData */ +#ifndef TOLUA_DISABLE_tolua_set_HTTPFormData_Type +static int tolua_set_HTTPFormData_Type(lua_State* tolua_S) +{ + HTTPFormData* self = (HTTPFormData*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Type'",NULL); + if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->Type = ((std::string) tolua_tocppstring(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Method of class HTTPRequest */ +#ifndef TOLUA_DISABLE_tolua_get_HTTPRequest_Method +static int tolua_get_HTTPRequest_Method(lua_State* tolua_S) +{ + HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Method'",NULL); +#endif + tolua_pushcppstring(tolua_S,(const char*)self->Method); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: Method of class HTTPRequest */ +#ifndef TOLUA_DISABLE_tolua_set_HTTPRequest_Method +static int tolua_set_HTTPRequest_Method(lua_State* tolua_S) +{ + HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Method'",NULL); + if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->Method = ((AString) tolua_tocppstring(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Path of class HTTPRequest */ +#ifndef TOLUA_DISABLE_tolua_get_HTTPRequest_Path +static int tolua_get_HTTPRequest_Path(lua_State* tolua_S) +{ + HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Path'",NULL); +#endif + tolua_pushcppstring(tolua_S,(const char*)self->Path); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: Path of class HTTPRequest */ +#ifndef TOLUA_DISABLE_tolua_set_HTTPRequest_Path +static int tolua_set_HTTPRequest_Path(lua_State* tolua_S) +{ + HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Path'",NULL); + if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->Path = ((AString) tolua_tocppstring(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Username of class HTTPRequest */ +#ifndef TOLUA_DISABLE_tolua_get_HTTPRequest_Username +static int tolua_get_HTTPRequest_Username(lua_State* tolua_S) +{ + HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Username'",NULL); +#endif + tolua_pushcppstring(tolua_S,(const char*)self->Username); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: Username of class HTTPRequest */ +#ifndef TOLUA_DISABLE_tolua_set_HTTPRequest_Username +static int tolua_set_HTTPRequest_Username(lua_State* tolua_S) +{ + HTTPRequest* self = (HTTPRequest*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Username'",NULL); + if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->Username = ((AString) tolua_tocppstring(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Request of class HTTPTemplateRequest */ +#ifndef TOLUA_DISABLE_tolua_get_HTTPTemplateRequest_Request +static int tolua_get_HTTPTemplateRequest_Request(lua_State* tolua_S) +{ + HTTPTemplateRequest* self = (HTTPTemplateRequest*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Request'",NULL); +#endif + tolua_pushusertype(tolua_S,(void*)&self->Request,"HTTPRequest"); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: Request of class HTTPTemplateRequest */ +#ifndef TOLUA_DISABLE_tolua_set_HTTPTemplateRequest_Request +static int tolua_set_HTTPTemplateRequest_Request(lua_State* tolua_S) +{ + HTTPTemplateRequest* self = (HTTPTemplateRequest*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Request'",NULL); + if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"HTTPRequest",0,&tolua_err))) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->Request = *((HTTPRequest*) tolua_tousertype(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: Content of class sWebAdminPage */ +#ifndef TOLUA_DISABLE_tolua_get_sWebAdminPage_Content +static int tolua_get_sWebAdminPage_Content(lua_State* tolua_S) +{ + sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Content'",NULL); +#endif + tolua_pushcppstring(tolua_S,(const char*)self->Content); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: Content of class sWebAdminPage */ +#ifndef TOLUA_DISABLE_tolua_set_sWebAdminPage_Content +static int tolua_set_sWebAdminPage_Content(lua_State* tolua_S) +{ + sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'Content'",NULL); + if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->Content = ((AString) tolua_tocppstring(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: PluginName of class sWebAdminPage */ +#ifndef TOLUA_DISABLE_tolua_get_sWebAdminPage_PluginName +static int tolua_get_sWebAdminPage_PluginName(lua_State* tolua_S) +{ + sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'PluginName'",NULL); +#endif + tolua_pushcppstring(tolua_S,(const char*)self->PluginName); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: PluginName of class sWebAdminPage */ +#ifndef TOLUA_DISABLE_tolua_set_sWebAdminPage_PluginName +static int tolua_set_sWebAdminPage_PluginName(lua_State* tolua_S) +{ + sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'PluginName'",NULL); + if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->PluginName = ((AString) tolua_tocppstring(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: TabName of class sWebAdminPage */ +#ifndef TOLUA_DISABLE_tolua_get_sWebAdminPage_TabName +static int tolua_get_sWebAdminPage_TabName(lua_State* tolua_S) +{ + sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'TabName'",NULL); +#endif + tolua_pushcppstring(tolua_S,(const char*)self->TabName); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: TabName of class sWebAdminPage */ +#ifndef TOLUA_DISABLE_tolua_set_sWebAdminPage_TabName +static int tolua_set_sWebAdminPage_TabName(lua_State* tolua_S) +{ + sWebAdminPage* self = (sWebAdminPage*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'TabName'",NULL); + if (!tolua_iscppstring(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->TabName = ((AString) tolua_tocppstring(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPage of class cWebAdmin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebAdmin_GetPage00 +static int tolua_AllToLua_cWebAdmin_GetPage00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWebAdmin",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const HTTPRequest",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWebAdmin* self = (cWebAdmin*) tolua_tousertype(tolua_S,1,0); + const HTTPRequest* a_Request = ((const HTTPRequest*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPage'", NULL); +#endif + { + sWebAdminPage tolua_ret = (sWebAdminPage) self->GetPage(*a_Request); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((sWebAdminPage)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"sWebAdminPage"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(sWebAdminPage)); + tolua_pushusertype(tolua_S,tolua_obj,"sWebAdminPage"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPage'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetDefaultPage of class cWebAdmin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebAdmin_GetDefaultPage00 +static int tolua_AllToLua_cWebAdmin_GetDefaultPage00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWebAdmin",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWebAdmin* self = (cWebAdmin*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDefaultPage'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetDefaultPage(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetDefaultPage'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBaseURL of class cWebAdmin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebAdmin_GetBaseURL00 +static int tolua_AllToLua_cWebAdmin_GetBaseURL00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWebAdmin",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWebAdmin* self = (cWebAdmin*) tolua_tousertype(tolua_S,1,0); + const AString a_URL = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBaseURL'", NULL); +#endif + { + AString tolua_ret = (AString) self->GetBaseURL(a_URL); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_URL); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBaseURL'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetHTMLEscapedString of class cWebAdmin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebAdmin_GetHTMLEscapedString00 +static int tolua_AllToLua_cWebAdmin_GetHTMLEscapedString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cWebAdmin",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_Input = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + AString tolua_ret = (AString) cWebAdmin::GetHTMLEscapedString(a_Input); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_Input); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHTMLEscapedString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWebTitle of class cWebPlugin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebPlugin_GetWebTitle00 +static int tolua_AllToLua_cWebPlugin_GetWebTitle00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWebPlugin",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWebPlugin* self = (const cWebPlugin*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWebTitle'", NULL); +#endif + { + const AString tolua_ret = (const AString) self->GetWebTitle(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWebTitle'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HandleWebRequest of class cWebPlugin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebPlugin_HandleWebRequest00 +static int tolua_AllToLua_cWebPlugin_HandleWebRequest00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWebPlugin",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const HTTPRequest",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWebPlugin* self = (cWebPlugin*) tolua_tousertype(tolua_S,1,0); + const HTTPRequest* a_Request = ((const HTTPRequest*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HandleWebRequest'", NULL); +#endif + { + AString tolua_ret = (AString) self->HandleWebRequest(a_Request); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HandleWebRequest'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SafeString of class cWebPlugin */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWebPlugin_SafeString00 +static int tolua_AllToLua_cWebPlugin_SafeString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cWebPlugin",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_String = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + AString tolua_ret = (AString) cWebPlugin::SafeString(a_String); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_String); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SafeString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Get of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_Get00 +static int tolua_AllToLua_cRoot_Get00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cRoot* tolua_ret = (cRoot*) cRoot::Get(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cRoot"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Get'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetServer of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetServer00 +static int tolua_AllToLua_cRoot_GetServer00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetServer'", NULL); +#endif + { + cServer* tolua_ret = (cServer*) self->GetServer(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cServer"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetServer'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetDefaultWorld of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetDefaultWorld00 +static int tolua_AllToLua_cRoot_GetDefaultWorld00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDefaultWorld'", NULL); +#endif + { + cWorld* tolua_ret = (cWorld*) self->GetDefaultWorld(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWorld"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetDefaultWorld'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWorld of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetWorld00 +static int tolua_AllToLua_cRoot_GetWorld00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); + const AString a_WorldName = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWorld'", NULL); +#endif + { + cWorld* tolua_ret = (cWorld*) self->GetWorld(a_WorldName); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWorld"); + tolua_pushcppstring(tolua_S,(const char*)a_WorldName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWorld'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPrimaryServerVersion of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetPrimaryServerVersion00 +static int tolua_AllToLua_cRoot_GetPrimaryServerVersion00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cRoot* self = (const cRoot*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPrimaryServerVersion'", NULL); +#endif + { + int tolua_ret = (int) self->GetPrimaryServerVersion(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPrimaryServerVersion'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetPrimaryServerVersion of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_SetPrimaryServerVersion00 +static int tolua_AllToLua_cRoot_SetPrimaryServerVersion00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); + int a_Version = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetPrimaryServerVersion'", NULL); +#endif + { + self->SetPrimaryServerVersion(a_Version); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetPrimaryServerVersion'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetGroupManager of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetGroupManager00 +static int tolua_AllToLua_cRoot_GetGroupManager00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetGroupManager'", NULL); +#endif + { + cGroupManager* tolua_ret = (cGroupManager*) self->GetGroupManager(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cGroupManager"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetGroupManager'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetCraftingRecipes of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetCraftingRecipes00 +static int tolua_AllToLua_cRoot_GetCraftingRecipes00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetCraftingRecipes'", NULL); +#endif + { + cCraftingRecipes* tolua_ret = (cCraftingRecipes*) self->GetCraftingRecipes(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCraftingRecipes"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetCraftingRecipes'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetFurnaceFuelBurnTime of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetFurnaceFuelBurnTime00 +static int tolua_AllToLua_cRoot_GetFurnaceFuelBurnTime00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cRoot",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cItem* a_Fuel = ((const cItem*) tolua_tousertype(tolua_S,2,0)); + { + int tolua_ret = (int) cRoot::GetFurnaceFuelBurnTime(*a_Fuel); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetFurnaceFuelBurnTime'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWebAdmin of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetWebAdmin00 +static int tolua_AllToLua_cRoot_GetWebAdmin00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWebAdmin'", NULL); +#endif + { + cWebAdmin* tolua_ret = (cWebAdmin*) self->GetWebAdmin(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cWebAdmin"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWebAdmin'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPluginManager of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetPluginManager00 +static int tolua_AllToLua_cRoot_GetPluginManager00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetPluginManager'", NULL); +#endif + { + cPluginManager* tolua_ret = (cPluginManager*) self->GetPluginManager(); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cPluginManager"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPluginManager'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: QueueExecuteConsoleCommand of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_QueueExecuteConsoleCommand00 +static int tolua_AllToLua_cRoot_QueueExecuteConsoleCommand00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); + const AString a_Cmd = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'QueueExecuteConsoleCommand'", NULL); +#endif + { + self->QueueExecuteConsoleCommand(a_Cmd); + tolua_pushcppstring(tolua_S,(const char*)a_Cmd); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'QueueExecuteConsoleCommand'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetTotalChunkCount of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetTotalChunkCount00 +static int tolua_AllToLua_cRoot_GetTotalChunkCount00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetTotalChunkCount'", NULL); +#endif + { + int tolua_ret = (int) self->GetTotalChunkCount(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetTotalChunkCount'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SaveAllChunks of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_SaveAllChunks00 +static int tolua_AllToLua_cRoot_SaveAllChunks00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SaveAllChunks'", NULL); +#endif + { + self->SaveAllChunks(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SaveAllChunks'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: BroadcastChat of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_BroadcastChat00 +static int tolua_AllToLua_cRoot_BroadcastChat00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cRoot* self = (cRoot*) tolua_tousertype(tolua_S,1,0); + const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'BroadcastChat'", NULL); +#endif + { + self->BroadcastChat(a_Message); + tolua_pushcppstring(tolua_S,(const char*)a_Message); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'BroadcastChat'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetProtocolVersionTextFromInt of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00 +static int tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + int a_ProtocolVersionNum = ((int) tolua_tonumber(tolua_S,2,0)); + { + AString tolua_ret = (AString) cRoot::GetProtocolVersionTextFromInt(a_ProtocolVersionNum); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetProtocolVersionTextFromInt'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetVirtualRAMUsage of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetVirtualRAMUsage00 +static int tolua_AllToLua_cRoot_GetVirtualRAMUsage00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + int tolua_ret = (int) cRoot::GetVirtualRAMUsage(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetVirtualRAMUsage'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetPhysicalRAMUsage of class cRoot */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cRoot_GetPhysicalRAMUsage00 +static int tolua_AllToLua_cRoot_GetPhysicalRAMUsage00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cRoot",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + int tolua_ret = (int) cRoot::GetPhysicalRAMUsage(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetPhysicalRAMUsage'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new00 +static int tolua_AllToLua_Vector3f_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + { + Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(*v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new00_local +static int tolua_AllToLua_Vector3f_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + { + Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(*v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new01 +static int tolua_AllToLua_Vector3f_new01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + { + Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f_new00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new01_local +static int tolua_AllToLua_Vector3f_new01_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + { + Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f_new00_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new02 +static int tolua_AllToLua_Vector3f_new02(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); + { + Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(*v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f_new01(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new02_local +static int tolua_AllToLua_Vector3f_new02_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); + { + Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(*v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f_new01_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new03 +static int tolua_AllToLua_Vector3f_new03(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); + { + Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f_new02(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new03_local +static int tolua_AllToLua_Vector3f_new03_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); + { + Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f_new02_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new04 +static int tolua_AllToLua_Vector3f_new04(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else + { + { + Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f_new03(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new04_local +static int tolua_AllToLua_Vector3f_new04_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else + { + { + Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f_new03_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new05 +static int tolua_AllToLua_Vector3f_new05(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + float a_x = ((float) tolua_tonumber(tolua_S,2,0)); + float a_y = ((float) tolua_tonumber(tolua_S,3,0)); + float a_z = ((float) tolua_tonumber(tolua_S,4,0)); + { + Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(a_x,a_y,a_z)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f_new04(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_new05_local +static int tolua_AllToLua_Vector3f_new05_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3f",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + float a_x = ((float) tolua_tonumber(tolua_S,2,0)); + float a_y = ((float) tolua_tonumber(tolua_S,3,0)); + float a_z = ((float) tolua_tonumber(tolua_S,4,0)); + { + Vector3f* tolua_ret = (Vector3f*) Mtolua_new((Vector3f)(a_x,a_y,a_z)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f_new04_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Set of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_Set00 +static int tolua_AllToLua_Vector3f_Set00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"Vector3f",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); + float a_x = ((float) tolua_tonumber(tolua_S,2,0)); + float a_y = ((float) tolua_tonumber(tolua_S,3,0)); + float a_z = ((float) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL); +#endif + { + self->Set(a_x,a_y,a_z); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Set'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Normalize of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_Normalize00 +static int tolua_AllToLua_Vector3f_Normalize00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"Vector3f",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Normalize'", NULL); +#endif + { + self->Normalize(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Normalize'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: NormalizeCopy of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_NormalizeCopy00 +static int tolua_AllToLua_Vector3f_NormalizeCopy00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NormalizeCopy'", NULL); +#endif + { + Vector3f tolua_ret = (Vector3f) self->NormalizeCopy(); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'NormalizeCopy'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: NormalizeCopy of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_NormalizeCopy01 +static int tolua_AllToLua_Vector3f_NormalizeCopy01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3f",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); + Vector3f* a_V = ((Vector3f*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NormalizeCopy'", NULL); +#endif + { + self->NormalizeCopy(*a_V); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_Vector3f_NormalizeCopy00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Length of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_Length00 +static int tolua_AllToLua_Vector3f_Length00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Length'", NULL); +#endif + { + float tolua_ret = (float) self->Length(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Length'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SqrLength of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_SqrLength00 +static int tolua_AllToLua_Vector3f_SqrLength00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SqrLength'", NULL); +#endif + { + float tolua_ret = (float) self->SqrLength(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SqrLength'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Dot of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_Dot00 +static int tolua_AllToLua_Vector3f_Dot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); + const Vector3f* a_V = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Dot'", NULL); +#endif + { + float tolua_ret = (float) self->Dot(*a_V); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Dot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Cross of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_Cross00 +static int tolua_AllToLua_Vector3f_Cross00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); + const Vector3f* v = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Cross'", NULL); +#endif + { + Vector3f tolua_ret = (Vector3f) self->Cross(*v); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Cross'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Equals of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f_Equals00 +static int tolua_AllToLua_Vector3f_Equals00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); + const Vector3f* v = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Equals'", NULL); +#endif + { + bool tolua_ret = (bool) self->Equals(*v); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Equals'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator+ of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f__add00 +static int tolua_AllToLua_Vector3f__add00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); + const Vector3f* v2 = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator+'", NULL); +#endif + { + Vector3f tolua_ret = (Vector3f) self->operator+(*v2); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function '.add'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator+ of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f__add01 +static int tolua_AllToLua_Vector3f__add01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); + const Vector3f* v2 = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator+'", NULL); +#endif + { + Vector3f tolua_ret = (Vector3f) self->operator+(v2); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f__add00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator- of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f__sub00 +static int tolua_AllToLua_Vector3f__sub00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); + const Vector3f* v2 = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator-'", NULL); +#endif + { + Vector3f tolua_ret = (Vector3f) self->operator-(*v2); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function '.sub'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator- of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f__sub01 +static int tolua_AllToLua_Vector3f__sub01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); + const Vector3f* v2 = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator-'", NULL); +#endif + { + Vector3f tolua_ret = (Vector3f) self->operator-(v2); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f__sub00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator* of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f__mul00 +static int tolua_AllToLua_Vector3f__mul00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); + const float f = ((const float) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator*'", NULL); +#endif + { + Vector3f tolua_ret = (Vector3f) self->operator*(f); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function '.mul'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator* of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3f__mul01 +static int tolua_AllToLua_Vector3f__mul01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3f",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3f* self = (const Vector3f*) tolua_tousertype(tolua_S,1,0); + const Vector3f* v2 = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator*'", NULL); +#endif + { + Vector3f tolua_ret = (Vector3f) self->operator*(*v2); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3f)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3f)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3f"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3f__mul00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: x of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_get_Vector3f_x +static int tolua_get_Vector3f_x(lua_State* tolua_S) +{ + Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->x); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: x of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_set_Vector3f_x +static int tolua_set_Vector3f_x(lua_State* tolua_S) +{ + Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->x = ((float) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: y of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_get_Vector3f_y +static int tolua_get_Vector3f_y(lua_State* tolua_S) +{ + Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->y); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: y of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_set_Vector3f_y +static int tolua_set_Vector3f_y(lua_State* tolua_S) +{ + Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->y = ((float) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: z of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_get_Vector3f_z +static int tolua_get_Vector3f_z(lua_State* tolua_S) +{ + Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'z'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->z); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: z of class Vector3f */ +#ifndef TOLUA_DISABLE_tolua_set_Vector3f_z +static int tolua_set_Vector3f_z(lua_State* tolua_S) +{ + Vector3f* self = (Vector3f*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'z'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->z = ((float) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new00 +static int tolua_AllToLua_Vector3d_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3f* v = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); + { + Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)(*v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new00_local +static int tolua_AllToLua_Vector3d_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3f* v = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); + { + Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)(*v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new01 +static int tolua_AllToLua_Vector3d_new01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3f* v = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); + { + Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)(v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3d_new00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new01_local +static int tolua_AllToLua_Vector3d_new01_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3f* v = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); + { + Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)(v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3d_new00_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new02 +static int tolua_AllToLua_Vector3d_new02(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else + { + { + Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3d_new01(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new02_local +static int tolua_AllToLua_Vector3d_new02_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else + { + { + Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3d_new01_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new03 +static int tolua_AllToLua_Vector3d_new03(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + double a_x = ((double) tolua_tonumber(tolua_S,2,0)); + double a_y = ((double) tolua_tonumber(tolua_S,3,0)); + double a_z = ((double) tolua_tonumber(tolua_S,4,0)); + { + Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)(a_x,a_y,a_z)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3d_new02(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_new03_local +static int tolua_AllToLua_Vector3d_new03_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3d",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + double a_x = ((double) tolua_tonumber(tolua_S,2,0)); + double a_y = ((double) tolua_tonumber(tolua_S,3,0)); + double a_z = ((double) tolua_tonumber(tolua_S,4,0)); + { + Vector3d* tolua_ret = (Vector3d*) Mtolua_new((Vector3d)(a_x,a_y,a_z)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3d_new02_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Set of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Set00 +static int tolua_AllToLua_Vector3d_Set00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"Vector3d",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); + double a_x = ((double) tolua_tonumber(tolua_S,2,0)); + double a_y = ((double) tolua_tonumber(tolua_S,3,0)); + double a_z = ((double) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL); +#endif + { + self->Set(a_x,a_y,a_z); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Set'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Normalize of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Normalize00 +static int tolua_AllToLua_Vector3d_Normalize00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"Vector3d",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Normalize'", NULL); +#endif + { + self->Normalize(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Normalize'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: NormalizeCopy of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_NormalizeCopy00 +static int tolua_AllToLua_Vector3d_NormalizeCopy00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"Vector3d",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NormalizeCopy'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->NormalizeCopy(); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'NormalizeCopy'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: NormalizeCopy of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_NormalizeCopy01 +static int tolua_AllToLua_Vector3d_NormalizeCopy01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); + Vector3d* a_V = ((Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'NormalizeCopy'", NULL); +#endif + { + self->NormalizeCopy(*a_V); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_Vector3d_NormalizeCopy00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Length of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Length00 +static int tolua_AllToLua_Vector3d_Length00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Length'", NULL); +#endif + { + double tolua_ret = (double) self->Length(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Length'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SqrLength of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_SqrLength00 +static int tolua_AllToLua_Vector3d_SqrLength00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SqrLength'", NULL); +#endif + { + double tolua_ret = (double) self->SqrLength(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SqrLength'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Dot of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Dot00 +static int tolua_AllToLua_Vector3d_Dot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_V = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Dot'", NULL); +#endif + { + double tolua_ret = (double) self->Dot(*a_V); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Dot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Cross of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Cross00 +static int tolua_AllToLua_Vector3d_Cross00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Cross'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->Cross(*v); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Cross'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: LineCoeffToXYPlane of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_LineCoeffToXYPlane00 +static int tolua_AllToLua_Vector3d_LineCoeffToXYPlane00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_OtherEnd = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + double a_Z = ((double) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'LineCoeffToXYPlane'", NULL); +#endif + { + double tolua_ret = (double) self->LineCoeffToXYPlane(*a_OtherEnd,a_Z); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'LineCoeffToXYPlane'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: LineCoeffToXZPlane of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_LineCoeffToXZPlane00 +static int tolua_AllToLua_Vector3d_LineCoeffToXZPlane00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_OtherEnd = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + double a_Y = ((double) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'LineCoeffToXZPlane'", NULL); +#endif + { + double tolua_ret = (double) self->LineCoeffToXZPlane(*a_OtherEnd,a_Y); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'LineCoeffToXZPlane'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: LineCoeffToYZPlane of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_LineCoeffToYZPlane00 +static int tolua_AllToLua_Vector3d_LineCoeffToYZPlane00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_OtherEnd = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + double a_X = ((double) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'LineCoeffToYZPlane'", NULL); +#endif + { + double tolua_ret = (double) self->LineCoeffToYZPlane(*a_OtherEnd,a_X); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'LineCoeffToYZPlane'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Equals of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d_Equals00 +static int tolua_AllToLua_Vector3d_Equals00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Equals'", NULL); +#endif + { + bool tolua_ret = (bool) self->Equals(*v); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Equals'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator+ of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__add00 +static int tolua_AllToLua_Vector3d__add00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const Vector3d* v2 = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator+'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->operator+(*v2); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function '.add'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator+ of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__add01 +static int tolua_AllToLua_Vector3d__add01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const Vector3d* v2 = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator+'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->operator+(v2); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3d__add00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator- of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__sub00 +static int tolua_AllToLua_Vector3d__sub00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const Vector3d* v2 = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator-'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->operator-(*v2); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function '.sub'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator- of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__sub01 +static int tolua_AllToLua_Vector3d__sub01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const Vector3d* v2 = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator-'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->operator-(v2); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3d__sub00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator* of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__mul00 +static int tolua_AllToLua_Vector3d__mul00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const double f = ((const double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator*'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->operator*(f); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function '.mul'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator* of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__mul01 +static int tolua_AllToLua_Vector3d__mul01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const Vector3d* v2 = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator*'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->operator*(*v2); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3d__mul00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: operator/ of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3d__div00 +static int tolua_AllToLua_Vector3d__div00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3d",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* self = (const Vector3d*) tolua_tousertype(tolua_S,1,0); + const double f = ((const double) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'operator/'", NULL); +#endif + { + Vector3d tolua_ret = (Vector3d) self->operator/(f); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((Vector3d)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(Vector3d)); + tolua_pushusertype(tolua_S,tolua_obj,"Vector3d"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function '.div'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: x of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_get_Vector3d_x +static int tolua_get_Vector3d_x(lua_State* tolua_S) +{ + Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->x); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: x of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_set_Vector3d_x +static int tolua_set_Vector3d_x(lua_State* tolua_S) +{ + Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->x = ((double) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: y of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_get_Vector3d_y +static int tolua_get_Vector3d_y(lua_State* tolua_S) +{ + Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->y); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: y of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_set_Vector3d_y +static int tolua_set_Vector3d_y(lua_State* tolua_S) +{ + Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->y = ((double) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: z of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_get_Vector3d_z +static int tolua_get_Vector3d_z(lua_State* tolua_S) +{ + Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'z'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->z); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: z of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_set_Vector3d_z +static int tolua_set_Vector3d_z(lua_State* tolua_S) +{ + Vector3d* self = (Vector3d*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'z'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->z = ((double) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: EPS of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_get_Vector3d_EPS +static int tolua_get_Vector3d_EPS(lua_State* tolua_S) +{ + tolua_pushnumber(tolua_S,(lua_Number)Vector3d::EPS); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: NO_INTERSECTION of class Vector3d */ +#ifndef TOLUA_DISABLE_tolua_get_Vector3d_NO_INTERSECTION +static int tolua_get_Vector3d_NO_INTERSECTION(lua_State* tolua_S) +{ + tolua_pushnumber(tolua_S,(lua_Number)Vector3d::NO_INTERSECTION); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_new00 +static int tolua_AllToLua_Vector3i_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3i",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + { + Vector3i* tolua_ret = (Vector3i*) Mtolua_new((Vector3i)(*v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3i"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_new00_local +static int tolua_AllToLua_Vector3i_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3i",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + { + Vector3i* tolua_ret = (Vector3i*) Mtolua_new((Vector3i)(*v)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3i"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_new01 +static int tolua_AllToLua_Vector3i_new01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3i",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else + { + { + Vector3i* tolua_ret = (Vector3i*) Mtolua_new((Vector3i)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3i"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3i_new00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_new01_local +static int tolua_AllToLua_Vector3i_new01_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3i",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else + { + { + Vector3i* tolua_ret = (Vector3i*) Mtolua_new((Vector3i)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3i"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3i_new00_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_new02 +static int tolua_AllToLua_Vector3i_new02(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3i",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + int a_x = ((int) tolua_tonumber(tolua_S,2,0)); + int a_y = ((int) tolua_tonumber(tolua_S,3,0)); + int a_z = ((int) tolua_tonumber(tolua_S,4,0)); + { + Vector3i* tolua_ret = (Vector3i*) Mtolua_new((Vector3i)(a_x,a_y,a_z)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3i"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3i_new01(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_new02_local +static int tolua_AllToLua_Vector3i_new02_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"Vector3i",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + int a_x = ((int) tolua_tonumber(tolua_S,2,0)); + int a_y = ((int) tolua_tonumber(tolua_S,3,0)); + int a_z = ((int) tolua_tonumber(tolua_S,4,0)); + { + Vector3i* tolua_ret = (Vector3i*) Mtolua_new((Vector3i)(a_x,a_y,a_z)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"Vector3i"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3i_new01_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Set of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_Set00 +static int tolua_AllToLua_Vector3i_Set00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"Vector3i",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); + int a_x = ((int) tolua_tonumber(tolua_S,2,0)); + int a_y = ((int) tolua_tonumber(tolua_S,3,0)); + int a_z = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Set'", NULL); +#endif + { + self->Set(a_x,a_y,a_z); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Set'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Length of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_Length00 +static int tolua_AllToLua_Vector3i_Length00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3i",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3i* self = (const Vector3i*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Length'", NULL); +#endif + { + float tolua_ret = (float) self->Length(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Length'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SqrLength of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_SqrLength00 +static int tolua_AllToLua_Vector3i_SqrLength00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3i",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3i* self = (const Vector3i*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SqrLength'", NULL); +#endif + { + int tolua_ret = (int) self->SqrLength(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SqrLength'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Equals of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_Equals00 +static int tolua_AllToLua_Vector3i_Equals00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3i",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const Vector3i* self = (const Vector3i*) tolua_tousertype(tolua_S,1,0); + const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Equals'", NULL); +#endif + { + bool tolua_ret = (bool) self->Equals(*v); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Equals'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Equals of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_Vector3i_Equals01 +static int tolua_AllToLua_Vector3i_Equals01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const Vector3i",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3i* self = (const Vector3i*) tolua_tousertype(tolua_S,1,0); + const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Equals'", NULL); +#endif + { + bool tolua_ret = (bool) self->Equals(v); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_Vector3i_Equals00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: x of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_get_Vector3i_x +static int tolua_get_Vector3i_x(lua_State* tolua_S) +{ + Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->x); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: x of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_set_Vector3i_x +static int tolua_set_Vector3i_x(lua_State* tolua_S) +{ + Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'x'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->x = ((int) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: y of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_get_Vector3i_y +static int tolua_get_Vector3i_y(lua_State* tolua_S) +{ + Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->y); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: y of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_set_Vector3i_y +static int tolua_set_Vector3i_y(lua_State* tolua_S) +{ + Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'y'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->y = ((int) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: z of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_get_Vector3i_z +static int tolua_get_Vector3i_z(lua_State* tolua_S) +{ + Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'z'",NULL); +#endif + tolua_pushnumber(tolua_S,(lua_Number)self->z); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: z of class Vector3i */ +#ifndef TOLUA_DISABLE_tolua_set_Vector3i_z +static int tolua_set_Vector3i_z(lua_State* tolua_S) +{ + Vector3i* self = (Vector3i*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'z'",NULL); + if (!tolua_isnumber(tolua_S,2,0,&tolua_err)) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->z = ((int) tolua_tonumber(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: p1 of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_get_cCuboid_p1 +static int tolua_get_cCuboid_p1(lua_State* tolua_S) +{ + cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p1'",NULL); +#endif + tolua_pushusertype(tolua_S,(void*)&self->p1,"Vector3i"); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: p1 of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_set_cCuboid_p1 +static int tolua_set_cCuboid_p1(lua_State* tolua_S) +{ + cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p1'",NULL); + if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3i",0,&tolua_err))) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->p1 = *((Vector3i*) tolua_tousertype(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: p2 of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_get_cCuboid_p2 +static int tolua_get_cCuboid_p2(lua_State* tolua_S) +{ + cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p2'",NULL); +#endif + tolua_pushusertype(tolua_S,(void*)&self->p2,"Vector3i"); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: p2 of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_set_cCuboid_p2 +static int tolua_set_cCuboid_p2(lua_State* tolua_S) +{ + cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'p2'",NULL); + if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3i",0,&tolua_err))) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->p2 = *((Vector3i*) tolua_tousertype(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new00 +static int tolua_AllToLua_cCuboid_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new00_local +static int tolua_AllToLua_cCuboid_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new01 +static int tolua_AllToLua_cCuboid_new01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const cCuboid* a_Cuboid = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); + { + cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(*a_Cuboid)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cCuboid_new00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new01_local +static int tolua_AllToLua_cCuboid_new01_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const cCuboid* a_Cuboid = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); + { + cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(*a_Cuboid)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cCuboid_new00_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new02 +static int tolua_AllToLua_cCuboid_new02(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3i",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3i* a_p1 = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); + const Vector3i* a_p2 = ((const Vector3i*) tolua_tousertype(tolua_S,3,0)); + { + cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(*a_p1,*a_p2)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cCuboid_new01(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new02_local +static int tolua_AllToLua_cCuboid_new02_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3i",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3i* a_p1 = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); + const Vector3i* a_p2 = ((const Vector3i*) tolua_tousertype(tolua_S,3,0)); + { + cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(*a_p1,*a_p2)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cCuboid_new01_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new03 +static int tolua_AllToLua_cCuboid_new03(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + int a_X1 = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y1 = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Z1 = ((int) tolua_tonumber(tolua_S,4,0)); + { + cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(a_X1,a_Y1,a_Z1)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cCuboid_new02(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new03_local +static int tolua_AllToLua_cCuboid_new03_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + int a_X1 = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y1 = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Z1 = ((int) tolua_tonumber(tolua_S,4,0)); + { + cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(a_X1,a_Y1,a_Z1)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cCuboid_new02_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new04 +static int tolua_AllToLua_cCuboid_new04(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else + { + int a_X1 = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y1 = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Z1 = ((int) tolua_tonumber(tolua_S,4,0)); + int a_X2 = ((int) tolua_tonumber(tolua_S,5,0)); + int a_Y2 = ((int) tolua_tonumber(tolua_S,6,0)); + int a_Z2 = ((int) tolua_tonumber(tolua_S,7,0)); + { + cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(a_X1,a_Y1,a_Z1,a_X2,a_Y2,a_Z2)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cCuboid_new03(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_new04_local +static int tolua_AllToLua_cCuboid_new04_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cCuboid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else + { + int a_X1 = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y1 = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Z1 = ((int) tolua_tonumber(tolua_S,4,0)); + int a_X2 = ((int) tolua_tonumber(tolua_S,5,0)); + int a_Y2 = ((int) tolua_tonumber(tolua_S,6,0)); + int a_Z2 = ((int) tolua_tonumber(tolua_S,7,0)); + { + cCuboid* tolua_ret = (cCuboid*) Mtolua_new((cCuboid)(a_X1,a_Y1,a_Z1,a_X2,a_Y2,a_Z2)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCuboid"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cCuboid_new03_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Assign of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_Assign00 +static int tolua_AllToLua_cCuboid_Assign00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCuboid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); + int a_X1 = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y1 = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Z1 = ((int) tolua_tonumber(tolua_S,4,0)); + int a_X2 = ((int) tolua_tonumber(tolua_S,5,0)); + int a_Y2 = ((int) tolua_tonumber(tolua_S,6,0)); + int a_Z2 = ((int) tolua_tonumber(tolua_S,7,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Assign'", NULL); +#endif + { + self->Assign(a_X1,a_Y1,a_Z1,a_X2,a_Y2,a_Z2); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Assign'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Sort of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_Sort00 +static int tolua_AllToLua_cCuboid_Sort00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCuboid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Sort'", NULL); +#endif + { + self->Sort(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Sort'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DifX of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_DifX00 +static int tolua_AllToLua_cCuboid_DifX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DifX'", NULL); +#endif + { + int tolua_ret = (int) self->DifX(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DifX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DifY of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_DifY00 +static int tolua_AllToLua_cCuboid_DifY00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DifY'", NULL); +#endif + { + int tolua_ret = (int) self->DifY(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DifY'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DifZ of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_DifZ00 +static int tolua_AllToLua_cCuboid_DifZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DifZ'", NULL); +#endif + { + int tolua_ret = (int) self->DifZ(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DifZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DoesIntersect of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_DoesIntersect00 +static int tolua_AllToLua_cCuboid_DoesIntersect00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); + const cCuboid* a_Other = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DoesIntersect'", NULL); +#endif + { + bool tolua_ret = (bool) self->DoesIntersect(*a_Other); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DoesIntersect'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsInside of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_IsInside00 +static int tolua_AllToLua_cCuboid_IsInside00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3i",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); + const Vector3i* v = ((const Vector3i*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsInside(*v); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsInside'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsInside of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_IsInside01 +static int tolua_AllToLua_cCuboid_IsInside01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); + int a_X = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Y = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Z = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsInside(a_X,a_Y,a_Z); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cCuboid_IsInside00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsInside of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_IsInside02 +static int tolua_AllToLua_cCuboid_IsInside02(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); + const Vector3d* v = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsInside(*v); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cCuboid_IsInside01(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsCompletelyInside of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_IsCompletelyInside00 +static int tolua_AllToLua_cCuboid_IsCompletelyInside00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); + const cCuboid* a_Outer = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsCompletelyInside'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsCompletelyInside(*a_Outer); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsCompletelyInside'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Move of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_Move00 +static int tolua_AllToLua_cCuboid_Move00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCuboid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cCuboid* self = (cCuboid*) tolua_tousertype(tolua_S,1,0); + int a_OfsX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_OfsY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_OfsZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Move'", NULL); +#endif + { + self->Move(a_OfsX,a_OfsY,a_OfsZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Move'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsSorted of class cCuboid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCuboid_IsSorted00 +static int tolua_AllToLua_cCuboid_IsSorted00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCuboid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCuboid* self = (const cCuboid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSorted'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsSorted(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsSorted'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new00 +static int tolua_AllToLua_cBoundingBox_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + double a_MinX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_MaxX = ((double) tolua_tonumber(tolua_S,3,0)); + double a_MinY = ((double) tolua_tonumber(tolua_S,4,0)); + double a_MaxY = ((double) tolua_tonumber(tolua_S,5,0)); + double a_MinZ = ((double) tolua_tonumber(tolua_S,6,0)); + double a_MaxZ = ((double) tolua_tonumber(tolua_S,7,0)); + { + cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new00_local +static int tolua_AllToLua_cBoundingBox_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + double a_MinX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_MaxX = ((double) tolua_tonumber(tolua_S,3,0)); + double a_MinY = ((double) tolua_tonumber(tolua_S,4,0)); + double a_MaxY = ((double) tolua_tonumber(tolua_S,5,0)); + double a_MinZ = ((double) tolua_tonumber(tolua_S,6,0)); + double a_MaxZ = ((double) tolua_tonumber(tolua_S,7,0)); + { + cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new01 +static int tolua_AllToLua_cBoundingBox_new01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); + { + cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Min,*a_Max)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_new00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new01_local +static int tolua_AllToLua_cBoundingBox_new01_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); + { + cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Min,*a_Max)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_new00_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new02 +static int tolua_AllToLua_cBoundingBox_new02(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3d* a_Pos = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + double a_Radius = ((double) tolua_tonumber(tolua_S,3,0)); + double a_Height = ((double) tolua_tonumber(tolua_S,4,0)); + { + cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Pos,a_Radius,a_Height)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_new01(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new02_local +static int tolua_AllToLua_cBoundingBox_new02_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3d* a_Pos = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + double a_Radius = ((double) tolua_tonumber(tolua_S,3,0)); + double a_Height = ((double) tolua_tonumber(tolua_S,4,0)); + { + cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Pos,a_Radius,a_Height)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_new01_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new03 +static int tolua_AllToLua_cBoundingBox_new03(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBoundingBox",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const cBoundingBox* a_Orig = ((const cBoundingBox*) tolua_tousertype(tolua_S,2,0)); + { + cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Orig)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_new02(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_new03_local +static int tolua_AllToLua_cBoundingBox_new03_local(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBoundingBox",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + const cBoundingBox* a_Orig = ((const cBoundingBox*) tolua_tousertype(tolua_S,2,0)); + { + cBoundingBox* tolua_ret = (cBoundingBox*) Mtolua_new((cBoundingBox)(*a_Orig)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBoundingBox"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_new02_local(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Move of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_Move00 +static int tolua_AllToLua_cBoundingBox_Move00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); + double a_OffX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_OffY = ((double) tolua_tonumber(tolua_S,3,0)); + double a_OffZ = ((double) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Move'", NULL); +#endif + { + self->Move(a_OffX,a_OffY,a_OffZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Move'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Move of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_Move01 +static int tolua_AllToLua_cBoundingBox_Move01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_Off = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Move'", NULL); +#endif + { + self->Move(*a_Off); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_Move00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Expand of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_Expand00 +static int tolua_AllToLua_cBoundingBox_Expand00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); + double a_ExpandX = ((double) tolua_tonumber(tolua_S,2,0)); + double a_ExpandY = ((double) tolua_tonumber(tolua_S,3,0)); + double a_ExpandZ = ((double) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Expand'", NULL); +#endif + { + self->Expand(a_ExpandX,a_ExpandY,a_ExpandZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Expand'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DoesIntersect of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_DoesIntersect00 +static int tolua_AllToLua_cBoundingBox_DoesIntersect00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBoundingBox",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); + const cBoundingBox* a_Other = ((const cBoundingBox*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DoesIntersect'", NULL); +#endif + { + bool tolua_ret = (bool) self->DoesIntersect(*a_Other); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DoesIntersect'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Union of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_Union00 +static int tolua_AllToLua_cBoundingBox_Union00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBoundingBox",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); + const cBoundingBox* a_Other = ((const cBoundingBox*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Union'", NULL); +#endif + { + cBoundingBox tolua_ret = (cBoundingBox) self->Union(*a_Other); + { +#ifdef __cplusplus + void* tolua_obj = Mtolua_new((cBoundingBox)(tolua_ret)); + tolua_pushusertype(tolua_S,tolua_obj,"cBoundingBox"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#else + void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(cBoundingBox)); + tolua_pushusertype(tolua_S,tolua_obj,"cBoundingBox"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); +#endif + } + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Union'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsInside of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside00 +static int tolua_AllToLua_cBoundingBox_IsInside00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_Point = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsInside(*a_Point); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsInside'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsInside of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside01 +static int tolua_AllToLua_cBoundingBox_IsInside01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); + double a_X = ((double) tolua_tonumber(tolua_S,2,0)); + double a_Y = ((double) tolua_tonumber(tolua_S,3,0)); + double a_Z = ((double) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsInside(a_X,a_Y,a_Z); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_IsInside00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsInside of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside02 +static int tolua_AllToLua_cBoundingBox_IsInside02(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cBoundingBox",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); + cBoundingBox* a_Other = ((cBoundingBox*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsInside(*a_Other); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_IsInside01(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsInside of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside03 +static int tolua_AllToLua_cBoundingBox_IsInside03(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else + { + cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsInside'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsInside(*a_Min,*a_Max); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_IsInside02(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsInside of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside04 +static int tolua_AllToLua_cBoundingBox_IsInside04(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const Vector3d",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); + const Vector3d* a_Point = ((const Vector3d*) tolua_tousertype(tolua_S,4,0)); + { + bool tolua_ret = (bool) cBoundingBox::IsInside(*a_Min,*a_Max,*a_Point); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_IsInside03(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsInside of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_IsInside05 +static int tolua_AllToLua_cBoundingBox_IsInside05(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); + double a_X = ((double) tolua_tonumber(tolua_S,4,0)); + double a_Y = ((double) tolua_tonumber(tolua_S,5,0)); + double a_Z = ((double) tolua_tonumber(tolua_S,6,0)); + { + bool tolua_ret = (bool) cBoundingBox::IsInside(*a_Min,*a_Max,a_X,a_Y,a_Z); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_IsInside04(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CalcLineIntersection of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_CalcLineIntersection00 +static int tolua_AllToLua_cBoundingBox_CalcLineIntersection00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBoundingBox* self = (cBoundingBox*) tolua_tousertype(tolua_S,1,0); + const Vector3d* a_Line1 = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + const Vector3d* a_Line2 = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); + double a_LineCoeff = ((double) tolua_tonumber(tolua_S,4,0)); + char a_Face = ((char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CalcLineIntersection'", NULL); +#endif + { + bool tolua_ret = (bool) self->CalcLineIntersection(*a_Line1,*a_Line2,a_LineCoeff,a_Face); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushnumber(tolua_S,(lua_Number)a_LineCoeff); + tolua_pushnumber(tolua_S,(lua_Number)a_Face); + } + } + return 3; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CalcLineIntersection'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CalcLineIntersection of class cBoundingBox */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBoundingBox_CalcLineIntersection01 +static int tolua_AllToLua_cBoundingBox_CalcLineIntersection01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBoundingBox",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3d",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3d",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const Vector3d",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,5,&tolua_err) || !tolua_isusertype(tolua_S,5,"const Vector3d",0,&tolua_err)) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else + { + const Vector3d* a_Min = ((const Vector3d*) tolua_tousertype(tolua_S,2,0)); + const Vector3d* a_Max = ((const Vector3d*) tolua_tousertype(tolua_S,3,0)); + const Vector3d* a_Line1 = ((const Vector3d*) tolua_tousertype(tolua_S,4,0)); + const Vector3d* a_Line2 = ((const Vector3d*) tolua_tousertype(tolua_S,5,0)); + double a_LineCoeff = ((double) tolua_tonumber(tolua_S,6,0)); + char a_Face = ((char) tolua_tonumber(tolua_S,7,0)); + { + bool tolua_ret = (bool) cBoundingBox::CalcLineIntersection(*a_Min,*a_Max,*a_Line1,*a_Line2,a_LineCoeff,a_Face); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushnumber(tolua_S,(lua_Number)a_LineCoeff); + tolua_pushnumber(tolua_S,(lua_Number)a_Face); + } + } + return 3; +tolua_lerror: + return tolua_AllToLua_cBoundingBox_CalcLineIntersection00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: BlockHitPosition of class cTracer */ +#ifndef TOLUA_DISABLE_tolua_get_cTracer_BlockHitPosition +static int tolua_get_cTracer_BlockHitPosition(lua_State* tolua_S) +{ + cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'BlockHitPosition'",NULL); +#endif + tolua_pushusertype(tolua_S,(void*)&self->BlockHitPosition,"Vector3f"); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: BlockHitPosition of class cTracer */ +#ifndef TOLUA_DISABLE_tolua_set_cTracer_BlockHitPosition +static int tolua_set_cTracer_BlockHitPosition(lua_State* tolua_S) +{ + cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'BlockHitPosition'",NULL); + if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3f",0,&tolua_err))) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->BlockHitPosition = *((Vector3f*) tolua_tousertype(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: HitNormal of class cTracer */ +#ifndef TOLUA_DISABLE_tolua_get_cTracer_HitNormal +static int tolua_get_cTracer_HitNormal(lua_State* tolua_S) +{ + cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'HitNormal'",NULL); +#endif + tolua_pushusertype(tolua_S,(void*)&self->HitNormal,"Vector3f"); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: HitNormal of class cTracer */ +#ifndef TOLUA_DISABLE_tolua_set_cTracer_HitNormal +static int tolua_set_cTracer_HitNormal(lua_State* tolua_S) +{ + cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'HitNormal'",NULL); + if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3f",0,&tolua_err))) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->HitNormal = *((Vector3f*) tolua_tousertype(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* get function: RealHit of class cTracer */ +#ifndef TOLUA_DISABLE_tolua_get_cTracer_RealHit +static int tolua_get_cTracer_RealHit(lua_State* tolua_S) +{ + cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'RealHit'",NULL); +#endif + tolua_pushusertype(tolua_S,(void*)&self->RealHit,"Vector3f"); + return 1; +} +#endif //#ifndef TOLUA_DISABLE + +/* set function: RealHit of class cTracer */ +#ifndef TOLUA_DISABLE_tolua_set_cTracer_RealHit +static int tolua_set_cTracer_RealHit(lua_State* tolua_S) +{ + cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if (!self) tolua_error(tolua_S,"invalid 'self' in accessing variable 'RealHit'",NULL); + if ((tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"Vector3f",0,&tolua_err))) + tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err); +#endif + self->RealHit = *((Vector3f*) tolua_tousertype(tolua_S,2,0)) +; + return 0; +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cTracer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cTracer_new00 +static int tolua_AllToLua_cTracer_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cTracer",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0)); + { + cTracer* tolua_ret = (cTracer*) Mtolua_new((cTracer)(a_World)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cTracer"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cTracer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cTracer_new00_local +static int tolua_AllToLua_cTracer_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cTracer",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0)); + { + cTracer* tolua_ret = (cTracer*) Mtolua_new((cTracer)(a_World)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cTracer"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: delete of class cTracer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cTracer_delete00 +static int tolua_AllToLua_cTracer_delete00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cTracer",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL); +#endif + Mtolua_delete(self); + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Trace of class cTracer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cTracer_Trace00 +static int tolua_AllToLua_cTracer_Trace00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cTracer",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3f",0,&tolua_err)) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); + const Vector3f* a_Start = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); + const Vector3f* a_Direction = ((const Vector3f*) tolua_tousertype(tolua_S,3,0)); + int a_Distance = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Trace'", NULL); +#endif + { + bool tolua_ret = (bool) self->Trace(*a_Start,*a_Direction,a_Distance); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Trace'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Trace of class cTracer */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cTracer_Trace01 +static int tolua_AllToLua_cTracer_Trace01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cTracer",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const Vector3f",0,&tolua_err)) || + (tolua_isvaluenil(tolua_S,3,&tolua_err) || !tolua_isusertype(tolua_S,3,"const Vector3f",0,&tolua_err)) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isboolean(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else + { + cTracer* self = (cTracer*) tolua_tousertype(tolua_S,1,0); + const Vector3f* a_Start = ((const Vector3f*) tolua_tousertype(tolua_S,2,0)); + const Vector3f* a_Direction = ((const Vector3f*) tolua_tousertype(tolua_S,3,0)); + int a_Distance = ((int) tolua_tonumber(tolua_S,4,0)); + bool a_LineOfSight = ((bool) tolua_toboolean(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Trace'", NULL); +#endif + { + bool tolua_ret = (bool) self->Trace(*a_Start,*a_Direction,a_Distance,a_LineOfSight); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cTracer_Trace00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetName of class cGroup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_SetName00 +static int tolua_AllToLua_cGroup_SetName00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cGroup",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cGroup* self = (cGroup*) tolua_tousertype(tolua_S,1,0); + std::string a_Name = ((std::string) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetName'", NULL); +#endif + { + self->SetName(a_Name); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetName'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetName of class cGroup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_GetName00 +static int tolua_AllToLua_cGroup_GetName00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cGroup",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cGroup* self = (const cGroup*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetName'", NULL); +#endif + { + const std::string tolua_ret = (const std::string) self->GetName(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetName'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetColor of class cGroup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_SetColor00 +static int tolua_AllToLua_cGroup_SetColor00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cGroup",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cGroup* self = (cGroup*) tolua_tousertype(tolua_S,1,0); + std::string a_Color = ((std::string) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetColor'", NULL); +#endif + { + self->SetColor(a_Color); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetColor'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddCommand of class cGroup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_AddCommand00 +static int tolua_AllToLua_cGroup_AddCommand00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cGroup",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cGroup* self = (cGroup*) tolua_tousertype(tolua_S,1,0); + std::string a_Command = ((std::string) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddCommand'", NULL); +#endif + { + self->AddCommand(a_Command); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddCommand'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: AddPermission of class cGroup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_AddPermission00 +static int tolua_AllToLua_cGroup_AddPermission00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cGroup",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cGroup* self = (cGroup*) tolua_tousertype(tolua_S,1,0); + std::string a_Permission = ((std::string) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'AddPermission'", NULL); +#endif + { + self->AddPermission(a_Permission); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'AddPermission'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: InheritFrom of class cGroup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_InheritFrom00 +static int tolua_AllToLua_cGroup_InheritFrom00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cGroup",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"cGroup",0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cGroup* self = (cGroup*) tolua_tousertype(tolua_S,1,0); + cGroup* a_Group = ((cGroup*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'InheritFrom'", NULL); +#endif + { + self->InheritFrom(a_Group); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'InheritFrom'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HasCommand of class cGroup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_HasCommand00 +static int tolua_AllToLua_cGroup_HasCommand00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cGroup",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cGroup* self = (cGroup*) tolua_tousertype(tolua_S,1,0); + std::string a_Command = ((std::string) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasCommand'", NULL); +#endif + { + bool tolua_ret = (bool) self->HasCommand(a_Command); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HasCommand'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetColor of class cGroup */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cGroup_GetColor00 +static int tolua_AllToLua_cGroup_GetColor00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cGroup",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cGroup* self = (const cGroup*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetColor'", NULL); +#endif + { + const AString tolua_ret = (const AString) self->GetColor(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetColor'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_new00 +static int tolua_AllToLua_cBlockArea_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cBlockArea* tolua_ret = (cBlockArea*) Mtolua_new((cBlockArea)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBlockArea"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_new00_local +static int tolua_AllToLua_cBlockArea_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + { + cBlockArea* tolua_ret = (cBlockArea*) Mtolua_new((cBlockArea)()); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBlockArea"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: delete of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_delete00 +static int tolua_AllToLua_cBlockArea_delete00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL); +#endif + Mtolua_delete(self); + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Clear of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Clear00 +static int tolua_AllToLua_cBlockArea_Clear00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); +#endif + { + self->Clear(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Create of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Create00 +static int tolua_AllToLua_cBlockArea_Create00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_SizeX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_SizeY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_SizeZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Create'", NULL); +#endif + { + self->Create(a_SizeX,a_SizeY,a_SizeZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Create'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Create of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Create01 +static int tolua_AllToLua_cBlockArea_Create01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_SizeX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_SizeY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_SizeZ = ((int) tolua_tonumber(tolua_S,4,0)); + int a_DataTypes = ((int) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Create'", NULL); +#endif + { + self->Create(a_SizeX,a_SizeY,a_SizeZ,a_DataTypes); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cBlockArea_Create00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetOrigin of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetOrigin00 +static int tolua_AllToLua_cBlockArea_SetOrigin00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_OriginX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_OriginY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_OriginZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetOrigin'", NULL); +#endif + { + self->SetOrigin(a_OriginX,a_OriginY,a_OriginZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetOrigin'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Read of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Read00 +static int tolua_AllToLua_cBlockArea_Read00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnumber(tolua_S,8,0,&tolua_err) || + !tolua_isnoobj(tolua_S,9,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0)); + int a_MinBlockX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_MaxBlockX = ((int) tolua_tonumber(tolua_S,4,0)); + int a_MinBlockY = ((int) tolua_tonumber(tolua_S,5,0)); + int a_MaxBlockY = ((int) tolua_tonumber(tolua_S,6,0)); + int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,7,0)); + int a_MaxBlockZ = ((int) tolua_tonumber(tolua_S,8,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Read'", NULL); +#endif + { + bool tolua_ret = (bool) self->Read(a_World,a_MinBlockX,a_MaxBlockX,a_MinBlockY,a_MaxBlockY,a_MinBlockZ,a_MaxBlockZ); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Read'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Read of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Read01 +static int tolua_AllToLua_cBlockArea_Read01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnumber(tolua_S,8,0,&tolua_err) || + !tolua_isnumber(tolua_S,9,0,&tolua_err) || + !tolua_isnoobj(tolua_S,10,&tolua_err) + ) + goto tolua_lerror; + else + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0)); + int a_MinBlockX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_MaxBlockX = ((int) tolua_tonumber(tolua_S,4,0)); + int a_MinBlockY = ((int) tolua_tonumber(tolua_S,5,0)); + int a_MaxBlockY = ((int) tolua_tonumber(tolua_S,6,0)); + int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,7,0)); + int a_MaxBlockZ = ((int) tolua_tonumber(tolua_S,8,0)); + int a_DataTypes = ((int) tolua_tonumber(tolua_S,9,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Read'", NULL); +#endif + { + bool tolua_ret = (bool) self->Read(a_World,a_MinBlockX,a_MaxBlockX,a_MinBlockY,a_MaxBlockY,a_MinBlockZ,a_MaxBlockZ,a_DataTypes); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBlockArea_Read00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Write of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Write00 +static int tolua_AllToLua_cBlockArea_Write00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0)); + int a_MinBlockX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_MinBlockY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Write'", NULL); +#endif + { + bool tolua_ret = (bool) self->Write(a_World,a_MinBlockX,a_MinBlockY,a_MinBlockZ); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Write'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Write of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Write01 +static int tolua_AllToLua_cBlockArea_Write01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isusertype(tolua_S,2,"cWorld",0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + cWorld* a_World = ((cWorld*) tolua_tousertype(tolua_S,2,0)); + int a_MinBlockX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_MinBlockY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_MinBlockZ = ((int) tolua_tonumber(tolua_S,5,0)); + int a_DataTypes = ((int) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Write'", NULL); +#endif + { + bool tolua_ret = (bool) self->Write(a_World,a_MinBlockX,a_MinBlockY,a_MinBlockZ,a_DataTypes); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +tolua_lerror: + return tolua_AllToLua_cBlockArea_Write00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CopyTo of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_CopyTo00 +static int tolua_AllToLua_cBlockArea_CopyTo00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cBlockArea",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); + cBlockArea* a_Into = ((cBlockArea*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CopyTo'", NULL); +#endif + { + self->CopyTo(*a_Into); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CopyTo'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: CopyFrom of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_CopyFrom00 +static int tolua_AllToLua_cBlockArea_CopyFrom00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBlockArea",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + const cBlockArea* a_From = ((const cBlockArea*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'CopyFrom'", NULL); +#endif + { + self->CopyFrom(*a_From); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'CopyFrom'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: DumpToRawFile of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_DumpToRawFile00 +static int tolua_AllToLua_cBlockArea_DumpToRawFile00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'DumpToRawFile'", NULL); +#endif + { + self->DumpToRawFile(a_FileName); + tolua_pushcppstring(tolua_S,(const char*)a_FileName); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'DumpToRawFile'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: LoadFromSchematicFile of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_LoadFromSchematicFile00 +static int tolua_AllToLua_cBlockArea_LoadFromSchematicFile00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'LoadFromSchematicFile'", NULL); +#endif + { + bool tolua_ret = (bool) self->LoadFromSchematicFile(a_FileName); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_FileName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'LoadFromSchematicFile'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SaveToSchematicFile of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SaveToSchematicFile00 +static int tolua_AllToLua_cBlockArea_SaveToSchematicFile00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + const AString a_FileName = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SaveToSchematicFile'", NULL); +#endif + { + bool tolua_ret = (bool) self->SaveToSchematicFile(a_FileName); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_FileName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SaveToSchematicFile'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Crop of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Crop00 +static int tolua_AllToLua_cBlockArea_Crop00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_AddMinX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_SubMaxX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_AddMinY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_SubMaxY = ((int) tolua_tonumber(tolua_S,5,0)); + int a_AddMinZ = ((int) tolua_tonumber(tolua_S,6,0)); + int a_SubMaxZ = ((int) tolua_tonumber(tolua_S,7,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Crop'", NULL); +#endif + { + self->Crop(a_AddMinX,a_SubMaxX,a_AddMinY,a_SubMaxY,a_AddMinZ,a_SubMaxZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Crop'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Expand of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Expand00 +static int tolua_AllToLua_cBlockArea_Expand00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnoobj(tolua_S,8,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_SubMinX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_AddMaxX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_SubMinY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_AddMaxY = ((int) tolua_tonumber(tolua_S,5,0)); + int a_SubMinZ = ((int) tolua_tonumber(tolua_S,6,0)); + int a_AddMaxZ = ((int) tolua_tonumber(tolua_S,7,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Expand'", NULL); +#endif + { + self->Expand(a_SubMinX,a_AddMaxX,a_SubMinY,a_AddMaxY,a_SubMinZ,a_AddMaxZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Expand'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Merge of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Merge00 +static int tolua_AllToLua_cBlockArea_Merge00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBlockArea",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + const cBlockArea* a_Src = ((const cBlockArea*) tolua_tousertype(tolua_S,2,0)); + int a_RelX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,5,0)); + cBlockArea::eMergeStrategy a_Strategy = ((cBlockArea::eMergeStrategy) (int) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Merge'", NULL); +#endif + { + self->Merge(*a_Src,a_RelX,a_RelY,a_RelZ,a_Strategy); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Merge'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Fill of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_Fill00 +static int tolua_AllToLua_cBlockArea_Fill00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,1,&tolua_err) || + !tolua_isnumber(tolua_S,5,1,&tolua_err) || + !tolua_isnumber(tolua_S,6,1,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_DataTypes = ((int) tolua_tonumber(tolua_S,2,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,3,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockLight = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockSkyLight = (( unsigned char) tolua_tonumber(tolua_S,6,0x0f)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Fill'", NULL); +#endif + { + self->Fill(a_DataTypes,a_BlockType,a_BlockMeta,a_BlockLight,a_BlockSkyLight); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Fill'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FillRelCuboid of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_FillRelCuboid00 +static int tolua_AllToLua_cBlockArea_FillRelCuboid00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnumber(tolua_S,8,0,&tolua_err) || + !tolua_isnumber(tolua_S,9,0,&tolua_err) || + !tolua_isnumber(tolua_S,10,1,&tolua_err) || + !tolua_isnumber(tolua_S,11,1,&tolua_err) || + !tolua_isnumber(tolua_S,12,1,&tolua_err) || + !tolua_isnoobj(tolua_S,13,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_MinRelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_MaxRelX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_MinRelY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_MaxRelY = ((int) tolua_tonumber(tolua_S,5,0)); + int a_MinRelZ = ((int) tolua_tonumber(tolua_S,6,0)); + int a_MaxRelZ = ((int) tolua_tonumber(tolua_S,7,0)); + int a_DataTypes = ((int) tolua_tonumber(tolua_S,8,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,9,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,10,0)); + unsigned char a_BlockLight = (( unsigned char) tolua_tonumber(tolua_S,11,0)); + unsigned char a_BlockSkyLight = (( unsigned char) tolua_tonumber(tolua_S,12,0x0f)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FillRelCuboid'", NULL); +#endif + { + self->FillRelCuboid(a_MinRelX,a_MaxRelX,a_MinRelY,a_MaxRelY,a_MinRelZ,a_MaxRelZ,a_DataTypes,a_BlockType,a_BlockMeta,a_BlockLight,a_BlockSkyLight); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'FillRelCuboid'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: RelLine of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RelLine00 +static int tolua_AllToLua_cBlockArea_RelLine00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnumber(tolua_S,8,0,&tolua_err) || + !tolua_isnumber(tolua_S,9,0,&tolua_err) || + !tolua_isnumber(tolua_S,10,1,&tolua_err) || + !tolua_isnumber(tolua_S,11,1,&tolua_err) || + !tolua_isnumber(tolua_S,12,1,&tolua_err) || + !tolua_isnoobj(tolua_S,13,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_RelX1 = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY1 = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ1 = ((int) tolua_tonumber(tolua_S,4,0)); + int a_RelX2 = ((int) tolua_tonumber(tolua_S,5,0)); + int a_RelY2 = ((int) tolua_tonumber(tolua_S,6,0)); + int a_RelZ2 = ((int) tolua_tonumber(tolua_S,7,0)); + int a_DataTypes = ((int) tolua_tonumber(tolua_S,8,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,9,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,10,0)); + unsigned char a_BlockLight = (( unsigned char) tolua_tonumber(tolua_S,11,0)); + unsigned char a_BlockSkyLight = (( unsigned char) tolua_tonumber(tolua_S,12,0x0f)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RelLine'", NULL); +#endif + { + self->RelLine(a_RelX1,a_RelY1,a_RelZ1,a_RelX2,a_RelY2,a_RelZ2,a_DataTypes,a_BlockType,a_BlockMeta,a_BlockLight,a_BlockSkyLight); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'RelLine'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: RotateCCW of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCCW00 +static int tolua_AllToLua_cBlockArea_RotateCCW00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCCW'", NULL); +#endif + { + self->RotateCCW(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'RotateCCW'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: RotateCW of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCW00 +static int tolua_AllToLua_cBlockArea_RotateCW00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCW'", NULL); +#endif + { + self->RotateCW(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'RotateCW'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: MirrorXY of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_MirrorXY00 +static int tolua_AllToLua_cBlockArea_MirrorXY00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MirrorXY'", NULL); +#endif + { + self->MirrorXY(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'MirrorXY'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: MirrorXZ of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_MirrorXZ00 +static int tolua_AllToLua_cBlockArea_MirrorXZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MirrorXZ'", NULL); +#endif + { + self->MirrorXZ(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'MirrorXZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: MirrorYZ of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_MirrorYZ00 +static int tolua_AllToLua_cBlockArea_MirrorYZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MirrorYZ'", NULL); +#endif + { + self->MirrorYZ(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'MirrorYZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: RotateCCWNoMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCCWNoMeta00 +static int tolua_AllToLua_cBlockArea_RotateCCWNoMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCCWNoMeta'", NULL); +#endif + { + self->RotateCCWNoMeta(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'RotateCCWNoMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: RotateCWNoMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_RotateCWNoMeta00 +static int tolua_AllToLua_cBlockArea_RotateCWNoMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RotateCWNoMeta'", NULL); +#endif + { + self->RotateCWNoMeta(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'RotateCWNoMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: MirrorXYNoMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_MirrorXYNoMeta00 +static int tolua_AllToLua_cBlockArea_MirrorXYNoMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MirrorXYNoMeta'", NULL); +#endif + { + self->MirrorXYNoMeta(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'MirrorXYNoMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: MirrorXZNoMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_MirrorXZNoMeta00 +static int tolua_AllToLua_cBlockArea_MirrorXZNoMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MirrorXZNoMeta'", NULL); +#endif + { + self->MirrorXZNoMeta(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'MirrorXZNoMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: MirrorYZNoMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_MirrorYZNoMeta00 +static int tolua_AllToLua_cBlockArea_MirrorYZNoMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'MirrorYZNoMeta'", NULL); +#endif + { + self->MirrorYZNoMeta(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'MirrorYZNoMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetRelBlockType of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockType00 +static int tolua_AllToLua_cBlockArea_SetRelBlockType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockType'", NULL); +#endif + { + self->SetRelBlockType(a_RelX,a_RelY,a_RelZ,a_BlockType); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetRelBlockType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBlockType of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockType00 +static int tolua_AllToLua_cBlockArea_SetBlockType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockType'", NULL); +#endif + { + self->SetBlockType(a_BlockX,a_BlockY,a_BlockZ,a_BlockType); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetBlockType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetRelBlockMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockMeta00 +static int tolua_AllToLua_cBlockArea_SetRelBlockMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockMeta'", NULL); +#endif + { + self->SetRelBlockMeta(a_RelX,a_RelY,a_RelZ,a_BlockMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetRelBlockMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBlockMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockMeta00 +static int tolua_AllToLua_cBlockArea_SetBlockMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockMeta'", NULL); +#endif + { + self->SetBlockMeta(a_BlockX,a_BlockY,a_BlockZ,a_BlockMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetBlockMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetRelBlockLight of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockLight00 +static int tolua_AllToLua_cBlockArea_SetRelBlockLight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockLight = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockLight'", NULL); +#endif + { + self->SetRelBlockLight(a_RelX,a_RelY,a_RelZ,a_BlockLight); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetRelBlockLight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBlockLight of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockLight00 +static int tolua_AllToLua_cBlockArea_SetBlockLight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockLight = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockLight'", NULL); +#endif + { + self->SetBlockLight(a_BlockX,a_BlockY,a_BlockZ,a_BlockLight); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetBlockLight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetRelBlockSkyLight of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockSkyLight00 +static int tolua_AllToLua_cBlockArea_SetRelBlockSkyLight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockSkyLight = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockSkyLight'", NULL); +#endif + { + self->SetRelBlockSkyLight(a_RelX,a_RelY,a_RelZ,a_BlockSkyLight); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetRelBlockSkyLight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBlockSkyLight of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockSkyLight00 +static int tolua_AllToLua_cBlockArea_SetBlockSkyLight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockSkyLight = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockSkyLight'", NULL); +#endif + { + self->SetBlockSkyLight(a_BlockX,a_BlockY,a_BlockZ,a_BlockSkyLight); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetBlockSkyLight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetRelBlockType of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockType00 +static int tolua_AllToLua_cBlockArea_GetRelBlockType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockType'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetRelBlockType(a_RelX,a_RelY,a_RelZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetRelBlockType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockType of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockType00 +static int tolua_AllToLua_cBlockArea_GetBlockType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockType'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlockType(a_BlockX,a_BlockY,a_BlockZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetRelBlockMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockMeta00 +static int tolua_AllToLua_cBlockArea_GetRelBlockMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockMeta'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetRelBlockMeta(a_RelX,a_RelY,a_RelZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetRelBlockMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockMeta00 +static int tolua_AllToLua_cBlockArea_GetBlockMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockMeta'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlockMeta(a_BlockX,a_BlockY,a_BlockZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetRelBlockLight of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockLight00 +static int tolua_AllToLua_cBlockArea_GetRelBlockLight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockLight'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetRelBlockLight(a_RelX,a_RelY,a_RelZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetRelBlockLight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockLight of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockLight00 +static int tolua_AllToLua_cBlockArea_GetBlockLight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockLight'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlockLight(a_BlockX,a_BlockY,a_BlockZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockLight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetRelBlockSkyLight of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockSkyLight00 +static int tolua_AllToLua_cBlockArea_GetRelBlockSkyLight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockSkyLight'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetRelBlockSkyLight(a_RelX,a_RelY,a_RelZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetRelBlockSkyLight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockSkyLight of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockSkyLight00 +static int tolua_AllToLua_cBlockArea_GetBlockSkyLight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockSkyLight'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlockSkyLight(a_BlockX,a_BlockY,a_BlockZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockSkyLight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBlockTypeMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetBlockTypeMeta00 +static int tolua_AllToLua_cBlockArea_SetBlockTypeMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockTypeMeta'", NULL); +#endif + { + self->SetBlockTypeMeta(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetBlockTypeMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetRelBlockTypeMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_SetRelBlockTypeMeta00 +static int tolua_AllToLua_cBlockArea_SetRelBlockTypeMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cBlockArea* self = (cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetRelBlockTypeMeta'", NULL); +#endif + { + self->SetRelBlockTypeMeta(a_RelX,a_RelY,a_RelZ,a_BlockType,a_BlockMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetRelBlockTypeMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockTypeMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetBlockTypeMeta00 +static int tolua_AllToLua_cBlockArea_GetBlockTypeMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_BlockX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_BlockY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BlockZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockTypeMeta'", NULL); +#endif + { + self->GetBlockTypeMeta(a_BlockX,a_BlockY,a_BlockZ,a_BlockType,a_BlockMeta); + tolua_pushnumber(tolua_S,(lua_Number)a_BlockType); + tolua_pushnumber(tolua_S,(lua_Number)a_BlockMeta); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockTypeMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetRelBlockTypeMeta of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetRelBlockTypeMeta00 +static int tolua_AllToLua_cBlockArea_GetRelBlockTypeMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetRelBlockTypeMeta'", NULL); +#endif + { + self->GetRelBlockTypeMeta(a_RelX,a_RelY,a_RelZ,a_BlockType,a_BlockMeta); + tolua_pushnumber(tolua_S,(lua_Number)a_BlockType); + tolua_pushnumber(tolua_S,(lua_Number)a_BlockMeta); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetRelBlockTypeMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSizeX of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetSizeX00 +static int tolua_AllToLua_cBlockArea_GetSizeX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSizeX'", NULL); +#endif + { + int tolua_ret = (int) self->GetSizeX(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSizeX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSizeY of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetSizeY00 +static int tolua_AllToLua_cBlockArea_GetSizeY00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSizeY'", NULL); +#endif + { + int tolua_ret = (int) self->GetSizeY(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSizeY'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSizeZ of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetSizeZ00 +static int tolua_AllToLua_cBlockArea_GetSizeZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSizeZ'", NULL); +#endif + { + int tolua_ret = (int) self->GetSizeZ(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSizeZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetOriginX of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetOriginX00 +static int tolua_AllToLua_cBlockArea_GetOriginX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOriginX'", NULL); +#endif + { + int tolua_ret = (int) self->GetOriginX(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetOriginX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetOriginY of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetOriginY00 +static int tolua_AllToLua_cBlockArea_GetOriginY00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOriginY'", NULL); +#endif + { + int tolua_ret = (int) self->GetOriginY(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetOriginY'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetOriginZ of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetOriginZ00 +static int tolua_AllToLua_cBlockArea_GetOriginZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetOriginZ'", NULL); +#endif + { + int tolua_ret = (int) self->GetOriginZ(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetOriginZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetDataTypes of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_GetDataTypes00 +static int tolua_AllToLua_cBlockArea_GetDataTypes00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetDataTypes'", NULL); +#endif + { + int tolua_ret = (int) self->GetDataTypes(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetDataTypes'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HasBlockTypes of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_HasBlockTypes00 +static int tolua_AllToLua_cBlockArea_HasBlockTypes00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasBlockTypes'", NULL); +#endif + { + bool tolua_ret = (bool) self->HasBlockTypes(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HasBlockTypes'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HasBlockMetas of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_HasBlockMetas00 +static int tolua_AllToLua_cBlockArea_HasBlockMetas00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasBlockMetas'", NULL); +#endif + { + bool tolua_ret = (bool) self->HasBlockMetas(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HasBlockMetas'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HasBlockLights of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_HasBlockLights00 +static int tolua_AllToLua_cBlockArea_HasBlockLights00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasBlockLights'", NULL); +#endif + { + bool tolua_ret = (bool) self->HasBlockLights(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HasBlockLights'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: HasBlockSkyLights of class cBlockArea */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cBlockArea_HasBlockSkyLights00 +static int tolua_AllToLua_cBlockArea_HasBlockSkyLights00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cBlockArea",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cBlockArea* self = (const cBlockArea*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'HasBlockSkyLights'", NULL); +#endif + { + bool tolua_ret = (bool) self->HasBlockSkyLights(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'HasBlockSkyLights'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetChunkX of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetChunkX00 +static int tolua_AllToLua_cChunkDesc_GetChunkX00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetChunkX'", NULL); +#endif + { + int tolua_ret = (int) self->GetChunkX(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetChunkX'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetChunkZ of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetChunkZ00 +static int tolua_AllToLua_cChunkDesc_GetChunkZ00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetChunkZ'", NULL); +#endif + { + int tolua_ret = (int) self->GetChunkZ(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetChunkZ'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FillBlocks of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FillBlocks00 +static int tolua_AllToLua_cChunkDesc_FillBlocks00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,2,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FillBlocks'", NULL); +#endif + { + self->FillBlocks(a_BlockType,a_BlockMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'FillBlocks'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBlockTypeMeta of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetBlockTypeMeta00 +static int tolua_AllToLua_cChunkDesc_SetBlockTypeMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockTypeMeta'", NULL); +#endif + { + self->SetBlockTypeMeta(a_RelX,a_RelY,a_RelZ,a_BlockType,a_BlockMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetBlockTypeMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockTypeMeta of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBlockTypeMeta00 +static int tolua_AllToLua_cChunkDesc_GetBlockTypeMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockTypeMeta'", NULL); +#endif + { + self->GetBlockTypeMeta(a_RelX,a_RelY,a_RelZ,a_BlockType,a_BlockMeta); + tolua_pushnumber(tolua_S,(lua_Number)a_BlockType); + tolua_pushnumber(tolua_S,(lua_Number)a_BlockMeta); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockTypeMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBlockType of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetBlockType00 +static int tolua_AllToLua_cChunkDesc_SetBlockType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockType'", NULL); +#endif + { + self->SetBlockType(a_RelX,a_RelY,a_RelZ,a_BlockType); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetBlockType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockType of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBlockType00 +static int tolua_AllToLua_cChunkDesc_GetBlockType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockType'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlockType(a_RelX,a_RelY,a_RelZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBlockMeta of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetBlockMeta00 +static int tolua_AllToLua_cChunkDesc_SetBlockMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,5,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBlockMeta'", NULL); +#endif + { + self->SetBlockMeta(a_RelX,a_RelY,a_RelZ,a_BlockMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetBlockMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockMeta of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBlockMeta00 +static int tolua_AllToLua_cChunkDesc_GetBlockMeta00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockMeta'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetBlockMeta(a_RelX,a_RelY,a_RelZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockMeta'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetBiome of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetBiome00 +static int tolua_AllToLua_cChunkDesc_SetBiome00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,3,0)); + int a_BiomeID = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetBiome'", NULL); +#endif + { + self->SetBiome(a_RelX,a_RelZ,a_BiomeID); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetBiome'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBiome of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBiome00 +static int tolua_AllToLua_cChunkDesc_GetBiome00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBiome'", NULL); +#endif + { + EMCSBiome tolua_ret = (EMCSBiome) self->GetBiome(a_RelX,a_RelZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBiome'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetHeight of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetHeight00 +static int tolua_AllToLua_cChunkDesc_SetHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,3,0)); + int a_Height = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetHeight'", NULL); +#endif + { + self->SetHeight(a_RelX,a_RelZ,a_Height); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetHeight of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetHeight00 +static int tolua_AllToLua_cChunkDesc_GetHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeight'", NULL); +#endif + { + int tolua_ret = (int) self->GetHeight(a_RelX,a_RelZ); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetUseDefaultBiomes of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultBiomes00 +static int tolua_AllToLua_cChunkDesc_SetUseDefaultBiomes00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + bool a_bUseDefaultBiomes = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultBiomes'", NULL); +#endif + { + self->SetUseDefaultBiomes(a_bUseDefaultBiomes); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetUseDefaultBiomes'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsUsingDefaultBiomes of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultBiomes00 +static int tolua_AllToLua_cChunkDesc_IsUsingDefaultBiomes00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultBiomes'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsUsingDefaultBiomes(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultBiomes'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetUseDefaultHeight of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultHeight00 +static int tolua_AllToLua_cChunkDesc_SetUseDefaultHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + bool a_bUseDefaultHeight = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultHeight'", NULL); +#endif + { + self->SetUseDefaultHeight(a_bUseDefaultHeight); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetUseDefaultHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsUsingDefaultHeight of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultHeight00 +static int tolua_AllToLua_cChunkDesc_IsUsingDefaultHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultHeight'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsUsingDefaultHeight(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetUseDefaultComposition of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultComposition00 +static int tolua_AllToLua_cChunkDesc_SetUseDefaultComposition00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + bool a_bUseDefaultComposition = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultComposition'", NULL); +#endif + { + self->SetUseDefaultComposition(a_bUseDefaultComposition); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetUseDefaultComposition'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsUsingDefaultComposition of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultComposition00 +static int tolua_AllToLua_cChunkDesc_IsUsingDefaultComposition00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultComposition'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsUsingDefaultComposition(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultComposition'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetUseDefaultStructures of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultStructures00 +static int tolua_AllToLua_cChunkDesc_SetUseDefaultStructures00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + bool a_bUseDefaultStructures = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultStructures'", NULL); +#endif + { + self->SetUseDefaultStructures(a_bUseDefaultStructures); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetUseDefaultStructures'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsUsingDefaultStructures of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultStructures00 +static int tolua_AllToLua_cChunkDesc_IsUsingDefaultStructures00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultStructures'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsUsingDefaultStructures(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultStructures'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetUseDefaultFinish of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_SetUseDefaultFinish00 +static int tolua_AllToLua_cChunkDesc_SetUseDefaultFinish00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isboolean(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + bool a_bUseDefaultFinish = ((bool) tolua_toboolean(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetUseDefaultFinish'", NULL); +#endif + { + self->SetUseDefaultFinish(a_bUseDefaultFinish); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetUseDefaultFinish'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsUsingDefaultFinish of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_IsUsingDefaultFinish00 +static int tolua_AllToLua_cChunkDesc_IsUsingDefaultFinish00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsUsingDefaultFinish'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsUsingDefaultFinish(); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsUsingDefaultFinish'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: WriteBlockArea of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_WriteBlockArea00 +static int tolua_AllToLua_cChunkDesc_WriteBlockArea00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cBlockArea",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,1,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + const cBlockArea* a_BlockArea = ((const cBlockArea*) tolua_tousertype(tolua_S,2,0)); + int a_RelX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,5,0)); + cBlockArea::eMergeStrategy a_MergeStrategy = ((cBlockArea::eMergeStrategy) (int) tolua_tonumber(tolua_S,6,cBlockArea::msOverwrite)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'WriteBlockArea'", NULL); +#endif + { + self->WriteBlockArea(*a_BlockArea,a_RelX,a_RelY,a_RelZ,a_MergeStrategy); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'WriteBlockArea'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ReadBlockArea of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_ReadBlockArea00 +static int tolua_AllToLua_cChunkDesc_ReadBlockArea00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cBlockArea",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnumber(tolua_S,8,0,&tolua_err) || + !tolua_isnoobj(tolua_S,9,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + cBlockArea* a_Dest = ((cBlockArea*) tolua_tousertype(tolua_S,2,0)); + int a_MinRelX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_MaxRelX = ((int) tolua_tonumber(tolua_S,4,0)); + int a_MinRelY = ((int) tolua_tonumber(tolua_S,5,0)); + int a_MaxRelY = ((int) tolua_tonumber(tolua_S,6,0)); + int a_MinRelZ = ((int) tolua_tonumber(tolua_S,7,0)); + int a_MaxRelZ = ((int) tolua_tonumber(tolua_S,8,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ReadBlockArea'", NULL); +#endif + { + self->ReadBlockArea(*a_Dest,a_MinRelX,a_MaxRelX,a_MinRelY,a_MaxRelY,a_MinRelZ,a_MaxRelZ); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ReadBlockArea'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMaxHeight of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetMaxHeight00 +static int tolua_AllToLua_cChunkDesc_GetMaxHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cChunkDesc",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cChunkDesc* self = (const cChunkDesc*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMaxHeight'", NULL); +#endif + { + unsigned char tolua_ret = ( unsigned char) self->GetMaxHeight(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMaxHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FillRelCuboid of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FillRelCuboid00 +static int tolua_AllToLua_cChunkDesc_FillRelCuboid00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnumber(tolua_S,8,0,&tolua_err) || + !tolua_isnumber(tolua_S,9,0,&tolua_err) || + !tolua_isnoobj(tolua_S,10,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_MinX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_MaxX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_MinY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_MaxY = ((int) tolua_tonumber(tolua_S,5,0)); + int a_MinZ = ((int) tolua_tonumber(tolua_S,6,0)); + int a_MaxZ = ((int) tolua_tonumber(tolua_S,7,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,8,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,9,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FillRelCuboid'", NULL); +#endif + { + self->FillRelCuboid(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ,a_BlockType,a_BlockMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'FillRelCuboid'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FillRelCuboid of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FillRelCuboid01 +static int tolua_AllToLua_cChunkDesc_FillRelCuboid01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + const cCuboid* a_RelCuboid = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,3,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FillRelCuboid'", NULL); +#endif + { + self->FillRelCuboid(*a_RelCuboid,a_BlockType,a_BlockMeta); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cChunkDesc_FillRelCuboid00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ReplaceRelCuboid of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_ReplaceRelCuboid00 +static int tolua_AllToLua_cChunkDesc_ReplaceRelCuboid00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnumber(tolua_S,8,0,&tolua_err) || + !tolua_isnumber(tolua_S,9,0,&tolua_err) || + !tolua_isnumber(tolua_S,10,0,&tolua_err) || + !tolua_isnumber(tolua_S,11,0,&tolua_err) || + !tolua_isnoobj(tolua_S,12,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_MinX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_MaxX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_MinY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_MaxY = ((int) tolua_tonumber(tolua_S,5,0)); + int a_MinZ = ((int) tolua_tonumber(tolua_S,6,0)); + int a_MaxZ = ((int) tolua_tonumber(tolua_S,7,0)); + unsigned char a_SrcType = (( unsigned char) tolua_tonumber(tolua_S,8,0)); + unsigned char a_SrcMeta = (( unsigned char) tolua_tonumber(tolua_S,9,0)); + unsigned char a_DstType = (( unsigned char) tolua_tonumber(tolua_S,10,0)); + unsigned char a_DstMeta = (( unsigned char) tolua_tonumber(tolua_S,11,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ReplaceRelCuboid'", NULL); +#endif + { + self->ReplaceRelCuboid(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ,a_SrcType,a_SrcMeta,a_DstType,a_DstMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ReplaceRelCuboid'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ReplaceRelCuboid of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_ReplaceRelCuboid01 +static int tolua_AllToLua_cChunkDesc_ReplaceRelCuboid01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + const cCuboid* a_RelCuboid = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); + unsigned char a_SrcType = (( unsigned char) tolua_tonumber(tolua_S,3,0)); + unsigned char a_SrcMeta = (( unsigned char) tolua_tonumber(tolua_S,4,0)); + unsigned char a_DstType = (( unsigned char) tolua_tonumber(tolua_S,5,0)); + unsigned char a_DstMeta = (( unsigned char) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ReplaceRelCuboid'", NULL); +#endif + { + self->ReplaceRelCuboid(*a_RelCuboid,a_SrcType,a_SrcMeta,a_DstType,a_DstMeta); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cChunkDesc_ReplaceRelCuboid00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FloorRelCuboid of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FloorRelCuboid00 +static int tolua_AllToLua_cChunkDesc_FloorRelCuboid00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnumber(tolua_S,8,0,&tolua_err) || + !tolua_isnumber(tolua_S,9,0,&tolua_err) || + !tolua_isnoobj(tolua_S,10,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_MinX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_MaxX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_MinY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_MaxY = ((int) tolua_tonumber(tolua_S,5,0)); + int a_MinZ = ((int) tolua_tonumber(tolua_S,6,0)); + int a_MaxZ = ((int) tolua_tonumber(tolua_S,7,0)); + unsigned char a_DstType = (( unsigned char) tolua_tonumber(tolua_S,8,0)); + unsigned char a_DstMeta = (( unsigned char) tolua_tonumber(tolua_S,9,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FloorRelCuboid'", NULL); +#endif + { + self->FloorRelCuboid(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ,a_DstType,a_DstMeta); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'FloorRelCuboid'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FloorRelCuboid of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_FloorRelCuboid01 +static int tolua_AllToLua_cChunkDesc_FloorRelCuboid01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + const cCuboid* a_RelCuboid = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); + unsigned char a_DstType = (( unsigned char) tolua_tonumber(tolua_S,3,0)); + unsigned char a_DstMeta = (( unsigned char) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'FloorRelCuboid'", NULL); +#endif + { + self->FloorRelCuboid(*a_RelCuboid,a_DstType,a_DstMeta); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cChunkDesc_FloorRelCuboid00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: RandomFillRelCuboid of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_RandomFillRelCuboid00 +static int tolua_AllToLua_cChunkDesc_RandomFillRelCuboid00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnumber(tolua_S,7,0,&tolua_err) || + !tolua_isnumber(tolua_S,8,0,&tolua_err) || + !tolua_isnumber(tolua_S,9,0,&tolua_err) || + !tolua_isnumber(tolua_S,10,0,&tolua_err) || + !tolua_isnumber(tolua_S,11,0,&tolua_err) || + !tolua_isnoobj(tolua_S,12,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_MinX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_MaxX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_MinY = ((int) tolua_tonumber(tolua_S,4,0)); + int a_MaxY = ((int) tolua_tonumber(tolua_S,5,0)); + int a_MinZ = ((int) tolua_tonumber(tolua_S,6,0)); + int a_MaxZ = ((int) tolua_tonumber(tolua_S,7,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,8,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,9,0)); + int a_RandomSeed = ((int) tolua_tonumber(tolua_S,10,0)); + int a_ChanceOutOf10k = ((int) tolua_tonumber(tolua_S,11,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RandomFillRelCuboid'", NULL); +#endif + { + self->RandomFillRelCuboid(a_MinX,a_MaxX,a_MinY,a_MaxY,a_MinZ,a_MaxZ,a_BlockType,a_BlockMeta,a_RandomSeed,a_ChanceOutOf10k); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'RandomFillRelCuboid'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: RandomFillRelCuboid of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_RandomFillRelCuboid01 +static int tolua_AllToLua_cChunkDesc_RandomFillRelCuboid01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCuboid",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + const cCuboid* a_RelCuboid = ((const cCuboid*) tolua_tousertype(tolua_S,2,0)); + unsigned char a_BlockType = (( unsigned char) tolua_tonumber(tolua_S,3,0)); + unsigned char a_BlockMeta = (( unsigned char) tolua_tonumber(tolua_S,4,0)); + int a_RandomSeed = ((int) tolua_tonumber(tolua_S,5,0)); + int a_ChanceOutOf10k = ((int) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'RandomFillRelCuboid'", NULL); +#endif + { + self->RandomFillRelCuboid(*a_RelCuboid,a_BlockType,a_BlockMeta,a_RandomSeed,a_ChanceOutOf10k); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cChunkDesc_RandomFillRelCuboid00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetBlockEntity of class cChunkDesc */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cChunkDesc_GetBlockEntity00 +static int tolua_AllToLua_cChunkDesc_GetBlockEntity00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cChunkDesc",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cChunkDesc* self = (cChunkDesc*) tolua_tousertype(tolua_S,1,0); + int a_RelX = ((int) tolua_tonumber(tolua_S,2,0)); + int a_RelY = ((int) tolua_tonumber(tolua_S,3,0)); + int a_RelZ = ((int) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetBlockEntity'", NULL); +#endif + { + cBlockEntity* tolua_ret = (cBlockEntity*) self->GetBlockEntity(a_RelX,a_RelY,a_RelZ); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cBlockEntity"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetBlockEntity'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cCraftingGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_new00 +static int tolua_AllToLua_cCraftingGrid_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cCraftingGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + int a_Width = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Height = ((int) tolua_tonumber(tolua_S,3,0)); + { + cCraftingGrid* tolua_ret = (cCraftingGrid*) Mtolua_new((cCraftingGrid)(a_Width,a_Height)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCraftingGrid"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cCraftingGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_new00_local +static int tolua_AllToLua_cCraftingGrid_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cCraftingGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + int a_Width = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Height = ((int) tolua_tonumber(tolua_S,3,0)); + { + cCraftingGrid* tolua_ret = (cCraftingGrid*) Mtolua_new((cCraftingGrid)(a_Width,a_Height)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cCraftingGrid"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWidth of class cCraftingGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_GetWidth00 +static int tolua_AllToLua_cCraftingGrid_GetWidth00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCraftingGrid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCraftingGrid* self = (const cCraftingGrid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWidth'", NULL); +#endif + { + int tolua_ret = (int) self->GetWidth(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWidth'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetHeight of class cCraftingGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_GetHeight00 +static int tolua_AllToLua_cCraftingGrid_GetHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCraftingGrid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCraftingGrid* self = (const cCraftingGrid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetHeight'", NULL); +#endif + { + int tolua_ret = (int) self->GetHeight(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetItem of class cCraftingGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_GetItem00 +static int tolua_AllToLua_cCraftingGrid_GetItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCraftingGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCraftingGrid* self = (const cCraftingGrid*) tolua_tousertype(tolua_S,1,0); + int x = ((int) tolua_tonumber(tolua_S,2,0)); + int y = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetItem'", NULL); +#endif + { + cItem& tolua_ret = (cItem&) self->GetItem(x,y); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetItem of class cCraftingGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_SetItem00 +static int tolua_AllToLua_cCraftingGrid_SetItem00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCraftingGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0); + int x = ((int) tolua_tonumber(tolua_S,2,0)); + int y = ((int) tolua_tonumber(tolua_S,3,0)); + ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,4,0)); + int a_ItemCount = ((int) tolua_tonumber(tolua_S,5,0)); + short a_ItemHealth = ((short) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetItem'", NULL); +#endif + { + self->SetItem(x,y,a_ItemType,a_ItemCount,a_ItemHealth); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetItem'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetItem of class cCraftingGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_SetItem01 +static int tolua_AllToLua_cCraftingGrid_SetItem01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCraftingGrid",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0); + int x = ((int) tolua_tonumber(tolua_S,2,0)); + int y = ((int) tolua_tonumber(tolua_S,3,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetItem'", NULL); +#endif + { + self->SetItem(x,y,*a_Item); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cCraftingGrid_SetItem00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Clear of class cCraftingGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_Clear00 +static int tolua_AllToLua_cCraftingGrid_Clear00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCraftingGrid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); +#endif + { + self->Clear(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ConsumeGrid of class cCraftingGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_ConsumeGrid00 +static int tolua_AllToLua_cCraftingGrid_ConsumeGrid00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCraftingGrid",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cCraftingGrid",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0); + const cCraftingGrid* a_Grid = ((const cCraftingGrid*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ConsumeGrid'", NULL); +#endif + { + self->ConsumeGrid(*a_Grid); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ConsumeGrid'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Dump of class cCraftingGrid */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingGrid_Dump00 +static int tolua_AllToLua_cCraftingGrid_Dump00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCraftingGrid",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cCraftingGrid* self = (cCraftingGrid*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Dump'", NULL); +#endif + { + self->Dump(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Dump'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Clear of class cCraftingRecipe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_Clear00 +static int tolua_AllToLua_cCraftingRecipe_Clear00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Clear'", NULL); +#endif + { + self->Clear(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Clear'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetIngredientsWidth of class cCraftingRecipe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_GetIngredientsWidth00 +static int tolua_AllToLua_cCraftingRecipe_GetIngredientsWidth00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCraftingRecipe",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCraftingRecipe* self = (const cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetIngredientsWidth'", NULL); +#endif + { + int tolua_ret = (int) self->GetIngredientsWidth(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetIngredientsWidth'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetIngredientsHeight of class cCraftingRecipe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_GetIngredientsHeight00 +static int tolua_AllToLua_cCraftingRecipe_GetIngredientsHeight00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCraftingRecipe",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCraftingRecipe* self = (const cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetIngredientsHeight'", NULL); +#endif + { + int tolua_ret = (int) self->GetIngredientsHeight(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetIngredientsHeight'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetIngredient of class cCraftingRecipe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_GetIngredient00 +static int tolua_AllToLua_cCraftingRecipe_GetIngredient00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCraftingRecipe",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCraftingRecipe* self = (const cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); + int x = ((int) tolua_tonumber(tolua_S,2,0)); + int y = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetIngredient'", NULL); +#endif + { + cItem& tolua_ret = (cItem&) self->GetIngredient(x,y); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetIngredient'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetResult of class cCraftingRecipe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_GetResult00 +static int tolua_AllToLua_cCraftingRecipe_GetResult00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cCraftingRecipe",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cCraftingRecipe* self = (const cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetResult'", NULL); +#endif + { + const cItem& tolua_ret = (const cItem&) self->GetResult(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetResult'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetResult of class cCraftingRecipe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_SetResult00 +static int tolua_AllToLua_cCraftingRecipe_SetResult00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); + ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,2,0)); + int a_ItemCount = ((int) tolua_tonumber(tolua_S,3,0)); + short a_ItemHealth = ((short) tolua_tonumber(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetResult'", NULL); +#endif + { + self->SetResult(a_ItemType,a_ItemCount,a_ItemHealth); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetResult'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetResult of class cCraftingRecipe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_SetResult01 +static int tolua_AllToLua_cCraftingRecipe_SetResult01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else + { + cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetResult'", NULL); +#endif + { + self->SetResult(*a_Item); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cCraftingRecipe_SetResult00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetIngredient of class cCraftingRecipe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_SetIngredient00 +static int tolua_AllToLua_cCraftingRecipe_SetIngredient00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_isnumber(tolua_S,5,0,&tolua_err) || + !tolua_isnumber(tolua_S,6,0,&tolua_err) || + !tolua_isnoobj(tolua_S,7,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); + int x = ((int) tolua_tonumber(tolua_S,2,0)); + int y = ((int) tolua_tonumber(tolua_S,3,0)); + ENUM_ITEM_ID a_ItemType = ((ENUM_ITEM_ID) (int) tolua_tonumber(tolua_S,4,0)); + int a_ItemCount = ((int) tolua_tonumber(tolua_S,5,0)); + short a_ItemHealth = ((short) tolua_tonumber(tolua_S,6,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetIngredient'", NULL); +#endif + { + self->SetIngredient(x,y,a_ItemType,a_ItemCount,a_ItemHealth); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetIngredient'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetIngredient of class cCraftingRecipe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_SetIngredient01 +static int tolua_AllToLua_cCraftingRecipe_SetIngredient01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); + int x = ((int) tolua_tonumber(tolua_S,2,0)); + int y = ((int) tolua_tonumber(tolua_S,3,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetIngredient'", NULL); +#endif + { + self->SetIngredient(x,y,*a_Item); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cCraftingRecipe_SetIngredient00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: ConsumeIngredients of class cCraftingRecipe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_ConsumeIngredients00 +static int tolua_AllToLua_cCraftingRecipe_ConsumeIngredients00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cCraftingGrid",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); + cCraftingGrid* a_CraftingGrid = ((cCraftingGrid*) tolua_tousertype(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'ConsumeIngredients'", NULL); +#endif + { + self->ConsumeIngredients(*a_CraftingGrid); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'ConsumeIngredients'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: Dump of class cCraftingRecipe */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cCraftingRecipe_Dump00 +static int tolua_AllToLua_cCraftingRecipe_Dump00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cCraftingRecipe",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cCraftingRecipe* self = (cCraftingRecipe*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'Dump'", NULL); +#endif + { + self->Dump(); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'Dump'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWindowID of class cWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_GetWindowID00 +static int tolua_AllToLua_cWindow_GetWindowID00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWindowID'", NULL); +#endif + { + char tolua_ret = (char) self->GetWindowID(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWindowID'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWindowType of class cWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_GetWindowType00 +static int tolua_AllToLua_cWindow_GetWindowType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWindowType'", NULL); +#endif + { + int tolua_ret = (int) self->GetWindowType(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWindowType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSlot of class cWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_GetSlot00 +static int tolua_AllToLua_cWindow_GetSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); + cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0)); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetSlot'", NULL); +#endif + { + const cItem* tolua_ret = (const cItem*) self->GetSlot(*a_Player,a_SlotNum); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"const cItem"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetSlot of class cWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_SetSlot00 +static int tolua_AllToLua_cWindow_SetSlot00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWindow",0,&tolua_err) || + (tolua_isvaluenil(tolua_S,2,&tolua_err) || !tolua_isusertype(tolua_S,2,"cPlayer",0,&tolua_err)) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"const cItem",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWindow* self = (cWindow*) tolua_tousertype(tolua_S,1,0); + cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,2,0)); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,3,0)); + const cItem* a_Item = ((const cItem*) tolua_tousertype(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetSlot'", NULL); +#endif + { + self->SetSlot(*a_Player,a_SlotNum,*a_Item); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetSlot'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsSlotInPlayerMainInventory of class cWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_IsSlotInPlayerMainInventory00 +static int tolua_AllToLua_cWindow_IsSlotInPlayerMainInventory00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSlotInPlayerMainInventory'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsSlotInPlayerMainInventory(a_SlotNum); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsSlotInPlayerMainInventory'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsSlotInPlayerHotbar of class cWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_IsSlotInPlayerHotbar00 +static int tolua_AllToLua_cWindow_IsSlotInPlayerHotbar00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSlotInPlayerHotbar'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsSlotInPlayerHotbar(a_SlotNum); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsSlotInPlayerHotbar'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: IsSlotInPlayerInventory of class cWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_IsSlotInPlayerInventory00 +static int tolua_AllToLua_cWindow_IsSlotInPlayerInventory00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); + int a_SlotNum = ((int) tolua_tonumber(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'IsSlotInPlayerInventory'", NULL); +#endif + { + bool tolua_ret = (bool) self->IsSlotInPlayerInventory(a_SlotNum); + tolua_pushboolean(tolua_S,(bool)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'IsSlotInPlayerInventory'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetWindowTitle of class cWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_GetWindowTitle00 +static int tolua_AllToLua_cWindow_GetWindowTitle00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cWindow",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cWindow* self = (const cWindow*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetWindowTitle'", NULL); +#endif + { + const AString tolua_ret = (const AString) self->GetWindowTitle(); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetWindowTitle'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetWindowTitle of class cWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_SetWindowTitle00 +static int tolua_AllToLua_cWindow_SetWindowTitle00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWindow",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWindow* self = (cWindow*) tolua_tousertype(tolua_S,1,0); + const AString a_WindowTitle = ((const AString) tolua_tocppstring(tolua_S,2,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetWindowTitle'", NULL); +#endif + { + self->SetWindowTitle(a_WindowTitle); + tolua_pushcppstring(tolua_S,(const char*)a_WindowTitle); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetWindowTitle'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetProperty of class cWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_SetProperty00 +static int tolua_AllToLua_cWindow_SetProperty00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWindow",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnoobj(tolua_S,4,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWindow* self = (cWindow*) tolua_tousertype(tolua_S,1,0); + int a_Property = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Value = ((int) tolua_tonumber(tolua_S,3,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetProperty'", NULL); +#endif + { + self->SetProperty(a_Property,a_Value); + } + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'SetProperty'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: SetProperty of class cWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cWindow_SetProperty01 +static int tolua_AllToLua_cWindow_SetProperty01(lua_State* tolua_S) +{ + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cWindow",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + (tolua_isvaluenil(tolua_S,4,&tolua_err) || !tolua_isusertype(tolua_S,4,"cPlayer",0,&tolua_err)) || + !tolua_isnoobj(tolua_S,5,&tolua_err) + ) + goto tolua_lerror; + else + { + cWindow* self = (cWindow*) tolua_tousertype(tolua_S,1,0); + int a_Property = ((int) tolua_tonumber(tolua_S,2,0)); + int a_Value = ((int) tolua_tonumber(tolua_S,3,0)); + cPlayer* a_Player = ((cPlayer*) tolua_tousertype(tolua_S,4,0)); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'SetProperty'", NULL); +#endif + { + self->SetProperty(a_Property,a_Value,*a_Player); + } + } + return 0; +tolua_lerror: + return tolua_AllToLua_cWindow_SetProperty00(tolua_S); +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new of class cLuaWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaWindow_new00 +static int tolua_AllToLua_cLuaWindow_new00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cLuaWindow",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_iscppstring(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWindow::WindowType a_WindowType = ((cWindow::WindowType) (int) tolua_tonumber(tolua_S,2,0)); + int a_SlotsX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_SlotsY = ((int) tolua_tonumber(tolua_S,4,0)); + const AString a_Title = ((const AString) tolua_tocppstring(tolua_S,5,0)); + { + cLuaWindow* tolua_ret = (cLuaWindow*) Mtolua_new((cLuaWindow)(a_WindowType,a_SlotsX,a_SlotsY,a_Title)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cLuaWindow"); + tolua_pushcppstring(tolua_S,(const char*)a_Title); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: new_local of class cLuaWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaWindow_new00_local +static int tolua_AllToLua_cLuaWindow_new00_local(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cLuaWindow",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnumber(tolua_S,3,0,&tolua_err) || + !tolua_isnumber(tolua_S,4,0,&tolua_err) || + !tolua_iscppstring(tolua_S,5,0,&tolua_err) || + !tolua_isnoobj(tolua_S,6,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cWindow::WindowType a_WindowType = ((cWindow::WindowType) (int) tolua_tonumber(tolua_S,2,0)); + int a_SlotsX = ((int) tolua_tonumber(tolua_S,3,0)); + int a_SlotsY = ((int) tolua_tonumber(tolua_S,4,0)); + const AString a_Title = ((const AString) tolua_tocppstring(tolua_S,5,0)); + { + cLuaWindow* tolua_ret = (cLuaWindow*) Mtolua_new((cLuaWindow)(a_WindowType,a_SlotsX,a_SlotsY,a_Title)); + tolua_pushusertype(tolua_S,(void*)tolua_ret,"cLuaWindow"); + tolua_register_gc(tolua_S,lua_gettop(tolua_S)); + tolua_pushcppstring(tolua_S,(const char*)a_Title); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'new'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: delete of class cLuaWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaWindow_delete00 +static int tolua_AllToLua_cLuaWindow_delete00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaWindow",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cLuaWindow* self = (cLuaWindow*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'delete'", NULL); +#endif + Mtolua_delete(self); + } + return 0; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'delete'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetContents of class cLuaWindow */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cLuaWindow_GetContents00 +static int tolua_AllToLua_cLuaWindow_GetContents00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"cLuaWindow",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cLuaWindow* self = (cLuaWindow*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetContents'", NULL); +#endif + { + cItemGrid& tolua_ret = (cItemGrid&) self->GetContents(); + tolua_pushusertype(tolua_S,(void*)&tolua_ret,"cItemGrid"); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetContents'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMobType of class cMonster */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cMonster_GetMobType00 +static int tolua_AllToLua_cMonster_GetMobType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cMonster",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cMonster* self = (const cMonster*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMobType'", NULL); +#endif + { + cMonster::eType tolua_ret = (cMonster::eType) self->GetMobType(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMobType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetMobFamily of class cMonster */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cMonster_GetMobFamily00 +static int tolua_AllToLua_cMonster_GetMobFamily00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertype(tolua_S,1,"const cMonster",0,&tolua_err) || + !tolua_isnoobj(tolua_S,2,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const cMonster* self = (const cMonster*) tolua_tousertype(tolua_S,1,0); +#ifndef TOLUA_RELEASE + if (!self) tolua_error(tolua_S,"invalid 'self' in function 'GetMobFamily'", NULL); +#endif + { + cMonster::eFamily tolua_ret = (cMonster::eFamily) self->GetMobFamily(); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetMobFamily'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: MobTypeToString of class cMonster */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cMonster_MobTypeToString00 +static int tolua_AllToLua_cMonster_MobTypeToString00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cMonster",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cMonster::eType a_MobType = ((cMonster::eType) (int) tolua_tonumber(tolua_S,2,0)); + { + AString tolua_ret = (AString) cMonster::MobTypeToString(a_MobType); + tolua_pushcppstring(tolua_S,(const char*)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'MobTypeToString'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: StringToMobType of class cMonster */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cMonster_StringToMobType00 +static int tolua_AllToLua_cMonster_StringToMobType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cMonster",0,&tolua_err) || + !tolua_iscppstring(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + const AString a_MobTypeName = ((const AString) tolua_tocppstring(tolua_S,2,0)); + { + cMonster::eType tolua_ret = (cMonster::eType) cMonster::StringToMobType(a_MobTypeName); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + tolua_pushcppstring(tolua_S,(const char*)a_MobTypeName); + } + } + return 2; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'StringToMobType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: FamilyFromType of class cMonster */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cMonster_FamilyFromType00 +static int tolua_AllToLua_cMonster_FamilyFromType00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cMonster",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cMonster::eType a_MobType = ((cMonster::eType) (int) tolua_tonumber(tolua_S,2,0)); + { + cMonster::eFamily tolua_ret = (cMonster::eFamily) cMonster::FamilyFromType(a_MobType); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'FamilyFromType'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* method: GetSpawnDelay of class cMonster */ +#ifndef TOLUA_DISABLE_tolua_AllToLua_cMonster_GetSpawnDelay00 +static int tolua_AllToLua_cMonster_GetSpawnDelay00(lua_State* tolua_S) +{ +#ifndef TOLUA_RELEASE + tolua_Error tolua_err; + if ( + !tolua_isusertable(tolua_S,1,"cMonster",0,&tolua_err) || + !tolua_isnumber(tolua_S,2,0,&tolua_err) || + !tolua_isnoobj(tolua_S,3,&tolua_err) + ) + goto tolua_lerror; + else +#endif + { + cMonster::eFamily a_MobFamily = ((cMonster::eFamily) (int) tolua_tonumber(tolua_S,2,0)); + { + int tolua_ret = (int) cMonster::GetSpawnDelay(a_MobFamily); + tolua_pushnumber(tolua_S,(lua_Number)tolua_ret); + } + } + return 1; +#ifndef TOLUA_RELEASE + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'GetSpawnDelay'.",&tolua_err); + return 0; +#endif +} +#endif //#ifndef TOLUA_DISABLE + +/* Open function */ +TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S) +{ + tolua_open(tolua_S); + tolua_reg_types(tolua_S); + tolua_module(tolua_S,NULL,1); + tolua_beginmodule(tolua_S,NULL); + tolua_constant(tolua_S,"biOcean",biOcean); + tolua_constant(tolua_S,"biPlains",biPlains); + tolua_constant(tolua_S,"biDesert",biDesert); + tolua_constant(tolua_S,"biExtremeHills",biExtremeHills); + tolua_constant(tolua_S,"biForest",biForest); + tolua_constant(tolua_S,"biTaiga",biTaiga); + tolua_constant(tolua_S,"biSwampland",biSwampland); + tolua_constant(tolua_S,"biRiver",biRiver); + tolua_constant(tolua_S,"biHell",biHell); + tolua_constant(tolua_S,"biNether",biNether); + tolua_constant(tolua_S,"biSky",biSky); + tolua_constant(tolua_S,"biEnd",biEnd); + tolua_constant(tolua_S,"biFrozenOcean",biFrozenOcean); + tolua_constant(tolua_S,"biFrozenRiver",biFrozenRiver); + tolua_constant(tolua_S,"biIcePlains",biIcePlains); + tolua_constant(tolua_S,"biTundra",biTundra); + tolua_constant(tolua_S,"biIceMountains",biIceMountains); + tolua_constant(tolua_S,"biMushroomIsland",biMushroomIsland); + tolua_constant(tolua_S,"biMushroomShore",biMushroomShore); + tolua_constant(tolua_S,"biBeach",biBeach); + tolua_constant(tolua_S,"biDesertHills",biDesertHills); + tolua_constant(tolua_S,"biForestHills",biForestHills); + tolua_constant(tolua_S,"biTaigaHills",biTaigaHills); + tolua_constant(tolua_S,"biExtremeHillsEdge",biExtremeHillsEdge); + tolua_constant(tolua_S,"biJungle",biJungle); + tolua_constant(tolua_S,"biJungleHills",biJungleHills); + tolua_constant(tolua_S,"biJungleEdge",biJungleEdge); + tolua_constant(tolua_S,"biDeepOcean",biDeepOcean); + tolua_constant(tolua_S,"biStoneBeach",biStoneBeach); + tolua_constant(tolua_S,"biColdBeach",biColdBeach); + tolua_constant(tolua_S,"biBirchForest",biBirchForest); + tolua_constant(tolua_S,"biBirchForestHills",biBirchForestHills); + tolua_constant(tolua_S,"biRoofedForest",biRoofedForest); + tolua_constant(tolua_S,"biColdTaiga",biColdTaiga); + tolua_constant(tolua_S,"biColdTaigaHills",biColdTaigaHills); + tolua_constant(tolua_S,"biMegaTaiga",biMegaTaiga); + tolua_constant(tolua_S,"biMegaTaigaHills",biMegaTaigaHills); + tolua_constant(tolua_S,"biExtremeHillsPlus",biExtremeHillsPlus); + tolua_constant(tolua_S,"biSavanna",biSavanna); + tolua_constant(tolua_S,"biSavannaPlateau",biSavannaPlateau); + tolua_constant(tolua_S,"biMesa",biMesa); + tolua_constant(tolua_S,"biMesaPlateauF",biMesaPlateauF); + tolua_constant(tolua_S,"biMesaPlateau",biMesaPlateau); + tolua_constant(tolua_S,"biNumBiomes",biNumBiomes); + tolua_constant(tolua_S,"biMaxBiome",biMaxBiome); + tolua_constant(tolua_S,"biVariant",biVariant); + tolua_constant(tolua_S,"biSunflowerPlains",biSunflowerPlains); + tolua_constant(tolua_S,"biDesertM",biDesertM); + tolua_constant(tolua_S,"biExtremeHillsM",biExtremeHillsM); + tolua_constant(tolua_S,"biFlowerForest",biFlowerForest); + tolua_constant(tolua_S,"biTaigaM",biTaigaM); + tolua_constant(tolua_S,"biSwamplandM",biSwamplandM); + tolua_constant(tolua_S,"biIcePlainsSpikes",biIcePlainsSpikes); + tolua_constant(tolua_S,"biJungleM",biJungleM); + tolua_constant(tolua_S,"biJungleEdgeM",biJungleEdgeM); + tolua_constant(tolua_S,"biBirchForestM",biBirchForestM); + tolua_constant(tolua_S,"biBirchForestHillsM",biBirchForestHillsM); + tolua_constant(tolua_S,"biRoofedForestM",biRoofedForestM); + tolua_constant(tolua_S,"biColdTaigaM",biColdTaigaM); + tolua_constant(tolua_S,"biMegaSpruceTaiga",biMegaSpruceTaiga); + tolua_constant(tolua_S,"biMegaSpruceTaigaHills",biMegaSpruceTaigaHills); + tolua_constant(tolua_S,"biExtremeHillsPlusM",biExtremeHillsPlusM); + tolua_constant(tolua_S,"biSavannaM",biSavannaM); + tolua_constant(tolua_S,"biSavannaPlateauM",biSavannaPlateauM); + tolua_constant(tolua_S,"biMesaBryce",biMesaBryce); + tolua_constant(tolua_S,"biMesaPlateauFM",biMesaPlateauFM); + tolua_constant(tolua_S,"biMesaPlateauM",biMesaPlateauM); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cIniFile","cIniFile","",tolua_collect_cIniFile); + #else + tolua_cclass(tolua_S,"cIniFile","cIniFile","",NULL); + #endif + tolua_beginmodule(tolua_S,"cIniFile"); + tolua_constant(tolua_S,"noID",cIniFile::noID); + tolua_function(tolua_S,"new",tolua_AllToLua_cIniFile_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cIniFile_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cIniFile_new00_local); + tolua_function(tolua_S,"CaseSensitive",tolua_AllToLua_cIniFile_CaseSensitive00); + tolua_function(tolua_S,"CaseInsensitive",tolua_AllToLua_cIniFile_CaseInsensitive00); + tolua_function(tolua_S,"ReadFile",tolua_AllToLua_cIniFile_ReadFile00); + tolua_function(tolua_S,"WriteFile",tolua_AllToLua_cIniFile_WriteFile00); + tolua_function(tolua_S,"Clear",tolua_AllToLua_cIniFile_Clear00); + tolua_function(tolua_S,"FindKey",tolua_AllToLua_cIniFile_FindKey00); + tolua_function(tolua_S,"FindValue",tolua_AllToLua_cIniFile_FindValue00); + tolua_function(tolua_S,"GetNumKeys",tolua_AllToLua_cIniFile_GetNumKeys00); + tolua_function(tolua_S,"AddKeyName",tolua_AllToLua_cIniFile_AddKeyName00); + tolua_function(tolua_S,"GetKeyName",tolua_AllToLua_cIniFile_GetKeyName00); + tolua_function(tolua_S,"GetNumValues",tolua_AllToLua_cIniFile_GetNumValues00); + tolua_function(tolua_S,"GetNumValues",tolua_AllToLua_cIniFile_GetNumValues01); + tolua_function(tolua_S,"GetValueName",tolua_AllToLua_cIniFile_GetValueName00); + tolua_function(tolua_S,"GetValueName",tolua_AllToLua_cIniFile_GetValueName01); + tolua_function(tolua_S,"GetValue",tolua_AllToLua_cIniFile_GetValue00); + tolua_function(tolua_S,"GetValue",tolua_AllToLua_cIniFile_GetValue01); + tolua_function(tolua_S,"GetValue",tolua_AllToLua_cIniFile_GetValue02); + tolua_function(tolua_S,"GetValue",tolua_AllToLua_cIniFile_GetValue03); + tolua_function(tolua_S,"GetValueF",tolua_AllToLua_cIniFile_GetValueF00); + tolua_function(tolua_S,"GetValueI",tolua_AllToLua_cIniFile_GetValueI00); + tolua_function(tolua_S,"GetValueB",tolua_AllToLua_cIniFile_GetValueB00); + tolua_function(tolua_S,"GetValueSet",tolua_AllToLua_cIniFile_GetValueSet00); + tolua_function(tolua_S,"GetValueSet",tolua_AllToLua_cIniFile_GetValueSet01); + tolua_function(tolua_S,"GetValueSetF",tolua_AllToLua_cIniFile_GetValueSetF00); + tolua_function(tolua_S,"GetValueSetI",tolua_AllToLua_cIniFile_GetValueSetI00); + tolua_function(tolua_S,"GetValueSetB",tolua_AllToLua_cIniFile_GetValueSetB00); + tolua_function(tolua_S,"SetValue",tolua_AllToLua_cIniFile_SetValue00); + tolua_function(tolua_S,"SetValue",tolua_AllToLua_cIniFile_SetValue01); + tolua_function(tolua_S,"SetValueI",tolua_AllToLua_cIniFile_SetValueI00); + tolua_function(tolua_S,"SetValueB",tolua_AllToLua_cIniFile_SetValueB00); + tolua_function(tolua_S,"SetValueF",tolua_AllToLua_cIniFile_SetValueF00); + tolua_function(tolua_S,"DeleteValueByID",tolua_AllToLua_cIniFile_DeleteValueByID00); + tolua_function(tolua_S,"DeleteValue",tolua_AllToLua_cIniFile_DeleteValue00); + tolua_function(tolua_S,"DeleteKey",tolua_AllToLua_cIniFile_DeleteKey00); + tolua_function(tolua_S,"GetNumHeaderComments",tolua_AllToLua_cIniFile_GetNumHeaderComments00); + tolua_function(tolua_S,"AddHeaderComment",tolua_AllToLua_cIniFile_AddHeaderComment00); + tolua_function(tolua_S,"GetHeaderComment",tolua_AllToLua_cIniFile_GetHeaderComment00); + tolua_function(tolua_S,"DeleteHeaderComment",tolua_AllToLua_cIniFile_DeleteHeaderComment00); + tolua_function(tolua_S,"DeleteHeaderComments",tolua_AllToLua_cIniFile_DeleteHeaderComments00); + tolua_function(tolua_S,"GetNumKeyComments",tolua_AllToLua_cIniFile_GetNumKeyComments00); + tolua_function(tolua_S,"GetNumKeyComments",tolua_AllToLua_cIniFile_GetNumKeyComments01); + tolua_function(tolua_S,"AddKeyComment",tolua_AllToLua_cIniFile_AddKeyComment00); + tolua_function(tolua_S,"AddKeyComment",tolua_AllToLua_cIniFile_AddKeyComment01); + tolua_function(tolua_S,"GetKeyComment",tolua_AllToLua_cIniFile_GetKeyComment00); + tolua_function(tolua_S,"GetKeyComment",tolua_AllToLua_cIniFile_GetKeyComment01); + tolua_function(tolua_S,"DeleteKeyComment",tolua_AllToLua_cIniFile_DeleteKeyComment00); + tolua_function(tolua_S,"DeleteKeyComment",tolua_AllToLua_cIniFile_DeleteKeyComment01); + tolua_function(tolua_S,"DeleteKeyComments",tolua_AllToLua_cIniFile_DeleteKeyComments00); + tolua_function(tolua_S,"DeleteKeyComments",tolua_AllToLua_cIniFile_DeleteKeyComments01); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cFile","cFile","",NULL); + tolua_beginmodule(tolua_S,"cFile"); + tolua_function(tolua_S,"Exists",tolua_AllToLua_cFile_Exists00); + tolua_function(tolua_S,"Delete",tolua_AllToLua_cFile_Delete00); + tolua_function(tolua_S,"Rename",tolua_AllToLua_cFile_Rename00); + tolua_function(tolua_S,"Copy",tolua_AllToLua_cFile_Copy00); + tolua_function(tolua_S,"IsFolder",tolua_AllToLua_cFile_IsFolder00); + tolua_function(tolua_S,"IsFile",tolua_AllToLua_cFile_IsFile00); + tolua_function(tolua_S,"GetSize",tolua_AllToLua_cFile_GetSize00); + tolua_function(tolua_S,"CreateFolder",tolua_AllToLua_cFile_CreateFolder00); + tolua_function(tolua_S,"ReadWholeFile",tolua_AllToLua_cFile_ReadWholeFile00); + tolua_endmodule(tolua_S); + tolua_constant(tolua_S,"E_BLOCK_AIR",E_BLOCK_AIR); + tolua_constant(tolua_S,"E_BLOCK_STONE",E_BLOCK_STONE); + tolua_constant(tolua_S,"E_BLOCK_GRASS",E_BLOCK_GRASS); + tolua_constant(tolua_S,"E_BLOCK_DIRT",E_BLOCK_DIRT); + tolua_constant(tolua_S,"E_BLOCK_COBBLESTONE",E_BLOCK_COBBLESTONE); + tolua_constant(tolua_S,"E_BLOCK_PLANKS",E_BLOCK_PLANKS); + tolua_constant(tolua_S,"E_BLOCK_SAPLING",E_BLOCK_SAPLING); + tolua_constant(tolua_S,"E_BLOCK_BEDROCK",E_BLOCK_BEDROCK); + tolua_constant(tolua_S,"E_BLOCK_WATER",E_BLOCK_WATER); + tolua_constant(tolua_S,"E_BLOCK_STATIONARY_WATER",E_BLOCK_STATIONARY_WATER); + tolua_constant(tolua_S,"E_BLOCK_LAVA",E_BLOCK_LAVA); + tolua_constant(tolua_S,"E_BLOCK_STATIONARY_LAVA",E_BLOCK_STATIONARY_LAVA); + tolua_constant(tolua_S,"E_BLOCK_SAND",E_BLOCK_SAND); + tolua_constant(tolua_S,"E_BLOCK_GRAVEL",E_BLOCK_GRAVEL); + tolua_constant(tolua_S,"E_BLOCK_GOLD_ORE",E_BLOCK_GOLD_ORE); + tolua_constant(tolua_S,"E_BLOCK_IRON_ORE",E_BLOCK_IRON_ORE); + tolua_constant(tolua_S,"E_BLOCK_COAL_ORE",E_BLOCK_COAL_ORE); + tolua_constant(tolua_S,"E_BLOCK_LOG",E_BLOCK_LOG); + tolua_constant(tolua_S,"E_BLOCK_LEAVES",E_BLOCK_LEAVES); + tolua_constant(tolua_S,"E_BLOCK_SPONGE",E_BLOCK_SPONGE); + tolua_constant(tolua_S,"E_BLOCK_GLASS",E_BLOCK_GLASS); + tolua_constant(tolua_S,"E_BLOCK_LAPIS_ORE",E_BLOCK_LAPIS_ORE); + tolua_constant(tolua_S,"E_BLOCK_LAPIS_BLOCK",E_BLOCK_LAPIS_BLOCK); + tolua_constant(tolua_S,"E_BLOCK_DISPENSER",E_BLOCK_DISPENSER); + tolua_constant(tolua_S,"E_BLOCK_SANDSTONE",E_BLOCK_SANDSTONE); + tolua_constant(tolua_S,"E_BLOCK_NOTE_BLOCK",E_BLOCK_NOTE_BLOCK); + tolua_constant(tolua_S,"E_BLOCK_BED",E_BLOCK_BED); + tolua_constant(tolua_S,"E_BLOCK_POWERED_RAIL",E_BLOCK_POWERED_RAIL); + tolua_constant(tolua_S,"E_BLOCK_DETECTOR_RAIL",E_BLOCK_DETECTOR_RAIL); + tolua_constant(tolua_S,"E_BLOCK_STICKY_PISTON",E_BLOCK_STICKY_PISTON); + tolua_constant(tolua_S,"E_BLOCK_COBWEB",E_BLOCK_COBWEB); + tolua_constant(tolua_S,"E_BLOCK_TALL_GRASS",E_BLOCK_TALL_GRASS); + tolua_constant(tolua_S,"E_BLOCK_DEAD_BUSH",E_BLOCK_DEAD_BUSH); + tolua_constant(tolua_S,"E_BLOCK_PISTON",E_BLOCK_PISTON); + tolua_constant(tolua_S,"E_BLOCK_PISTON_EXTENSION",E_BLOCK_PISTON_EXTENSION); + tolua_constant(tolua_S,"E_BLOCK_WOOL",E_BLOCK_WOOL); + tolua_constant(tolua_S,"E_BLOCK_PISTON_MOVED_BLOCK",E_BLOCK_PISTON_MOVED_BLOCK); + tolua_constant(tolua_S,"E_BLOCK_DANDELION",E_BLOCK_DANDELION); + tolua_constant(tolua_S,"E_BLOCK_FLOWER",E_BLOCK_FLOWER); + tolua_constant(tolua_S,"E_BLOCK_BROWN_MUSHROOM",E_BLOCK_BROWN_MUSHROOM); + tolua_constant(tolua_S,"E_BLOCK_RED_MUSHROOM",E_BLOCK_RED_MUSHROOM); + tolua_constant(tolua_S,"E_BLOCK_GOLD_BLOCK",E_BLOCK_GOLD_BLOCK); + tolua_constant(tolua_S,"E_BLOCK_IRON_BLOCK",E_BLOCK_IRON_BLOCK); + tolua_constant(tolua_S,"E_BLOCK_DOUBLE_STONE_SLAB",E_BLOCK_DOUBLE_STONE_SLAB); + tolua_constant(tolua_S,"E_BLOCK_STONE_SLAB",E_BLOCK_STONE_SLAB); + tolua_constant(tolua_S,"E_BLOCK_BRICK",E_BLOCK_BRICK); + tolua_constant(tolua_S,"E_BLOCK_TNT",E_BLOCK_TNT); + tolua_constant(tolua_S,"E_BLOCK_BOOKCASE",E_BLOCK_BOOKCASE); + tolua_constant(tolua_S,"E_BLOCK_MOSSY_COBBLESTONE",E_BLOCK_MOSSY_COBBLESTONE); + tolua_constant(tolua_S,"E_BLOCK_OBSIDIAN",E_BLOCK_OBSIDIAN); + tolua_constant(tolua_S,"E_BLOCK_TORCH",E_BLOCK_TORCH); + tolua_constant(tolua_S,"E_BLOCK_FIRE",E_BLOCK_FIRE); + tolua_constant(tolua_S,"E_BLOCK_MOB_SPAWNER",E_BLOCK_MOB_SPAWNER); + tolua_constant(tolua_S,"E_BLOCK_WOODEN_STAIRS",E_BLOCK_WOODEN_STAIRS); + tolua_constant(tolua_S,"E_BLOCK_CHEST",E_BLOCK_CHEST); + tolua_constant(tolua_S,"E_BLOCK_REDSTONE_WIRE",E_BLOCK_REDSTONE_WIRE); + tolua_constant(tolua_S,"E_BLOCK_DIAMOND_ORE",E_BLOCK_DIAMOND_ORE); + tolua_constant(tolua_S,"E_BLOCK_DIAMOND_BLOCK",E_BLOCK_DIAMOND_BLOCK); + tolua_constant(tolua_S,"E_BLOCK_CRAFTING_TABLE",E_BLOCK_CRAFTING_TABLE); + tolua_constant(tolua_S,"E_BLOCK_WORKBENCH",E_BLOCK_WORKBENCH); + tolua_constant(tolua_S,"E_BLOCK_CROPS",E_BLOCK_CROPS); + tolua_constant(tolua_S,"E_BLOCK_FARMLAND",E_BLOCK_FARMLAND); + tolua_constant(tolua_S,"E_BLOCK_FURNACE",E_BLOCK_FURNACE); + tolua_constant(tolua_S,"E_BLOCK_LIT_FURNACE",E_BLOCK_LIT_FURNACE); + tolua_constant(tolua_S,"E_BLOCK_BURNING_FURNACE",E_BLOCK_BURNING_FURNACE); + tolua_constant(tolua_S,"E_BLOCK_SIGN_POST",E_BLOCK_SIGN_POST); + tolua_constant(tolua_S,"E_BLOCK_WOODEN_DOOR",E_BLOCK_WOODEN_DOOR); + tolua_constant(tolua_S,"E_BLOCK_LADDER",E_BLOCK_LADDER); + tolua_constant(tolua_S,"E_BLOCK_RAIL",E_BLOCK_RAIL); + tolua_constant(tolua_S,"E_BLOCK_MINECART_TRACKS",E_BLOCK_MINECART_TRACKS); + tolua_constant(tolua_S,"E_BLOCK_COBBLESTONE_STAIRS",E_BLOCK_COBBLESTONE_STAIRS); + tolua_constant(tolua_S,"E_BLOCK_WALLSIGN",E_BLOCK_WALLSIGN); + tolua_constant(tolua_S,"E_BLOCK_LEVER",E_BLOCK_LEVER); + tolua_constant(tolua_S,"E_BLOCK_STONE_PRESSURE_PLATE",E_BLOCK_STONE_PRESSURE_PLATE); + tolua_constant(tolua_S,"E_BLOCK_IRON_DOOR",E_BLOCK_IRON_DOOR); + tolua_constant(tolua_S,"E_BLOCK_WOODEN_PRESSURE_PLATE",E_BLOCK_WOODEN_PRESSURE_PLATE); + tolua_constant(tolua_S,"E_BLOCK_REDSTONE_ORE",E_BLOCK_REDSTONE_ORE); + tolua_constant(tolua_S,"E_BLOCK_REDSTONE_ORE_GLOWING",E_BLOCK_REDSTONE_ORE_GLOWING); + tolua_constant(tolua_S,"E_BLOCK_REDSTONE_TORCH_OFF",E_BLOCK_REDSTONE_TORCH_OFF); + tolua_constant(tolua_S,"E_BLOCK_REDSTONE_TORCH_ON",E_BLOCK_REDSTONE_TORCH_ON); + tolua_constant(tolua_S,"E_BLOCK_STONE_BUTTON",E_BLOCK_STONE_BUTTON); + tolua_constant(tolua_S,"E_BLOCK_SNOW",E_BLOCK_SNOW); + tolua_constant(tolua_S,"E_BLOCK_ICE",E_BLOCK_ICE); + tolua_constant(tolua_S,"E_BLOCK_SNOW_BLOCK",E_BLOCK_SNOW_BLOCK); + tolua_constant(tolua_S,"E_BLOCK_CACTUS",E_BLOCK_CACTUS); + tolua_constant(tolua_S,"E_BLOCK_CLAY",E_BLOCK_CLAY); + tolua_constant(tolua_S,"E_BLOCK_SUGARCANE",E_BLOCK_SUGARCANE); + tolua_constant(tolua_S,"E_BLOCK_REEDS",E_BLOCK_REEDS); + tolua_constant(tolua_S,"E_BLOCK_JUKEBOX",E_BLOCK_JUKEBOX); + tolua_constant(tolua_S,"E_BLOCK_FENCE",E_BLOCK_FENCE); + tolua_constant(tolua_S,"E_BLOCK_PUMPKIN",E_BLOCK_PUMPKIN); + tolua_constant(tolua_S,"E_BLOCK_NETHERRACK",E_BLOCK_NETHERRACK); + tolua_constant(tolua_S,"E_BLOCK_SOULSAND",E_BLOCK_SOULSAND); + tolua_constant(tolua_S,"E_BLOCK_GLOWSTONE",E_BLOCK_GLOWSTONE); + tolua_constant(tolua_S,"E_BLOCK_NETHER_PORTAL",E_BLOCK_NETHER_PORTAL); + tolua_constant(tolua_S,"E_BLOCK_JACK_O_LANTERN",E_BLOCK_JACK_O_LANTERN); + tolua_constant(tolua_S,"E_BLOCK_CAKE",E_BLOCK_CAKE); + tolua_constant(tolua_S,"E_BLOCK_REDSTONE_REPEATER_OFF",E_BLOCK_REDSTONE_REPEATER_OFF); + tolua_constant(tolua_S,"E_BLOCK_REDSTONE_REPEATER_ON",E_BLOCK_REDSTONE_REPEATER_ON); + tolua_constant(tolua_S,"E_BLOCK_STAINED_GLASS",E_BLOCK_STAINED_GLASS); + tolua_constant(tolua_S,"E_BLOCK_TRAPDOOR",E_BLOCK_TRAPDOOR); + tolua_constant(tolua_S,"E_BLOCK_SILVERFISH_EGG",E_BLOCK_SILVERFISH_EGG); + tolua_constant(tolua_S,"E_BLOCK_STONE_BRICKS",E_BLOCK_STONE_BRICKS); + tolua_constant(tolua_S,"E_BLOCK_HUGE_BROWN_MUSHROOM",E_BLOCK_HUGE_BROWN_MUSHROOM); + tolua_constant(tolua_S,"E_BLOCK_HUGE_RED_MUSHROOM",E_BLOCK_HUGE_RED_MUSHROOM); + tolua_constant(tolua_S,"E_BLOCK_IRON_BARS",E_BLOCK_IRON_BARS); + tolua_constant(tolua_S,"E_BLOCK_GLASS_PANE",E_BLOCK_GLASS_PANE); + tolua_constant(tolua_S,"E_BLOCK_MELON",E_BLOCK_MELON); + tolua_constant(tolua_S,"E_BLOCK_PUMPKIN_STEM",E_BLOCK_PUMPKIN_STEM); + tolua_constant(tolua_S,"E_BLOCK_MELON_STEM",E_BLOCK_MELON_STEM); + tolua_constant(tolua_S,"E_BLOCK_VINES",E_BLOCK_VINES); + tolua_constant(tolua_S,"E_BLOCK_FENCE_GATE",E_BLOCK_FENCE_GATE); + tolua_constant(tolua_S,"E_BLOCK_BRICK_STAIRS",E_BLOCK_BRICK_STAIRS); + tolua_constant(tolua_S,"E_BLOCK_STONE_BRICK_STAIRS",E_BLOCK_STONE_BRICK_STAIRS); + tolua_constant(tolua_S,"E_BLOCK_MYCELIUM",E_BLOCK_MYCELIUM); + tolua_constant(tolua_S,"E_BLOCK_LILY_PAD",E_BLOCK_LILY_PAD); + tolua_constant(tolua_S,"E_BLOCK_NETHER_BRICK",E_BLOCK_NETHER_BRICK); + tolua_constant(tolua_S,"E_BLOCK_NETHER_BRICK_FENCE",E_BLOCK_NETHER_BRICK_FENCE); + tolua_constant(tolua_S,"E_BLOCK_NETHER_BRICK_STAIRS",E_BLOCK_NETHER_BRICK_STAIRS); + tolua_constant(tolua_S,"E_BLOCK_NETHER_WART",E_BLOCK_NETHER_WART); + tolua_constant(tolua_S,"E_BLOCK_ENCHANTMENT_TABLE",E_BLOCK_ENCHANTMENT_TABLE); + tolua_constant(tolua_S,"E_BLOCK_BREWING_STAND",E_BLOCK_BREWING_STAND); + tolua_constant(tolua_S,"E_BLOCK_CAULDRON",E_BLOCK_CAULDRON); + tolua_constant(tolua_S,"E_BLOCK_END_PORTAL",E_BLOCK_END_PORTAL); + tolua_constant(tolua_S,"E_BLOCK_END_PORTAL_FRAME",E_BLOCK_END_PORTAL_FRAME); + tolua_constant(tolua_S,"E_BLOCK_END_STONE",E_BLOCK_END_STONE); + tolua_constant(tolua_S,"E_BLOCK_DRAGON_EGG",E_BLOCK_DRAGON_EGG); + tolua_constant(tolua_S,"E_BLOCK_REDSTONE_LAMP_OFF",E_BLOCK_REDSTONE_LAMP_OFF); + tolua_constant(tolua_S,"E_BLOCK_REDSTONE_LAMP_ON",E_BLOCK_REDSTONE_LAMP_ON); + tolua_constant(tolua_S,"E_BLOCK_DOUBLE_WOODEN_SLAB",E_BLOCK_DOUBLE_WOODEN_SLAB); + tolua_constant(tolua_S,"E_BLOCK_WOODEN_SLAB",E_BLOCK_WOODEN_SLAB); + tolua_constant(tolua_S,"E_BLOCK_COCOA_POD",E_BLOCK_COCOA_POD); + tolua_constant(tolua_S,"E_BLOCK_SANDSTONE_STAIRS",E_BLOCK_SANDSTONE_STAIRS); + tolua_constant(tolua_S,"E_BLOCK_EMERALD_ORE",E_BLOCK_EMERALD_ORE); + tolua_constant(tolua_S,"E_BLOCK_ENDER_CHEST",E_BLOCK_ENDER_CHEST); + tolua_constant(tolua_S,"E_BLOCK_TRIPWIRE_HOOK",E_BLOCK_TRIPWIRE_HOOK); + tolua_constant(tolua_S,"E_BLOCK_TRIPWIRE",E_BLOCK_TRIPWIRE); + tolua_constant(tolua_S,"E_BLOCK_EMERALD_BLOCK",E_BLOCK_EMERALD_BLOCK); + tolua_constant(tolua_S,"E_BLOCK_SPRUCE_WOOD_STAIRS",E_BLOCK_SPRUCE_WOOD_STAIRS); + tolua_constant(tolua_S,"E_BLOCK_BIRCH_WOOD_STAIRS",E_BLOCK_BIRCH_WOOD_STAIRS); + tolua_constant(tolua_S,"E_BLOCK_JUNGLE_WOOD_STAIRS",E_BLOCK_JUNGLE_WOOD_STAIRS); + tolua_constant(tolua_S,"E_BLOCK_COMMAND_BLOCK",E_BLOCK_COMMAND_BLOCK); + tolua_constant(tolua_S,"E_BLOCK_BEACON",E_BLOCK_BEACON); + tolua_constant(tolua_S,"E_BLOCK_COBBLESTONE_WALL",E_BLOCK_COBBLESTONE_WALL); + tolua_constant(tolua_S,"E_BLOCK_FLOWER_POT",E_BLOCK_FLOWER_POT); + tolua_constant(tolua_S,"E_BLOCK_CARROTS",E_BLOCK_CARROTS); + tolua_constant(tolua_S,"E_BLOCK_POTATOES",E_BLOCK_POTATOES); + tolua_constant(tolua_S,"E_BLOCK_WOODEN_BUTTON",E_BLOCK_WOODEN_BUTTON); + tolua_constant(tolua_S,"E_BLOCK_HEAD",E_BLOCK_HEAD); + tolua_constant(tolua_S,"E_BLOCK_ANVIL",E_BLOCK_ANVIL); + tolua_constant(tolua_S,"E_BLOCK_TRAPPED_CHEST",E_BLOCK_TRAPPED_CHEST); + tolua_constant(tolua_S,"E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE",E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE); + tolua_constant(tolua_S,"E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE",E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE); + tolua_constant(tolua_S,"E_BLOCK_INACTIVE_COMPARATOR",E_BLOCK_INACTIVE_COMPARATOR); + tolua_constant(tolua_S,"E_BLOCK_ACTIVE_COMPARATOR",E_BLOCK_ACTIVE_COMPARATOR); + tolua_constant(tolua_S,"E_BLOCK_DAYLIGHT_SENSOR",E_BLOCK_DAYLIGHT_SENSOR); + tolua_constant(tolua_S,"E_BLOCK_BLOCK_OF_REDSTONE",E_BLOCK_BLOCK_OF_REDSTONE); + tolua_constant(tolua_S,"E_BLOCK_NETHER_QUARTZ_ORE",E_BLOCK_NETHER_QUARTZ_ORE); + tolua_constant(tolua_S,"E_BLOCK_HOPPER",E_BLOCK_HOPPER); + tolua_constant(tolua_S,"E_BLOCK_QUARTZ_BLOCK",E_BLOCK_QUARTZ_BLOCK); + tolua_constant(tolua_S,"E_BLOCK_QUARTZ_STAIRS",E_BLOCK_QUARTZ_STAIRS); + tolua_constant(tolua_S,"E_BLOCK_ACTIVATOR_RAIL",E_BLOCK_ACTIVATOR_RAIL); + tolua_constant(tolua_S,"E_BLOCK_DROPPER",E_BLOCK_DROPPER); + tolua_constant(tolua_S,"E_BLOCK_STAINED_CLAY",E_BLOCK_STAINED_CLAY); + tolua_constant(tolua_S,"E_BLOCK_STAINED_GLASS_PANE",E_BLOCK_STAINED_GLASS_PANE); + tolua_constant(tolua_S,"E_BLOCK_NEW_LEAVES",E_BLOCK_NEW_LEAVES); + tolua_constant(tolua_S,"E_BLOCK_NEW_LOG",E_BLOCK_NEW_LOG); + tolua_constant(tolua_S,"E_BLOCK_ACACIA_WOOD_STAIRS",E_BLOCK_ACACIA_WOOD_STAIRS); + tolua_constant(tolua_S,"E_BLOCK_DARK_OAK_WOOD_STAIRS",E_BLOCK_DARK_OAK_WOOD_STAIRS); + tolua_constant(tolua_S,"E_BLOCK_HAY_BALE",E_BLOCK_HAY_BALE); + tolua_constant(tolua_S,"E_BLOCK_CARPET",E_BLOCK_CARPET); + tolua_constant(tolua_S,"E_BLOCK_HARDENED_CLAY",E_BLOCK_HARDENED_CLAY); + tolua_constant(tolua_S,"E_BLOCK_BLOCK_OF_COAL",E_BLOCK_BLOCK_OF_COAL); + tolua_constant(tolua_S,"E_BLOCK_PACKED_ICE",E_BLOCK_PACKED_ICE); + tolua_constant(tolua_S,"E_BLOCK_BIG_FLOWER",E_BLOCK_BIG_FLOWER); + tolua_constant(tolua_S,"E_BLOCK_NUMBER_OF_TYPES",E_BLOCK_NUMBER_OF_TYPES); + tolua_constant(tolua_S,"E_BLOCK_MAX_TYPE_ID",E_BLOCK_MAX_TYPE_ID); + tolua_constant(tolua_S,"E_BLOCK_YELLOW_FLOWER",E_BLOCK_YELLOW_FLOWER); + tolua_constant(tolua_S,"E_BLOCK_RED_ROSE",E_BLOCK_RED_ROSE); + tolua_constant(tolua_S,"E_BLOCK_LOCKED_CHEST",E_BLOCK_LOCKED_CHEST); + tolua_constant(tolua_S,"E_ITEM_EMPTY",E_ITEM_EMPTY); + tolua_constant(tolua_S,"E_ITEM_FIRST",E_ITEM_FIRST); + tolua_constant(tolua_S,"E_ITEM_IRON_SHOVEL",E_ITEM_IRON_SHOVEL); + tolua_constant(tolua_S,"E_ITEM_IRON_PICKAXE",E_ITEM_IRON_PICKAXE); + tolua_constant(tolua_S,"E_ITEM_IRON_AXE",E_ITEM_IRON_AXE); + tolua_constant(tolua_S,"E_ITEM_FLINT_AND_STEEL",E_ITEM_FLINT_AND_STEEL); + tolua_constant(tolua_S,"E_ITEM_RED_APPLE",E_ITEM_RED_APPLE); + tolua_constant(tolua_S,"E_ITEM_BOW",E_ITEM_BOW); + tolua_constant(tolua_S,"E_ITEM_ARROW",E_ITEM_ARROW); + tolua_constant(tolua_S,"E_ITEM_COAL",E_ITEM_COAL); + tolua_constant(tolua_S,"E_ITEM_DIAMOND",E_ITEM_DIAMOND); + tolua_constant(tolua_S,"E_ITEM_IRON",E_ITEM_IRON); + tolua_constant(tolua_S,"E_ITEM_GOLD",E_ITEM_GOLD); + tolua_constant(tolua_S,"E_ITEM_IRON_SWORD",E_ITEM_IRON_SWORD); + tolua_constant(tolua_S,"E_ITEM_WOODEN_SWORD",E_ITEM_WOODEN_SWORD); + tolua_constant(tolua_S,"E_ITEM_WOODEN_SHOVEL",E_ITEM_WOODEN_SHOVEL); + tolua_constant(tolua_S,"E_ITEM_WOODEN_PICKAXE",E_ITEM_WOODEN_PICKAXE); + tolua_constant(tolua_S,"E_ITEM_WOODEN_AXE",E_ITEM_WOODEN_AXE); + tolua_constant(tolua_S,"E_ITEM_STONE_SWORD",E_ITEM_STONE_SWORD); + tolua_constant(tolua_S,"E_ITEM_STONE_SHOVEL",E_ITEM_STONE_SHOVEL); + tolua_constant(tolua_S,"E_ITEM_STONE_PICKAXE",E_ITEM_STONE_PICKAXE); + tolua_constant(tolua_S,"E_ITEM_STONE_AXE",E_ITEM_STONE_AXE); + tolua_constant(tolua_S,"E_ITEM_DIAMOND_SWORD",E_ITEM_DIAMOND_SWORD); + tolua_constant(tolua_S,"E_ITEM_DIAMOND_SHOVEL",E_ITEM_DIAMOND_SHOVEL); + tolua_constant(tolua_S,"E_ITEM_DIAMOND_PICKAXE",E_ITEM_DIAMOND_PICKAXE); + tolua_constant(tolua_S,"E_ITEM_DIAMOND_AXE",E_ITEM_DIAMOND_AXE); + tolua_constant(tolua_S,"E_ITEM_STICK",E_ITEM_STICK); + tolua_constant(tolua_S,"E_ITEM_BOWL",E_ITEM_BOWL); + tolua_constant(tolua_S,"E_ITEM_MUSHROOM_SOUP",E_ITEM_MUSHROOM_SOUP); + tolua_constant(tolua_S,"E_ITEM_GOLD_SWORD",E_ITEM_GOLD_SWORD); + tolua_constant(tolua_S,"E_ITEM_GOLD_SHOVEL",E_ITEM_GOLD_SHOVEL); + tolua_constant(tolua_S,"E_ITEM_GOLD_PICKAXE",E_ITEM_GOLD_PICKAXE); + tolua_constant(tolua_S,"E_ITEM_GOLD_AXE",E_ITEM_GOLD_AXE); + tolua_constant(tolua_S,"E_ITEM_STRING",E_ITEM_STRING); + tolua_constant(tolua_S,"E_ITEM_FEATHER",E_ITEM_FEATHER); + tolua_constant(tolua_S,"E_ITEM_GUNPOWDER",E_ITEM_GUNPOWDER); + tolua_constant(tolua_S,"E_ITEM_WOODEN_HOE",E_ITEM_WOODEN_HOE); + tolua_constant(tolua_S,"E_ITEM_STONE_HOE",E_ITEM_STONE_HOE); + tolua_constant(tolua_S,"E_ITEM_IRON_HOE",E_ITEM_IRON_HOE); + tolua_constant(tolua_S,"E_ITEM_DIAMOND_HOE",E_ITEM_DIAMOND_HOE); + tolua_constant(tolua_S,"E_ITEM_GOLD_HOE",E_ITEM_GOLD_HOE); + tolua_constant(tolua_S,"E_ITEM_SEEDS",E_ITEM_SEEDS); + tolua_constant(tolua_S,"E_ITEM_WHEAT",E_ITEM_WHEAT); + tolua_constant(tolua_S,"E_ITEM_BREAD",E_ITEM_BREAD); + tolua_constant(tolua_S,"E_ITEM_LEATHER_CAP",E_ITEM_LEATHER_CAP); + tolua_constant(tolua_S,"E_ITEM_LEATHER_TUNIC",E_ITEM_LEATHER_TUNIC); + tolua_constant(tolua_S,"E_ITEM_LEATHER_PANTS",E_ITEM_LEATHER_PANTS); + tolua_constant(tolua_S,"E_ITEM_LEATHER_BOOTS",E_ITEM_LEATHER_BOOTS); + tolua_constant(tolua_S,"E_ITEM_CHAIN_HELMET",E_ITEM_CHAIN_HELMET); + tolua_constant(tolua_S,"E_ITEM_CHAIN_CHESTPLATE",E_ITEM_CHAIN_CHESTPLATE); + tolua_constant(tolua_S,"E_ITEM_CHAIN_LEGGINGS",E_ITEM_CHAIN_LEGGINGS); + tolua_constant(tolua_S,"E_ITEM_CHAIN_BOOTS",E_ITEM_CHAIN_BOOTS); + tolua_constant(tolua_S,"E_ITEM_IRON_HELMET",E_ITEM_IRON_HELMET); + tolua_constant(tolua_S,"E_ITEM_IRON_CHESTPLATE",E_ITEM_IRON_CHESTPLATE); + tolua_constant(tolua_S,"E_ITEM_IRON_LEGGINGS",E_ITEM_IRON_LEGGINGS); + tolua_constant(tolua_S,"E_ITEM_IRON_BOOTS",E_ITEM_IRON_BOOTS); + tolua_constant(tolua_S,"E_ITEM_DIAMOND_HELMET",E_ITEM_DIAMOND_HELMET); + tolua_constant(tolua_S,"E_ITEM_DIAMOND_CHESTPLATE",E_ITEM_DIAMOND_CHESTPLATE); + tolua_constant(tolua_S,"E_ITEM_DIAMOND_LEGGINGS",E_ITEM_DIAMOND_LEGGINGS); + tolua_constant(tolua_S,"E_ITEM_DIAMOND_BOOTS",E_ITEM_DIAMOND_BOOTS); + tolua_constant(tolua_S,"E_ITEM_GOLD_HELMET",E_ITEM_GOLD_HELMET); + tolua_constant(tolua_S,"E_ITEM_GOLD_CHESTPLATE",E_ITEM_GOLD_CHESTPLATE); + tolua_constant(tolua_S,"E_ITEM_GOLD_LEGGINGS",E_ITEM_GOLD_LEGGINGS); + tolua_constant(tolua_S,"E_ITEM_GOLD_BOOTS",E_ITEM_GOLD_BOOTS); + tolua_constant(tolua_S,"E_ITEM_FLINT",E_ITEM_FLINT); + tolua_constant(tolua_S,"E_ITEM_RAW_PORKCHOP",E_ITEM_RAW_PORKCHOP); + tolua_constant(tolua_S,"E_ITEM_COOKED_PORKCHOP",E_ITEM_COOKED_PORKCHOP); + tolua_constant(tolua_S,"E_ITEM_PAINTINGS",E_ITEM_PAINTINGS); + tolua_constant(tolua_S,"E_ITEM_GOLDEN_APPLE",E_ITEM_GOLDEN_APPLE); + tolua_constant(tolua_S,"E_ITEM_SIGN",E_ITEM_SIGN); + tolua_constant(tolua_S,"E_ITEM_WOODEN_DOOR",E_ITEM_WOODEN_DOOR); + tolua_constant(tolua_S,"E_ITEM_BUCKET",E_ITEM_BUCKET); + tolua_constant(tolua_S,"E_ITEM_WATER_BUCKET",E_ITEM_WATER_BUCKET); + tolua_constant(tolua_S,"E_ITEM_LAVA_BUCKET",E_ITEM_LAVA_BUCKET); + tolua_constant(tolua_S,"E_ITEM_MINECART",E_ITEM_MINECART); + tolua_constant(tolua_S,"E_ITEM_SADDLE",E_ITEM_SADDLE); + tolua_constant(tolua_S,"E_ITEM_IRON_DOOR",E_ITEM_IRON_DOOR); + tolua_constant(tolua_S,"E_ITEM_REDSTONE_DUST",E_ITEM_REDSTONE_DUST); + tolua_constant(tolua_S,"E_ITEM_SNOWBALL",E_ITEM_SNOWBALL); + tolua_constant(tolua_S,"E_ITEM_BOAT",E_ITEM_BOAT); + tolua_constant(tolua_S,"E_ITEM_LEATHER",E_ITEM_LEATHER); + tolua_constant(tolua_S,"E_ITEM_MILK",E_ITEM_MILK); + tolua_constant(tolua_S,"E_ITEM_CLAY_BRICK",E_ITEM_CLAY_BRICK); + tolua_constant(tolua_S,"E_ITEM_CLAY",E_ITEM_CLAY); + tolua_constant(tolua_S,"E_ITEM_SUGARCANE",E_ITEM_SUGARCANE); + tolua_constant(tolua_S,"E_ITEM_SUGAR_CANE",E_ITEM_SUGAR_CANE); + tolua_constant(tolua_S,"E_ITEM_PAPER",E_ITEM_PAPER); + tolua_constant(tolua_S,"E_ITEM_BOOK",E_ITEM_BOOK); + tolua_constant(tolua_S,"E_ITEM_SLIMEBALL",E_ITEM_SLIMEBALL); + tolua_constant(tolua_S,"E_ITEM_CHEST_MINECART",E_ITEM_CHEST_MINECART); + tolua_constant(tolua_S,"E_ITEM_FURNACE_MINECART",E_ITEM_FURNACE_MINECART); + tolua_constant(tolua_S,"E_ITEM_EGG",E_ITEM_EGG); + tolua_constant(tolua_S,"E_ITEM_COMPASS",E_ITEM_COMPASS); + tolua_constant(tolua_S,"E_ITEM_FISHING_ROD",E_ITEM_FISHING_ROD); + tolua_constant(tolua_S,"E_ITEM_CLOCK",E_ITEM_CLOCK); + tolua_constant(tolua_S,"E_ITEM_GLOWSTONE_DUST",E_ITEM_GLOWSTONE_DUST); + tolua_constant(tolua_S,"E_ITEM_RAW_FISH",E_ITEM_RAW_FISH); + tolua_constant(tolua_S,"E_ITEM_COOKED_FISH",E_ITEM_COOKED_FISH); + tolua_constant(tolua_S,"E_ITEM_DYE",E_ITEM_DYE); + tolua_constant(tolua_S,"E_ITEM_BONE",E_ITEM_BONE); + tolua_constant(tolua_S,"E_ITEM_SUGAR",E_ITEM_SUGAR); + tolua_constant(tolua_S,"E_ITEM_CAKE",E_ITEM_CAKE); + tolua_constant(tolua_S,"E_ITEM_BED",E_ITEM_BED); + tolua_constant(tolua_S,"E_ITEM_REDSTONE_REPEATER",E_ITEM_REDSTONE_REPEATER); + tolua_constant(tolua_S,"E_ITEM_COOKIE",E_ITEM_COOKIE); + tolua_constant(tolua_S,"E_ITEM_MAP",E_ITEM_MAP); + tolua_constant(tolua_S,"E_ITEM_SHEARS",E_ITEM_SHEARS); + tolua_constant(tolua_S,"E_ITEM_MELON_SLICE",E_ITEM_MELON_SLICE); + tolua_constant(tolua_S,"E_ITEM_PUMPKIN_SEEDS",E_ITEM_PUMPKIN_SEEDS); + tolua_constant(tolua_S,"E_ITEM_MELON_SEEDS",E_ITEM_MELON_SEEDS); + tolua_constant(tolua_S,"E_ITEM_RAW_BEEF",E_ITEM_RAW_BEEF); + tolua_constant(tolua_S,"E_ITEM_STEAK",E_ITEM_STEAK); + tolua_constant(tolua_S,"E_ITEM_RAW_CHICKEN",E_ITEM_RAW_CHICKEN); + tolua_constant(tolua_S,"E_ITEM_COOKED_CHICKEN",E_ITEM_COOKED_CHICKEN); + tolua_constant(tolua_S,"E_ITEM_ROTTEN_FLESH",E_ITEM_ROTTEN_FLESH); + tolua_constant(tolua_S,"E_ITEM_ENDER_PEARL",E_ITEM_ENDER_PEARL); + tolua_constant(tolua_S,"E_ITEM_BLAZE_ROD",E_ITEM_BLAZE_ROD); + tolua_constant(tolua_S,"E_ITEM_GHAST_TEAR",E_ITEM_GHAST_TEAR); + tolua_constant(tolua_S,"E_ITEM_GOLD_NUGGET",E_ITEM_GOLD_NUGGET); + tolua_constant(tolua_S,"E_ITEM_NETHER_WART",E_ITEM_NETHER_WART); + tolua_constant(tolua_S,"E_ITEM_POTIONS",E_ITEM_POTIONS); + tolua_constant(tolua_S,"E_ITEM_GLASS_BOTTLE",E_ITEM_GLASS_BOTTLE); + tolua_constant(tolua_S,"E_ITEM_SPIDER_EYE",E_ITEM_SPIDER_EYE); + tolua_constant(tolua_S,"E_ITEM_FERMENTED_SPIDER_EYE",E_ITEM_FERMENTED_SPIDER_EYE); + tolua_constant(tolua_S,"E_ITEM_BLAZE_POWDER",E_ITEM_BLAZE_POWDER); + tolua_constant(tolua_S,"E_ITEM_MAGMA_CREAM",E_ITEM_MAGMA_CREAM); + tolua_constant(tolua_S,"E_ITEM_BREWING_STAND",E_ITEM_BREWING_STAND); + tolua_constant(tolua_S,"E_ITEM_CAULDRON",E_ITEM_CAULDRON); + tolua_constant(tolua_S,"E_ITEM_EYE_OF_ENDER",E_ITEM_EYE_OF_ENDER); + tolua_constant(tolua_S,"E_ITEM_GLISTERING_MELON",E_ITEM_GLISTERING_MELON); + tolua_constant(tolua_S,"E_ITEM_SPAWN_EGG",E_ITEM_SPAWN_EGG); + tolua_constant(tolua_S,"E_ITEM_BOTTLE_O_ENCHANTING",E_ITEM_BOTTLE_O_ENCHANTING); + tolua_constant(tolua_S,"E_ITEM_FIRE_CHARGE",E_ITEM_FIRE_CHARGE); + tolua_constant(tolua_S,"E_ITEM_BOOK_AND_QUILL",E_ITEM_BOOK_AND_QUILL); + tolua_constant(tolua_S,"E_ITEM_WRITTEN_BOOK",E_ITEM_WRITTEN_BOOK); + tolua_constant(tolua_S,"E_ITEM_EMERALD",E_ITEM_EMERALD); + tolua_constant(tolua_S,"E_ITEM_ITEM_FRAME",E_ITEM_ITEM_FRAME); + tolua_constant(tolua_S,"E_ITEM_FLOWER_POT",E_ITEM_FLOWER_POT); + tolua_constant(tolua_S,"E_ITEM_CARROT",E_ITEM_CARROT); + tolua_constant(tolua_S,"E_ITEM_POTATO",E_ITEM_POTATO); + tolua_constant(tolua_S,"E_ITEM_BAKED_POTATO",E_ITEM_BAKED_POTATO); + tolua_constant(tolua_S,"E_ITEM_POISONOUS_POTATO",E_ITEM_POISONOUS_POTATO); + tolua_constant(tolua_S,"E_ITEM_EMPTY_MAP",E_ITEM_EMPTY_MAP); + tolua_constant(tolua_S,"E_ITEM_GOLDEN_CARROT",E_ITEM_GOLDEN_CARROT); + tolua_constant(tolua_S,"E_ITEM_HEAD",E_ITEM_HEAD); + tolua_constant(tolua_S,"E_ITEM_CARROT_ON_STICK",E_ITEM_CARROT_ON_STICK); + tolua_constant(tolua_S,"E_ITEM_NETHER_STAR",E_ITEM_NETHER_STAR); + tolua_constant(tolua_S,"E_ITEM_PUMPKIN_PIE",E_ITEM_PUMPKIN_PIE); + tolua_constant(tolua_S,"E_ITEM_FIREWORK_ROCKET",E_ITEM_FIREWORK_ROCKET); + tolua_constant(tolua_S,"E_ITEM_FIREWORK_STAR",E_ITEM_FIREWORK_STAR); + tolua_constant(tolua_S,"E_ITEM_ENCHANTED_BOOK",E_ITEM_ENCHANTED_BOOK); + tolua_constant(tolua_S,"E_ITEM_COMPARATOR",E_ITEM_COMPARATOR); + tolua_constant(tolua_S,"E_ITEM_NETHER_BRICK",E_ITEM_NETHER_BRICK); + tolua_constant(tolua_S,"E_ITEM_NETHER_QUARTZ",E_ITEM_NETHER_QUARTZ); + tolua_constant(tolua_S,"E_ITEM_MINECART_WITH_TNT",E_ITEM_MINECART_WITH_TNT); + tolua_constant(tolua_S,"E_ITEM_MINECART_WITH_HOPPER",E_ITEM_MINECART_WITH_HOPPER); + tolua_constant(tolua_S,"E_ITEM_IRON_HORSE_ARMOR",E_ITEM_IRON_HORSE_ARMOR); + tolua_constant(tolua_S,"E_ITEM_GOLD_HORSE_ARMOR",E_ITEM_GOLD_HORSE_ARMOR); + tolua_constant(tolua_S,"E_ITEM_DIAMOND_HORSE_ARMOR",E_ITEM_DIAMOND_HORSE_ARMOR); + tolua_constant(tolua_S,"E_ITEM_LEAD",E_ITEM_LEAD); + tolua_constant(tolua_S,"E_ITEM_NAME_TAG",E_ITEM_NAME_TAG); + tolua_constant(tolua_S,"E_ITEM_MINECART_WITH_COMMAND_BLOCK",E_ITEM_MINECART_WITH_COMMAND_BLOCK); + tolua_constant(tolua_S,"E_ITEM_NUMBER_OF_CONSECUTIVE_TYPES",E_ITEM_NUMBER_OF_CONSECUTIVE_TYPES); + tolua_constant(tolua_S,"E_ITEM_MAX_CONSECUTIVE_TYPE_ID",E_ITEM_MAX_CONSECUTIVE_TYPE_ID); + tolua_constant(tolua_S,"E_ITEM_FIRST_DISC",E_ITEM_FIRST_DISC); + tolua_constant(tolua_S,"E_ITEM_13_DISC",E_ITEM_13_DISC); + tolua_constant(tolua_S,"E_ITEM_CAT_DISC",E_ITEM_CAT_DISC); + tolua_constant(tolua_S,"E_ITEM_BLOCKS_DISC",E_ITEM_BLOCKS_DISC); + tolua_constant(tolua_S,"E_ITEM_CHIRP_DISC",E_ITEM_CHIRP_DISC); + tolua_constant(tolua_S,"E_ITEM_FAR_DISC",E_ITEM_FAR_DISC); + tolua_constant(tolua_S,"E_ITEM_MALL_DISC",E_ITEM_MALL_DISC); + tolua_constant(tolua_S,"E_ITEM_MELLOHI_DISC",E_ITEM_MELLOHI_DISC); + tolua_constant(tolua_S,"E_ITEM_STAL_DISC",E_ITEM_STAL_DISC); + tolua_constant(tolua_S,"E_ITEM_STRAD_DISC",E_ITEM_STRAD_DISC); + tolua_constant(tolua_S,"E_ITEM_WARD_DISC",E_ITEM_WARD_DISC); + tolua_constant(tolua_S,"E_ITEM_11_DISC",E_ITEM_11_DISC); + tolua_constant(tolua_S,"E_ITEM_WAIT_DISC",E_ITEM_WAIT_DISC); + tolua_constant(tolua_S,"E_ITEM_LAST_DISC_PLUS_ONE",E_ITEM_LAST_DISC_PLUS_ONE); + tolua_constant(tolua_S,"E_ITEM_LAST_DISC",E_ITEM_LAST_DISC); + tolua_constant(tolua_S,"E_ITEM_LAST",E_ITEM_LAST); + tolua_constant(tolua_S,"E_META_CHEST_FACING_ZM",E_META_CHEST_FACING_ZM); + tolua_constant(tolua_S,"E_META_CHEST_FACING_ZP",E_META_CHEST_FACING_ZP); + tolua_constant(tolua_S,"E_META_CHEST_FACING_XM",E_META_CHEST_FACING_XM); + tolua_constant(tolua_S,"E_META_CHEST_FACING_XP",E_META_CHEST_FACING_XP); + tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_YM",E_META_DROPSPENSER_FACING_YM); + tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_YP",E_META_DROPSPENSER_FACING_YP); + tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_ZM",E_META_DROPSPENSER_FACING_ZM); + tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_ZP",E_META_DROPSPENSER_FACING_ZP); + tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_XM",E_META_DROPSPENSER_FACING_XM); + tolua_constant(tolua_S,"E_META_DROPSPENSER_FACING_XP",E_META_DROPSPENSER_FACING_XP); + tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_STONE",E_META_DOUBLE_STONE_SLAB_STONE); + tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_SANDSTONE",E_META_DOUBLE_STONE_SLAB_SANDSTONE); + tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_WOODEN",E_META_DOUBLE_STONE_SLAB_WOODEN); + tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_COBBLESTONE",E_META_DOUBLE_STONE_SLAB_COBBLESTONE); + tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_BRICK",E_META_DOUBLE_STONE_SLAB_BRICK); + tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_STONE_BRICK",E_META_DOUBLE_STONE_SLAB_STONE_BRICK); + tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_NETHER_BRICK",E_META_DOUBLE_STONE_SLAB_NETHER_BRICK); + tolua_constant(tolua_S,"E_META_DOUBLE_STONE_SLAB_STONE_SECRET",E_META_DOUBLE_STONE_SLAB_STONE_SECRET); + tolua_constant(tolua_S,"E_META_HOPPER_FACING_YM",E_META_HOPPER_FACING_YM); + tolua_constant(tolua_S,"E_META_HOPPER_UNATTACHED",E_META_HOPPER_UNATTACHED); + tolua_constant(tolua_S,"E_META_HOPPER_FACING_ZM",E_META_HOPPER_FACING_ZM); + tolua_constant(tolua_S,"E_META_HOPPER_FACING_ZP",E_META_HOPPER_FACING_ZP); + tolua_constant(tolua_S,"E_META_HOPPER_FACING_XM",E_META_HOPPER_FACING_XM); + tolua_constant(tolua_S,"E_META_HOPPER_FACING_XP",E_META_HOPPER_FACING_XP); + tolua_constant(tolua_S,"E_META_LEAVES_APPLE",E_META_LEAVES_APPLE); + tolua_constant(tolua_S,"E_META_LEAVES_CONIFER",E_META_LEAVES_CONIFER); + tolua_constant(tolua_S,"E_META_LEAVES_BIRCH",E_META_LEAVES_BIRCH); + tolua_constant(tolua_S,"E_META_LEAVES_JUNGLE",E_META_LEAVES_JUNGLE); + tolua_constant(tolua_S,"E_META_LOG_APPLE",E_META_LOG_APPLE); + tolua_constant(tolua_S,"E_META_LOG_CONIFER",E_META_LOG_CONIFER); + tolua_constant(tolua_S,"E_META_LOG_BIRCH",E_META_LOG_BIRCH); + tolua_constant(tolua_S,"E_META_LOG_JUNGLE",E_META_LOG_JUNGLE); + tolua_constant(tolua_S,"E_META_PLANKS_APPLE",E_META_PLANKS_APPLE); + tolua_constant(tolua_S,"E_META_PLANKS_CONIFER",E_META_PLANKS_CONIFER); + tolua_constant(tolua_S,"E_META_PLANKS_BIRCH",E_META_PLANKS_BIRCH); + tolua_constant(tolua_S,"E_META_PLANKS_JUNGLE",E_META_PLANKS_JUNGLE); + tolua_constant(tolua_S,"E_META_SANDSTONE_NORMAL",E_META_SANDSTONE_NORMAL); + tolua_constant(tolua_S,"E_META_SANDSTONE_ORNAMENT",E_META_SANDSTONE_ORNAMENT); + tolua_constant(tolua_S,"E_META_SANDSTONE_SMOOTH",E_META_SANDSTONE_SMOOTH); + tolua_constant(tolua_S,"E_META_SAPLING_APPLE",E_META_SAPLING_APPLE); + tolua_constant(tolua_S,"E_META_SAPLING_CONIFER",E_META_SAPLING_CONIFER); + tolua_constant(tolua_S,"E_META_SAPLING_BIRCH",E_META_SAPLING_BIRCH); + tolua_constant(tolua_S,"E_META_SAPLING_JUNGLE",E_META_SAPLING_JUNGLE); + tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE",E_META_SILVERFISH_EGG_STONE); + tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_COBBLESTONE",E_META_SILVERFISH_EGG_COBBLESTONE); + tolua_constant(tolua_S,"E_META_SILVERFISH_EGG_STONE_BRICK",E_META_SILVERFISH_EGG_STONE_BRICK); + tolua_constant(tolua_S,"E_META_STONE_SLAB_STONE",E_META_STONE_SLAB_STONE); + tolua_constant(tolua_S,"E_META_STONE_SLAB_SANDSTONE",E_META_STONE_SLAB_SANDSTONE); + tolua_constant(tolua_S,"E_META_STONE_SLAB_PLANKS",E_META_STONE_SLAB_PLANKS); + tolua_constant(tolua_S,"E_META_STONE_SLAB_COBBLESTONE",E_META_STONE_SLAB_COBBLESTONE); + tolua_constant(tolua_S,"E_META_STONE_SLAB_BRICK",E_META_STONE_SLAB_BRICK); + tolua_constant(tolua_S,"E_META_STONE_SLAB_STONE_BRICK",E_META_STONE_SLAB_STONE_BRICK); + tolua_constant(tolua_S,"E_META_STONE_SLAB_NETHER_BRICK",E_META_STONE_SLAB_NETHER_BRICK); + tolua_constant(tolua_S,"E_META_STONE_SLAB_STONE_SECRET",E_META_STONE_SLAB_STONE_SECRET); + tolua_constant(tolua_S,"E_META_STONE_BRICK_NORMAL",E_META_STONE_BRICK_NORMAL); + tolua_constant(tolua_S,"E_META_STONE_BRICK_MOSSY",E_META_STONE_BRICK_MOSSY); + tolua_constant(tolua_S,"E_META_STONE_BRICK_CRACKED",E_META_STONE_BRICK_CRACKED); + tolua_constant(tolua_S,"E_META_STONE_BRICK_ORNAMENT",E_META_STONE_BRICK_ORNAMENT); + tolua_constant(tolua_S,"E_META_TALL_GRASS_DEAD_SHRUB",E_META_TALL_GRASS_DEAD_SHRUB); + tolua_constant(tolua_S,"E_META_TALL_GRASS_GRASS",E_META_TALL_GRASS_GRASS); + tolua_constant(tolua_S,"E_META_TALL_GRASS_FERN",E_META_TALL_GRASS_FERN); + tolua_constant(tolua_S,"E_META_TORCH_EAST",E_META_TORCH_EAST); + tolua_constant(tolua_S,"E_META_TORCH_WEST",E_META_TORCH_WEST); + tolua_constant(tolua_S,"E_META_TORCH_SOUTH",E_META_TORCH_SOUTH); + tolua_constant(tolua_S,"E_META_TORCH_NORTH",E_META_TORCH_NORTH); + tolua_constant(tolua_S,"E_META_TORCH_FLOOR",E_META_TORCH_FLOOR); + tolua_constant(tolua_S,"E_META_TORCH_XM",E_META_TORCH_XM); + tolua_constant(tolua_S,"E_META_TORCH_XP",E_META_TORCH_XP); + tolua_constant(tolua_S,"E_META_TORCH_ZM",E_META_TORCH_ZM); + tolua_constant(tolua_S,"E_META_TORCH_ZP",E_META_TORCH_ZP); + tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_APPLE",E_META_WOODEN_DOUBLE_SLAB_APPLE); + tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_CONIFER",E_META_WOODEN_DOUBLE_SLAB_CONIFER); + tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_BIRCH",E_META_WOODEN_DOUBLE_SLAB_BIRCH); + tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_JUNGLE",E_META_WOODEN_DOUBLE_SLAB_JUNGLE); + tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_ACACIA",E_META_WOODEN_DOUBLE_SLAB_ACACIA); + tolua_constant(tolua_S,"E_META_WOODEN_DOUBLE_SLAB_DARK_OAK",E_META_WOODEN_DOUBLE_SLAB_DARK_OAK); + tolua_constant(tolua_S,"E_META_WOODEN_SLAB_APPLE",E_META_WOODEN_SLAB_APPLE); + tolua_constant(tolua_S,"E_META_WOODEN_SLAB_CONIFER",E_META_WOODEN_SLAB_CONIFER); + tolua_constant(tolua_S,"E_META_WOODEN_SLAB_BIRCH",E_META_WOODEN_SLAB_BIRCH); + tolua_constant(tolua_S,"E_META_WOODEN_SLAB_JUNGLE",E_META_WOODEN_SLAB_JUNGLE); + tolua_constant(tolua_S,"E_META_WOODEN_SLAB_ACACIA",E_META_WOODEN_SLAB_ACACIA); + tolua_constant(tolua_S,"E_META_WOODEN_SLAB_DARK_OAK",E_META_WOODEN_SLAB_DARK_OAK); + tolua_constant(tolua_S,"E_META_WOOL_WHITE",E_META_WOOL_WHITE); + tolua_constant(tolua_S,"E_META_WOOL_ORANGE",E_META_WOOL_ORANGE); + tolua_constant(tolua_S,"E_META_WOOL_MAGENTA",E_META_WOOL_MAGENTA); + tolua_constant(tolua_S,"E_META_WOOL_LIGHTBLUE",E_META_WOOL_LIGHTBLUE); + tolua_constant(tolua_S,"E_META_WOOL_YELLOW",E_META_WOOL_YELLOW); + tolua_constant(tolua_S,"E_META_WOOL_LIGHTGREEN",E_META_WOOL_LIGHTGREEN); + tolua_constant(tolua_S,"E_META_WOOL_PINK",E_META_WOOL_PINK); + tolua_constant(tolua_S,"E_META_WOOL_GRAY",E_META_WOOL_GRAY); + tolua_constant(tolua_S,"E_META_WOOL_LIGHTGRAY",E_META_WOOL_LIGHTGRAY); + tolua_constant(tolua_S,"E_META_WOOL_CYAN",E_META_WOOL_CYAN); + tolua_constant(tolua_S,"E_META_WOOL_PURPLE",E_META_WOOL_PURPLE); + tolua_constant(tolua_S,"E_META_WOOL_BLUE",E_META_WOOL_BLUE); + tolua_constant(tolua_S,"E_META_WOOL_BROWN",E_META_WOOL_BROWN); + tolua_constant(tolua_S,"E_META_WOOL_GREEN",E_META_WOOL_GREEN); + tolua_constant(tolua_S,"E_META_WOOL_RED",E_META_WOOL_RED); + tolua_constant(tolua_S,"E_META_WOOL_BLACK",E_META_WOOL_BLACK); + tolua_constant(tolua_S,"E_META_CARPET_WHITE",E_META_CARPET_WHITE); + tolua_constant(tolua_S,"E_META_CARPET_ORANGE",E_META_CARPET_ORANGE); + tolua_constant(tolua_S,"E_META_CARPET_MAGENTA",E_META_CARPET_MAGENTA); + tolua_constant(tolua_S,"E_META_CARPET_LIGHTBLUE",E_META_CARPET_LIGHTBLUE); + tolua_constant(tolua_S,"E_META_CARPET_YELLOW",E_META_CARPET_YELLOW); + tolua_constant(tolua_S,"E_META_CARPET_LIGHTGREEN",E_META_CARPET_LIGHTGREEN); + tolua_constant(tolua_S,"E_META_CARPET_PINK",E_META_CARPET_PINK); + tolua_constant(tolua_S,"E_META_CARPET_GRAY",E_META_CARPET_GRAY); + tolua_constant(tolua_S,"E_META_CARPET_LIGHTGRAY",E_META_CARPET_LIGHTGRAY); + tolua_constant(tolua_S,"E_META_CARPET_CYAN",E_META_CARPET_CYAN); + tolua_constant(tolua_S,"E_META_CARPET_PURPLE",E_META_CARPET_PURPLE); + tolua_constant(tolua_S,"E_META_CARPET_BLUE",E_META_CARPET_BLUE); + tolua_constant(tolua_S,"E_META_CARPET_BROWN",E_META_CARPET_BROWN); + tolua_constant(tolua_S,"E_META_CARPET_GREEN",E_META_CARPET_GREEN); + tolua_constant(tolua_S,"E_META_CARPET_RED",E_META_CARPET_RED); + tolua_constant(tolua_S,"E_META_CARPET_BLACK",E_META_CARPET_BLACK); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_WHITE",E_META_STAINED_CLAY_WHITE); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_ORANGE",E_META_STAINED_CLAY_ORANGE); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_MAGENTA",E_META_STAINED_CLAY_MAGENTA); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_LIGHTBLUE",E_META_STAINED_CLAY_LIGHTBLUE); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_YELLOW",E_META_STAINED_CLAY_YELLOW); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_LIGHTGREEN",E_META_STAINED_CLAY_LIGHTGREEN); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_PINK",E_META_STAINED_CLAY_PINK); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_GRAY",E_META_STAINED_CLAY_GRAY); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_LIGHTGRAY",E_META_STAINED_CLAY_LIGHTGRAY); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_CYAN",E_META_STAINED_CLAY_CYAN); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_PURPLE",E_META_STAINED_CLAY_PURPLE); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_BLUE",E_META_STAINED_CLAY_BLUE); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_BROWN",E_META_STAINED_CLAY_BROWN); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_GREEN",E_META_STAINED_CLAY_GREEN); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_RED",E_META_STAINED_CLAY_RED); + tolua_constant(tolua_S,"E_META_STAINED_CLAY_BLACK",E_META_STAINED_CLAY_BLACK); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_WHITE",E_META_STAINED_GLASS_WHITE); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_ORANGE",E_META_STAINED_GLASS_ORANGE); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_MAGENTA",E_META_STAINED_GLASS_MAGENTA); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_LIGHTBLUE",E_META_STAINED_GLASS_LIGHTBLUE); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_YELLOW",E_META_STAINED_GLASS_YELLOW); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_LIGHTGREEN",E_META_STAINED_GLASS_LIGHTGREEN); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PINK",E_META_STAINED_GLASS_PINK); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_GRAY",E_META_STAINED_GLASS_GRAY); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_LIGHTGRAY",E_META_STAINED_GLASS_LIGHTGRAY); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_CYAN",E_META_STAINED_GLASS_CYAN); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PURPLE",E_META_STAINED_GLASS_PURPLE); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_BLUE",E_META_STAINED_GLASS_BLUE); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_BROWN",E_META_STAINED_GLASS_BROWN); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_GREEN",E_META_STAINED_GLASS_GREEN); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_RED",E_META_STAINED_GLASS_RED); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_BLACK",E_META_STAINED_GLASS_BLACK); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_WHITE",E_META_STAINED_GLASS_PANE_WHITE); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_ORANGE",E_META_STAINED_GLASS_PANE_ORANGE); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_MAGENTA",E_META_STAINED_GLASS_PANE_MAGENTA); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_LIGHTBLUE",E_META_STAINED_GLASS_PANE_LIGHTBLUE); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_YELLOW",E_META_STAINED_GLASS_PANE_YELLOW); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_LIGHTGREEN",E_META_STAINED_GLASS_PANE_LIGHTGREEN); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_PINK",E_META_STAINED_GLASS_PANE_PINK); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_GRAY",E_META_STAINED_GLASS_PANE_GRAY); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_LIGHTGRAY",E_META_STAINED_GLASS_PANE_LIGHTGRAY); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_CYAN",E_META_STAINED_GLASS_PANE_CYAN); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_PURPLE",E_META_STAINED_GLASS_PANE_PURPLE); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_BLUE",E_META_STAINED_GLASS_PANE_BLUE); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_BROWN",E_META_STAINED_GLASS_PANE_BROWN); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_GREEN",E_META_STAINED_GLASS_PANE_GREEN); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_RED",E_META_STAINED_GLASS_PANE_RED); + tolua_constant(tolua_S,"E_META_STAINED_GLASS_PANE_BLACK",E_META_STAINED_GLASS_PANE_BLACK); + tolua_constant(tolua_S,"E_META_SNOW_LAYER_ONE",E_META_SNOW_LAYER_ONE); + tolua_constant(tolua_S,"E_META_SNOW_LAYER_TWO",E_META_SNOW_LAYER_TWO); + tolua_constant(tolua_S,"E_META_SNOW_LAYER_THREE",E_META_SNOW_LAYER_THREE); + tolua_constant(tolua_S,"E_META_SNOW_LAYER_FOUR",E_META_SNOW_LAYER_FOUR); + tolua_constant(tolua_S,"E_META_SNOW_LAYER_FIVE",E_META_SNOW_LAYER_FIVE); + tolua_constant(tolua_S,"E_META_SNOW_LAYER_SIX",E_META_SNOW_LAYER_SIX); + tolua_constant(tolua_S,"E_META_SNOW_LAYER_SEVEN",E_META_SNOW_LAYER_SEVEN); + tolua_constant(tolua_S,"E_META_SNOW_LAYER_EIGHT",E_META_SNOW_LAYER_EIGHT); + tolua_constant(tolua_S,"E_META_RAIL_ZM_ZP",E_META_RAIL_ZM_ZP); + tolua_constant(tolua_S,"E_META_RAIL_XM_XP",E_META_RAIL_XM_XP); + tolua_constant(tolua_S,"E_META_RAIL_ASCEND_XP",E_META_RAIL_ASCEND_XP); + tolua_constant(tolua_S,"E_META_RAIL_ASCEND_XM",E_META_RAIL_ASCEND_XM); + tolua_constant(tolua_S,"E_META_RAIL_ASCEND_ZM",E_META_RAIL_ASCEND_ZM); + tolua_constant(tolua_S,"E_META_RAIL_ASCEND_ZP",E_META_RAIL_ASCEND_ZP); + tolua_constant(tolua_S,"E_META_RAIL_CURVED_ZP_XP",E_META_RAIL_CURVED_ZP_XP); + tolua_constant(tolua_S,"E_META_RAIL_CURVED_ZP_XM",E_META_RAIL_CURVED_ZP_XM); + tolua_constant(tolua_S,"E_META_RAIL_CURVED_ZM_XM",E_META_RAIL_CURVED_ZM_XM); + tolua_constant(tolua_S,"E_META_RAIL_CURVED_ZM_XP",E_META_RAIL_CURVED_ZM_XP); + tolua_constant(tolua_S,"E_META_NEW_LEAVES_ACACIA_WOOD",E_META_NEW_LEAVES_ACACIA_WOOD); + tolua_constant(tolua_S,"E_META_NEW_LEAVES_DARK_OAK_WOOD",E_META_NEW_LEAVES_DARK_OAK_WOOD); + tolua_constant(tolua_S,"E_META_NEW_LOG_ACACIA_WOOD",E_META_NEW_LOG_ACACIA_WOOD); + tolua_constant(tolua_S,"E_META_NEW_LOG_DARK_OAK_WOOD",E_META_NEW_LOG_DARK_OAK_WOOD); + tolua_constant(tolua_S,"E_META_FLOWER_POPPY",E_META_FLOWER_POPPY); + tolua_constant(tolua_S,"E_META_FLOWER_BLUE_ORCHID",E_META_FLOWER_BLUE_ORCHID); + tolua_constant(tolua_S,"E_META_FLOWER_ALLIUM",E_META_FLOWER_ALLIUM); + tolua_constant(tolua_S,"E_META_FLOWER_RED_TULIP",E_META_FLOWER_RED_TULIP); + tolua_constant(tolua_S,"E_META_FLOWER_ORANGE_TULIP",E_META_FLOWER_ORANGE_TULIP); + tolua_constant(tolua_S,"E_META_FLOWER_WHITE_TULIP",E_META_FLOWER_WHITE_TULIP); + tolua_constant(tolua_S,"E_META_FLOWER_PINK_TULIP",E_META_FLOWER_PINK_TULIP); + tolua_constant(tolua_S,"E_META_FLOWER_OXEYE_DAISY",E_META_FLOWER_OXEYE_DAISY); + tolua_constant(tolua_S,"E_META_BIG_FLOWER_SUNFLOWER",E_META_BIG_FLOWER_SUNFLOWER); + tolua_constant(tolua_S,"E_META_BIG_FLOWER_LILAC",E_META_BIG_FLOWER_LILAC); + tolua_constant(tolua_S,"E_META_BIG_FLOWER_DOUBLE_TALL_GRASS",E_META_BIG_FLOWER_DOUBLE_TALL_GRASS); + tolua_constant(tolua_S,"E_META_BIG_FLOWER_LARGE_FERN",E_META_BIG_FLOWER_LARGE_FERN); + tolua_constant(tolua_S,"E_META_BIG_FLOWER_ROSE_BUSH",E_META_BIG_FLOWER_ROSE_BUSH); + tolua_constant(tolua_S,"E_META_BIG_FLOWER_PEONY",E_META_BIG_FLOWER_PEONY); + tolua_constant(tolua_S,"E_META_COAL_NORMAL",E_META_COAL_NORMAL); + tolua_constant(tolua_S,"E_META_COAL_CHARCOAL",E_META_COAL_CHARCOAL); + tolua_constant(tolua_S,"E_META_DYE_BLACK",E_META_DYE_BLACK); + tolua_constant(tolua_S,"E_META_DYE_RED",E_META_DYE_RED); + tolua_constant(tolua_S,"E_META_DYE_GREEN",E_META_DYE_GREEN); + tolua_constant(tolua_S,"E_META_DYE_BROWN",E_META_DYE_BROWN); + tolua_constant(tolua_S,"E_META_DYE_BLUE",E_META_DYE_BLUE); + tolua_constant(tolua_S,"E_META_DYE_PURPLE",E_META_DYE_PURPLE); + tolua_constant(tolua_S,"E_META_DYE_CYAN",E_META_DYE_CYAN); + tolua_constant(tolua_S,"E_META_DYE_LIGHTGRAY",E_META_DYE_LIGHTGRAY); + tolua_constant(tolua_S,"E_META_DYE_GRAY",E_META_DYE_GRAY); + tolua_constant(tolua_S,"E_META_DYE_PINK",E_META_DYE_PINK); + tolua_constant(tolua_S,"E_META_DYE_LIGHTGREEN",E_META_DYE_LIGHTGREEN); + tolua_constant(tolua_S,"E_META_DYE_YELLOW",E_META_DYE_YELLOW); + tolua_constant(tolua_S,"E_META_DYE_LIGHTBLUE",E_META_DYE_LIGHTBLUE); + tolua_constant(tolua_S,"E_META_DYE_MAGENTA",E_META_DYE_MAGENTA); + tolua_constant(tolua_S,"E_META_DYE_ORANGE",E_META_DYE_ORANGE); + tolua_constant(tolua_S,"E_META_DYE_WHITE",E_META_DYE_WHITE); + tolua_constant(tolua_S,"E_META_GOLDEN_APPLE_NORMAL",E_META_GOLDEN_APPLE_NORMAL); + tolua_constant(tolua_S,"E_META_GOLDEN_APPLE_ENCHANTED",E_META_GOLDEN_APPLE_ENCHANTED); + tolua_constant(tolua_S,"E_META_RAW_FISH_FISH",E_META_RAW_FISH_FISH); + tolua_constant(tolua_S,"E_META_RAW_FISH_SALMON",E_META_RAW_FISH_SALMON); + tolua_constant(tolua_S,"E_META_RAW_FISH_CLOWNFISH",E_META_RAW_FISH_CLOWNFISH); + tolua_constant(tolua_S,"E_META_RAW_FISH_PUFFERFISH",E_META_RAW_FISH_PUFFERFISH); + tolua_constant(tolua_S,"E_META_COOKED_FISH_FISH",E_META_COOKED_FISH_FISH); + tolua_constant(tolua_S,"E_META_COOKED_FISH_SALMON",E_META_COOKED_FISH_SALMON); + tolua_constant(tolua_S,"E_META_COOKED_FISH_CLOWNFISH",E_META_COOKED_FISH_CLOWNFISH); + tolua_constant(tolua_S,"E_META_COOKED_FISH_PUFFERFISH",E_META_COOKED_FISH_PUFFERFISH); + tolua_constant(tolua_S,"E_META_TRACKS_X",E_META_TRACKS_X); + tolua_constant(tolua_S,"E_META_TRACKS_Z",E_META_TRACKS_Z); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_PICKUP",E_META_SPAWN_EGG_PICKUP); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_EXPERIENCE_ORB",E_META_SPAWN_EGG_EXPERIENCE_ORB); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_LEASH_KNOT",E_META_SPAWN_EGG_LEASH_KNOT); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_PAINTING",E_META_SPAWN_EGG_PAINTING); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_ARROW",E_META_SPAWN_EGG_ARROW); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_SNOWBALL",E_META_SPAWN_EGG_SNOWBALL); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_FIREBALL",E_META_SPAWN_EGG_FIREBALL); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_SMALL_FIREBALL",E_META_SPAWN_EGG_SMALL_FIREBALL); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_ENDER_PEARL",E_META_SPAWN_EGG_ENDER_PEARL); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_EYE_OF_ENDER",E_META_SPAWN_EGG_EYE_OF_ENDER); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_SPLASH_POTION",E_META_SPAWN_EGG_SPLASH_POTION); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_EXP_BOTTLE",E_META_SPAWN_EGG_EXP_BOTTLE); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_ITEM_FRAME",E_META_SPAWN_EGG_ITEM_FRAME); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_WITHER_SKULL",E_META_SPAWN_EGG_WITHER_SKULL); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_PRIMED_TNT",E_META_SPAWN_EGG_PRIMED_TNT); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_FALLING_BLOCK",E_META_SPAWN_EGG_FALLING_BLOCK); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_FIREWORK",E_META_SPAWN_EGG_FIREWORK); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_BOAT",E_META_SPAWN_EGG_BOAT); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_MINECART",E_META_SPAWN_EGG_MINECART); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_MINECART_CHEST",E_META_SPAWN_EGG_MINECART_CHEST); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_MINECART_FURNACE",E_META_SPAWN_EGG_MINECART_FURNACE); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_MINECART_TNT",E_META_SPAWN_EGG_MINECART_TNT); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_MINECART_HOPPER",E_META_SPAWN_EGG_MINECART_HOPPER); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_MINECART_SPAWNER",E_META_SPAWN_EGG_MINECART_SPAWNER); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_CREEPER",E_META_SPAWN_EGG_CREEPER); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_SKELETON",E_META_SPAWN_EGG_SKELETON); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_SPIDER",E_META_SPAWN_EGG_SPIDER); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_GIANT",E_META_SPAWN_EGG_GIANT); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_ZOMBIE",E_META_SPAWN_EGG_ZOMBIE); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_SLIME",E_META_SPAWN_EGG_SLIME); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_GHAST",E_META_SPAWN_EGG_GHAST); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_ZOMBIE_PIGMAN",E_META_SPAWN_EGG_ZOMBIE_PIGMAN); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_ENDERMAN",E_META_SPAWN_EGG_ENDERMAN); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_CAVE_SPIDER",E_META_SPAWN_EGG_CAVE_SPIDER); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_SILVERFISH",E_META_SPAWN_EGG_SILVERFISH); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_BLAZE",E_META_SPAWN_EGG_BLAZE); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_MAGMA_CUBE",E_META_SPAWN_EGG_MAGMA_CUBE); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_ENDER_DRAGON",E_META_SPAWN_EGG_ENDER_DRAGON); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_WITHER",E_META_SPAWN_EGG_WITHER); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_BAT",E_META_SPAWN_EGG_BAT); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_WITCH",E_META_SPAWN_EGG_WITCH); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_PIG",E_META_SPAWN_EGG_PIG); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_SHEEP",E_META_SPAWN_EGG_SHEEP); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_COW",E_META_SPAWN_EGG_COW); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_CHICKEN",E_META_SPAWN_EGG_CHICKEN); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_SQUID",E_META_SPAWN_EGG_SQUID); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_WOLF",E_META_SPAWN_EGG_WOLF); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_MOOSHROOM",E_META_SPAWN_EGG_MOOSHROOM); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_SNOW_GOLEM",E_META_SPAWN_EGG_SNOW_GOLEM); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_OCELOT",E_META_SPAWN_EGG_OCELOT); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_IRON_GOLEM",E_META_SPAWN_EGG_IRON_GOLEM); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_HORSE",E_META_SPAWN_EGG_HORSE); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_VILLAGER",E_META_SPAWN_EGG_VILLAGER); + tolua_constant(tolua_S,"E_META_SPAWN_EGG_ENDER_CRYSTAL",E_META_SPAWN_EGG_ENDER_CRYSTAL); + tolua_constant(tolua_S,"dimNether",dimNether); + tolua_constant(tolua_S,"dimOverworld",dimOverworld); + tolua_constant(tolua_S,"dimEnd",dimEnd); + tolua_constant(tolua_S,"dtAttack",dtAttack); + tolua_constant(tolua_S,"dtRangedAttack",dtRangedAttack); + tolua_constant(tolua_S,"dtLightning",dtLightning); + tolua_constant(tolua_S,"dtFalling",dtFalling); + tolua_constant(tolua_S,"dtDrowning",dtDrowning); + tolua_constant(tolua_S,"dtSuffocating",dtSuffocating); + tolua_constant(tolua_S,"dtStarving",dtStarving); + tolua_constant(tolua_S,"dtCactusContact",dtCactusContact); + tolua_constant(tolua_S,"dtLavaContact",dtLavaContact); + tolua_constant(tolua_S,"dtPoisoning",dtPoisoning); + tolua_constant(tolua_S,"dtOnFire",dtOnFire); + tolua_constant(tolua_S,"dtFireContact",dtFireContact); + tolua_constant(tolua_S,"dtInVoid",dtInVoid); + tolua_constant(tolua_S,"dtPotionOfHarming",dtPotionOfHarming); + tolua_constant(tolua_S,"dtEnderPearl",dtEnderPearl); + tolua_constant(tolua_S,"dtAdmin",dtAdmin); + tolua_constant(tolua_S,"dtPawnAttack",dtPawnAttack); + tolua_constant(tolua_S,"dtEntityAttack",dtEntityAttack); + tolua_constant(tolua_S,"dtMob",dtMob); + tolua_constant(tolua_S,"dtMobAttack",dtMobAttack); + tolua_constant(tolua_S,"dtArrowAttack",dtArrowAttack); + tolua_constant(tolua_S,"dtArrow",dtArrow); + tolua_constant(tolua_S,"dtProjectile",dtProjectile); + tolua_constant(tolua_S,"dtFall",dtFall); + tolua_constant(tolua_S,"dtDrown",dtDrown); + tolua_constant(tolua_S,"dtSuffocation",dtSuffocation); + tolua_constant(tolua_S,"dtStarvation",dtStarvation); + tolua_constant(tolua_S,"dtHunger",dtHunger); + tolua_constant(tolua_S,"dtCactus",dtCactus); + tolua_constant(tolua_S,"dtCactuses",dtCactuses); + tolua_constant(tolua_S,"dtCacti",dtCacti); + tolua_constant(tolua_S,"dtLava",dtLava); + tolua_constant(tolua_S,"dtPoison",dtPoison); + tolua_constant(tolua_S,"dtBurning",dtBurning); + tolua_constant(tolua_S,"dtInFire",dtInFire); + tolua_constant(tolua_S,"dtPlugin",dtPlugin); + tolua_constant(tolua_S,"esOther",esOther); + tolua_constant(tolua_S,"esPrimedTNT",esPrimedTNT); + tolua_constant(tolua_S,"esCreeper",esCreeper); + tolua_constant(tolua_S,"esBed",esBed); + tolua_constant(tolua_S,"esEnderCrystal",esEnderCrystal); + tolua_constant(tolua_S,"esGhastFireball",esGhastFireball); + tolua_constant(tolua_S,"esWitherSkullBlack",esWitherSkullBlack); + tolua_constant(tolua_S,"esWitherSkullBlue",esWitherSkullBlue); + tolua_constant(tolua_S,"esWitherBirth",esWitherBirth); + tolua_constant(tolua_S,"esPlugin",esPlugin); + tolua_function(tolua_S,"BlockStringToType",tolua_AllToLua_BlockStringToType00); + tolua_function(tolua_S,"StringToItem",tolua_AllToLua_StringToItem00); + tolua_function(tolua_S,"ItemToString",tolua_AllToLua_ItemToString00); + tolua_function(tolua_S,"ItemTypeToString",tolua_AllToLua_ItemTypeToString00); + tolua_function(tolua_S,"ItemToFullString",tolua_AllToLua_ItemToFullString00); + tolua_function(tolua_S,"StringToBiome",tolua_AllToLua_StringToBiome00); + tolua_function(tolua_S,"StringToMobType",tolua_AllToLua_StringToMobType00); + tolua_function(tolua_S,"StringToDimension",tolua_AllToLua_StringToDimension00); + tolua_function(tolua_S,"DamageTypeToString",tolua_AllToLua_DamageTypeToString00); + tolua_function(tolua_S,"StringToDamageType",tolua_AllToLua_StringToDamageType00); + tolua_function(tolua_S,"GetIniItemSet",tolua_AllToLua_GetIniItemSet00); + tolua_function(tolua_S,"TrimString",tolua_AllToLua_TrimString00); + tolua_function(tolua_S,"NoCaseCompare",tolua_AllToLua_NoCaseCompare00); + tolua_function(tolua_S,"ReplaceString",tolua_AllToLua_ReplaceString00); + tolua_function(tolua_S,"EscapeString",tolua_AllToLua_EscapeString00); + tolua_function(tolua_S,"StripColorCodes",tolua_AllToLua_StripColorCodes00); + tolua_array(tolua_S,"g_BlockLightValue",tolua_get_AllToLua_g_BlockLightValue,tolua_set_AllToLua_g_BlockLightValue); + tolua_array(tolua_S,"g_BlockSpreadLightFalloff",tolua_get_AllToLua_g_BlockSpreadLightFalloff,tolua_set_AllToLua_g_BlockSpreadLightFalloff); + tolua_array(tolua_S,"g_BlockTransparent",tolua_get_AllToLua_g_BlockTransparent,tolua_set_AllToLua_g_BlockTransparent); + tolua_array(tolua_S,"g_BlockOneHitDig",tolua_get_AllToLua_g_BlockOneHitDig,tolua_set_AllToLua_g_BlockOneHitDig); + tolua_array(tolua_S,"g_BlockPistonBreakable",tolua_get_AllToLua_g_BlockPistonBreakable,tolua_set_AllToLua_g_BlockPistonBreakable); + tolua_array(tolua_S,"g_BlockIsSnowable",tolua_get_AllToLua_g_BlockIsSnowable,tolua_set_AllToLua_g_BlockIsSnowable); + tolua_array(tolua_S,"g_BlockRequiresSpecialTool",tolua_get_AllToLua_g_BlockRequiresSpecialTool,tolua_set_AllToLua_g_BlockRequiresSpecialTool); + tolua_array(tolua_S,"g_BlockIsSolid",tolua_get_AllToLua_g_BlockIsSolid,tolua_set_AllToLua_g_BlockIsSolid); + tolua_array(tolua_S,"g_BlockIsTorchPlaceable",tolua_get_AllToLua_g_BlockIsTorchPlaceable,tolua_set_AllToLua_g_BlockIsTorchPlaceable); + tolua_constant(tolua_S,"MAX_EXPERIENCE_ORB_SIZE",MAX_EXPERIENCE_ORB_SIZE); + tolua_constant(tolua_S,"BLOCK_FACE_NONE",BLOCK_FACE_NONE); + tolua_constant(tolua_S,"BLOCK_FACE_XM",BLOCK_FACE_XM); + tolua_constant(tolua_S,"BLOCK_FACE_XP",BLOCK_FACE_XP); + tolua_constant(tolua_S,"BLOCK_FACE_YM",BLOCK_FACE_YM); + tolua_constant(tolua_S,"BLOCK_FACE_YP",BLOCK_FACE_YP); + tolua_constant(tolua_S,"BLOCK_FACE_ZM",BLOCK_FACE_ZM); + tolua_constant(tolua_S,"BLOCK_FACE_ZP",BLOCK_FACE_ZP); + tolua_constant(tolua_S,"BLOCK_FACE_BOTTOM",BLOCK_FACE_BOTTOM); + tolua_constant(tolua_S,"BLOCK_FACE_TOP",BLOCK_FACE_TOP); + tolua_constant(tolua_S,"BLOCK_FACE_NORTH",BLOCK_FACE_NORTH); + tolua_constant(tolua_S,"BLOCK_FACE_SOUTH",BLOCK_FACE_SOUTH); + tolua_constant(tolua_S,"BLOCK_FACE_WEST",BLOCK_FACE_WEST); + tolua_constant(tolua_S,"BLOCK_FACE_EAST",BLOCK_FACE_EAST); + tolua_constant(tolua_S,"DIG_STATUS_STARTED",DIG_STATUS_STARTED); + tolua_constant(tolua_S,"DIG_STATUS_CANCELLED",DIG_STATUS_CANCELLED); + tolua_constant(tolua_S,"DIG_STATUS_FINISHED",DIG_STATUS_FINISHED); + tolua_constant(tolua_S,"DIG_STATUS_DROP_HELD",DIG_STATUS_DROP_HELD); + tolua_constant(tolua_S,"DIG_STATUS_SHOOT_EAT",DIG_STATUS_SHOOT_EAT); + tolua_constant(tolua_S,"caLeftClick",caLeftClick); + tolua_constant(tolua_S,"caRightClick",caRightClick); + tolua_constant(tolua_S,"caShiftLeftClick",caShiftLeftClick); + tolua_constant(tolua_S,"caShiftRightClick",caShiftRightClick); + tolua_constant(tolua_S,"caNumber1",caNumber1); + tolua_constant(tolua_S,"caNumber2",caNumber2); + tolua_constant(tolua_S,"caNumber3",caNumber3); + tolua_constant(tolua_S,"caNumber4",caNumber4); + tolua_constant(tolua_S,"caNumber5",caNumber5); + tolua_constant(tolua_S,"caNumber6",caNumber6); + tolua_constant(tolua_S,"caNumber7",caNumber7); + tolua_constant(tolua_S,"caNumber8",caNumber8); + tolua_constant(tolua_S,"caNumber9",caNumber9); + tolua_constant(tolua_S,"caMiddleClick",caMiddleClick); + tolua_constant(tolua_S,"caDropKey",caDropKey); + tolua_constant(tolua_S,"caCtrlDropKey",caCtrlDropKey); + tolua_constant(tolua_S,"caLeftClickOutside",caLeftClickOutside); + tolua_constant(tolua_S,"caRightClickOutside",caRightClickOutside); + tolua_constant(tolua_S,"caLeftClickOutsideHoldNothing",caLeftClickOutsideHoldNothing); + tolua_constant(tolua_S,"caRightClickOutsideHoldNothing",caRightClickOutsideHoldNothing); + tolua_constant(tolua_S,"caLeftPaintBegin",caLeftPaintBegin); + tolua_constant(tolua_S,"caRightPaintBegin",caRightPaintBegin); + tolua_constant(tolua_S,"caLeftPaintProgress",caLeftPaintProgress); + tolua_constant(tolua_S,"caRightPaintProgress",caRightPaintProgress); + tolua_constant(tolua_S,"caLeftPaintEnd",caLeftPaintEnd); + tolua_constant(tolua_S,"caRightPaintEnd",caRightPaintEnd); + tolua_constant(tolua_S,"caDblClick",caDblClick); + tolua_constant(tolua_S,"caUnknown",caUnknown); + tolua_constant(tolua_S,"eGameMode_NotSet",eGameMode_NotSet); + tolua_constant(tolua_S,"eGameMode_Survival",eGameMode_Survival); + tolua_constant(tolua_S,"eGameMode_Creative",eGameMode_Creative); + tolua_constant(tolua_S,"eGameMode_Adventure",eGameMode_Adventure); + tolua_constant(tolua_S,"gmNotSet",gmNotSet); + tolua_constant(tolua_S,"gmSurvival",gmSurvival); + tolua_constant(tolua_S,"gmCreative",gmCreative); + tolua_constant(tolua_S,"gmAdventure",gmAdventure); + tolua_constant(tolua_S,"gmMax",gmMax); + tolua_constant(tolua_S,"gmMin",gmMin); + tolua_constant(tolua_S,"eWeather_Sunny",eWeather_Sunny); + tolua_constant(tolua_S,"eWeather_Rain",eWeather_Rain); + tolua_constant(tolua_S,"eWeather_ThunderStorm",eWeather_ThunderStorm); + tolua_constant(tolua_S,"wSunny",wSunny); + tolua_constant(tolua_S,"wRain",wRain); + tolua_constant(tolua_S,"wThunderstorm",wThunderstorm); + tolua_constant(tolua_S,"wStorm",wStorm); + tolua_function(tolua_S,"ClickActionToString",tolua_AllToLua_ClickActionToString00); + tolua_function(tolua_S,"IsValidBlock",tolua_AllToLua_IsValidBlock00); + tolua_function(tolua_S,"IsValidItem",tolua_AllToLua_IsValidItem00); + tolua_function(tolua_S,"AddFaceDirection",tolua_AllToLua_AddFaceDirection00); + tolua_module(tolua_S,"ItemCategory",0); + tolua_beginmodule(tolua_S,"ItemCategory"); + tolua_function(tolua_S,"IsPickaxe",tolua_AllToLua_ItemCategory_IsPickaxe00); + tolua_function(tolua_S,"IsAxe",tolua_AllToLua_ItemCategory_IsAxe00); + tolua_function(tolua_S,"IsSword",tolua_AllToLua_ItemCategory_IsSword00); + tolua_function(tolua_S,"IsHoe",tolua_AllToLua_ItemCategory_IsHoe00); + tolua_function(tolua_S,"IsShovel",tolua_AllToLua_ItemCategory_IsShovel00); + tolua_function(tolua_S,"IsTool",tolua_AllToLua_ItemCategory_IsTool00); + tolua_function(tolua_S,"IsHelmet",tolua_AllToLua_ItemCategory_IsHelmet00); + tolua_function(tolua_S,"IsChestPlate",tolua_AllToLua_ItemCategory_IsChestPlate00); + tolua_function(tolua_S,"IsLeggings",tolua_AllToLua_ItemCategory_IsLeggings00); + tolua_function(tolua_S,"IsBoots",tolua_AllToLua_ItemCategory_IsBoots00); + tolua_function(tolua_S,"IsArmor",tolua_AllToLua_ItemCategory_IsArmor00); + tolua_endmodule(tolua_S); + tolua_function(tolua_S,"GetTime",tolua_AllToLua_GetTime00); + tolua_function(tolua_S,"GetChar",tolua_AllToLua_GetChar00); + tolua_cclass(tolua_S,"cChatColor","cChatColor","",NULL); + tolua_beginmodule(tolua_S,"cChatColor"); + tolua_variable(tolua_S,"Color",tolua_get_cChatColor_Color,NULL); + tolua_variable(tolua_S,"Delimiter",tolua_get_cChatColor_Delimiter,NULL); + tolua_variable(tolua_S,"Black",tolua_get_cChatColor_Black,NULL); + tolua_variable(tolua_S,"Navy",tolua_get_cChatColor_Navy,NULL); + tolua_variable(tolua_S,"Green",tolua_get_cChatColor_Green,NULL); + tolua_variable(tolua_S,"Blue",tolua_get_cChatColor_Blue,NULL); + tolua_variable(tolua_S,"Red",tolua_get_cChatColor_Red,NULL); + tolua_variable(tolua_S,"Purple",tolua_get_cChatColor_Purple,NULL); + tolua_variable(tolua_S,"Gold",tolua_get_cChatColor_Gold,NULL); + tolua_variable(tolua_S,"LightGray",tolua_get_cChatColor_LightGray,NULL); + tolua_variable(tolua_S,"Gray",tolua_get_cChatColor_Gray,NULL); + tolua_variable(tolua_S,"DarkPurple",tolua_get_cChatColor_DarkPurple,NULL); + tolua_variable(tolua_S,"LightGreen",tolua_get_cChatColor_LightGreen,NULL); + tolua_variable(tolua_S,"LightBlue",tolua_get_cChatColor_LightBlue,NULL); + tolua_variable(tolua_S,"Rose",tolua_get_cChatColor_Rose,NULL); + tolua_variable(tolua_S,"LightPurple",tolua_get_cChatColor_LightPurple,NULL); + tolua_variable(tolua_S,"Yellow",tolua_get_cChatColor_Yellow,NULL); + tolua_variable(tolua_S,"White",tolua_get_cChatColor_White,NULL); + tolua_variable(tolua_S,"Random",tolua_get_cChatColor_Random,NULL); + tolua_variable(tolua_S,"Bold",tolua_get_cChatColor_Bold,NULL); + tolua_variable(tolua_S,"Strikethrough",tolua_get_cChatColor_Strikethrough,NULL); + tolua_variable(tolua_S,"Underlined",tolua_get_cChatColor_Underlined,NULL); + tolua_variable(tolua_S,"Italic",tolua_get_cChatColor_Italic,NULL); + tolua_variable(tolua_S,"Plain",tolua_get_cChatColor_Plain,NULL); + tolua_function(tolua_S,"MakeColor",tolua_AllToLua_cChatColor_MakeColor00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cClientHandle","cClientHandle","",NULL); + tolua_beginmodule(tolua_S,"cClientHandle"); + tolua_function(tolua_S,"GetPlayer",tolua_AllToLua_cClientHandle_GetPlayer00); + tolua_function(tolua_S,"Kick",tolua_AllToLua_cClientHandle_Kick00); + tolua_function(tolua_S,"SendBlockChange",tolua_AllToLua_cClientHandle_SendBlockChange00); + tolua_function(tolua_S,"GetUsername",tolua_AllToLua_cClientHandle_GetUsername00); + tolua_function(tolua_S,"SetUsername",tolua_AllToLua_cClientHandle_SetUsername00); + tolua_function(tolua_S,"GetPing",tolua_AllToLua_cClientHandle_GetPing00); + tolua_function(tolua_S,"SetViewDistance",tolua_AllToLua_cClientHandle_SetViewDistance00); + tolua_function(tolua_S,"GetViewDistance",tolua_AllToLua_cClientHandle_GetViewDistance00); + tolua_function(tolua_S,"GetUniqueID",tolua_AllToLua_cClientHandle_GetUniqueID00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"TakeDamageInfo","TakeDamageInfo","",NULL); + tolua_beginmodule(tolua_S,"TakeDamageInfo"); + tolua_variable(tolua_S,"DamageType",tolua_get_TakeDamageInfo_DamageType,tolua_set_TakeDamageInfo_DamageType); + tolua_variable(tolua_S,"Attacker",tolua_get_TakeDamageInfo_Attacker_ptr,tolua_set_TakeDamageInfo_Attacker_ptr); + tolua_variable(tolua_S,"RawDamage",tolua_get_TakeDamageInfo_RawDamage,tolua_set_TakeDamageInfo_RawDamage); + tolua_variable(tolua_S,"FinalDamage",tolua_get_TakeDamageInfo_FinalDamage,tolua_set_TakeDamageInfo_FinalDamage); + tolua_variable(tolua_S,"Knockback",tolua_get_TakeDamageInfo_Knockback,tolua_set_TakeDamageInfo_Knockback); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cEntity","cEntity","",NULL); + tolua_beginmodule(tolua_S,"cEntity"); + tolua_constant(tolua_S,"etEntity",cEntity::etEntity); + tolua_constant(tolua_S,"etPlayer",cEntity::etPlayer); + tolua_constant(tolua_S,"etPickup",cEntity::etPickup); + tolua_constant(tolua_S,"etMonster",cEntity::etMonster); + tolua_constant(tolua_S,"etFallingBlock",cEntity::etFallingBlock); + tolua_constant(tolua_S,"etMinecart",cEntity::etMinecart); + tolua_constant(tolua_S,"etBoat",cEntity::etBoat); + tolua_constant(tolua_S,"etTNT",cEntity::etTNT); + tolua_constant(tolua_S,"etProjectile",cEntity::etProjectile); + tolua_constant(tolua_S,"etExpOrb",cEntity::etExpOrb); + tolua_constant(tolua_S,"etMob",cEntity::etMob); + tolua_function(tolua_S,"GetEntityType",tolua_AllToLua_cEntity_GetEntityType00); + tolua_function(tolua_S,"IsPlayer",tolua_AllToLua_cEntity_IsPlayer00); + tolua_function(tolua_S,"IsPickup",tolua_AllToLua_cEntity_IsPickup00); + tolua_function(tolua_S,"IsMob",tolua_AllToLua_cEntity_IsMob00); + tolua_function(tolua_S,"IsFallingBlock",tolua_AllToLua_cEntity_IsFallingBlock00); + tolua_function(tolua_S,"IsMinecart",tolua_AllToLua_cEntity_IsMinecart00); + tolua_function(tolua_S,"IsBoat",tolua_AllToLua_cEntity_IsBoat00); + tolua_function(tolua_S,"IsTNT",tolua_AllToLua_cEntity_IsTNT00); + tolua_function(tolua_S,"IsProjectile",tolua_AllToLua_cEntity_IsProjectile00); + tolua_function(tolua_S,"IsA",tolua_AllToLua_cEntity_IsA00); + tolua_function(tolua_S,"GetClass",tolua_AllToLua_cEntity_GetClass00); + tolua_function(tolua_S,"GetClassStatic",tolua_AllToLua_cEntity_GetClassStatic00); + tolua_function(tolua_S,"GetParentClass",tolua_AllToLua_cEntity_GetParentClass00); + tolua_function(tolua_S,"GetWorld",tolua_AllToLua_cEntity_GetWorld00); + tolua_function(tolua_S,"GetHeadYaw",tolua_AllToLua_cEntity_GetHeadYaw00); + tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cEntity_GetHeight00); + tolua_function(tolua_S,"GetMass",tolua_AllToLua_cEntity_GetMass00); + tolua_function(tolua_S,"GetPosition",tolua_AllToLua_cEntity_GetPosition00); + tolua_function(tolua_S,"GetPosX",tolua_AllToLua_cEntity_GetPosX00); + tolua_function(tolua_S,"GetPosY",tolua_AllToLua_cEntity_GetPosY00); + tolua_function(tolua_S,"GetPosZ",tolua_AllToLua_cEntity_GetPosZ00); + tolua_function(tolua_S,"GetRot",tolua_AllToLua_cEntity_GetRot00); + tolua_function(tolua_S,"GetRotation",tolua_AllToLua_cEntity_GetRotation00); + tolua_function(tolua_S,"GetYaw",tolua_AllToLua_cEntity_GetYaw00); + tolua_function(tolua_S,"GetPitch",tolua_AllToLua_cEntity_GetPitch00); + tolua_function(tolua_S,"GetRoll",tolua_AllToLua_cEntity_GetRoll00); + tolua_function(tolua_S,"GetLookVector",tolua_AllToLua_cEntity_GetLookVector00); + tolua_function(tolua_S,"GetSpeed",tolua_AllToLua_cEntity_GetSpeed00); + tolua_function(tolua_S,"GetSpeedX",tolua_AllToLua_cEntity_GetSpeedX00); + tolua_function(tolua_S,"GetSpeedY",tolua_AllToLua_cEntity_GetSpeedY00); + tolua_function(tolua_S,"GetSpeedZ",tolua_AllToLua_cEntity_GetSpeedZ00); + tolua_function(tolua_S,"GetWidth",tolua_AllToLua_cEntity_GetWidth00); + tolua_function(tolua_S,"GetChunkX",tolua_AllToLua_cEntity_GetChunkX00); + tolua_function(tolua_S,"GetChunkZ",tolua_AllToLua_cEntity_GetChunkZ00); + tolua_function(tolua_S,"SetHeadYaw",tolua_AllToLua_cEntity_SetHeadYaw00); + tolua_function(tolua_S,"SetHeight",tolua_AllToLua_cEntity_SetHeight00); + tolua_function(tolua_S,"SetMass",tolua_AllToLua_cEntity_SetMass00); + tolua_function(tolua_S,"SetPosX",tolua_AllToLua_cEntity_SetPosX00); + tolua_function(tolua_S,"SetPosY",tolua_AllToLua_cEntity_SetPosY00); + tolua_function(tolua_S,"SetPosZ",tolua_AllToLua_cEntity_SetPosZ00); + tolua_function(tolua_S,"SetPosition",tolua_AllToLua_cEntity_SetPosition00); + tolua_function(tolua_S,"SetPosition",tolua_AllToLua_cEntity_SetPosition01); + tolua_function(tolua_S,"SetRot",tolua_AllToLua_cEntity_SetRot00); + tolua_function(tolua_S,"SetRotation",tolua_AllToLua_cEntity_SetRotation00); + tolua_function(tolua_S,"SetYaw",tolua_AllToLua_cEntity_SetYaw00); + tolua_function(tolua_S,"SetPitch",tolua_AllToLua_cEntity_SetPitch00); + tolua_function(tolua_S,"SetRoll",tolua_AllToLua_cEntity_SetRoll00); + tolua_function(tolua_S,"SetSpeed",tolua_AllToLua_cEntity_SetSpeed00); + tolua_function(tolua_S,"SetSpeed",tolua_AllToLua_cEntity_SetSpeed01); + tolua_function(tolua_S,"SetSpeedX",tolua_AllToLua_cEntity_SetSpeedX00); + tolua_function(tolua_S,"SetSpeedY",tolua_AllToLua_cEntity_SetSpeedY00); + tolua_function(tolua_S,"SetSpeedZ",tolua_AllToLua_cEntity_SetSpeedZ00); + tolua_function(tolua_S,"SetWidth",tolua_AllToLua_cEntity_SetWidth00); + tolua_function(tolua_S,"AddPosX",tolua_AllToLua_cEntity_AddPosX00); + tolua_function(tolua_S,"AddPosY",tolua_AllToLua_cEntity_AddPosY00); + tolua_function(tolua_S,"AddPosZ",tolua_AllToLua_cEntity_AddPosZ00); + tolua_function(tolua_S,"AddPosition",tolua_AllToLua_cEntity_AddPosition00); + tolua_function(tolua_S,"AddPosition",tolua_AllToLua_cEntity_AddPosition01); + tolua_function(tolua_S,"AddSpeed",tolua_AllToLua_cEntity_AddSpeed00); + tolua_function(tolua_S,"AddSpeed",tolua_AllToLua_cEntity_AddSpeed01); + tolua_function(tolua_S,"AddSpeedX",tolua_AllToLua_cEntity_AddSpeedX00); + tolua_function(tolua_S,"AddSpeedY",tolua_AllToLua_cEntity_AddSpeedY00); + tolua_function(tolua_S,"AddSpeedZ",tolua_AllToLua_cEntity_AddSpeedZ00); + tolua_function(tolua_S,"SteerVehicle",tolua_AllToLua_cEntity_SteerVehicle00); + tolua_function(tolua_S,"GetUniqueID",tolua_AllToLua_cEntity_GetUniqueID00); + tolua_function(tolua_S,"IsDestroyed",tolua_AllToLua_cEntity_IsDestroyed00); + tolua_function(tolua_S,"Destroy",tolua_AllToLua_cEntity_Destroy00); + tolua_function(tolua_S,"TakeDamage",tolua_AllToLua_cEntity_TakeDamage00); + tolua_function(tolua_S,"TakeDamage",tolua_AllToLua_cEntity_TakeDamage01); + tolua_function(tolua_S,"TakeDamage",tolua_AllToLua_cEntity_TakeDamage02); + tolua_function(tolua_S,"GetGravity",tolua_AllToLua_cEntity_GetGravity00); + tolua_function(tolua_S,"SetGravity",tolua_AllToLua_cEntity_SetGravity00); + tolua_function(tolua_S,"SetRotationFromSpeed",tolua_AllToLua_cEntity_SetRotationFromSpeed00); + tolua_function(tolua_S,"SetPitchFromSpeed",tolua_AllToLua_cEntity_SetPitchFromSpeed00); + tolua_function(tolua_S,"GetRawDamageAgainst",tolua_AllToLua_cEntity_GetRawDamageAgainst00); + tolua_function(tolua_S,"GetArmorCoverAgainst",tolua_AllToLua_cEntity_GetArmorCoverAgainst00); + tolua_function(tolua_S,"GetKnockbackAmountAgainst",tolua_AllToLua_cEntity_GetKnockbackAmountAgainst00); + tolua_function(tolua_S,"GetEquippedWeapon",tolua_AllToLua_cEntity_GetEquippedWeapon00); + tolua_function(tolua_S,"GetEquippedHelmet",tolua_AllToLua_cEntity_GetEquippedHelmet00); + tolua_function(tolua_S,"GetEquippedChestplate",tolua_AllToLua_cEntity_GetEquippedChestplate00); + tolua_function(tolua_S,"GetEquippedLeggings",tolua_AllToLua_cEntity_GetEquippedLeggings00); + tolua_function(tolua_S,"GetEquippedBoots",tolua_AllToLua_cEntity_GetEquippedBoots00); + tolua_function(tolua_S,"KilledBy",tolua_AllToLua_cEntity_KilledBy00); + tolua_function(tolua_S,"Heal",tolua_AllToLua_cEntity_Heal00); + tolua_function(tolua_S,"GetHealth",tolua_AllToLua_cEntity_GetHealth00); + tolua_function(tolua_S,"SetHealth",tolua_AllToLua_cEntity_SetHealth00); + tolua_function(tolua_S,"SetMaxHealth",tolua_AllToLua_cEntity_SetMaxHealth00); + tolua_function(tolua_S,"GetMaxHealth",tolua_AllToLua_cEntity_GetMaxHealth00); + tolua_function(tolua_S,"StartBurning",tolua_AllToLua_cEntity_StartBurning00); + tolua_function(tolua_S,"StopBurning",tolua_AllToLua_cEntity_StopBurning00); + tolua_function(tolua_S,"TeleportToEntity",tolua_AllToLua_cEntity_TeleportToEntity00); + tolua_function(tolua_S,"TeleportToCoords",tolua_AllToLua_cEntity_TeleportToCoords00); + tolua_function(tolua_S,"IsOnFire",tolua_AllToLua_cEntity_IsOnFire00); + tolua_function(tolua_S,"IsCrouched",tolua_AllToLua_cEntity_IsCrouched00); + tolua_function(tolua_S,"IsRiding",tolua_AllToLua_cEntity_IsRiding00); + tolua_function(tolua_S,"IsSprinting",tolua_AllToLua_cEntity_IsSprinting00); + tolua_function(tolua_S,"IsRclking",tolua_AllToLua_cEntity_IsRclking00); + tolua_function(tolua_S,"IsInvisible",tolua_AllToLua_cEntity_IsInvisible00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cPawn","cPawn","cEntity",NULL); + tolua_beginmodule(tolua_S,"cPawn"); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cPlayer","cPlayer","cPawn",NULL); + tolua_beginmodule(tolua_S,"cPlayer"); + tolua_constant(tolua_S,"MAX_HEALTH",cPlayer::MAX_HEALTH); + tolua_constant(tolua_S,"MAX_FOOD_LEVEL",cPlayer::MAX_FOOD_LEVEL); + tolua_constant(tolua_S,"EATING_TICKS",cPlayer::EATING_TICKS); + tolua_constant(tolua_S,"MAX_AIR_LEVEL",cPlayer::MAX_AIR_LEVEL); + tolua_constant(tolua_S,"DROWNING_TICKS",cPlayer::DROWNING_TICKS); + tolua_function(tolua_S,"SetCurrentExperience",tolua_AllToLua_cPlayer_SetCurrentExperience00); + tolua_function(tolua_S,"DeltaExperience",tolua_AllToLua_cPlayer_DeltaExperience00); + tolua_function(tolua_S,"GetXpLifetimeTotal",tolua_AllToLua_cPlayer_GetXpLifetimeTotal00); + tolua_function(tolua_S,"GetCurrentXp",tolua_AllToLua_cPlayer_GetCurrentXp00); + tolua_function(tolua_S,"GetXpLevel",tolua_AllToLua_cPlayer_GetXpLevel00); + tolua_function(tolua_S,"GetXpPercentage",tolua_AllToLua_cPlayer_GetXpPercentage00); + tolua_function(tolua_S,"XpForLevel",tolua_AllToLua_cPlayer_XpForLevel00); + tolua_function(tolua_S,"CalcLevelFromXp",tolua_AllToLua_cPlayer_CalcLevelFromXp00); + tolua_function(tolua_S,"GetEyeHeight",tolua_AllToLua_cPlayer_GetEyeHeight00); + tolua_function(tolua_S,"GetEyePosition",tolua_AllToLua_cPlayer_GetEyePosition00); + tolua_function(tolua_S,"IsOnGround",tolua_AllToLua_cPlayer_IsOnGround00); + tolua_function(tolua_S,"GetStance",tolua_AllToLua_cPlayer_GetStance00); + tolua_function(tolua_S,"GetInventory",tolua_AllToLua_cPlayer_GetInventory00); + tolua_function(tolua_S,"GetEquippedItem",tolua_AllToLua_cPlayer_GetEquippedItem00); + tolua_function(tolua_S,"GetThrowStartPos",tolua_AllToLua_cPlayer_GetThrowStartPos00); + tolua_function(tolua_S,"GetThrowSpeed",tolua_AllToLua_cPlayer_GetThrowSpeed00); + tolua_function(tolua_S,"GetGameMode",tolua_AllToLua_cPlayer_GetGameMode00); + tolua_function(tolua_S,"GetEffectiveGameMode",tolua_AllToLua_cPlayer_GetEffectiveGameMode00); + tolua_function(tolua_S,"SetGameMode",tolua_AllToLua_cPlayer_SetGameMode00); + tolua_function(tolua_S,"IsGameModeCreative",tolua_AllToLua_cPlayer_IsGameModeCreative00); + tolua_function(tolua_S,"IsGameModeSurvival",tolua_AllToLua_cPlayer_IsGameModeSurvival00); + tolua_function(tolua_S,"IsGameModeAdventure",tolua_AllToLua_cPlayer_IsGameModeAdventure00); + tolua_function(tolua_S,"GetIP",tolua_AllToLua_cPlayer_GetIP00); + tolua_function(tolua_S,"MoveTo",tolua_AllToLua_cPlayer_MoveTo00); + tolua_function(tolua_S,"GetWindow",tolua_AllToLua_cPlayer_GetWindow00); + tolua_function(tolua_S,"CloseWindow",tolua_AllToLua_cPlayer_CloseWindow00); + tolua_function(tolua_S,"CloseWindowIfID",tolua_AllToLua_cPlayer_CloseWindowIfID00); + tolua_function(tolua_S,"GetClientHandle",tolua_AllToLua_cPlayer_GetClientHandle00); + tolua_function(tolua_S,"SendMessage",tolua_AllToLua_cPlayer_SendMessage00); + tolua_function(tolua_S,"GetName",tolua_AllToLua_cPlayer_GetName00); + tolua_function(tolua_S,"SetName",tolua_AllToLua_cPlayer_SetName00); + tolua_function(tolua_S,"AddToGroup",tolua_AllToLua_cPlayer_AddToGroup00); + tolua_function(tolua_S,"RemoveFromGroup",tolua_AllToLua_cPlayer_RemoveFromGroup00); + tolua_function(tolua_S,"CanUseCommand",tolua_AllToLua_cPlayer_CanUseCommand00); + tolua_function(tolua_S,"HasPermission",tolua_AllToLua_cPlayer_HasPermission00); + tolua_function(tolua_S,"IsInGroup",tolua_AllToLua_cPlayer_IsInGroup00); + tolua_function(tolua_S,"GetColor",tolua_AllToLua_cPlayer_GetColor00); + tolua_function(tolua_S,"TossItem",tolua_AllToLua_cPlayer_TossItem00); + tolua_function(tolua_S,"Heal",tolua_AllToLua_cPlayer_Heal00); + tolua_function(tolua_S,"GetFoodLevel",tolua_AllToLua_cPlayer_GetFoodLevel00); + tolua_function(tolua_S,"GetFoodSaturationLevel",tolua_AllToLua_cPlayer_GetFoodSaturationLevel00); + tolua_function(tolua_S,"GetFoodTickTimer",tolua_AllToLua_cPlayer_GetFoodTickTimer00); + tolua_function(tolua_S,"GetFoodExhaustionLevel",tolua_AllToLua_cPlayer_GetFoodExhaustionLevel00); + tolua_function(tolua_S,"GetFoodPoisonedTicksRemaining",tolua_AllToLua_cPlayer_GetFoodPoisonedTicksRemaining00); + tolua_function(tolua_S,"GetAirLevel",tolua_AllToLua_cPlayer_GetAirLevel00); + tolua_function(tolua_S,"IsSatiated",tolua_AllToLua_cPlayer_IsSatiated00); + tolua_function(tolua_S,"SetFoodLevel",tolua_AllToLua_cPlayer_SetFoodLevel00); + tolua_function(tolua_S,"SetFoodSaturationLevel",tolua_AllToLua_cPlayer_SetFoodSaturationLevel00); + tolua_function(tolua_S,"SetFoodTickTimer",tolua_AllToLua_cPlayer_SetFoodTickTimer00); + tolua_function(tolua_S,"SetFoodExhaustionLevel",tolua_AllToLua_cPlayer_SetFoodExhaustionLevel00); + tolua_function(tolua_S,"SetFoodPoisonedTicksRemaining",tolua_AllToLua_cPlayer_SetFoodPoisonedTicksRemaining00); + tolua_function(tolua_S,"Feed",tolua_AllToLua_cPlayer_Feed00); + tolua_function(tolua_S,"AddFoodExhaustion",tolua_AllToLua_cPlayer_AddFoodExhaustion00); + tolua_function(tolua_S,"FoodPoison",tolua_AllToLua_cPlayer_FoodPoison00); + tolua_function(tolua_S,"IsEating",tolua_AllToLua_cPlayer_IsEating00); + tolua_function(tolua_S,"Respawn",tolua_AllToLua_cPlayer_Respawn00); + tolua_function(tolua_S,"SetVisible",tolua_AllToLua_cPlayer_SetVisible00); + tolua_function(tolua_S,"IsVisible",tolua_AllToLua_cPlayer_IsVisible00); + tolua_function(tolua_S,"MoveToWorld",tolua_AllToLua_cPlayer_MoveToWorld00); + tolua_function(tolua_S,"LoadPermissionsFromDisk",tolua_AllToLua_cPlayer_LoadPermissionsFromDisk00); + tolua_function(tolua_S,"GetMaxSpeed",tolua_AllToLua_cPlayer_GetMaxSpeed00); + tolua_function(tolua_S,"GetNormalMaxSpeed",tolua_AllToLua_cPlayer_GetNormalMaxSpeed00); + tolua_function(tolua_S,"GetSprintingMaxSpeed",tolua_AllToLua_cPlayer_GetSprintingMaxSpeed00); + tolua_function(tolua_S,"SetNormalMaxSpeed",tolua_AllToLua_cPlayer_SetNormalMaxSpeed00); + tolua_function(tolua_S,"SetSprintingMaxSpeed",tolua_AllToLua_cPlayer_SetSprintingMaxSpeed00); + tolua_function(tolua_S,"SetCrouch",tolua_AllToLua_cPlayer_SetCrouch00); + tolua_function(tolua_S,"SetSprint",tolua_AllToLua_cPlayer_SetSprint00); + tolua_function(tolua_S,"IsSwimming",tolua_AllToLua_cPlayer_IsSwimming00); + tolua_function(tolua_S,"IsSubmerged",tolua_AllToLua_cPlayer_IsSubmerged00); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cPickup","cPickup","cEntity",tolua_collect_cPickup); + #else + tolua_cclass(tolua_S,"cPickup","cPickup","cEntity",NULL); + #endif + tolua_beginmodule(tolua_S,"cPickup"); + tolua_function(tolua_S,"new",tolua_AllToLua_cPickup_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cPickup_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cPickup_new00_local); + tolua_function(tolua_S,"GetItem",tolua_AllToLua_cPickup_GetItem00); + tolua_function(tolua_S,"CollectedBy",tolua_AllToLua_cPickup_CollectedBy00); + tolua_function(tolua_S,"GetAge",tolua_AllToLua_cPickup_GetAge00); + tolua_function(tolua_S,"IsCollected",tolua_AllToLua_cPickup_IsCollected00); + tolua_function(tolua_S,"IsPlayerCreated",tolua_AllToLua_cPickup_IsPlayerCreated00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cProjectileEntity","cProjectileEntity","cEntity",NULL); + tolua_beginmodule(tolua_S,"cProjectileEntity"); + tolua_constant(tolua_S,"pkArrow",cProjectileEntity::pkArrow); + tolua_constant(tolua_S,"pkSnowball",cProjectileEntity::pkSnowball); + tolua_constant(tolua_S,"pkEgg",cProjectileEntity::pkEgg); + tolua_constant(tolua_S,"pkGhastFireball",cProjectileEntity::pkGhastFireball); + tolua_constant(tolua_S,"pkFireCharge",cProjectileEntity::pkFireCharge); + tolua_constant(tolua_S,"pkEnderPearl",cProjectileEntity::pkEnderPearl); + tolua_constant(tolua_S,"pkExpBottle",cProjectileEntity::pkExpBottle); + tolua_constant(tolua_S,"pkSplashPotion",cProjectileEntity::pkSplashPotion); + tolua_constant(tolua_S,"pkFirework",cProjectileEntity::pkFirework); + tolua_constant(tolua_S,"pkWitherSkull",cProjectileEntity::pkWitherSkull); + tolua_constant(tolua_S,"pkFishingFloat",cProjectileEntity::pkFishingFloat); + tolua_function(tolua_S,"GetProjectileKind",tolua_AllToLua_cProjectileEntity_GetProjectileKind00); + tolua_function(tolua_S,"GetCreator",tolua_AllToLua_cProjectileEntity_GetCreator00); + tolua_function(tolua_S,"GetMCAClassName",tolua_AllToLua_cProjectileEntity_GetMCAClassName00); + tolua_function(tolua_S,"IsInGround",tolua_AllToLua_cProjectileEntity_IsInGround00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cArrowEntity","cArrowEntity","cProjectileEntity",NULL); + tolua_beginmodule(tolua_S,"cArrowEntity"); + tolua_constant(tolua_S,"psNoPickup",cArrowEntity::psNoPickup); + tolua_constant(tolua_S,"psInSurvivalOrCreative",cArrowEntity::psInSurvivalOrCreative); + tolua_constant(tolua_S,"psInCreative",cArrowEntity::psInCreative); + tolua_function(tolua_S,"GetPickupState",tolua_AllToLua_cArrowEntity_GetPickupState00); + tolua_function(tolua_S,"SetPickupState",tolua_AllToLua_cArrowEntity_SetPickupState00); + tolua_function(tolua_S,"GetDamageCoeff",tolua_AllToLua_cArrowEntity_GetDamageCoeff00); + tolua_function(tolua_S,"SetDamageCoeff",tolua_AllToLua_cArrowEntity_SetDamageCoeff00); + tolua_function(tolua_S,"CanPickup",tolua_AllToLua_cArrowEntity_CanPickup00); + tolua_function(tolua_S,"IsCritical",tolua_AllToLua_cArrowEntity_IsCritical00); + tolua_function(tolua_S,"SetIsCritical",tolua_AllToLua_cArrowEntity_SetIsCritical00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cThrownEggEntity","cThrownEggEntity","cProjectileEntity",NULL); + tolua_beginmodule(tolua_S,"cThrownEggEntity"); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cThrownEnderPearlEntity","cThrownEnderPearlEntity","cProjectileEntity",NULL); + tolua_beginmodule(tolua_S,"cThrownEnderPearlEntity"); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cThrownSnowballEntity","cThrownSnowballEntity","cProjectileEntity",NULL); + tolua_beginmodule(tolua_S,"cThrownSnowballEntity"); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cExpBottleEntity","cExpBottleEntity","cProjectileEntity",NULL); + tolua_beginmodule(tolua_S,"cExpBottleEntity"); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cFireworkEntity","cFireworkEntity","cProjectileEntity",NULL); + tolua_beginmodule(tolua_S,"cFireworkEntity"); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cGhastFireballEntity","cGhastFireballEntity","cProjectileEntity",NULL); + tolua_beginmodule(tolua_S,"cGhastFireballEntity"); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cFireChargeEntity","cFireChargeEntity","cProjectileEntity",NULL); + tolua_beginmodule(tolua_S,"cFireChargeEntity"); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cPluginManager","cPluginManager","",NULL); + tolua_beginmodule(tolua_S,"cPluginManager"); + tolua_constant(tolua_S,"HOOK_BLOCK_TO_PICKUPS",cPluginManager::HOOK_BLOCK_TO_PICKUPS); + tolua_constant(tolua_S,"HOOK_CHAT",cPluginManager::HOOK_CHAT); + tolua_constant(tolua_S,"HOOK_CHUNK_AVAILABLE",cPluginManager::HOOK_CHUNK_AVAILABLE); + tolua_constant(tolua_S,"HOOK_CHUNK_GENERATED",cPluginManager::HOOK_CHUNK_GENERATED); + tolua_constant(tolua_S,"HOOK_CHUNK_GENERATING",cPluginManager::HOOK_CHUNK_GENERATING); + tolua_constant(tolua_S,"HOOK_CHUNK_UNLOADED",cPluginManager::HOOK_CHUNK_UNLOADED); + tolua_constant(tolua_S,"HOOK_CHUNK_UNLOADING",cPluginManager::HOOK_CHUNK_UNLOADING); + tolua_constant(tolua_S,"HOOK_COLLECTING_PICKUP",cPluginManager::HOOK_COLLECTING_PICKUP); + tolua_constant(tolua_S,"HOOK_CRAFTING_NO_RECIPE",cPluginManager::HOOK_CRAFTING_NO_RECIPE); + tolua_constant(tolua_S,"HOOK_DISCONNECT",cPluginManager::HOOK_DISCONNECT); + tolua_constant(tolua_S,"HOOK_EXECUTE_COMMAND",cPluginManager::HOOK_EXECUTE_COMMAND); + tolua_constant(tolua_S,"HOOK_EXPLODED",cPluginManager::HOOK_EXPLODED); + tolua_constant(tolua_S,"HOOK_EXPLODING",cPluginManager::HOOK_EXPLODING); + tolua_constant(tolua_S,"HOOK_HANDSHAKE",cPluginManager::HOOK_HANDSHAKE); + tolua_constant(tolua_S,"HOOK_HOPPER_PULLING_ITEM",cPluginManager::HOOK_HOPPER_PULLING_ITEM); + tolua_constant(tolua_S,"HOOK_HOPPER_PUSHING_ITEM",cPluginManager::HOOK_HOPPER_PUSHING_ITEM); + tolua_constant(tolua_S,"HOOK_KILLING",cPluginManager::HOOK_KILLING); + tolua_constant(tolua_S,"HOOK_LOGIN",cPluginManager::HOOK_LOGIN); + tolua_constant(tolua_S,"HOOK_PLAYER_ANIMATION",cPluginManager::HOOK_PLAYER_ANIMATION); + tolua_constant(tolua_S,"HOOK_PLAYER_BREAKING_BLOCK",cPluginManager::HOOK_PLAYER_BREAKING_BLOCK); + tolua_constant(tolua_S,"HOOK_PLAYER_BROKEN_BLOCK",cPluginManager::HOOK_PLAYER_BROKEN_BLOCK); + tolua_constant(tolua_S,"HOOK_PLAYER_EATING",cPluginManager::HOOK_PLAYER_EATING); + tolua_constant(tolua_S,"HOOK_PLAYER_JOINED",cPluginManager::HOOK_PLAYER_JOINED); + tolua_constant(tolua_S,"HOOK_PLAYER_LEFT_CLICK",cPluginManager::HOOK_PLAYER_LEFT_CLICK); + tolua_constant(tolua_S,"HOOK_PLAYER_MOVING",cPluginManager::HOOK_PLAYER_MOVING); + tolua_constant(tolua_S,"HOOK_PLAYER_PLACED_BLOCK",cPluginManager::HOOK_PLAYER_PLACED_BLOCK); + tolua_constant(tolua_S,"HOOK_PLAYER_PLACING_BLOCK",cPluginManager::HOOK_PLAYER_PLACING_BLOCK); + tolua_constant(tolua_S,"HOOK_PLAYER_RIGHT_CLICK",cPluginManager::HOOK_PLAYER_RIGHT_CLICK); + tolua_constant(tolua_S,"HOOK_PLAYER_RIGHT_CLICKING_ENTITY",cPluginManager::HOOK_PLAYER_RIGHT_CLICKING_ENTITY); + tolua_constant(tolua_S,"HOOK_PLAYER_SHOOTING",cPluginManager::HOOK_PLAYER_SHOOTING); + tolua_constant(tolua_S,"HOOK_PLAYER_SPAWNED",cPluginManager::HOOK_PLAYER_SPAWNED); + tolua_constant(tolua_S,"HOOK_PLAYER_TOSSING_ITEM",cPluginManager::HOOK_PLAYER_TOSSING_ITEM); + tolua_constant(tolua_S,"HOOK_PLAYER_USED_BLOCK",cPluginManager::HOOK_PLAYER_USED_BLOCK); + tolua_constant(tolua_S,"HOOK_PLAYER_USED_ITEM",cPluginManager::HOOK_PLAYER_USED_ITEM); + tolua_constant(tolua_S,"HOOK_PLAYER_USING_BLOCK",cPluginManager::HOOK_PLAYER_USING_BLOCK); + tolua_constant(tolua_S,"HOOK_PLAYER_USING_ITEM",cPluginManager::HOOK_PLAYER_USING_ITEM); + tolua_constant(tolua_S,"HOOK_POST_CRAFTING",cPluginManager::HOOK_POST_CRAFTING); + tolua_constant(tolua_S,"HOOK_PRE_CRAFTING",cPluginManager::HOOK_PRE_CRAFTING); + tolua_constant(tolua_S,"HOOK_SPAWNED_ENTITY",cPluginManager::HOOK_SPAWNED_ENTITY); + tolua_constant(tolua_S,"HOOK_SPAWNED_MONSTER",cPluginManager::HOOK_SPAWNED_MONSTER); + tolua_constant(tolua_S,"HOOK_SPAWNING_ENTITY",cPluginManager::HOOK_SPAWNING_ENTITY); + tolua_constant(tolua_S,"HOOK_SPAWNING_MONSTER",cPluginManager::HOOK_SPAWNING_MONSTER); + tolua_constant(tolua_S,"HOOK_TAKE_DAMAGE",cPluginManager::HOOK_TAKE_DAMAGE); + tolua_constant(tolua_S,"HOOK_TICK",cPluginManager::HOOK_TICK); + tolua_constant(tolua_S,"HOOK_UPDATED_SIGN",cPluginManager::HOOK_UPDATED_SIGN); + tolua_constant(tolua_S,"HOOK_UPDATING_SIGN",cPluginManager::HOOK_UPDATING_SIGN); + tolua_constant(tolua_S,"HOOK_WEATHER_CHANGED",cPluginManager::HOOK_WEATHER_CHANGED); + tolua_constant(tolua_S,"HOOK_WEATHER_CHANGING",cPluginManager::HOOK_WEATHER_CHANGING); + tolua_constant(tolua_S,"HOOK_WORLD_TICK",cPluginManager::HOOK_WORLD_TICK); + tolua_constant(tolua_S,"HOOK_NUM_HOOKS",cPluginManager::HOOK_NUM_HOOKS); + tolua_constant(tolua_S,"HOOK_MAX",cPluginManager::HOOK_MAX); + tolua_function(tolua_S,"Get",tolua_AllToLua_cPluginManager_Get00); + tolua_function(tolua_S,"GetPlugin",tolua_AllToLua_cPluginManager_GetPlugin00); + tolua_function(tolua_S,"FindPlugins",tolua_AllToLua_cPluginManager_FindPlugins00); + tolua_function(tolua_S,"ReloadPlugins",tolua_AllToLua_cPluginManager_ReloadPlugins00); + tolua_function(tolua_S,"GetNumPlugins",tolua_AllToLua_cPluginManager_GetNumPlugins00); + tolua_function(tolua_S,"DisablePlugin",tolua_AllToLua_cPluginManager_DisablePlugin00); + tolua_function(tolua_S,"LoadPlugin",tolua_AllToLua_cPluginManager_LoadPlugin00); + tolua_function(tolua_S,"IsCommandBound",tolua_AllToLua_cPluginManager_IsCommandBound00); + tolua_function(tolua_S,"GetCommandPermission",tolua_AllToLua_cPluginManager_GetCommandPermission00); + tolua_function(tolua_S,"ExecuteCommand",tolua_AllToLua_cPluginManager_ExecuteCommand00); + tolua_function(tolua_S,"ForceExecuteCommand",tolua_AllToLua_cPluginManager_ForceExecuteCommand00); + tolua_function(tolua_S,"IsConsoleCommandBound",tolua_AllToLua_cPluginManager_IsConsoleCommandBound00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cPlugin","cPlugin","",NULL); + tolua_beginmodule(tolua_S,"cPlugin"); + tolua_function(tolua_S,"GetName",tolua_AllToLua_cPlugin_GetName00); + tolua_function(tolua_S,"SetName",tolua_AllToLua_cPlugin_SetName00); + tolua_function(tolua_S,"GetVersion",tolua_AllToLua_cPlugin_GetVersion00); + tolua_function(tolua_S,"SetVersion",tolua_AllToLua_cPlugin_SetVersion00); + tolua_function(tolua_S,"GetDirectory",tolua_AllToLua_cPlugin_GetDirectory00); + tolua_function(tolua_S,"GetLocalDirectory",tolua_AllToLua_cPlugin_GetLocalDirectory00); + tolua_function(tolua_S,"GetLocalFolder",tolua_AllToLua_cPlugin_GetLocalFolder00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cPluginLua","cPluginLua","cPlugin",NULL); + tolua_beginmodule(tolua_S,"cPluginLua"); + tolua_variable(tolua_S,"__cWebPlugin__",tolua_get_cPluginLua___cWebPlugin__,NULL); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cServer","cServer","",NULL); + tolua_beginmodule(tolua_S,"cServer"); + tolua_function(tolua_S,"GetDescription",tolua_AllToLua_cServer_GetDescription00); + tolua_function(tolua_S,"GetMaxPlayers",tolua_AllToLua_cServer_GetMaxPlayers00); + tolua_function(tolua_S,"GetNumPlayers",tolua_AllToLua_cServer_GetNumPlayers00); + tolua_function(tolua_S,"SetMaxPlayers",tolua_AllToLua_cServer_SetMaxPlayers00); + tolua_function(tolua_S,"IsHardcore",tolua_AllToLua_cServer_IsHardcore00); + tolua_function(tolua_S,"GetServerID",tolua_AllToLua_cServer_GetServerID00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cWorld","cWorld","",NULL); + tolua_beginmodule(tolua_S,"cWorld"); + tolua_function(tolua_S,"GetTicksUntilWeatherChange",tolua_AllToLua_cWorld_GetTicksUntilWeatherChange00); + tolua_function(tolua_S,"GetWorldAge",tolua_AllToLua_cWorld_GetWorldAge00); + tolua_function(tolua_S,"GetTimeOfDay",tolua_AllToLua_cWorld_GetTimeOfDay00); + tolua_function(tolua_S,"SetTicksUntilWeatherChange",tolua_AllToLua_cWorld_SetTicksUntilWeatherChange00); + tolua_function(tolua_S,"SetTimeOfDay",tolua_AllToLua_cWorld_SetTimeOfDay00); + tolua_function(tolua_S,"GetGameMode",tolua_AllToLua_cWorld_GetGameMode00); + tolua_function(tolua_S,"IsGameModeCreative",tolua_AllToLua_cWorld_IsGameModeCreative00); + tolua_function(tolua_S,"IsGameModeSurvival",tolua_AllToLua_cWorld_IsGameModeSurvival00); + tolua_function(tolua_S,"IsGameModeAdventure",tolua_AllToLua_cWorld_IsGameModeAdventure00); + tolua_function(tolua_S,"IsPVPEnabled",tolua_AllToLua_cWorld_IsPVPEnabled00); + tolua_function(tolua_S,"IsDeepSnowEnabled",tolua_AllToLua_cWorld_IsDeepSnowEnabled00); + tolua_function(tolua_S,"GetDimension",tolua_AllToLua_cWorld_GetDimension00); + tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cWorld_GetHeight00); + tolua_function(tolua_S,"BroadcastChat",tolua_AllToLua_cWorld_BroadcastChat00); + tolua_function(tolua_S,"BroadcastSoundEffect",tolua_AllToLua_cWorld_BroadcastSoundEffect00); + tolua_function(tolua_S,"BroadcastSoundParticleEffect",tolua_AllToLua_cWorld_BroadcastSoundParticleEffect00); + tolua_function(tolua_S,"UnloadUnusedChunks",tolua_AllToLua_cWorld_UnloadUnusedChunks00); + tolua_function(tolua_S,"RegenerateChunk",tolua_AllToLua_cWorld_RegenerateChunk00); + tolua_function(tolua_S,"GenerateChunk",tolua_AllToLua_cWorld_GenerateChunk00); + tolua_function(tolua_S,"SetBlock",tolua_AllToLua_cWorld_SetBlock00); + tolua_function(tolua_S,"FastSetBlock",tolua_AllToLua_cWorld_FastSetBlock00); + tolua_function(tolua_S,"QueueSetBlock",tolua_AllToLua_cWorld_QueueSetBlock00); + tolua_function(tolua_S,"GetBlock",tolua_AllToLua_cWorld_GetBlock00); + tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cWorld_GetBlockMeta00); + tolua_function(tolua_S,"SetBlockMeta",tolua_AllToLua_cWorld_SetBlockMeta00); + tolua_function(tolua_S,"GetBlockSkyLight",tolua_AllToLua_cWorld_GetBlockSkyLight00); + tolua_function(tolua_S,"GetBlockBlockLight",tolua_AllToLua_cWorld_GetBlockBlockLight00); + tolua_function(tolua_S,"FastSetBlock",tolua_AllToLua_cWorld_FastSetBlock01); + tolua_function(tolua_S,"GetBlock",tolua_AllToLua_cWorld_GetBlock01); + tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cWorld_GetBlockMeta01); + tolua_function(tolua_S,"SetBlockMeta",tolua_AllToLua_cWorld_SetBlockMeta01); + tolua_function(tolua_S,"SpawnItemPickups",tolua_AllToLua_cWorld_SpawnItemPickups00); + tolua_function(tolua_S,"SpawnItemPickups",tolua_AllToLua_cWorld_SpawnItemPickups01); + tolua_function(tolua_S,"SpawnExperienceOrb",tolua_AllToLua_cWorld_SpawnExperienceOrb00); + tolua_function(tolua_S,"SpawnPrimedTNT",tolua_AllToLua_cWorld_SpawnPrimedTNT00); + tolua_function(tolua_S,"DigBlock",tolua_AllToLua_cWorld_DigBlock00); + tolua_function(tolua_S,"SendBlockTo",tolua_AllToLua_cWorld_SendBlockTo00); + tolua_function(tolua_S,"GetSpawnX",tolua_AllToLua_cWorld_GetSpawnX00); + tolua_function(tolua_S,"GetSpawnY",tolua_AllToLua_cWorld_GetSpawnY00); + tolua_function(tolua_S,"GetSpawnZ",tolua_AllToLua_cWorld_GetSpawnZ00); + tolua_function(tolua_S,"WakeUpSimulators",tolua_AllToLua_cWorld_WakeUpSimulators00); + tolua_function(tolua_S,"WakeUpSimulatorsInArea",tolua_AllToLua_cWorld_WakeUpSimulatorsInArea00); + tolua_function(tolua_S,"DoExplosionAt",tolua_AllToLua_cWorld_DoExplosionAt00); + tolua_function(tolua_S,"UseBlockEntity",tolua_AllToLua_cWorld_UseBlockEntity00); + tolua_function(tolua_S,"GrowTree",tolua_AllToLua_cWorld_GrowTree00); + tolua_function(tolua_S,"GrowTreeFromSapling",tolua_AllToLua_cWorld_GrowTreeFromSapling00); + tolua_function(tolua_S,"GrowTreeByBiome",tolua_AllToLua_cWorld_GrowTreeByBiome00); + tolua_function(tolua_S,"GrowRipePlant",tolua_AllToLua_cWorld_GrowRipePlant00); + tolua_function(tolua_S,"GrowCactus",tolua_AllToLua_cWorld_GrowCactus00); + tolua_function(tolua_S,"GrowMelonPumpkin",tolua_AllToLua_cWorld_GrowMelonPumpkin00); + tolua_function(tolua_S,"GrowSugarcane",tolua_AllToLua_cWorld_GrowSugarcane00); + tolua_function(tolua_S,"GetBiomeAt",tolua_AllToLua_cWorld_GetBiomeAt00); + tolua_function(tolua_S,"GetName",tolua_AllToLua_cWorld_GetName00); + tolua_function(tolua_S,"GetIniFileName",tolua_AllToLua_cWorld_GetIniFileName00); + tolua_function(tolua_S,"QueueSaveAllChunks",tolua_AllToLua_cWorld_QueueSaveAllChunks00); + tolua_function(tolua_S,"GetNumChunks",tolua_AllToLua_cWorld_GetNumChunks00); + tolua_function(tolua_S,"GetGeneratorQueueLength",tolua_AllToLua_cWorld_GetGeneratorQueueLength00); + tolua_function(tolua_S,"GetLightingQueueLength",tolua_AllToLua_cWorld_GetLightingQueueLength00); + tolua_function(tolua_S,"GetStorageLoadQueueLength",tolua_AllToLua_cWorld_GetStorageLoadQueueLength00); + tolua_function(tolua_S,"GetStorageSaveQueueLength",tolua_AllToLua_cWorld_GetStorageSaveQueueLength00); + tolua_function(tolua_S,"QueueBlockForTick",tolua_AllToLua_cWorld_QueueBlockForTick00); + tolua_function(tolua_S,"CastThunderbolt",tolua_AllToLua_cWorld_CastThunderbolt00); + tolua_function(tolua_S,"SetWeather",tolua_AllToLua_cWorld_SetWeather00); + tolua_function(tolua_S,"ChangeWeather",tolua_AllToLua_cWorld_ChangeWeather00); + tolua_function(tolua_S,"GetWeather",tolua_AllToLua_cWorld_GetWeather00); + tolua_function(tolua_S,"IsWeatherSunny",tolua_AllToLua_cWorld_IsWeatherSunny00); + tolua_function(tolua_S,"IsWeatherRain",tolua_AllToLua_cWorld_IsWeatherRain00); + tolua_function(tolua_S,"IsWeatherStorm",tolua_AllToLua_cWorld_IsWeatherStorm00); + tolua_function(tolua_S,"IsWeatherWet",tolua_AllToLua_cWorld_IsWeatherWet00); + tolua_function(tolua_S,"SetNextBlockTick",tolua_AllToLua_cWorld_SetNextBlockTick00); + tolua_function(tolua_S,"GetMaxSugarcaneHeight",tolua_AllToLua_cWorld_GetMaxSugarcaneHeight00); + tolua_function(tolua_S,"GetMaxCactusHeight",tolua_AllToLua_cWorld_GetMaxCactusHeight00); + tolua_function(tolua_S,"IsBlockDirectlyWatered",tolua_AllToLua_cWorld_IsBlockDirectlyWatered00); + tolua_function(tolua_S,"SpawnMob",tolua_AllToLua_cWorld_SpawnMob00); + tolua_function(tolua_S,"CreateProjectile",tolua_AllToLua_cWorld_CreateProjectile00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cInventory","cInventory","cItemGrid::cListener",NULL); + tolua_beginmodule(tolua_S,"cInventory"); + tolua_constant(tolua_S,"invArmorCount",cInventory::invArmorCount); + tolua_constant(tolua_S,"invInventoryCount",cInventory::invInventoryCount); + tolua_constant(tolua_S,"invHotbarCount",cInventory::invHotbarCount); + tolua_constant(tolua_S,"invArmorOffset",cInventory::invArmorOffset); + tolua_constant(tolua_S,"invInventoryOffset",cInventory::invInventoryOffset); + tolua_constant(tolua_S,"invHotbarOffset",cInventory::invHotbarOffset); + tolua_constant(tolua_S,"invNumSlots",cInventory::invNumSlots); + tolua_function(tolua_S,"Clear",tolua_AllToLua_cInventory_Clear00); + tolua_function(tolua_S,"HowManyCanFit",tolua_AllToLua_cInventory_HowManyCanFit00); + tolua_function(tolua_S,"HowManyCanFit",tolua_AllToLua_cInventory_HowManyCanFit01); + tolua_function(tolua_S,"AddItem",tolua_AllToLua_cInventory_AddItem00); + tolua_function(tolua_S,"AddItems",tolua_AllToLua_cInventory_AddItems00); + tolua_function(tolua_S,"RemoveOneEquippedItem",tolua_AllToLua_cInventory_RemoveOneEquippedItem00); + tolua_function(tolua_S,"HowManyItems",tolua_AllToLua_cInventory_HowManyItems00); + tolua_function(tolua_S,"HasItems",tolua_AllToLua_cInventory_HasItems00); + tolua_function(tolua_S,"GetArmorGrid",tolua_AllToLua_cInventory_GetArmorGrid00); + tolua_function(tolua_S,"GetInventoryGrid",tolua_AllToLua_cInventory_GetInventoryGrid00); + tolua_function(tolua_S,"GetHotbarGrid",tolua_AllToLua_cInventory_GetHotbarGrid00); + tolua_function(tolua_S,"GetOwner",tolua_AllToLua_cInventory_GetOwner00); + tolua_function(tolua_S,"CopyToItems",tolua_AllToLua_cInventory_CopyToItems00); + tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cInventory_GetSlot00); + tolua_function(tolua_S,"GetArmorSlot",tolua_AllToLua_cInventory_GetArmorSlot00); + tolua_function(tolua_S,"GetInventorySlot",tolua_AllToLua_cInventory_GetInventorySlot00); + tolua_function(tolua_S,"GetHotbarSlot",tolua_AllToLua_cInventory_GetHotbarSlot00); + tolua_function(tolua_S,"GetEquippedItem",tolua_AllToLua_cInventory_GetEquippedItem00); + tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cInventory_SetSlot00); + tolua_function(tolua_S,"SetArmorSlot",tolua_AllToLua_cInventory_SetArmorSlot00); + tolua_function(tolua_S,"SetInventorySlot",tolua_AllToLua_cInventory_SetInventorySlot00); + tolua_function(tolua_S,"SetHotbarSlot",tolua_AllToLua_cInventory_SetHotbarSlot00); + tolua_function(tolua_S,"SetEquippedSlotNum",tolua_AllToLua_cInventory_SetEquippedSlotNum00); + tolua_function(tolua_S,"GetEquippedSlotNum",tolua_AllToLua_cInventory_GetEquippedSlotNum00); + tolua_function(tolua_S,"ChangeSlotCount",tolua_AllToLua_cInventory_ChangeSlotCount00); + tolua_function(tolua_S,"DamageItem",tolua_AllToLua_cInventory_DamageItem00); + tolua_function(tolua_S,"DamageEquippedItem",tolua_AllToLua_cInventory_DamageEquippedItem00); + tolua_function(tolua_S,"GetEquippedHelmet",tolua_AllToLua_cInventory_GetEquippedHelmet00); + tolua_function(tolua_S,"GetEquippedChestplate",tolua_AllToLua_cInventory_GetEquippedChestplate00); + tolua_function(tolua_S,"GetEquippedLeggings",tolua_AllToLua_cInventory_GetEquippedLeggings00); + tolua_function(tolua_S,"GetEquippedBoots",tolua_AllToLua_cInventory_GetEquippedBoots00); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cEnchantments","cEnchantments","",tolua_collect_cEnchantments); + #else + tolua_cclass(tolua_S,"cEnchantments","cEnchantments","",NULL); + #endif + tolua_beginmodule(tolua_S,"cEnchantments"); + tolua_constant(tolua_S,"enchProtection",cEnchantments::enchProtection); + tolua_constant(tolua_S,"enchFireProtection",cEnchantments::enchFireProtection); + tolua_constant(tolua_S,"enchFeatherFalling",cEnchantments::enchFeatherFalling); + tolua_constant(tolua_S,"enchBlastProtection",cEnchantments::enchBlastProtection); + tolua_constant(tolua_S,"enchProjectileProtection",cEnchantments::enchProjectileProtection); + tolua_constant(tolua_S,"enchRespiration",cEnchantments::enchRespiration); + tolua_constant(tolua_S,"enchAquaAffinity",cEnchantments::enchAquaAffinity); + tolua_constant(tolua_S,"enchThorns",cEnchantments::enchThorns); + tolua_constant(tolua_S,"enchSharpness",cEnchantments::enchSharpness); + tolua_constant(tolua_S,"enchSmite",cEnchantments::enchSmite); + tolua_constant(tolua_S,"enchBaneOfArthropods",cEnchantments::enchBaneOfArthropods); + tolua_constant(tolua_S,"enchKnockback",cEnchantments::enchKnockback); + tolua_constant(tolua_S,"enchFireAspect",cEnchantments::enchFireAspect); + tolua_constant(tolua_S,"enchLooting",cEnchantments::enchLooting); + tolua_constant(tolua_S,"enchEfficiency",cEnchantments::enchEfficiency); + tolua_constant(tolua_S,"enchSilkTouch",cEnchantments::enchSilkTouch); + tolua_constant(tolua_S,"enchUnbreaking",cEnchantments::enchUnbreaking); + tolua_constant(tolua_S,"enchFortune",cEnchantments::enchFortune); + tolua_constant(tolua_S,"enchPower",cEnchantments::enchPower); + tolua_constant(tolua_S,"enchPunch",cEnchantments::enchPunch); + tolua_constant(tolua_S,"enchFlame",cEnchantments::enchFlame); + tolua_constant(tolua_S,"enchInfinity",cEnchantments::enchInfinity); + tolua_constant(tolua_S,"enchLuckOfTheSea",cEnchantments::enchLuckOfTheSea); + tolua_constant(tolua_S,"enchLure",cEnchantments::enchLure); + tolua_function(tolua_S,"new",tolua_AllToLua_cEnchantments_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cEnchantments_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cEnchantments_new00_local); + tolua_function(tolua_S,"new",tolua_AllToLua_cEnchantments_new01); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cEnchantments_new01_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cEnchantments_new01_local); + tolua_function(tolua_S,"AddFromString",tolua_AllToLua_cEnchantments_AddFromString00); + tolua_function(tolua_S,"ToString",tolua_AllToLua_cEnchantments_ToString00); + tolua_function(tolua_S,"GetLevel",tolua_AllToLua_cEnchantments_GetLevel00); + tolua_function(tolua_S,"SetLevel",tolua_AllToLua_cEnchantments_SetLevel00); + tolua_function(tolua_S,"Clear",tolua_AllToLua_cEnchantments_Clear00); + tolua_function(tolua_S,"IsEmpty",tolua_AllToLua_cEnchantments_IsEmpty00); + tolua_function(tolua_S,"StringToEnchantmentID",tolua_AllToLua_cEnchantments_StringToEnchantmentID00); + tolua_function(tolua_S,".eq",tolua_AllToLua_cEnchantments__eq00); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cItem","cItem","",tolua_collect_cItem); + #else + tolua_cclass(tolua_S,"cItem","cItem","",NULL); + #endif + tolua_beginmodule(tolua_S,"cItem"); + tolua_function(tolua_S,"new",tolua_AllToLua_cItem_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cItem_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cItem_new00_local); + tolua_function(tolua_S,"new",tolua_AllToLua_cItem_new01); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cItem_new01_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cItem_new01_local); + tolua_function(tolua_S,"new",tolua_AllToLua_cItem_new02); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cItem_new02_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cItem_new02_local); + tolua_function(tolua_S,"new",tolua_AllToLua_cItem_new03); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cItem_new03_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cItem_new03_local); + tolua_function(tolua_S,"Empty",tolua_AllToLua_cItem_Empty00); + tolua_function(tolua_S,"Clear",tolua_AllToLua_cItem_Clear00); + tolua_function(tolua_S,"IsEmpty",tolua_AllToLua_cItem_IsEmpty00); + tolua_function(tolua_S,"IsEqual",tolua_AllToLua_cItem_IsEqual00); + tolua_function(tolua_S,"IsSameType",tolua_AllToLua_cItem_IsSameType00); + tolua_function(tolua_S,"CopyOne",tolua_AllToLua_cItem_CopyOne00); + tolua_function(tolua_S,"AddCount",tolua_AllToLua_cItem_AddCount00); + tolua_function(tolua_S,"GetMaxDamage",tolua_AllToLua_cItem_GetMaxDamage00); + tolua_function(tolua_S,"DamageItem",tolua_AllToLua_cItem_DamageItem00); + tolua_function(tolua_S,"IsDamageable",tolua_AllToLua_cItem_IsDamageable00); + tolua_function(tolua_S,"IsStackableWith",tolua_AllToLua_cItem_IsStackableWith00); + tolua_function(tolua_S,"IsFullStack",tolua_AllToLua_cItem_IsFullStack00); + tolua_function(tolua_S,"GetMaxStackSize",tolua_AllToLua_cItem_GetMaxStackSize00); + tolua_variable(tolua_S,"m_ItemType",tolua_get_cItem_m_ItemType,tolua_set_cItem_m_ItemType); + tolua_variable(tolua_S,"m_ItemCount",tolua_get_cItem_m_ItemCount,tolua_set_cItem_m_ItemCount); + tolua_variable(tolua_S,"m_ItemDamage",tolua_get_cItem_m_ItemDamage,tolua_set_cItem_m_ItemDamage); + tolua_variable(tolua_S,"m_Enchantments",tolua_get_cItem_m_Enchantments,tolua_set_cItem_m_Enchantments); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cItems","cItems","",tolua_collect_cItems); + #else + tolua_cclass(tolua_S,"cItems","cItems","",NULL); + #endif + tolua_beginmodule(tolua_S,"cItems"); + tolua_function(tolua_S,"new",tolua_AllToLua_cItems_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cItems_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cItems_new00_local); + tolua_function(tolua_S,"Get",tolua_AllToLua_cItems_Get00); + tolua_function(tolua_S,"Set",tolua_AllToLua_cItems_Set00); + tolua_function(tolua_S,"Add",tolua_AllToLua_cItems_Add00); + tolua_function(tolua_S,"Delete",tolua_AllToLua_cItems_Delete00); + tolua_function(tolua_S,"Clear",tolua_AllToLua_cItems_Clear00); + tolua_function(tolua_S,"Size",tolua_AllToLua_cItems_Size00); + tolua_function(tolua_S,"Set",tolua_AllToLua_cItems_Set01); + tolua_function(tolua_S,"Add",tolua_AllToLua_cItems_Add01); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cItemGrid","cItemGrid","",NULL); + tolua_beginmodule(tolua_S,"cItemGrid"); + tolua_function(tolua_S,"GetWidth",tolua_AllToLua_cItemGrid_GetWidth00); + tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cItemGrid_GetHeight00); + tolua_function(tolua_S,"GetNumSlots",tolua_AllToLua_cItemGrid_GetNumSlots00); + tolua_function(tolua_S,"GetSlotNum",tolua_AllToLua_cItemGrid_GetSlotNum00); + tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cItemGrid_GetSlot00); + tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cItemGrid_GetSlot01); + tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cItemGrid_SetSlot00); + tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cItemGrid_SetSlot01); + tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cItemGrid_SetSlot02); + tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cItemGrid_SetSlot03); + tolua_function(tolua_S,"EmptySlot",tolua_AllToLua_cItemGrid_EmptySlot00); + tolua_function(tolua_S,"EmptySlot",tolua_AllToLua_cItemGrid_EmptySlot01); + tolua_function(tolua_S,"IsSlotEmpty",tolua_AllToLua_cItemGrid_IsSlotEmpty00); + tolua_function(tolua_S,"IsSlotEmpty",tolua_AllToLua_cItemGrid_IsSlotEmpty01); + tolua_function(tolua_S,"Clear",tolua_AllToLua_cItemGrid_Clear00); + tolua_function(tolua_S,"HowManyCanFit",tolua_AllToLua_cItemGrid_HowManyCanFit00); + tolua_function(tolua_S,"AddItem",tolua_AllToLua_cItemGrid_AddItem00); + tolua_function(tolua_S,"AddItems",tolua_AllToLua_cItemGrid_AddItems00); + tolua_function(tolua_S,"ChangeSlotCount",tolua_AllToLua_cItemGrid_ChangeSlotCount00); + tolua_function(tolua_S,"ChangeSlotCount",tolua_AllToLua_cItemGrid_ChangeSlotCount01); + tolua_function(tolua_S,"RemoveOneItem",tolua_AllToLua_cItemGrid_RemoveOneItem00); + tolua_function(tolua_S,"RemoveOneItem",tolua_AllToLua_cItemGrid_RemoveOneItem01); + tolua_function(tolua_S,"HowManyItems",tolua_AllToLua_cItemGrid_HowManyItems00); + tolua_function(tolua_S,"HasItems",tolua_AllToLua_cItemGrid_HasItems00); + tolua_function(tolua_S,"GetFirstEmptySlot",tolua_AllToLua_cItemGrid_GetFirstEmptySlot00); + tolua_function(tolua_S,"GetFirstUsedSlot",tolua_AllToLua_cItemGrid_GetFirstUsedSlot00); + tolua_function(tolua_S,"GetLastEmptySlot",tolua_AllToLua_cItemGrid_GetLastEmptySlot00); + tolua_function(tolua_S,"GetLastUsedSlot",tolua_AllToLua_cItemGrid_GetLastUsedSlot00); + tolua_function(tolua_S,"GetNextEmptySlot",tolua_AllToLua_cItemGrid_GetNextEmptySlot00); + tolua_function(tolua_S,"GetNextUsedSlot",tolua_AllToLua_cItemGrid_GetNextUsedSlot00); + tolua_function(tolua_S,"CopyToItems",tolua_AllToLua_cItemGrid_CopyToItems00); + tolua_function(tolua_S,"DamageItem",tolua_AllToLua_cItemGrid_DamageItem00); + tolua_function(tolua_S,"DamageItem",tolua_AllToLua_cItemGrid_DamageItem01); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cBlockEntity","cBlockEntity","",tolua_collect_cBlockEntity); + #else + tolua_cclass(tolua_S,"cBlockEntity","cBlockEntity","",NULL); + #endif + tolua_beginmodule(tolua_S,"cBlockEntity"); + tolua_function(tolua_S,"GetPosX",tolua_AllToLua_cBlockEntity_GetPosX00); + tolua_function(tolua_S,"GetPosY",tolua_AllToLua_cBlockEntity_GetPosY00); + tolua_function(tolua_S,"GetPosZ",tolua_AllToLua_cBlockEntity_GetPosZ00); + tolua_function(tolua_S,"GetBlockType",tolua_AllToLua_cBlockEntity_GetBlockType00); + tolua_function(tolua_S,"GetWorld",tolua_AllToLua_cBlockEntity_GetWorld00); + tolua_function(tolua_S,"GetChunkX",tolua_AllToLua_cBlockEntity_GetChunkX00); + tolua_function(tolua_S,"GetChunkZ",tolua_AllToLua_cBlockEntity_GetChunkZ00); + tolua_function(tolua_S,"GetRelX",tolua_AllToLua_cBlockEntity_GetRelX00); + tolua_function(tolua_S,"GetRelZ",tolua_AllToLua_cBlockEntity_GetRelZ00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cBlockEntityWithItems","cBlockEntityWithItems","cBlockEntity",NULL); + tolua_beginmodule(tolua_S,"cBlockEntityWithItems"); + tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cBlockEntityWithItems_GetSlot00); + tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cBlockEntityWithItems_GetSlot01); + tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cBlockEntityWithItems_SetSlot00); + tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cBlockEntityWithItems_SetSlot01); + tolua_function(tolua_S,"GetContents",tolua_AllToLua_cBlockEntityWithItems_GetContents00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cChestEntity","cChestEntity","cBlockEntityWithItems",NULL); + tolua_beginmodule(tolua_S,"cChestEntity"); + tolua_constant(tolua_S,"ContentsHeight",cChestEntity::ContentsHeight); + tolua_constant(tolua_S,"ContentsWidth",cChestEntity::ContentsWidth); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cDropSpenserEntity","cDropSpenserEntity","cBlockEntityWithItems",NULL); + tolua_beginmodule(tolua_S,"cDropSpenserEntity"); + tolua_constant(tolua_S,"ContentsHeight",cDropSpenserEntity::ContentsHeight); + tolua_constant(tolua_S,"ContentsWidth",cDropSpenserEntity::ContentsWidth); + tolua_function(tolua_S,"AddDropSpenserDir",tolua_AllToLua_cDropSpenserEntity_AddDropSpenserDir00); + tolua_function(tolua_S,"Activate",tolua_AllToLua_cDropSpenserEntity_Activate00); + tolua_function(tolua_S,"SetRedstonePower",tolua_AllToLua_cDropSpenserEntity_SetRedstonePower00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cDispenserEntity","cDispenserEntity","cDropSpenserEntity",NULL); + tolua_beginmodule(tolua_S,"cDispenserEntity"); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cDropperEntity","cDropperEntity","cDropSpenserEntity",NULL); + tolua_beginmodule(tolua_S,"cDropperEntity"); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cFurnaceEntity","cFurnaceEntity","cBlockEntityWithItems",NULL); + tolua_beginmodule(tolua_S,"cFurnaceEntity"); + tolua_constant(tolua_S,"fsInput",cFurnaceEntity::fsInput); + tolua_constant(tolua_S,"fsFuel",cFurnaceEntity::fsFuel); + tolua_constant(tolua_S,"fsOutput",cFurnaceEntity::fsOutput); + tolua_constant(tolua_S,"ContentsWidth",cFurnaceEntity::ContentsWidth); + tolua_constant(tolua_S,"ContentsHeight",cFurnaceEntity::ContentsHeight); + tolua_function(tolua_S,"GetInputSlot",tolua_AllToLua_cFurnaceEntity_GetInputSlot00); + tolua_function(tolua_S,"GetFuelSlot",tolua_AllToLua_cFurnaceEntity_GetFuelSlot00); + tolua_function(tolua_S,"GetOutputSlot",tolua_AllToLua_cFurnaceEntity_GetOutputSlot00); + tolua_function(tolua_S,"SetInputSlot",tolua_AllToLua_cFurnaceEntity_SetInputSlot00); + tolua_function(tolua_S,"SetFuelSlot",tolua_AllToLua_cFurnaceEntity_SetFuelSlot00); + tolua_function(tolua_S,"SetOutputSlot",tolua_AllToLua_cFurnaceEntity_SetOutputSlot00); + tolua_function(tolua_S,"GetTimeCooked",tolua_AllToLua_cFurnaceEntity_GetTimeCooked00); + tolua_function(tolua_S,"GetCookTimeLeft",tolua_AllToLua_cFurnaceEntity_GetCookTimeLeft00); + tolua_function(tolua_S,"GetFuelBurnTimeLeft",tolua_AllToLua_cFurnaceEntity_GetFuelBurnTimeLeft00); + tolua_function(tolua_S,"HasFuelTimeLeft",tolua_AllToLua_cFurnaceEntity_HasFuelTimeLeft00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cHopperEntity","cHopperEntity","cBlockEntityWithItems",NULL); + tolua_beginmodule(tolua_S,"cHopperEntity"); + tolua_constant(tolua_S,"ContentsHeight",cHopperEntity::ContentsHeight); + tolua_constant(tolua_S,"ContentsWidth",cHopperEntity::ContentsWidth); + tolua_constant(tolua_S,"TICKS_PER_TRANSFER",cHopperEntity::TICKS_PER_TRANSFER); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cJukeboxEntity","cJukeboxEntity","cBlockEntity",NULL); + tolua_beginmodule(tolua_S,"cJukeboxEntity"); + tolua_function(tolua_S,"GetRecord",tolua_AllToLua_cJukeboxEntity_GetRecord00); + tolua_function(tolua_S,"SetRecord",tolua_AllToLua_cJukeboxEntity_SetRecord00); + tolua_function(tolua_S,"PlayRecord",tolua_AllToLua_cJukeboxEntity_PlayRecord00); + tolua_function(tolua_S,"EjectRecord",tolua_AllToLua_cJukeboxEntity_EjectRecord00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cNoteEntity","cNoteEntity","cBlockEntity",NULL); + tolua_beginmodule(tolua_S,"cNoteEntity"); + tolua_function(tolua_S,"GetPitch",tolua_AllToLua_cNoteEntity_GetPitch00); + tolua_function(tolua_S,"SetPitch",tolua_AllToLua_cNoteEntity_SetPitch00); + tolua_function(tolua_S,"IncrementPitch",tolua_AllToLua_cNoteEntity_IncrementPitch00); + tolua_function(tolua_S,"MakeSound",tolua_AllToLua_cNoteEntity_MakeSound00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cSignEntity","cSignEntity","cBlockEntity",NULL); + tolua_beginmodule(tolua_S,"cSignEntity"); + tolua_function(tolua_S,"SetLines",tolua_AllToLua_cSignEntity_SetLines00); + tolua_function(tolua_S,"SetLine",tolua_AllToLua_cSignEntity_SetLine00); + tolua_function(tolua_S,"GetLine",tolua_AllToLua_cSignEntity_GetLine00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"HTTPFormData","HTTPFormData","",NULL); + tolua_beginmodule(tolua_S,"HTTPFormData"); + tolua_variable(tolua_S,"Name",tolua_get_HTTPFormData_Name,tolua_set_HTTPFormData_Name); + tolua_variable(tolua_S,"Value",tolua_get_HTTPFormData_Value,tolua_set_HTTPFormData_Value); + tolua_variable(tolua_S,"Type",tolua_get_HTTPFormData_Type,tolua_set_HTTPFormData_Type); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"HTTPRequest","HTTPRequest","",NULL); + tolua_beginmodule(tolua_S,"HTTPRequest"); + tolua_variable(tolua_S,"Method",tolua_get_HTTPRequest_Method,tolua_set_HTTPRequest_Method); + tolua_variable(tolua_S,"Path",tolua_get_HTTPRequest_Path,tolua_set_HTTPRequest_Path); + tolua_variable(tolua_S,"Username",tolua_get_HTTPRequest_Username,tolua_set_HTTPRequest_Username); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"HTTPTemplateRequest","HTTPTemplateRequest","",NULL); + tolua_beginmodule(tolua_S,"HTTPTemplateRequest"); + tolua_variable(tolua_S,"Request",tolua_get_HTTPTemplateRequest_Request,tolua_set_HTTPTemplateRequest_Request); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"sWebAdminPage","sWebAdminPage","",tolua_collect_sWebAdminPage); + #else + tolua_cclass(tolua_S,"sWebAdminPage","sWebAdminPage","",NULL); + #endif + tolua_beginmodule(tolua_S,"sWebAdminPage"); + tolua_variable(tolua_S,"Content",tolua_get_sWebAdminPage_Content,tolua_set_sWebAdminPage_Content); + tolua_variable(tolua_S,"PluginName",tolua_get_sWebAdminPage_PluginName,tolua_set_sWebAdminPage_PluginName); + tolua_variable(tolua_S,"TabName",tolua_get_sWebAdminPage_TabName,tolua_set_sWebAdminPage_TabName); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cWebAdmin","cWebAdmin","cHTTPServer::cCallbacks",NULL); + tolua_beginmodule(tolua_S,"cWebAdmin"); + tolua_function(tolua_S,"GetPage",tolua_AllToLua_cWebAdmin_GetPage00); + tolua_function(tolua_S,"GetDefaultPage",tolua_AllToLua_cWebAdmin_GetDefaultPage00); + tolua_function(tolua_S,"GetBaseURL",tolua_AllToLua_cWebAdmin_GetBaseURL00); + tolua_function(tolua_S,"GetHTMLEscapedString",tolua_AllToLua_cWebAdmin_GetHTMLEscapedString00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cWebPlugin","cWebPlugin","",NULL); + tolua_beginmodule(tolua_S,"cWebPlugin"); + tolua_function(tolua_S,"GetWebTitle",tolua_AllToLua_cWebPlugin_GetWebTitle00); + tolua_function(tolua_S,"HandleWebRequest",tolua_AllToLua_cWebPlugin_HandleWebRequest00); + tolua_function(tolua_S,"SafeString",tolua_AllToLua_cWebPlugin_SafeString00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cRoot","cRoot","",NULL); + tolua_beginmodule(tolua_S,"cRoot"); + tolua_function(tolua_S,"Get",tolua_AllToLua_cRoot_Get00); + tolua_function(tolua_S,"GetServer",tolua_AllToLua_cRoot_GetServer00); + tolua_function(tolua_S,"GetDefaultWorld",tolua_AllToLua_cRoot_GetDefaultWorld00); + tolua_function(tolua_S,"GetWorld",tolua_AllToLua_cRoot_GetWorld00); + tolua_function(tolua_S,"GetPrimaryServerVersion",tolua_AllToLua_cRoot_GetPrimaryServerVersion00); + tolua_function(tolua_S,"SetPrimaryServerVersion",tolua_AllToLua_cRoot_SetPrimaryServerVersion00); + tolua_function(tolua_S,"GetGroupManager",tolua_AllToLua_cRoot_GetGroupManager00); + tolua_function(tolua_S,"GetCraftingRecipes",tolua_AllToLua_cRoot_GetCraftingRecipes00); + tolua_function(tolua_S,"GetFurnaceFuelBurnTime",tolua_AllToLua_cRoot_GetFurnaceFuelBurnTime00); + tolua_function(tolua_S,"GetWebAdmin",tolua_AllToLua_cRoot_GetWebAdmin00); + tolua_function(tolua_S,"GetPluginManager",tolua_AllToLua_cRoot_GetPluginManager00); + tolua_function(tolua_S,"QueueExecuteConsoleCommand",tolua_AllToLua_cRoot_QueueExecuteConsoleCommand00); + tolua_function(tolua_S,"GetTotalChunkCount",tolua_AllToLua_cRoot_GetTotalChunkCount00); + tolua_function(tolua_S,"SaveAllChunks",tolua_AllToLua_cRoot_SaveAllChunks00); + tolua_function(tolua_S,"BroadcastChat",tolua_AllToLua_cRoot_BroadcastChat00); + tolua_function(tolua_S,"GetProtocolVersionTextFromInt",tolua_AllToLua_cRoot_GetProtocolVersionTextFromInt00); + tolua_function(tolua_S,"GetVirtualRAMUsage",tolua_AllToLua_cRoot_GetVirtualRAMUsage00); + tolua_function(tolua_S,"GetPhysicalRAMUsage",tolua_AllToLua_cRoot_GetPhysicalRAMUsage00); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"Vector3f","Vector3f","",tolua_collect_Vector3f); + #else + tolua_cclass(tolua_S,"Vector3f","Vector3f","",NULL); + #endif + tolua_beginmodule(tolua_S,"Vector3f"); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3f_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3f_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3f_new00_local); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3f_new01); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3f_new01_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3f_new01_local); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3f_new02); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3f_new02_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3f_new02_local); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3f_new03); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3f_new03_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3f_new03_local); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3f_new04); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3f_new04_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3f_new04_local); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3f_new05); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3f_new05_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3f_new05_local); + tolua_function(tolua_S,"Set",tolua_AllToLua_Vector3f_Set00); + tolua_function(tolua_S,"Normalize",tolua_AllToLua_Vector3f_Normalize00); + tolua_function(tolua_S,"NormalizeCopy",tolua_AllToLua_Vector3f_NormalizeCopy00); + tolua_function(tolua_S,"NormalizeCopy",tolua_AllToLua_Vector3f_NormalizeCopy01); + tolua_function(tolua_S,"Length",tolua_AllToLua_Vector3f_Length00); + tolua_function(tolua_S,"SqrLength",tolua_AllToLua_Vector3f_SqrLength00); + tolua_function(tolua_S,"Dot",tolua_AllToLua_Vector3f_Dot00); + tolua_function(tolua_S,"Cross",tolua_AllToLua_Vector3f_Cross00); + tolua_function(tolua_S,"Equals",tolua_AllToLua_Vector3f_Equals00); + tolua_function(tolua_S,".add",tolua_AllToLua_Vector3f__add00); + tolua_function(tolua_S,".add",tolua_AllToLua_Vector3f__add01); + tolua_function(tolua_S,".sub",tolua_AllToLua_Vector3f__sub00); + tolua_function(tolua_S,".sub",tolua_AllToLua_Vector3f__sub01); + tolua_function(tolua_S,".mul",tolua_AllToLua_Vector3f__mul00); + tolua_function(tolua_S,".mul",tolua_AllToLua_Vector3f__mul01); + tolua_variable(tolua_S,"x",tolua_get_Vector3f_x,tolua_set_Vector3f_x); + tolua_variable(tolua_S,"y",tolua_get_Vector3f_y,tolua_set_Vector3f_y); + tolua_variable(tolua_S,"z",tolua_get_Vector3f_z,tolua_set_Vector3f_z); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"Vector3d","Vector3d","",tolua_collect_Vector3d); + #else + tolua_cclass(tolua_S,"Vector3d","Vector3d","",NULL); + #endif + tolua_beginmodule(tolua_S,"Vector3d"); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3d_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3d_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3d_new00_local); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3d_new01); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3d_new01_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3d_new01_local); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3d_new02); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3d_new02_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3d_new02_local); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3d_new03); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3d_new03_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3d_new03_local); + tolua_function(tolua_S,"Set",tolua_AllToLua_Vector3d_Set00); + tolua_function(tolua_S,"Normalize",tolua_AllToLua_Vector3d_Normalize00); + tolua_function(tolua_S,"NormalizeCopy",tolua_AllToLua_Vector3d_NormalizeCopy00); + tolua_function(tolua_S,"NormalizeCopy",tolua_AllToLua_Vector3d_NormalizeCopy01); + tolua_function(tolua_S,"Length",tolua_AllToLua_Vector3d_Length00); + tolua_function(tolua_S,"SqrLength",tolua_AllToLua_Vector3d_SqrLength00); + tolua_function(tolua_S,"Dot",tolua_AllToLua_Vector3d_Dot00); + tolua_function(tolua_S,"Cross",tolua_AllToLua_Vector3d_Cross00); + tolua_function(tolua_S,"LineCoeffToXYPlane",tolua_AllToLua_Vector3d_LineCoeffToXYPlane00); + tolua_function(tolua_S,"LineCoeffToXZPlane",tolua_AllToLua_Vector3d_LineCoeffToXZPlane00); + tolua_function(tolua_S,"LineCoeffToYZPlane",tolua_AllToLua_Vector3d_LineCoeffToYZPlane00); + tolua_function(tolua_S,"Equals",tolua_AllToLua_Vector3d_Equals00); + tolua_function(tolua_S,".add",tolua_AllToLua_Vector3d__add00); + tolua_function(tolua_S,".add",tolua_AllToLua_Vector3d__add01); + tolua_function(tolua_S,".sub",tolua_AllToLua_Vector3d__sub00); + tolua_function(tolua_S,".sub",tolua_AllToLua_Vector3d__sub01); + tolua_function(tolua_S,".mul",tolua_AllToLua_Vector3d__mul00); + tolua_function(tolua_S,".mul",tolua_AllToLua_Vector3d__mul01); + tolua_function(tolua_S,".div",tolua_AllToLua_Vector3d__div00); + tolua_variable(tolua_S,"x",tolua_get_Vector3d_x,tolua_set_Vector3d_x); + tolua_variable(tolua_S,"y",tolua_get_Vector3d_y,tolua_set_Vector3d_y); + tolua_variable(tolua_S,"z",tolua_get_Vector3d_z,tolua_set_Vector3d_z); + tolua_variable(tolua_S,"EPS",tolua_get_Vector3d_EPS,NULL); + tolua_variable(tolua_S,"NO_INTERSECTION",tolua_get_Vector3d_NO_INTERSECTION,NULL); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"Vector3i","Vector3i","",tolua_collect_Vector3i); + #else + tolua_cclass(tolua_S,"Vector3i","Vector3i","",NULL); + #endif + tolua_beginmodule(tolua_S,"Vector3i"); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3i_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3i_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3i_new00_local); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3i_new01); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3i_new01_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3i_new01_local); + tolua_function(tolua_S,"new",tolua_AllToLua_Vector3i_new02); + tolua_function(tolua_S,"new_local",tolua_AllToLua_Vector3i_new02_local); + tolua_function(tolua_S,".call",tolua_AllToLua_Vector3i_new02_local); + tolua_function(tolua_S,"Set",tolua_AllToLua_Vector3i_Set00); + tolua_function(tolua_S,"Length",tolua_AllToLua_Vector3i_Length00); + tolua_function(tolua_S,"SqrLength",tolua_AllToLua_Vector3i_SqrLength00); + tolua_function(tolua_S,"Equals",tolua_AllToLua_Vector3i_Equals00); + tolua_function(tolua_S,"Equals",tolua_AllToLua_Vector3i_Equals01); + tolua_variable(tolua_S,"x",tolua_get_Vector3i_x,tolua_set_Vector3i_x); + tolua_variable(tolua_S,"y",tolua_get_Vector3i_y,tolua_set_Vector3i_y); + tolua_variable(tolua_S,"z",tolua_get_Vector3i_z,tolua_set_Vector3i_z); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cCuboid","cCuboid","",tolua_collect_cCuboid); + #else + tolua_cclass(tolua_S,"cCuboid","cCuboid","",NULL); + #endif + tolua_beginmodule(tolua_S,"cCuboid"); + tolua_variable(tolua_S,"p1",tolua_get_cCuboid_p1,tolua_set_cCuboid_p1); + tolua_variable(tolua_S,"p2",tolua_get_cCuboid_p2,tolua_set_cCuboid_p2); + tolua_function(tolua_S,"new",tolua_AllToLua_cCuboid_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cCuboid_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cCuboid_new00_local); + tolua_function(tolua_S,"new",tolua_AllToLua_cCuboid_new01); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cCuboid_new01_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cCuboid_new01_local); + tolua_function(tolua_S,"new",tolua_AllToLua_cCuboid_new02); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cCuboid_new02_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cCuboid_new02_local); + tolua_function(tolua_S,"new",tolua_AllToLua_cCuboid_new03); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cCuboid_new03_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cCuboid_new03_local); + tolua_function(tolua_S,"new",tolua_AllToLua_cCuboid_new04); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cCuboid_new04_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cCuboid_new04_local); + tolua_function(tolua_S,"Assign",tolua_AllToLua_cCuboid_Assign00); + tolua_function(tolua_S,"Sort",tolua_AllToLua_cCuboid_Sort00); + tolua_function(tolua_S,"DifX",tolua_AllToLua_cCuboid_DifX00); + tolua_function(tolua_S,"DifY",tolua_AllToLua_cCuboid_DifY00); + tolua_function(tolua_S,"DifZ",tolua_AllToLua_cCuboid_DifZ00); + tolua_function(tolua_S,"DoesIntersect",tolua_AllToLua_cCuboid_DoesIntersect00); + tolua_function(tolua_S,"IsInside",tolua_AllToLua_cCuboid_IsInside00); + tolua_function(tolua_S,"IsInside",tolua_AllToLua_cCuboid_IsInside01); + tolua_function(tolua_S,"IsInside",tolua_AllToLua_cCuboid_IsInside02); + tolua_function(tolua_S,"IsCompletelyInside",tolua_AllToLua_cCuboid_IsCompletelyInside00); + tolua_function(tolua_S,"Move",tolua_AllToLua_cCuboid_Move00); + tolua_function(tolua_S,"IsSorted",tolua_AllToLua_cCuboid_IsSorted00); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cBoundingBox","cBoundingBox","",tolua_collect_cBoundingBox); + #else + tolua_cclass(tolua_S,"cBoundingBox","cBoundingBox","",NULL); + #endif + tolua_beginmodule(tolua_S,"cBoundingBox"); + tolua_function(tolua_S,"new",tolua_AllToLua_cBoundingBox_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cBoundingBox_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cBoundingBox_new00_local); + tolua_function(tolua_S,"new",tolua_AllToLua_cBoundingBox_new01); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cBoundingBox_new01_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cBoundingBox_new01_local); + tolua_function(tolua_S,"new",tolua_AllToLua_cBoundingBox_new02); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cBoundingBox_new02_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cBoundingBox_new02_local); + tolua_function(tolua_S,"new",tolua_AllToLua_cBoundingBox_new03); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cBoundingBox_new03_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cBoundingBox_new03_local); + tolua_function(tolua_S,"Move",tolua_AllToLua_cBoundingBox_Move00); + tolua_function(tolua_S,"Move",tolua_AllToLua_cBoundingBox_Move01); + tolua_function(tolua_S,"Expand",tolua_AllToLua_cBoundingBox_Expand00); + tolua_function(tolua_S,"DoesIntersect",tolua_AllToLua_cBoundingBox_DoesIntersect00); + tolua_function(tolua_S,"Union",tolua_AllToLua_cBoundingBox_Union00); + tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside00); + tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside01); + tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside02); + tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside03); + tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside04); + tolua_function(tolua_S,"IsInside",tolua_AllToLua_cBoundingBox_IsInside05); + tolua_function(tolua_S,"CalcLineIntersection",tolua_AllToLua_cBoundingBox_CalcLineIntersection00); + tolua_function(tolua_S,"CalcLineIntersection",tolua_AllToLua_cBoundingBox_CalcLineIntersection01); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cTracer","cTracer","",tolua_collect_cTracer); + #else + tolua_cclass(tolua_S,"cTracer","cTracer","",NULL); + #endif + tolua_beginmodule(tolua_S,"cTracer"); + tolua_variable(tolua_S,"BlockHitPosition",tolua_get_cTracer_BlockHitPosition,tolua_set_cTracer_BlockHitPosition); + tolua_variable(tolua_S,"HitNormal",tolua_get_cTracer_HitNormal,tolua_set_cTracer_HitNormal); + tolua_variable(tolua_S,"RealHit",tolua_get_cTracer_RealHit,tolua_set_cTracer_RealHit); + tolua_function(tolua_S,"new",tolua_AllToLua_cTracer_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cTracer_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cTracer_new00_local); + tolua_function(tolua_S,"delete",tolua_AllToLua_cTracer_delete00); + tolua_function(tolua_S,"Trace",tolua_AllToLua_cTracer_Trace00); + tolua_function(tolua_S,"Trace",tolua_AllToLua_cTracer_Trace01); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cGroup","cGroup","",NULL); + tolua_beginmodule(tolua_S,"cGroup"); + tolua_function(tolua_S,"SetName",tolua_AllToLua_cGroup_SetName00); + tolua_function(tolua_S,"GetName",tolua_AllToLua_cGroup_GetName00); + tolua_function(tolua_S,"SetColor",tolua_AllToLua_cGroup_SetColor00); + tolua_function(tolua_S,"AddCommand",tolua_AllToLua_cGroup_AddCommand00); + tolua_function(tolua_S,"AddPermission",tolua_AllToLua_cGroup_AddPermission00); + tolua_function(tolua_S,"InheritFrom",tolua_AllToLua_cGroup_InheritFrom00); + tolua_function(tolua_S,"HasCommand",tolua_AllToLua_cGroup_HasCommand00); + tolua_function(tolua_S,"GetColor",tolua_AllToLua_cGroup_GetColor00); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cBlockArea","cBlockArea","",tolua_collect_cBlockArea); + #else + tolua_cclass(tolua_S,"cBlockArea","cBlockArea","",NULL); + #endif + tolua_beginmodule(tolua_S,"cBlockArea"); + tolua_constant(tolua_S,"baTypes",cBlockArea::baTypes); + tolua_constant(tolua_S,"baMetas",cBlockArea::baMetas); + tolua_constant(tolua_S,"baLight",cBlockArea::baLight); + tolua_constant(tolua_S,"baSkyLight",cBlockArea::baSkyLight); + tolua_constant(tolua_S,"msOverwrite",cBlockArea::msOverwrite); + tolua_constant(tolua_S,"msFillAir",cBlockArea::msFillAir); + tolua_constant(tolua_S,"msImprint",cBlockArea::msImprint); + tolua_constant(tolua_S,"msLake",cBlockArea::msLake); + tolua_function(tolua_S,"new",tolua_AllToLua_cBlockArea_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cBlockArea_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cBlockArea_new00_local); + tolua_function(tolua_S,"delete",tolua_AllToLua_cBlockArea_delete00); + tolua_function(tolua_S,"Clear",tolua_AllToLua_cBlockArea_Clear00); + tolua_function(tolua_S,"Create",tolua_AllToLua_cBlockArea_Create00); + tolua_function(tolua_S,"Create",tolua_AllToLua_cBlockArea_Create01); + tolua_function(tolua_S,"SetOrigin",tolua_AllToLua_cBlockArea_SetOrigin00); + tolua_function(tolua_S,"Read",tolua_AllToLua_cBlockArea_Read00); + tolua_function(tolua_S,"Read",tolua_AllToLua_cBlockArea_Read01); + tolua_function(tolua_S,"Write",tolua_AllToLua_cBlockArea_Write00); + tolua_function(tolua_S,"Write",tolua_AllToLua_cBlockArea_Write01); + tolua_function(tolua_S,"CopyTo",tolua_AllToLua_cBlockArea_CopyTo00); + tolua_function(tolua_S,"CopyFrom",tolua_AllToLua_cBlockArea_CopyFrom00); + tolua_function(tolua_S,"DumpToRawFile",tolua_AllToLua_cBlockArea_DumpToRawFile00); + tolua_function(tolua_S,"LoadFromSchematicFile",tolua_AllToLua_cBlockArea_LoadFromSchematicFile00); + tolua_function(tolua_S,"SaveToSchematicFile",tolua_AllToLua_cBlockArea_SaveToSchematicFile00); + tolua_function(tolua_S,"Crop",tolua_AllToLua_cBlockArea_Crop00); + tolua_function(tolua_S,"Expand",tolua_AllToLua_cBlockArea_Expand00); + tolua_function(tolua_S,"Merge",tolua_AllToLua_cBlockArea_Merge00); + tolua_function(tolua_S,"Fill",tolua_AllToLua_cBlockArea_Fill00); + tolua_function(tolua_S,"FillRelCuboid",tolua_AllToLua_cBlockArea_FillRelCuboid00); + tolua_function(tolua_S,"RelLine",tolua_AllToLua_cBlockArea_RelLine00); + tolua_function(tolua_S,"RotateCCW",tolua_AllToLua_cBlockArea_RotateCCW00); + tolua_function(tolua_S,"RotateCW",tolua_AllToLua_cBlockArea_RotateCW00); + tolua_function(tolua_S,"MirrorXY",tolua_AllToLua_cBlockArea_MirrorXY00); + tolua_function(tolua_S,"MirrorXZ",tolua_AllToLua_cBlockArea_MirrorXZ00); + tolua_function(tolua_S,"MirrorYZ",tolua_AllToLua_cBlockArea_MirrorYZ00); + tolua_function(tolua_S,"RotateCCWNoMeta",tolua_AllToLua_cBlockArea_RotateCCWNoMeta00); + tolua_function(tolua_S,"RotateCWNoMeta",tolua_AllToLua_cBlockArea_RotateCWNoMeta00); + tolua_function(tolua_S,"MirrorXYNoMeta",tolua_AllToLua_cBlockArea_MirrorXYNoMeta00); + tolua_function(tolua_S,"MirrorXZNoMeta",tolua_AllToLua_cBlockArea_MirrorXZNoMeta00); + tolua_function(tolua_S,"MirrorYZNoMeta",tolua_AllToLua_cBlockArea_MirrorYZNoMeta00); + tolua_function(tolua_S,"SetRelBlockType",tolua_AllToLua_cBlockArea_SetRelBlockType00); + tolua_function(tolua_S,"SetBlockType",tolua_AllToLua_cBlockArea_SetBlockType00); + tolua_function(tolua_S,"SetRelBlockMeta",tolua_AllToLua_cBlockArea_SetRelBlockMeta00); + tolua_function(tolua_S,"SetBlockMeta",tolua_AllToLua_cBlockArea_SetBlockMeta00); + tolua_function(tolua_S,"SetRelBlockLight",tolua_AllToLua_cBlockArea_SetRelBlockLight00); + tolua_function(tolua_S,"SetBlockLight",tolua_AllToLua_cBlockArea_SetBlockLight00); + tolua_function(tolua_S,"SetRelBlockSkyLight",tolua_AllToLua_cBlockArea_SetRelBlockSkyLight00); + tolua_function(tolua_S,"SetBlockSkyLight",tolua_AllToLua_cBlockArea_SetBlockSkyLight00); + tolua_function(tolua_S,"GetRelBlockType",tolua_AllToLua_cBlockArea_GetRelBlockType00); + tolua_function(tolua_S,"GetBlockType",tolua_AllToLua_cBlockArea_GetBlockType00); + tolua_function(tolua_S,"GetRelBlockMeta",tolua_AllToLua_cBlockArea_GetRelBlockMeta00); + tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cBlockArea_GetBlockMeta00); + tolua_function(tolua_S,"GetRelBlockLight",tolua_AllToLua_cBlockArea_GetRelBlockLight00); + tolua_function(tolua_S,"GetBlockLight",tolua_AllToLua_cBlockArea_GetBlockLight00); + tolua_function(tolua_S,"GetRelBlockSkyLight",tolua_AllToLua_cBlockArea_GetRelBlockSkyLight00); + tolua_function(tolua_S,"GetBlockSkyLight",tolua_AllToLua_cBlockArea_GetBlockSkyLight00); + tolua_function(tolua_S,"SetBlockTypeMeta",tolua_AllToLua_cBlockArea_SetBlockTypeMeta00); + tolua_function(tolua_S,"SetRelBlockTypeMeta",tolua_AllToLua_cBlockArea_SetRelBlockTypeMeta00); + tolua_function(tolua_S,"GetBlockTypeMeta",tolua_AllToLua_cBlockArea_GetBlockTypeMeta00); + tolua_function(tolua_S,"GetRelBlockTypeMeta",tolua_AllToLua_cBlockArea_GetRelBlockTypeMeta00); + tolua_function(tolua_S,"GetSizeX",tolua_AllToLua_cBlockArea_GetSizeX00); + tolua_function(tolua_S,"GetSizeY",tolua_AllToLua_cBlockArea_GetSizeY00); + tolua_function(tolua_S,"GetSizeZ",tolua_AllToLua_cBlockArea_GetSizeZ00); + tolua_function(tolua_S,"GetOriginX",tolua_AllToLua_cBlockArea_GetOriginX00); + tolua_function(tolua_S,"GetOriginY",tolua_AllToLua_cBlockArea_GetOriginY00); + tolua_function(tolua_S,"GetOriginZ",tolua_AllToLua_cBlockArea_GetOriginZ00); + tolua_function(tolua_S,"GetDataTypes",tolua_AllToLua_cBlockArea_GetDataTypes00); + tolua_function(tolua_S,"HasBlockTypes",tolua_AllToLua_cBlockArea_HasBlockTypes00); + tolua_function(tolua_S,"HasBlockMetas",tolua_AllToLua_cBlockArea_HasBlockMetas00); + tolua_function(tolua_S,"HasBlockLights",tolua_AllToLua_cBlockArea_HasBlockLights00); + tolua_function(tolua_S,"HasBlockSkyLights",tolua_AllToLua_cBlockArea_HasBlockSkyLights00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cChunkDesc","cChunkDesc","",NULL); + tolua_beginmodule(tolua_S,"cChunkDesc"); + tolua_function(tolua_S,"GetChunkX",tolua_AllToLua_cChunkDesc_GetChunkX00); + tolua_function(tolua_S,"GetChunkZ",tolua_AllToLua_cChunkDesc_GetChunkZ00); + tolua_function(tolua_S,"FillBlocks",tolua_AllToLua_cChunkDesc_FillBlocks00); + tolua_function(tolua_S,"SetBlockTypeMeta",tolua_AllToLua_cChunkDesc_SetBlockTypeMeta00); + tolua_function(tolua_S,"GetBlockTypeMeta",tolua_AllToLua_cChunkDesc_GetBlockTypeMeta00); + tolua_function(tolua_S,"SetBlockType",tolua_AllToLua_cChunkDesc_SetBlockType00); + tolua_function(tolua_S,"GetBlockType",tolua_AllToLua_cChunkDesc_GetBlockType00); + tolua_function(tolua_S,"SetBlockMeta",tolua_AllToLua_cChunkDesc_SetBlockMeta00); + tolua_function(tolua_S,"GetBlockMeta",tolua_AllToLua_cChunkDesc_GetBlockMeta00); + tolua_function(tolua_S,"SetBiome",tolua_AllToLua_cChunkDesc_SetBiome00); + tolua_function(tolua_S,"GetBiome",tolua_AllToLua_cChunkDesc_GetBiome00); + tolua_function(tolua_S,"SetHeight",tolua_AllToLua_cChunkDesc_SetHeight00); + tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cChunkDesc_GetHeight00); + tolua_function(tolua_S,"SetUseDefaultBiomes",tolua_AllToLua_cChunkDesc_SetUseDefaultBiomes00); + tolua_function(tolua_S,"IsUsingDefaultBiomes",tolua_AllToLua_cChunkDesc_IsUsingDefaultBiomes00); + tolua_function(tolua_S,"SetUseDefaultHeight",tolua_AllToLua_cChunkDesc_SetUseDefaultHeight00); + tolua_function(tolua_S,"IsUsingDefaultHeight",tolua_AllToLua_cChunkDesc_IsUsingDefaultHeight00); + tolua_function(tolua_S,"SetUseDefaultComposition",tolua_AllToLua_cChunkDesc_SetUseDefaultComposition00); + tolua_function(tolua_S,"IsUsingDefaultComposition",tolua_AllToLua_cChunkDesc_IsUsingDefaultComposition00); + tolua_function(tolua_S,"SetUseDefaultStructures",tolua_AllToLua_cChunkDesc_SetUseDefaultStructures00); + tolua_function(tolua_S,"IsUsingDefaultStructures",tolua_AllToLua_cChunkDesc_IsUsingDefaultStructures00); + tolua_function(tolua_S,"SetUseDefaultFinish",tolua_AllToLua_cChunkDesc_SetUseDefaultFinish00); + tolua_function(tolua_S,"IsUsingDefaultFinish",tolua_AllToLua_cChunkDesc_IsUsingDefaultFinish00); + tolua_function(tolua_S,"WriteBlockArea",tolua_AllToLua_cChunkDesc_WriteBlockArea00); + tolua_function(tolua_S,"ReadBlockArea",tolua_AllToLua_cChunkDesc_ReadBlockArea00); + tolua_function(tolua_S,"GetMaxHeight",tolua_AllToLua_cChunkDesc_GetMaxHeight00); + tolua_function(tolua_S,"FillRelCuboid",tolua_AllToLua_cChunkDesc_FillRelCuboid00); + tolua_function(tolua_S,"FillRelCuboid",tolua_AllToLua_cChunkDesc_FillRelCuboid01); + tolua_function(tolua_S,"ReplaceRelCuboid",tolua_AllToLua_cChunkDesc_ReplaceRelCuboid00); + tolua_function(tolua_S,"ReplaceRelCuboid",tolua_AllToLua_cChunkDesc_ReplaceRelCuboid01); + tolua_function(tolua_S,"FloorRelCuboid",tolua_AllToLua_cChunkDesc_FloorRelCuboid00); + tolua_function(tolua_S,"FloorRelCuboid",tolua_AllToLua_cChunkDesc_FloorRelCuboid01); + tolua_function(tolua_S,"RandomFillRelCuboid",tolua_AllToLua_cChunkDesc_RandomFillRelCuboid00); + tolua_function(tolua_S,"RandomFillRelCuboid",tolua_AllToLua_cChunkDesc_RandomFillRelCuboid01); + tolua_function(tolua_S,"GetBlockEntity",tolua_AllToLua_cChunkDesc_GetBlockEntity00); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cCraftingGrid","cCraftingGrid","",tolua_collect_cCraftingGrid); + #else + tolua_cclass(tolua_S,"cCraftingGrid","cCraftingGrid","",NULL); + #endif + tolua_beginmodule(tolua_S,"cCraftingGrid"); + tolua_function(tolua_S,"new",tolua_AllToLua_cCraftingGrid_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cCraftingGrid_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cCraftingGrid_new00_local); + tolua_function(tolua_S,"GetWidth",tolua_AllToLua_cCraftingGrid_GetWidth00); + tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cCraftingGrid_GetHeight00); + tolua_function(tolua_S,"GetItem",tolua_AllToLua_cCraftingGrid_GetItem00); + tolua_function(tolua_S,"SetItem",tolua_AllToLua_cCraftingGrid_SetItem00); + tolua_function(tolua_S,"SetItem",tolua_AllToLua_cCraftingGrid_SetItem01); + tolua_function(tolua_S,"Clear",tolua_AllToLua_cCraftingGrid_Clear00); + tolua_function(tolua_S,"ConsumeGrid",tolua_AllToLua_cCraftingGrid_ConsumeGrid00); + tolua_function(tolua_S,"Dump",tolua_AllToLua_cCraftingGrid_Dump00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cCraftingRecipe","cCraftingRecipe","",NULL); + tolua_beginmodule(tolua_S,"cCraftingRecipe"); + tolua_function(tolua_S,"Clear",tolua_AllToLua_cCraftingRecipe_Clear00); + tolua_function(tolua_S,"GetIngredientsWidth",tolua_AllToLua_cCraftingRecipe_GetIngredientsWidth00); + tolua_function(tolua_S,"GetIngredientsHeight",tolua_AllToLua_cCraftingRecipe_GetIngredientsHeight00); + tolua_function(tolua_S,"GetIngredient",tolua_AllToLua_cCraftingRecipe_GetIngredient00); + tolua_function(tolua_S,"GetResult",tolua_AllToLua_cCraftingRecipe_GetResult00); + tolua_function(tolua_S,"SetResult",tolua_AllToLua_cCraftingRecipe_SetResult00); + tolua_function(tolua_S,"SetResult",tolua_AllToLua_cCraftingRecipe_SetResult01); + tolua_function(tolua_S,"SetIngredient",tolua_AllToLua_cCraftingRecipe_SetIngredient00); + tolua_function(tolua_S,"SetIngredient",tolua_AllToLua_cCraftingRecipe_SetIngredient01); + tolua_function(tolua_S,"ConsumeIngredients",tolua_AllToLua_cCraftingRecipe_ConsumeIngredients00); + tolua_function(tolua_S,"Dump",tolua_AllToLua_cCraftingRecipe_Dump00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cWindow","cWindow","",NULL); + tolua_beginmodule(tolua_S,"cWindow"); + tolua_constant(tolua_S,"wtInventory",cWindow::wtInventory); + tolua_constant(tolua_S,"wtChest",cWindow::wtChest); + tolua_constant(tolua_S,"wtWorkbench",cWindow::wtWorkbench); + tolua_constant(tolua_S,"wtFurnace",cWindow::wtFurnace); + tolua_constant(tolua_S,"wtDropSpenser",cWindow::wtDropSpenser); + tolua_constant(tolua_S,"wtEnchantment",cWindow::wtEnchantment); + tolua_constant(tolua_S,"wtBrewery",cWindow::wtBrewery); + tolua_constant(tolua_S,"wtNPCTrade",cWindow::wtNPCTrade); + tolua_constant(tolua_S,"wtBeacon",cWindow::wtBeacon); + tolua_constant(tolua_S,"wtAnvil",cWindow::wtAnvil); + tolua_constant(tolua_S,"wtHopper",cWindow::wtHopper); + tolua_constant(tolua_S,"wtAnimalChest",cWindow::wtAnimalChest); + tolua_function(tolua_S,"GetWindowID",tolua_AllToLua_cWindow_GetWindowID00); + tolua_function(tolua_S,"GetWindowType",tolua_AllToLua_cWindow_GetWindowType00); + tolua_function(tolua_S,"GetSlot",tolua_AllToLua_cWindow_GetSlot00); + tolua_function(tolua_S,"SetSlot",tolua_AllToLua_cWindow_SetSlot00); + tolua_function(tolua_S,"IsSlotInPlayerMainInventory",tolua_AllToLua_cWindow_IsSlotInPlayerMainInventory00); + tolua_function(tolua_S,"IsSlotInPlayerHotbar",tolua_AllToLua_cWindow_IsSlotInPlayerHotbar00); + tolua_function(tolua_S,"IsSlotInPlayerInventory",tolua_AllToLua_cWindow_IsSlotInPlayerInventory00); + tolua_function(tolua_S,"GetWindowTitle",tolua_AllToLua_cWindow_GetWindowTitle00); + tolua_function(tolua_S,"SetWindowTitle",tolua_AllToLua_cWindow_SetWindowTitle00); + tolua_function(tolua_S,"SetProperty",tolua_AllToLua_cWindow_SetProperty00); + tolua_function(tolua_S,"SetProperty",tolua_AllToLua_cWindow_SetProperty01); + tolua_endmodule(tolua_S); + #ifdef __cplusplus + tolua_cclass(tolua_S,"cLuaWindow","cLuaWindow","cWindow",tolua_collect_cLuaWindow); + #else + tolua_cclass(tolua_S,"cLuaWindow","cLuaWindow","cWindow",NULL); + #endif + tolua_beginmodule(tolua_S,"cLuaWindow"); + tolua_function(tolua_S,"new",tolua_AllToLua_cLuaWindow_new00); + tolua_function(tolua_S,"new_local",tolua_AllToLua_cLuaWindow_new00_local); + tolua_function(tolua_S,".call",tolua_AllToLua_cLuaWindow_new00_local); + tolua_function(tolua_S,"delete",tolua_AllToLua_cLuaWindow_delete00); + tolua_function(tolua_S,"GetContents",tolua_AllToLua_cLuaWindow_GetContents00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cMonster","cMonster","cPawn",NULL); + tolua_beginmodule(tolua_S,"cMonster"); + tolua_constant(tolua_S,"mtInvalidType",cMonster::mtInvalidType); + tolua_constant(tolua_S,"mtBat",cMonster::mtBat); + tolua_constant(tolua_S,"mtBlaze",cMonster::mtBlaze); + tolua_constant(tolua_S,"mtCaveSpider",cMonster::mtCaveSpider); + tolua_constant(tolua_S,"mtChicken",cMonster::mtChicken); + tolua_constant(tolua_S,"mtCow",cMonster::mtCow); + tolua_constant(tolua_S,"mtCreeper",cMonster::mtCreeper); + tolua_constant(tolua_S,"mtEnderDragon",cMonster::mtEnderDragon); + tolua_constant(tolua_S,"mtEnderman",cMonster::mtEnderman); + tolua_constant(tolua_S,"mtGhast",cMonster::mtGhast); + tolua_constant(tolua_S,"mtGiant",cMonster::mtGiant); + tolua_constant(tolua_S,"mtHorse",cMonster::mtHorse); + tolua_constant(tolua_S,"mtIronGolem",cMonster::mtIronGolem); + tolua_constant(tolua_S,"mtMagmaCube",cMonster::mtMagmaCube); + tolua_constant(tolua_S,"mtMooshroom",cMonster::mtMooshroom); + tolua_constant(tolua_S,"mtOcelot",cMonster::mtOcelot); + tolua_constant(tolua_S,"mtPig",cMonster::mtPig); + tolua_constant(tolua_S,"mtSheep",cMonster::mtSheep); + tolua_constant(tolua_S,"mtSilverfish",cMonster::mtSilverfish); + tolua_constant(tolua_S,"mtSkeleton",cMonster::mtSkeleton); + tolua_constant(tolua_S,"mtSlime",cMonster::mtSlime); + tolua_constant(tolua_S,"mtSnowGolem",cMonster::mtSnowGolem); + tolua_constant(tolua_S,"mtSpider",cMonster::mtSpider); + tolua_constant(tolua_S,"mtSquid",cMonster::mtSquid); + tolua_constant(tolua_S,"mtVillager",cMonster::mtVillager); + tolua_constant(tolua_S,"mtWitch",cMonster::mtWitch); + tolua_constant(tolua_S,"mtWither",cMonster::mtWither); + tolua_constant(tolua_S,"mtWolf",cMonster::mtWolf); + tolua_constant(tolua_S,"mtZombie",cMonster::mtZombie); + tolua_constant(tolua_S,"mtZombiePigman",cMonster::mtZombiePigman); + tolua_constant(tolua_S,"mfHostile",cMonster::mfHostile); + tolua_constant(tolua_S,"mfPassive",cMonster::mfPassive); + tolua_constant(tolua_S,"mfAmbient",cMonster::mfAmbient); + tolua_constant(tolua_S,"mfWater",cMonster::mfWater); + tolua_constant(tolua_S,"mfMaxplusone",cMonster::mfMaxplusone); + tolua_function(tolua_S,"GetMobType",tolua_AllToLua_cMonster_GetMobType00); + tolua_function(tolua_S,"GetMobFamily",tolua_AllToLua_cMonster_GetMobFamily00); + tolua_function(tolua_S,"MobTypeToString",tolua_AllToLua_cMonster_MobTypeToString00); + tolua_function(tolua_S,"StringToMobType",tolua_AllToLua_cMonster_StringToMobType00); + tolua_function(tolua_S,"FamilyFromType",tolua_AllToLua_cMonster_FamilyFromType00); + tolua_function(tolua_S,"GetSpawnDelay",tolua_AllToLua_cMonster_GetSpawnDelay00); + tolua_endmodule(tolua_S); + tolua_cclass(tolua_S,"cLineBlockTracer","cLineBlockTracer","",NULL); + tolua_beginmodule(tolua_S,"cLineBlockTracer"); + tolua_endmodule(tolua_S); + tolua_endmodule(tolua_S); + return 1; +} + + +#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501 + TOLUA_API int luaopen_AllToLua (lua_State* tolua_S) { + return tolua_AllToLua_open(tolua_S); +}; +#endif + diff --git a/src/Bindings.h b/src/Bindings.h new file mode 100644 index 000000000..d141484db --- /dev/null +++ b/src/Bindings.h @@ -0,0 +1,8 @@ +/* +** Lua binding: AllToLua +** Generated automatically by tolua++-1.0.92 on 11/26/13 22:11:11. +*/ + +/* Exported function */ +TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S); + diff --git a/source/BlockArea.cpp b/src/BlockArea.cpp index 5c15adfef..5c15adfef 100644 --- a/source/BlockArea.cpp +++ b/src/BlockArea.cpp diff --git a/source/BlockArea.h b/src/BlockArea.h index 075cc99ec..075cc99ec 100644 --- a/source/BlockArea.h +++ b/src/BlockArea.h diff --git a/source/BlockEntities/BlockEntity.cpp b/src/BlockEntities/BlockEntity.cpp index 41a488717..41a488717 100644 --- a/source/BlockEntities/BlockEntity.cpp +++ b/src/BlockEntities/BlockEntity.cpp diff --git a/source/BlockEntities/BlockEntity.h b/src/BlockEntities/BlockEntity.h index 0d358b556..0d358b556 100644 --- a/source/BlockEntities/BlockEntity.h +++ b/src/BlockEntities/BlockEntity.h diff --git a/source/BlockEntities/BlockEntityWithItems.h b/src/BlockEntities/BlockEntityWithItems.h index 0846ae17e..0846ae17e 100644 --- a/source/BlockEntities/BlockEntityWithItems.h +++ b/src/BlockEntities/BlockEntityWithItems.h diff --git a/src/BlockEntities/ChestEntity.cpp b/src/BlockEntities/ChestEntity.cpp new file mode 100644 index 000000000..dfbe6ae87 --- /dev/null +++ b/src/BlockEntities/ChestEntity.cpp @@ -0,0 +1,172 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "ChestEntity.h" +#include "../Item.h" +#include "../Entities/Player.h" +#include "../UI/Window.h" +#include "json/json.h" + + + + + +cChestEntity::cChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) : + super(E_BLOCK_CHEST, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World) +{ + cBlockEntityWindowOwner::SetBlockEntity(this); +} + + + + + +cChestEntity::~cChestEntity() +{ + cWindow * Window = GetWindow(); + if (Window != NULL) + { + Window->OwnerDestroyed(); + } +} + + + + + +bool cChestEntity::LoadFromJson(const Json::Value & a_Value) +{ + m_PosX = a_Value.get("x", 0).asInt(); + m_PosY = a_Value.get("y", 0).asInt(); + m_PosZ = a_Value.get("z", 0).asInt(); + + Json::Value AllSlots = a_Value.get("Slots", 0); + int SlotIdx = 0; + for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr) + { + cItem Item; + Item.FromJson(*itr); + SetSlot(SlotIdx, Item); + SlotIdx++; + } + return true; +} + + + + + +void cChestEntity::SaveToJson(Json::Value & a_Value) +{ + a_Value["x"] = m_PosX; + a_Value["y"] = m_PosY; + a_Value["z"] = m_PosZ; + + Json::Value AllSlots; + for (int i = m_Contents.GetNumSlots() - 1; i >= 0; i--) + { + Json::Value Slot; + m_Contents.GetSlot(i).GetJson(Slot); + AllSlots.append(Slot); + } + a_Value["Slots"] = AllSlots; +} + + + + + +void cChestEntity::SendTo(cClientHandle & a_Client) +{ + // The chest entity doesn't need anything sent to the client when it's created / gets in the viewdistance + // All the actual handling is in the cWindow UI code that gets called when the chest is rclked + + UNUSED(a_Client); +} + + + + + +void cChestEntity::UsedBy(cPlayer * a_Player) +{ + // If the window is not created, open it anew: + cWindow * Window = GetWindow(); + if (Window == NULL) + { + OpenNewWindow(); + Window = GetWindow(); + } + + // Open the window for the player: + if (Window != NULL) + { + if (a_Player->GetWindow() != Window) + { + a_Player->OpenWindow(Window); + } + } + + // This is rather a hack + // Instead of marking the chunk as dirty upon chest contents change, we mark it dirty now + // We cannot properly detect contents change, but such a change doesn't happen without a player opening the chest first. + // The few false positives aren't much to worry about + int ChunkX, ChunkZ; + cChunkDef::BlockToChunk(m_PosX, m_PosZ, ChunkX, ChunkZ); + m_World->MarkChunkDirty(ChunkX, ChunkZ); +} + + + + + +void cChestEntity::OpenNewWindow(void) +{ + // Callback for opening together with neighbor chest: + class cOpenDouble : + public cChestCallback + { + cChestEntity * m_ThisChest; + public: + cOpenDouble(cChestEntity * a_ThisChest) : + m_ThisChest(a_ThisChest) + { + } + + virtual bool Item(cChestEntity * a_Chest) override + { + // The primary chest should eb the one with lesser X or Z coord: + cChestEntity * Primary = a_Chest; + cChestEntity * Secondary = m_ThisChest; + if ( + (Primary->GetPosX() > Secondary->GetPosX()) || + (Primary->GetPosZ() > Secondary->GetPosZ()) + ) + { + std::swap(Primary, Secondary); + } + m_ThisChest->OpenWindow(new cChestWindow(Primary, Secondary)); + return false; + } + } ; + + // Scan neighbors for adjacent chests: + cOpenDouble OpenDbl(this); + if ( + m_World->DoWithChestAt(m_PosX - 1, m_PosY, m_PosZ, OpenDbl) || + m_World->DoWithChestAt(m_PosX + 1, m_PosY, m_PosZ, OpenDbl) || + m_World->DoWithChestAt(m_PosX , m_PosY, m_PosZ - 1, OpenDbl) || + m_World->DoWithChestAt(m_PosX , m_PosY, m_PosZ + 1, OpenDbl) + ) + { + // The double-chest window has been opened in the callback + return; + } + + // There is no chest neighbor, open a single-chest window: + OpenWindow(new cChestWindow(this)); +} + + + + diff --git a/source/BlockEntities/ChestEntity.h b/src/BlockEntities/ChestEntity.h index 4f2c21e91..4f2c21e91 100644 --- a/source/BlockEntities/ChestEntity.h +++ b/src/BlockEntities/ChestEntity.h diff --git a/source/BlockEntities/DispenserEntity.cpp b/src/BlockEntities/DispenserEntity.cpp index 374f3d6e3..374f3d6e3 100644 --- a/source/BlockEntities/DispenserEntity.cpp +++ b/src/BlockEntities/DispenserEntity.cpp diff --git a/source/BlockEntities/DispenserEntity.h b/src/BlockEntities/DispenserEntity.h index fdfe4e5b4..fdfe4e5b4 100644 --- a/source/BlockEntities/DispenserEntity.h +++ b/src/BlockEntities/DispenserEntity.h diff --git a/source/BlockEntities/DropSpenserEntity.cpp b/src/BlockEntities/DropSpenserEntity.cpp index 823ed598f..823ed598f 100644 --- a/source/BlockEntities/DropSpenserEntity.cpp +++ b/src/BlockEntities/DropSpenserEntity.cpp diff --git a/source/BlockEntities/DropSpenserEntity.h b/src/BlockEntities/DropSpenserEntity.h index 0e9039915..0e9039915 100644 --- a/source/BlockEntities/DropSpenserEntity.h +++ b/src/BlockEntities/DropSpenserEntity.h diff --git a/source/BlockEntities/DropperEntity.cpp b/src/BlockEntities/DropperEntity.cpp index 5d4a8ad97..5d4a8ad97 100644 --- a/source/BlockEntities/DropperEntity.cpp +++ b/src/BlockEntities/DropperEntity.cpp diff --git a/source/BlockEntities/DropperEntity.h b/src/BlockEntities/DropperEntity.h index 8e07bc6f8..8e07bc6f8 100644 --- a/source/BlockEntities/DropperEntity.h +++ b/src/BlockEntities/DropperEntity.h diff --git a/src/BlockEntities/FurnaceEntity.cpp b/src/BlockEntities/FurnaceEntity.cpp new file mode 100644 index 000000000..b1409f5cc --- /dev/null +++ b/src/BlockEntities/FurnaceEntity.cpp @@ -0,0 +1,479 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "FurnaceEntity.h" +#include "../UI/Window.h" +#include "../Entities/Player.h" +#include "../Root.h" +#include "../Chunk.h" +#include "json/json.h" + + + + + + +enum +{ + PROGRESSBAR_SMELTING = 0, + PROGRESSBAR_FUEL = 1, +} ; + + + + + +cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cWorld * a_World) : + super(E_BLOCK_FURNACE, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World), + m_BlockType(a_BlockType), + m_BlockMeta(a_BlockMeta), + m_CurrentRecipe(NULL), + m_IsCooking((a_World->GetBlock(a_BlockX, a_BlockY, a_BlockZ) == E_BLOCK_LIT_FURNACE)), + m_NeedCookTime(0), + m_TimeCooked(0), + m_FuelBurnTime(0), + m_TimeBurned(0), + m_LastProgressFuel(0), + m_LastProgressCook(0) +{ + cBlockEntityWindowOwner::SetBlockEntity(this); + m_Contents.AddListener(*this); +} + + + + + +cFurnaceEntity::~cFurnaceEntity() +{ + // Tell window its owner is destroyed + cWindow * Window = GetWindow(); + if (Window != NULL) + { + Window->OwnerDestroyed(); + } +} + + + + + +void cFurnaceEntity::UsedBy(cPlayer * a_Player) +{ + if (GetWindow() == NULL) + { + OpenWindow(new cFurnaceWindow(m_PosX, m_PosY, m_PosZ, this)); + } + cWindow * Window = GetWindow(); + if (Window != NULL) + { + if (a_Player->GetWindow() != Window) + { + a_Player->OpenWindow(Window); + BroadcastProgress(PROGRESSBAR_FUEL, m_LastProgressFuel); + BroadcastProgress(PROGRESSBAR_SMELTING, m_LastProgressCook); + } + } +} + + + + + +/// Restarts cooking. Used after the furnace is loaded from storage to set up the internal variables so that cooking continues, if it was active. Returns true if cooking. +bool cFurnaceEntity::ContinueCooking(void) +{ + UpdateInput(); + UpdateFuel(); + return m_IsCooking; +} + + + + + +bool cFurnaceEntity::Tick(float a_Dt, cChunk & a_Chunk) +{ + if (m_FuelBurnTime <= 0) + { + // No fuel is burning, reset progressbars and bail out + if ((m_LastProgressCook > 0) || (m_LastProgressFuel > 0)) + { + UpdateProgressBars(); + } + return false; + } + + if (m_IsCooking) + { + m_TimeCooked++; + if (m_TimeCooked >= m_NeedCookTime) + { + // Finished smelting one item + FinishOne(a_Chunk); + } + } + + m_TimeBurned++; + if (m_TimeBurned >= m_FuelBurnTime) + { + // The current fuel has been exhausted, use another one, if possible + BurnNewFuel(); + } + + UpdateProgressBars(); + + return true; +} + + + + + +bool cFurnaceEntity::LoadFromJson(const Json::Value & a_Value) +{ + m_PosX = a_Value.get("x", 0).asInt(); + m_PosY = a_Value.get("y", 0).asInt(); + m_PosZ = a_Value.get("z", 0).asInt(); + + Json::Value AllSlots = a_Value.get("Slots", 0); + int SlotIdx = 0; + for (Json::Value::iterator itr = AllSlots.begin(); itr != AllSlots.end(); ++itr) + { + cItem Item; + Item.FromJson(*itr); + SetSlot(SlotIdx, Item); + SlotIdx++; + } + + m_NeedCookTime = (int)(a_Value.get("CookTime", 0).asDouble() / 50); + m_TimeCooked = (int)(a_Value.get("TimeCooked", 0).asDouble() / 50); + m_FuelBurnTime = (int)(a_Value.get("BurnTime", 0).asDouble() / 50); + m_TimeBurned = (int)(a_Value.get("TimeBurned", 0).asDouble() / 50); + + return true; +} + + + + + +void cFurnaceEntity::SaveToJson( Json::Value& a_Value ) +{ + a_Value["x"] = m_PosX; + a_Value["y"] = m_PosY; + a_Value["z"] = m_PosZ; + + Json::Value AllSlots; + int NumSlots = m_Contents.GetNumSlots(); + for (int i = 0; i < NumSlots; i++) + { + Json::Value Slot; + m_Contents.GetSlot(i).GetJson(Slot); + AllSlots.append(Slot); + } + a_Value["Slots"] = AllSlots; + + a_Value["CookTime"] = m_NeedCookTime * 50; + a_Value["TimeCooked"] = m_TimeCooked * 50; + a_Value["BurnTime"] = m_FuelBurnTime * 50; + a_Value["TimeBurned"] = m_TimeBurned * 50; +} + + + + + +void cFurnaceEntity::SendTo(cClientHandle & a_Client) +{ + // Nothing needs to be sent + UNUSED(a_Client); +} + + + + + +void cFurnaceEntity::BroadcastProgress(int a_ProgressbarID, short a_Value) +{ + cWindow * Window = GetWindow(); + if (Window != NULL) + { + Window->BroadcastProgress(a_ProgressbarID, a_Value); + } +} + + + + + +/// One item finished cooking +void cFurnaceEntity::FinishOne(cChunk & a_Chunk) +{ + m_TimeCooked = 0; + + if (m_Contents.GetSlot(fsOutput).IsEmpty()) + { + m_Contents.SetSlot(fsOutput, *m_CurrentRecipe->Out); + } + else + { + m_Contents.ChangeSlotCount(fsOutput, m_CurrentRecipe->Out->m_ItemCount); + } + m_Contents.ChangeSlotCount(fsInput, -m_CurrentRecipe->In->m_ItemCount); + + UpdateIsCooking(); +} + + + + + +void cFurnaceEntity::BurnNewFuel(void) +{ + cFurnaceRecipe * FR = cRoot::Get()->GetFurnaceRecipe(); + int NewTime = FR->GetBurnTime(m_Contents.GetSlot(fsFuel)); + if (NewTime == 0) + { + // The item in the fuel slot is not suitable + m_FuelBurnTime = 0; + m_TimeBurned = 0; + SetIsCooking(false); + return; + } + + // Is the input and output ready for cooking? + if (!CanCookInputToOutput()) + { + return; + } + + // Burn one new fuel: + m_FuelBurnTime = NewTime; + m_TimeBurned = 0; + SetIsCooking(true); + if (m_Contents.GetSlot(fsFuel).m_ItemType == E_ITEM_LAVA_BUCKET) + { + m_Contents.SetSlot(fsFuel, cItem(E_ITEM_BUCKET)); + } + else + { + m_Contents.ChangeSlotCount(fsFuel, -1); + } +} + + + + + +void cFurnaceEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) +{ + super::OnSlotChanged(a_ItemGrid, a_SlotNum); + + if (m_World == NULL) + { + // The furnace isn't initialized yet, do no processing + return; + } + + ASSERT(a_ItemGrid == &m_Contents); + switch (a_SlotNum) + { + case fsInput: + { + UpdateInput(); + break; + } + + case fsFuel: + { + UpdateFuel(); + break; + } + + case fsOutput: + { + UpdateOutput(); + break; + } + } +} + + + + + + +/// Updates the current recipe, based on the current input +void cFurnaceEntity::UpdateInput(void) +{ + if (!m_Contents.GetSlot(fsInput).IsStackableWith(m_LastInput)) + { + // The input is different from what we had before, reset the cooking time + m_TimeCooked = 0; + } + m_LastInput = m_Contents.GetSlot(fsInput); + + cFurnaceRecipe * FR = cRoot::Get()->GetFurnaceRecipe(); + m_CurrentRecipe = FR->GetRecipeFrom(m_Contents.GetSlot(fsInput)); + if (!CanCookInputToOutput()) + { + // This input cannot be cooked + m_NeedCookTime = 0; + SetIsCooking(false); + } + else + { + m_NeedCookTime = m_CurrentRecipe->CookTime; + SetIsCooking(true); + + // Start burning new fuel if there's no flame now: + if (GetFuelBurnTimeLeft() <= 0) + { + BurnNewFuel(); + } + } +} + + + + + +/// Called when the fuel slot changes or when the fuel is spent, burns another piece of fuel if appropriate +void cFurnaceEntity::UpdateFuel(void) +{ + if (m_FuelBurnTime > m_TimeBurned) + { + // The current fuel is still burning, don't modify anything: + return; + } + + // The current fuel is spent, try to burn some more: + BurnNewFuel(); +} + + + + + +/// Called when the output slot changes; starts burning if space became available +void cFurnaceEntity::UpdateOutput(void) +{ + if (!CanCookInputToOutput()) + { + // Cannot cook anymore: + m_TimeCooked = 0; + m_NeedCookTime = 0; + SetIsCooking(false); + return; + } + + // No need to burn new fuel, the Tick() function will take care of that + + // Can cook, start cooking if not already underway: + m_NeedCookTime = m_CurrentRecipe->CookTime; + SetIsCooking(m_FuelBurnTime > 0); +} + + + + + +/// Updates the m_IsCooking, based on the input slot, output slot and m_FuelBurnTime / m_TimeBurned +void cFurnaceEntity::UpdateIsCooking(void) +{ + if ( + !CanCookInputToOutput() || // Cannot cook this + (m_FuelBurnTime <= 0) || // No fuel + (m_TimeBurned >= m_FuelBurnTime) // Fuel burnt out + ) + { + // Reset everything + SetIsCooking(false); + m_TimeCooked = 0; + m_NeedCookTime = 0; + return; + } + + SetIsCooking(true); +} + + + + + +/// Returns true if the input can be cooked into output and the item counts allow for another cooking operation +bool cFurnaceEntity::CanCookInputToOutput(void) const +{ + if (m_CurrentRecipe == NULL) + { + // This input cannot be cooked + return false; + } + + if (m_Contents.GetSlot(fsOutput).IsEmpty()) + { + // The output is empty, can cook + return true; + } + + if (!m_Contents.GetSlot(fsOutput).IsStackableWith(*m_CurrentRecipe->Out)) + { + // The output slot is blocked with something that cannot be stacked with the recipe's output + return false; + } + + if (m_Contents.GetSlot(fsOutput).IsFullStack()) + { + // Cannot add any more items to the output slot + return false; + } + + return true; +} + + + + + +/// Broadcasts progressbar updates, if needed +void cFurnaceEntity::UpdateProgressBars(void) +{ + // In order to preserve bandwidth, an update is sent only every 10th tick + // That's why the comparisons use the division by eight + + int CurFuel = (m_FuelBurnTime > 0) ? (200 - 200 * m_TimeBurned / m_FuelBurnTime) : 0; + if ((CurFuel / 8) != (m_LastProgressFuel / 8)) + { + BroadcastProgress(PROGRESSBAR_FUEL, CurFuel); + m_LastProgressFuel = CurFuel; + } + + int CurCook = (m_NeedCookTime > 0) ? (200 * m_TimeCooked / m_NeedCookTime) : 0; + if ((CurCook / 8) != (m_LastProgressCook / 8)) + { + BroadcastProgress(PROGRESSBAR_SMELTING, CurCook); + m_LastProgressCook = CurCook; + } +} + + + + + +void cFurnaceEntity::SetIsCooking(bool a_IsCooking) +{ + if (a_IsCooking == m_IsCooking) + { + return; + } + + m_IsCooking = a_IsCooking; + + // Light or extinguish the furnace: + m_World->FastSetBlock(m_PosX, m_PosY, m_PosZ, m_IsCooking ? E_BLOCK_LIT_FURNACE : E_BLOCK_FURNACE, m_BlockMeta); +} + + + + diff --git a/source/BlockEntities/FurnaceEntity.h b/src/BlockEntities/FurnaceEntity.h index 9464fd175..9464fd175 100644 --- a/source/BlockEntities/FurnaceEntity.h +++ b/src/BlockEntities/FurnaceEntity.h diff --git a/source/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp index 41849b1b3..41849b1b3 100644 --- a/source/BlockEntities/HopperEntity.cpp +++ b/src/BlockEntities/HopperEntity.cpp diff --git a/source/BlockEntities/HopperEntity.h b/src/BlockEntities/HopperEntity.h index 3eaa05b7c..3eaa05b7c 100644 --- a/source/BlockEntities/HopperEntity.h +++ b/src/BlockEntities/HopperEntity.h diff --git a/src/BlockEntities/JukeboxEntity.cpp b/src/BlockEntities/JukeboxEntity.cpp new file mode 100644 index 000000000..33042179d --- /dev/null +++ b/src/BlockEntities/JukeboxEntity.cpp @@ -0,0 +1,125 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "JukeboxEntity.h" +#include "../World.h" +#include "json/json.h" + + + + + +cJukeboxEntity::cJukeboxEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) : + super(E_BLOCK_JUKEBOX, a_BlockX, a_BlockY, a_BlockZ, a_World), + m_Record(0) +{ +} + + + + + +cJukeboxEntity::~cJukeboxEntity() +{ + EjectRecord(); +} + + + + + +void cJukeboxEntity::UsedBy(cPlayer * a_Player) +{ + if (m_Record == 0) + { + const cItem & HeldItem = a_Player->GetEquippedItem(); + if (HeldItem.m_ItemType >= 2256 && HeldItem.m_ItemType <= 2267) + { + m_Record = HeldItem.m_ItemType; + a_Player->GetInventory().RemoveOneEquippedItem(); + PlayRecord(); + } + } + else + { + EjectRecord(); + } +} + + + + + +void cJukeboxEntity::PlayRecord(void) +{ + m_World->BroadcastSoundParticleEffect(1005, m_PosX, m_PosY, m_PosZ, m_Record); +} + + + + + +void cJukeboxEntity::EjectRecord(void) +{ + if ((m_Record < E_ITEM_FIRST_DISC) || (m_Record > E_ITEM_LAST_DISC)) + { + // There's no record here + return; + } + + cItems Drops; + Drops.push_back(cItem(m_Record, 1, 0)); + m_World->SpawnItemPickups(Drops, m_PosX + 0.5, m_PosY + 1, m_PosZ + 0.5, 8); + m_World->BroadcastSoundParticleEffect(1005, m_PosX, m_PosY, m_PosZ, 0); + m_Record = 0; +} + + + + + +int cJukeboxEntity::GetRecord(void) +{ + return m_Record; +} + + + + + +void cJukeboxEntity::SetRecord(int a_Record) +{ + m_Record = a_Record; +} + + + + + +bool cJukeboxEntity::LoadFromJson(const Json::Value & a_Value) +{ + m_PosX = a_Value.get("x", 0).asInt(); + m_PosY = a_Value.get("y", 0).asInt(); + m_PosZ = a_Value.get("z", 0).asInt(); + + m_Record = a_Value.get("Record", 0).asInt(); + + return true; +} + + + + + +void cJukeboxEntity::SaveToJson(Json::Value & a_Value) +{ + a_Value["x"] = m_PosX; + a_Value["y"] = m_PosY; + a_Value["z"] = m_PosZ; + + a_Value["Record"] = m_Record; +} + + + + diff --git a/source/BlockEntities/JukeboxEntity.h b/src/BlockEntities/JukeboxEntity.h index fcafdc479..fcafdc479 100644 --- a/source/BlockEntities/JukeboxEntity.h +++ b/src/BlockEntities/JukeboxEntity.h diff --git a/src/BlockEntities/NoteEntity.cpp b/src/BlockEntities/NoteEntity.cpp new file mode 100644 index 000000000..9a33ead62 --- /dev/null +++ b/src/BlockEntities/NoteEntity.cpp @@ -0,0 +1,154 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "NoteEntity.h" +#include "../World.h" +#include "json/json.h" + + + + + +cNoteEntity::cNoteEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World) : + super(E_BLOCK_NOTE_BLOCK, a_BlockX, a_BlockY, a_BlockZ, a_World), + m_Pitch(0) +{ +} + + + + + +void cNoteEntity::UsedBy(cPlayer * a_Player) +{ + IncrementPitch(); + MakeSound(); +} + + + + + +void cNoteEntity::MakeSound(void) +{ + char instrument; + AString sampleName; + + switch (m_World->GetBlock(m_PosX, m_PosY - 1, m_PosZ)) + { + case E_BLOCK_PLANKS: + case E_BLOCK_LOG: + case E_BLOCK_NOTE_BLOCK: + { + // TODO: add other wood-based blocks if needed + instrument = E_INST_DOUBLE_BASS; + sampleName = "note.db"; + break; + } + + case E_BLOCK_SAND: + case E_BLOCK_GRAVEL: + case E_BLOCK_SOULSAND: + { + instrument = E_INST_SNARE_DRUM; + sampleName = "note.snare"; + break; + } + + case E_BLOCK_GLASS: + case E_BLOCK_GLASS_PANE: + case E_BLOCK_GLOWSTONE: + { + instrument = E_INST_CLICKS; + sampleName = "note.hat"; + break; + } + + case E_BLOCK_STONE: + case E_BLOCK_STONE_BRICKS: + case E_BLOCK_COBBLESTONE: + case E_BLOCK_OBSIDIAN: + case E_BLOCK_NETHERRACK: + case E_BLOCK_BRICK: + case E_BLOCK_NETHER_BRICK: + { + // TODO: add other stone-based blocks if needed + instrument = E_INST_BASS_DRUM; + sampleName = "note.bassattack"; + break; + } + + default: + { + instrument = E_INST_HARP_PIANO; + sampleName = "note.harp"; + break; + } + } + + m_World->BroadcastBlockAction(m_PosX, m_PosY, m_PosZ, instrument, m_Pitch, E_BLOCK_NOTE_BLOCK); + + // TODO: instead of calculating the power function over and over, make a precalculated table - there's only 24 pitches after all + float calcPitch = pow(2.0f, ((float)m_Pitch - 12.0f) / 12.0f); + m_World->BroadcastSoundEffect(sampleName, m_PosX * 8, m_PosY * 8, m_PosZ * 8, 3.0f, calcPitch); +} + + + + + +char cNoteEntity::GetPitch(void) +{ + return m_Pitch; +} + + + + + +void cNoteEntity::SetPitch(char a_Pitch) +{ + m_Pitch = a_Pitch % 25; +} + + + + + +void cNoteEntity::IncrementPitch(void) +{ + SetPitch(m_Pitch + 1); +} + + + + + +bool cNoteEntity::LoadFromJson(const Json::Value & a_Value) +{ + + m_PosX = a_Value.get("x", 0).asInt(); + m_PosY = a_Value.get("y", 0).asInt(); + m_PosZ = a_Value.get("z", 0).asInt(); + + m_Pitch = (char)a_Value.get("p", 0).asInt(); + + return true; +} + + + + + +void cNoteEntity::SaveToJson(Json::Value & a_Value) +{ + a_Value["x"] = m_PosX; + a_Value["y"] = m_PosY; + a_Value["z"] = m_PosZ; + + a_Value["p"] = m_Pitch; +} + + + + diff --git a/source/BlockEntities/NoteEntity.h b/src/BlockEntities/NoteEntity.h index e2d088f44..e2d088f44 100644 --- a/source/BlockEntities/NoteEntity.h +++ b/src/BlockEntities/NoteEntity.h diff --git a/src/BlockEntities/SignEntity.cpp b/src/BlockEntities/SignEntity.cpp new file mode 100644 index 000000000..df8774377 --- /dev/null +++ b/src/BlockEntities/SignEntity.cpp @@ -0,0 +1,115 @@ + +// SignEntity.cpp + +// Implements the cSignEntity class representing a single sign in the world + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules +#include "json/json.h" +#include "SignEntity.h" +#include "../Entities/Player.h" + + + + + +cSignEntity::cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World) : + super(a_BlockType, a_X, a_Y, a_Z, a_World) +{ +} + + + + + +// It don't do anything when 'used' +void cSignEntity::UsedBy(cPlayer * a_Player) +{ + UNUSED(a_Player); +} + + + + + +void cSignEntity::SetLines(const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) +{ + m_Line[0] = a_Line1; + m_Line[1] = a_Line2; + m_Line[2] = a_Line3; + m_Line[3] = a_Line4; +} + + + + + +void cSignEntity::SetLine(int a_Index, const AString & a_Line) +{ + if ((a_Index < 0) || (a_Index >= ARRAYCOUNT(m_Line))) + { + LOGWARNING("%s: setting a non-existent line %d (value \"%s\"", __FUNCTION__, a_Index, a_Line.c_str()); + return; + } + m_Line[a_Index] = a_Line; +} + + + + + +AString cSignEntity::GetLine(int a_Index) const +{ + if ((a_Index < 0) || (a_Index >= ARRAYCOUNT(m_Line))) + { + LOGWARNING("%s: requesting a non-existent line %d", __FUNCTION__, a_Index); + return ""; + } + return m_Line[a_Index]; +} + + + + + +void cSignEntity::SendTo(cClientHandle & a_Client) +{ + a_Client.SendUpdateSign(m_PosX, m_PosY, m_PosZ, m_Line[0], m_Line[1], m_Line[2], m_Line[3]); +} + + + + + +bool cSignEntity::LoadFromJson(const Json::Value & a_Value) +{ + m_PosX = a_Value.get("x", 0).asInt(); + m_PosY = a_Value.get("y", 0).asInt(); + m_PosZ = a_Value.get("z", 0).asInt(); + + m_Line[0] = a_Value.get("Line1", "").asString(); + m_Line[1] = a_Value.get("Line2", "").asString(); + m_Line[2] = a_Value.get("Line3", "").asString(); + m_Line[3] = a_Value.get("Line4", "").asString(); + + return true; +} + + + + + +void cSignEntity::SaveToJson(Json::Value & a_Value) +{ + a_Value["x"] = m_PosX; + a_Value["y"] = m_PosY; + a_Value["z"] = m_PosZ; + + a_Value["Line1"] = m_Line[0]; + a_Value["Line2"] = m_Line[1]; + a_Value["Line3"] = m_Line[2]; + a_Value["Line4"] = m_Line[3]; +} + + + + diff --git a/source/BlockEntities/SignEntity.h b/src/BlockEntities/SignEntity.h index d998ff1e8..d998ff1e8 100644 --- a/source/BlockEntities/SignEntity.h +++ b/src/BlockEntities/SignEntity.h diff --git a/src/BlockID.cpp b/src/BlockID.cpp new file mode 100644 index 000000000..708618d25 --- /dev/null +++ b/src/BlockID.cpp @@ -0,0 +1,958 @@ +// BlockID.cpp + +// Implements the helper functions for converting Block ID string to int etc. + +#include "Globals.h" +#include "BlockID.h" +#include "inifile/iniFile.h" +#include "Item.h" +#include "Mobs/Monster.h" + + + + + +NIBBLETYPE g_BlockLightValue[256]; +NIBBLETYPE g_BlockSpreadLightFalloff[256]; +bool g_BlockTransparent[256]; +bool g_BlockOneHitDig[256]; +bool g_BlockPistonBreakable[256]; +bool g_BlockIsSnowable[256]; +bool g_BlockRequiresSpecialTool[256]; +bool g_BlockIsSolid[256]; +bool g_BlockIsTorchPlaceable[256]; + + + + + +class cBlockIDMap +{ + // Making the map case-insensitive: + struct Comparator + { + bool operator()(const AString & a_Item1, const AString & a_Item2) const + { + return (NoCaseCompare(a_Item1, a_Item2) > 0); + } + } ; + + typedef std::map<AString, std::pair<short, short>, Comparator> ItemMap; + +public: + cBlockIDMap(void) + { + cIniFile Ini; + if (!Ini.ReadFile("items.ini")) + { + return; + } + int KeyID = Ini.FindKey("Items"); + if (KeyID == cIniFile::noID) + { + return; + } + int NumValues = Ini.GetNumValues(KeyID); + for (int i = 0; i < NumValues; i++) + { + AString Name = Ini.GetValueName(KeyID, i); + if (Name.empty()) + { + continue; + } + AString Value = Ini.GetValue(KeyID, i); + AddToMap(Name, Value); + } // for i - Ini.Values[] + } + + + int Resolve(const AString & a_ItemName) + { + ItemMap::iterator itr = m_Map.find(a_ItemName); + if (itr == m_Map.end()) + { + return -1; + } + return itr->second.first; + } + + + bool ResolveItem(const AString & a_ItemName, cItem & a_Item) + { + // Split into parts divided by either ':' or '^' + AStringVector Split = StringSplitAndTrim(a_ItemName, ":^"); + if (Split.empty()) + { + return false; + } + + ItemMap::iterator itr = m_Map.find(Split[0]); + if (itr != m_Map.end()) + { + // Resolved as a string, assign the type and the default damage / count + a_Item.m_ItemType = itr->second.first; + a_Item.m_ItemDamage = itr->second.second; + if (a_Item.m_ItemDamage == -1) + { + a_Item.m_ItemDamage = 0; + } + } + else + { + // Not a resolvable string, try pure numbers: "45:6", "45^6" etc. + a_Item.m_ItemType = (short)atoi(Split[0].c_str()); + if ((a_Item.m_ItemType == 0) && (Split[0] != "0")) + { + // Parsing the number failed + return false; + } + } + + // Parse the damage, if present: + if (Split.size() < 2) + { + // Not present, set the item as valid and return success: + a_Item.m_ItemCount = 1; + return true; + } + + a_Item.m_ItemDamage = atoi(Split[1].c_str()); + if ((a_Item.m_ItemDamage == 0) && (Split[1] != "0")) + { + // Parsing the number failed + return false; + } + a_Item.m_ItemCount = 1; + return true; + } + + + AString Desolve(short a_ItemType, short a_ItemDamage) + { + // First try an exact match, both ItemType and ItemDamage ("birchplanks=5:2"): + for (ItemMap::iterator itr = m_Map.begin(), end = m_Map.end(); itr != end; ++itr) + { + if ((itr->second.first == a_ItemType) && (itr->second.second == a_ItemDamage)) + { + return itr->first; + } + } // for itr - m_Map[] + + // There is no exact match, try matching ItemType only ("planks=5"): + if (a_ItemDamage == 0) + { + for (ItemMap::iterator itr = m_Map.begin(), end = m_Map.end(); itr != end; ++itr) + { + if ((itr->second.first == a_ItemType) && (itr->second.second == -1)) + { + return itr->first; + } + } // for itr - m_Map[] + } + + // No match at all, synthesize a string ("5:1"): + AString res; + if (a_ItemDamage == -1) + { + Printf(res, "%d", a_ItemType); + } + else + { + Printf(res, "%d:%d", a_ItemType, a_ItemDamage); + } + return res; + } + + +protected: + ItemMap m_Map; + + + void AddToMap(const AString & a_Name, const AString & a_Value) + { + AStringVector Split = StringSplit(a_Value, ":"); + if (Split.size() == 1) + { + Split = StringSplit(a_Value, "^"); + } + if (Split.empty()) + { + return; + } + short ItemType = (short)atoi(Split[0].c_str()); + short ItemDamage = (Split.size() > 1) ? (short)atoi(Split[1].c_str()) : -1; + m_Map[a_Name] = std::make_pair(ItemType, ItemDamage); + } +} ; + + + + + +static cBlockIDMap gsBlockIDMap; + + + + + +/* +// Quick self-test: +class Tester +{ +public: + Tester(void) + { + cItem Item; + gsBlockIDMap.ResolveItem("charcoal", Item); + AString Charcoal = gsBlockIDMap.Desolve(Item.m_ItemType, Item.m_ItemDamage); + ASSERT(Charcoal == "charcoal"); + } +} test; +//*/ + + + + + +BLOCKTYPE BlockStringToType(const AString & a_BlockTypeString) +{ + int res = atoi(a_BlockTypeString.c_str()); + if ((res != 0) || (a_BlockTypeString.compare("0") == 0)) + { + // It was a valid number, return that + return res; + } + + return gsBlockIDMap.Resolve(TrimString(a_BlockTypeString)); +} + + + + +bool StringToItem(const AString & a_ItemTypeString, cItem & a_Item) +{ + return gsBlockIDMap.ResolveItem(TrimString(a_ItemTypeString), a_Item); +} + + + + + +AString ItemToString(const cItem & a_Item) +{ + return gsBlockIDMap.Desolve(a_Item.m_ItemType, a_Item.m_ItemDamage); +} + + + + + +AString ItemTypeToString(short a_ItemType) +{ + return gsBlockIDMap.Desolve(a_ItemType, -1); +} + + + + + +AString ItemToFullString(const cItem & a_Item) +{ + AString res; + Printf(res, "%s:%d * %d", ItemToString(a_Item).c_str(), a_Item.m_ItemDamage, a_Item.m_ItemCount); + return res; +} + + + + + +EMCSBiome StringToBiome(const AString & a_BiomeString) +{ + // If it is a number, return it: + int res = atoi(a_BiomeString.c_str()); + if ((res != 0) || (a_BiomeString.compare("0") == 0)) + { + // It was a valid number + return (EMCSBiome)res; + } + + // Convert using the built-in map: + static struct { + EMCSBiome m_Biome; + const char * m_String; + } BiomeMap[] = + { + {biOcean, "Ocean"} , + {biPlains, "Plains"}, + {biDesert, "Desert"}, + {biExtremeHills, "ExtremeHills"}, + {biForest, "Forest"}, + {biTaiga, "Taiga"}, + {biSwampland, "Swampland"}, + {biRiver, "River"}, + {biNether, "Hell"}, + {biNether, "Nether"}, + {biEnd, "Sky"}, + {biEnd, "End"}, + {biFrozenOcean, "FrozenOcean"}, + {biFrozenRiver, "FrozenRiver"}, + {biIcePlains, "IcePlains"}, + {biIcePlains, "Tundra"}, + {biIceMountains, "IceMountains"}, + {biMushroomIsland, "MushroomIsland"}, + {biMushroomShore, "MushroomShore"}, + {biBeach, "Beach"}, + {biDesertHills, "DesertHills"}, + {biForestHills, "ForestHills"}, + {biTaigaHills, "TaigaHills"}, + {biExtremeHillsEdge, "ExtremeHillsEdge"}, + {biJungle, "Jungle"}, + {biJungleHills, "JungleHills"}, + + // Release 1.7 biomes: + {biJungleEdge, "JungleEdge"}, + {biDeepOcean, "DeepOcean"}, + {biStoneBeach, "StoneBeach"}, + {biColdBeach, "ColdBeach"}, + {biBirchForest, "BirchForest"}, + {biBirchForestHills, "BirchForestHills"}, + {biRoofedForest, "RoofedForest"}, + {biColdTaiga, "ColdTaiga"}, + {biColdTaigaHills, "ColdTaigaHills"}, + {biMegaTaiga, "MegaTaiga"}, + {biMegaTaigaHills, "MegaTaigaHills"}, + {biExtremeHillsPlus, "ExtremeHillsPlus"}, + {biSavanna, "Savanna"}, + {biSavannaPlateau, "SavannaPlateau"}, + {biMesa, "Mesa"}, + {biMesaPlateauF, "MesaPlateauF"}, + {biMesaPlateau, "MesaPlateau"}, + + // Release 1.7 variants: + {biSunflowerPlains, "SunflowerPlains"}, + {biDesertM, "DesertM"}, + {biExtremeHillsM, "ExtremeHillsM"}, + {biFlowerForest, "FlowerForest"}, + {biTaigaM, "TaigaM"}, + {biSwamplandM, "SwamplandM"}, + {biIcePlainsSpikes, "IcePlainsSpikes"}, + {biJungleM, "JungleM"}, + {biJungleEdgeM, "JungleEdgeM"}, + {biBirchForestM, "BirchForestM"}, + {biBirchForestHillsM, "BirchForestHillsM"}, + {biRoofedForestM, "RoofedForestM"}, + {biColdTaigaM, "ColdTaigaM"}, + {biMegaSpruceTaiga, "MegaSpruceTaiga"}, + {biMegaSpruceTaigaHills, "MegaSpruceTaigaHills"}, + {biExtremeHillsPlusM, "ExtremeHillsPlusM"}, + {biSavannaM, "SavannaM"}, + {biSavannaPlateauM, "SavannaPlateauM"}, + {biMesaBryce, "MesaBryce"}, + {biMesaPlateauFM, "MesaPlateauFM"}, + {biMesaPlateauM, "MesaPlateauM"}, + } ; + + for (int i = 0; i < ARRAYCOUNT(BiomeMap); i++) + { + if (NoCaseCompare(BiomeMap[i].m_String, a_BiomeString) == 0) + { + return BiomeMap[i].m_Biome; + } + } // for i - BiomeMap[] + return (EMCSBiome)-1; +} + + + + + +int StringToMobType(const AString & a_MobString) +{ + static struct { + int m_MobType; + const char * m_String; + } MobMap [] = + { + {cMonster::mtCreeper, "Creeper"}, + {cMonster::mtSkeleton, "Skeleton"}, + {cMonster::mtSpider, "Spider"}, + {cMonster::mtGiant, "Giant"}, + {cMonster::mtZombie, "Zombie"}, + {cMonster::mtSlime, "Slime"}, + {cMonster::mtGhast, "Ghast"}, + {cMonster::mtZombiePigman, "ZombiePigman"}, + {cMonster::mtEnderman, "Enderman"}, + {cMonster::mtCaveSpider, "CaveSpider"}, + {cMonster::mtSilverfish, "SilverFish"}, + {cMonster::mtBlaze, "Blaze"}, + {cMonster::mtMagmaCube, "MagmaCube"}, + {cMonster::mtEnderDragon, "EnderDragon"}, + {cMonster::mtWither, "Wither"}, + {cMonster::mtBat, "Bat"}, + {cMonster::mtWitch, "Witch"}, + {cMonster::mtPig, "Pig"}, + {cMonster::mtSheep, "Sheep"}, + {cMonster::mtCow, "Cow"}, + {cMonster::mtChicken, "Chicken"}, + {cMonster::mtSquid, "Squid"}, + {cMonster::mtWolf, "Wolf"}, + {cMonster::mtMooshroom, "Mooshroom"}, + {cMonster::mtSnowGolem, "SnowGolem"}, + {cMonster::mtOcelot, "Ocelot"}, + {cMonster::mtIronGolem, "IronGolem"}, + {cMonster::mtVillager, "Villager"}, + }; + for (int i = 0; i < ARRAYCOUNT(MobMap); i++) + { + if (NoCaseCompare(MobMap[i].m_String, a_MobString) == 0) + { + return MobMap[i].m_MobType; + } + } // for i - MobMap[] + return -1; +} + + + + + +eDimension StringToDimension(const AString & a_DimensionString) +{ + // First try decoding as a number + int res = atoi(a_DimensionString.c_str()); + if ((res != 0) || (a_DimensionString == "0")) + { + // It was a valid number + return (eDimension)res; + } + + // Decode using a built-in map: + static struct + { + eDimension m_Dimension; + const char * m_String; + } DimensionMap [] = + { + { dimOverworld, "Overworld"}, + { dimOverworld, "Normal"}, + { dimOverworld, "World"}, + { dimNether, "Nether"}, + { dimNether, "Hell"}, // Alternate name for End + { dimEnd, "End"}, + { dimEnd, "Sky"}, // Old name for End + } ; + for (int i = 0; i < ARRAYCOUNT(DimensionMap); i++) + { + if (NoCaseCompare(DimensionMap[i].m_String, a_DimensionString) == 0) + { + return DimensionMap[i].m_Dimension; + } + } // for i - DimensionMap[] + + // Not found + return (eDimension)-1000; +} + + + + + +/// Translates damage type constant to a string representation (built-in). +AString DamageTypeToString(eDamageType a_DamageType) +{ + // Make sure to keep this alpha-sorted. + switch (a_DamageType) + { + case dtAdmin: return "dtAdmin"; + case dtAttack: return "dtAttack"; + case dtCactusContact: return "dtCactusContact"; + case dtDrowning: return "dtDrowning"; + case dtEnderPearl: return "dtEnderPearl"; + case dtFalling: return "dtFalling"; + case dtFireContact: return "dtFireContact"; + case dtInVoid: return "dtInVoid"; + case dtLavaContact: return "dtLavaContact"; + case dtLightning: return "dtLightning"; + case dtOnFire: return "dtOnFire"; + case dtPoisoning: return "dtPoisoning"; + case dtPotionOfHarming: return "dtPotionOfHarming"; + case dtRangedAttack: return "dtRangedAttack"; + case dtStarving: return "dtStarving"; + case dtSuffocating: return "dtSuffocation"; + + } + + // Unknown damage type: + ASSERT(!"Unknown DamageType"); + return Printf("dtUnknown_%d", (int)a_DamageType); +} + + + + + +/// Translates a damage type string to damage type. Takes either a number or a damage type alias (built-in). Returns -1 on failure +eDamageType StringToDamageType(const AString & a_DamageTypeString) +{ + // First try decoding as a number: + int res = atoi(a_DamageTypeString.c_str()); + if ((res != 0) || (a_DamageTypeString == "0")) + { + // It was a valid number + return (eDamageType)res; + } + + // Decode using a built-in map: + static struct + { + eDamageType m_DamageType; + const char * m_String; + } DamageTypeMap [] = + { + // Cannonical names: + { dtAttack, "dtAttack"}, + { dtRangedAttack, "dtRangedAttack"}, + { dtLightning, "dtLightning"}, + { dtFalling, "dtFalling"}, + { dtDrowning, "dtDrowning"}, + { dtSuffocating, "dtSuffocation"}, + { dtStarving, "dtStarving"}, + { dtCactusContact, "dtCactusContact"}, + { dtLavaContact, "dtLavaContact"}, + { dtPoisoning, "dtPoisoning"}, + { dtOnFire, "dtOnFire"}, + { dtFireContact, "dtFireContact"}, + { dtInVoid, "dtInVoid"}, + { dtPotionOfHarming, "dtPotionOfHarming"}, + { dtAdmin, "dtAdmin"}, + + // Common synonyms: + { dtAttack, "dtPawnAttack"}, + { dtAttack, "dtEntityAttack"}, + { dtAttack, "dtMob"}, + { dtAttack, "dtMobAttack"}, + { dtRangedAttack, "dtArrowAttack"}, + { dtRangedAttack, "dtArrow"}, + { dtRangedAttack, "dtProjectile"}, + { dtFalling, "dtFall"}, + { dtDrowning, "dtDrown"}, + { dtSuffocating, "dtSuffocation"}, + { dtStarving, "dtStarvation"}, + { dtStarving, "dtHunger"}, + { dtCactusContact, "dtCactus"}, + { dtCactusContact, "dtCactuses"}, + { dtCactusContact, "dtCacti"}, + { dtLavaContact, "dtLava"}, + { dtPoisoning, "dtPoison"}, + { dtOnFire, "dtBurning"}, + { dtFireContact, "dtInFire"}, + { dtAdmin, "dtPlugin"}, + } ; + for (int i = 0; i < ARRAYCOUNT(DamageTypeMap); i++) + { + if (NoCaseCompare(DamageTypeMap[i].m_String, a_DamageTypeString) == 0) + { + return DamageTypeMap[i].m_DamageType; + } + } // for i - DamageTypeMap[] + + // Not found: + return (eDamageType)-1; +} + + + + + +cItem GetIniItemSet(cIniFile & a_IniFile, const char * a_Section, const char * a_Key, const char * a_Default) +{ + AString ItemStr = a_IniFile.GetValueSet(a_Section, a_Key, a_Default); + cItem res; + if (!StringToItem(ItemStr, res)) + { + res.Empty(); + } + return res; +} + + + + + +// This is actually just some code that needs to run at program startup, so it is wrapped into a global var's constructor: +class cBlockPropertiesInitializer +{ +public: + cBlockPropertiesInitializer(void) + { + memset(g_BlockLightValue, 0x00, sizeof(g_BlockLightValue)); + memset(g_BlockSpreadLightFalloff, 0x0f, sizeof(g_BlockSpreadLightFalloff)); // 0x0f means total falloff + memset(g_BlockTransparent, 0x00, sizeof(g_BlockTransparent)); + memset(g_BlockOneHitDig, 0x00, sizeof(g_BlockOneHitDig)); + memset(g_BlockPistonBreakable, 0x00, sizeof(g_BlockPistonBreakable)); + memset(g_BlockIsTorchPlaceable, 0x00, sizeof(g_BlockIsTorchPlaceable)); + + // Setting bools to true must be done manually, see http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415 + for (int i = 0; i < ARRAYCOUNT(g_BlockIsSnowable); i++) + { + g_BlockIsSnowable[i] = true; + } + memset(g_BlockRequiresSpecialTool, 0x00, sizeof(g_BlockRequiresSpecialTool)); // Set all blocks to false + + // Setting bools to true must be done manually, see http://forum.mc-server.org/showthread.php?tid=629&pid=5415#pid5415 + for (int i = 0; i < ARRAYCOUNT(g_BlockIsSolid); i++) + { + g_BlockIsSolid[i] = true; + } + + // Emissive blocks + g_BlockLightValue[E_BLOCK_FIRE] = 15; + g_BlockLightValue[E_BLOCK_GLOWSTONE] = 15; + g_BlockLightValue[E_BLOCK_JACK_O_LANTERN] = 15; + g_BlockLightValue[E_BLOCK_LAVA] = 15; + g_BlockLightValue[E_BLOCK_STATIONARY_LAVA] = 15; + g_BlockLightValue[E_BLOCK_END_PORTAL] = 15; + g_BlockLightValue[E_BLOCK_REDSTONE_LAMP_ON] = 15; + g_BlockLightValue[E_BLOCK_TORCH] = 14; + g_BlockLightValue[E_BLOCK_BURNING_FURNACE] = 13; + g_BlockLightValue[E_BLOCK_NETHER_PORTAL] = 11; + g_BlockLightValue[E_BLOCK_REDSTONE_ORE_GLOWING] = 9; + g_BlockLightValue[E_BLOCK_REDSTONE_REPEATER_ON] = 9; + g_BlockLightValue[E_BLOCK_REDSTONE_TORCH_ON] = 7; + g_BlockLightValue[E_BLOCK_BREWING_STAND] = 1; + g_BlockLightValue[E_BLOCK_BROWN_MUSHROOM] = 1; + g_BlockLightValue[E_BLOCK_DRAGON_EGG] = 1; + + // Spread blocks + g_BlockSpreadLightFalloff[E_BLOCK_AIR] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_CAKE] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_CHEST] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_COBWEB] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_CROPS] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_FENCE] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_FENCE_GATE] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_FIRE] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_GLASS] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_GLASS_PANE] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_GLOWSTONE] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_IRON_BARS] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_IRON_DOOR] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_LEAVES] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_SIGN_POST] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_TORCH] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_VINES] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_WALLSIGN] = 1; + g_BlockSpreadLightFalloff[E_BLOCK_WOODEN_DOOR] = 1; + + // Light in water and lava dissapears faster: + g_BlockSpreadLightFalloff[E_BLOCK_LAVA] = 3; + g_BlockSpreadLightFalloff[E_BLOCK_STATIONARY_LAVA] = 3; + g_BlockSpreadLightFalloff[E_BLOCK_STATIONARY_WATER] = 3; + g_BlockSpreadLightFalloff[E_BLOCK_WATER] = 3; + + // Transparent blocks + g_BlockTransparent[E_BLOCK_ACTIVATOR_RAIL] = true; + g_BlockTransparent[E_BLOCK_AIR] = true; + g_BlockTransparent[E_BLOCK_BIG_FLOWER] = true; + g_BlockTransparent[E_BLOCK_BROWN_MUSHROOM] = true; + g_BlockTransparent[E_BLOCK_CARROTS] = true; + g_BlockTransparent[E_BLOCK_CHEST] = true; + g_BlockTransparent[E_BLOCK_COBWEB] = true; + g_BlockTransparent[E_BLOCK_CROPS] = true; + g_BlockTransparent[E_BLOCK_DANDELION] = true; + g_BlockTransparent[E_BLOCK_DETECTOR_RAIL] = true; + g_BlockTransparent[E_BLOCK_FENCE] = true; + g_BlockTransparent[E_BLOCK_FENCE_GATE] = true; + g_BlockTransparent[E_BLOCK_FIRE] = true; + g_BlockTransparent[E_BLOCK_FLOWER] = true; + g_BlockTransparent[E_BLOCK_FLOWER_POT] = true; + g_BlockTransparent[E_BLOCK_GLASS] = true; + g_BlockTransparent[E_BLOCK_GLASS_PANE] = true; + g_BlockTransparent[E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE] = true; + g_BlockTransparent[E_BLOCK_ICE] = true; + g_BlockTransparent[E_BLOCK_IRON_DOOR] = true; + g_BlockTransparent[E_BLOCK_LAVA] = true; + g_BlockTransparent[E_BLOCK_LEAVES] = true; + g_BlockTransparent[E_BLOCK_LEVER] = true; + g_BlockTransparent[E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE] = true; + g_BlockTransparent[E_BLOCK_MELON_STEM] = true; + g_BlockTransparent[E_BLOCK_NETHER_BRICK_FENCE] = true; + g_BlockTransparent[E_BLOCK_NEW_LEAVES] = true; + g_BlockTransparent[E_BLOCK_POTATOES] = true; + g_BlockTransparent[E_BLOCK_POWERED_RAIL] = true; + g_BlockTransparent[E_BLOCK_PISTON_EXTENSION] = true; + g_BlockTransparent[E_BLOCK_PUMPKIN_STEM] = true; + g_BlockTransparent[E_BLOCK_RAIL] = true; + g_BlockTransparent[E_BLOCK_RED_MUSHROOM] = true; + g_BlockTransparent[E_BLOCK_SIGN_POST] = true; + g_BlockTransparent[E_BLOCK_SNOW] = true; + g_BlockTransparent[E_BLOCK_STAINED_GLASS] = true; + g_BlockTransparent[E_BLOCK_STAINED_GLASS_PANE] = true; + g_BlockTransparent[E_BLOCK_STATIONARY_LAVA] = true; + g_BlockTransparent[E_BLOCK_STATIONARY_WATER] = true; + g_BlockTransparent[E_BLOCK_STONE_PRESSURE_PLATE] = true; + g_BlockTransparent[E_BLOCK_TALL_GRASS] = true; + g_BlockTransparent[E_BLOCK_TORCH] = true; + g_BlockTransparent[E_BLOCK_VINES] = true; + g_BlockTransparent[E_BLOCK_WALLSIGN] = true; + g_BlockTransparent[E_BLOCK_WATER] = true; + g_BlockTransparent[E_BLOCK_WOODEN_DOOR] = true; + g_BlockTransparent[E_BLOCK_WOODEN_PRESSURE_PLATE] = true; + + // TODO: Any other transparent blocks? + + // One hit break blocks: + g_BlockOneHitDig[E_BLOCK_ACTIVE_COMPARATOR] = true; + g_BlockOneHitDig[E_BLOCK_BIG_FLOWER] = true; + g_BlockOneHitDig[E_BLOCK_BROWN_MUSHROOM] = true; + g_BlockOneHitDig[E_BLOCK_CARROTS] = true; + g_BlockOneHitDig[E_BLOCK_CROPS] = true; + g_BlockOneHitDig[E_BLOCK_DANDELION] = true; + g_BlockOneHitDig[E_BLOCK_FIRE] = true; + g_BlockOneHitDig[E_BLOCK_FLOWER] = true; + g_BlockOneHitDig[E_BLOCK_FLOWER_POT] = true; + g_BlockOneHitDig[E_BLOCK_INACTIVE_COMPARATOR] = true; + g_BlockOneHitDig[E_BLOCK_MELON_STEM] = true; + g_BlockOneHitDig[E_BLOCK_POTATOES] = true; + g_BlockOneHitDig[E_BLOCK_PUMPKIN_STEM] = true; + g_BlockOneHitDig[E_BLOCK_REDSTONE_REPEATER_OFF] = true; + g_BlockOneHitDig[E_BLOCK_REDSTONE_REPEATER_ON] = true; + g_BlockOneHitDig[E_BLOCK_REDSTONE_TORCH_OFF] = true; + g_BlockOneHitDig[E_BLOCK_REDSTONE_TORCH_ON] = true; + g_BlockOneHitDig[E_BLOCK_REDSTONE_WIRE] = true; + g_BlockOneHitDig[E_BLOCK_RED_MUSHROOM] = true; + g_BlockOneHitDig[E_BLOCK_REEDS] = true; + g_BlockOneHitDig[E_BLOCK_SAPLING] = true; + g_BlockOneHitDig[E_BLOCK_TNT] = true; + g_BlockOneHitDig[E_BLOCK_TALL_GRASS] = true; + g_BlockOneHitDig[E_BLOCK_TORCH] = true; + + // Blocks that break when pushed by piston: + g_BlockPistonBreakable[E_BLOCK_ACTIVE_COMPARATOR] = true; + g_BlockPistonBreakable[E_BLOCK_AIR] = true; + g_BlockPistonBreakable[E_BLOCK_BED] = true; + g_BlockPistonBreakable[E_BLOCK_BIG_FLOWER] = true; + g_BlockPistonBreakable[E_BLOCK_BROWN_MUSHROOM] = true; + g_BlockPistonBreakable[E_BLOCK_COBWEB] = true; + g_BlockPistonBreakable[E_BLOCK_CROPS] = true; + g_BlockPistonBreakable[E_BLOCK_DANDELION] = true; + g_BlockPistonBreakable[E_BLOCK_DEAD_BUSH] = true; + g_BlockPistonBreakable[E_BLOCK_FIRE] = true; + g_BlockPistonBreakable[E_BLOCK_FLOWER] = true; + g_BlockPistonBreakable[E_BLOCK_INACTIVE_COMPARATOR] = true; + g_BlockPistonBreakable[E_BLOCK_IRON_DOOR] = true; + g_BlockPistonBreakable[E_BLOCK_JACK_O_LANTERN] = true; + g_BlockPistonBreakable[E_BLOCK_LADDER] = true; + g_BlockPistonBreakable[E_BLOCK_LAVA] = true; + g_BlockPistonBreakable[E_BLOCK_LEVER] = true; + g_BlockPistonBreakable[E_BLOCK_MELON] = true; + g_BlockPistonBreakable[E_BLOCK_MELON_STEM] = true; + g_BlockPistonBreakable[E_BLOCK_PUMPKIN] = true; + g_BlockPistonBreakable[E_BLOCK_PUMPKIN_STEM] = true; + g_BlockPistonBreakable[E_BLOCK_REDSTONE_REPEATER_OFF] = true; + g_BlockPistonBreakable[E_BLOCK_REDSTONE_REPEATER_ON] = true; + g_BlockPistonBreakable[E_BLOCK_REDSTONE_TORCH_OFF] = true; + g_BlockPistonBreakable[E_BLOCK_REDSTONE_TORCH_ON] = true; + g_BlockPistonBreakable[E_BLOCK_REDSTONE_WIRE] = true; + g_BlockPistonBreakable[E_BLOCK_RED_MUSHROOM] = true; + g_BlockPistonBreakable[E_BLOCK_REEDS] = true; + g_BlockPistonBreakable[E_BLOCK_SNOW] = true; + g_BlockPistonBreakable[E_BLOCK_STATIONARY_LAVA] = true; + g_BlockPistonBreakable[E_BLOCK_STATIONARY_WATER] = true; + g_BlockPistonBreakable[E_BLOCK_STONE_BUTTON] = true; + g_BlockPistonBreakable[E_BLOCK_STONE_PRESSURE_PLATE] = true; + g_BlockPistonBreakable[E_BLOCK_TALL_GRASS] = true; + g_BlockPistonBreakable[E_BLOCK_TORCH] = true; + g_BlockPistonBreakable[E_BLOCK_VINES] = true; + g_BlockPistonBreakable[E_BLOCK_WATER] = true; + g_BlockPistonBreakable[E_BLOCK_WOODEN_BUTTON] = true; + g_BlockPistonBreakable[E_BLOCK_WOODEN_DOOR] = true; + g_BlockPistonBreakable[E_BLOCK_WOODEN_PRESSURE_PLATE] = true; + + + // Blocks that cannot be snowed over: + g_BlockIsSnowable[E_BLOCK_ACTIVE_COMPARATOR] = false; + g_BlockIsSnowable[E_BLOCK_AIR] = false; + g_BlockIsSnowable[E_BLOCK_BIG_FLOWER] = false; + g_BlockIsSnowable[E_BLOCK_BROWN_MUSHROOM] = false; + g_BlockIsSnowable[E_BLOCK_CACTUS] = false; + g_BlockIsSnowable[E_BLOCK_CHEST] = false; + g_BlockIsSnowable[E_BLOCK_CROPS] = false; + g_BlockIsSnowable[E_BLOCK_DANDELION] = false; + g_BlockIsSnowable[E_BLOCK_FIRE] = false; + g_BlockIsSnowable[E_BLOCK_FLOWER] = false; + g_BlockIsSnowable[E_BLOCK_GLASS] = false; + g_BlockIsSnowable[E_BLOCK_ICE] = false; + g_BlockIsSnowable[E_BLOCK_INACTIVE_COMPARATOR] = false; + g_BlockIsSnowable[E_BLOCK_LAVA] = false; + g_BlockIsSnowable[E_BLOCK_LILY_PAD] = false; + g_BlockIsSnowable[E_BLOCK_REDSTONE_REPEATER_OFF] = false; + g_BlockIsSnowable[E_BLOCK_REDSTONE_REPEATER_ON] = false; + g_BlockIsSnowable[E_BLOCK_REDSTONE_TORCH_OFF] = false; + g_BlockIsSnowable[E_BLOCK_REDSTONE_TORCH_ON] = false; + g_BlockIsSnowable[E_BLOCK_REDSTONE_WIRE] = false; + g_BlockIsSnowable[E_BLOCK_RED_MUSHROOM] = false; + g_BlockIsSnowable[E_BLOCK_REEDS] = false; + g_BlockIsSnowable[E_BLOCK_SAPLING] = false; + g_BlockIsSnowable[E_BLOCK_SIGN_POST] = false; + g_BlockIsSnowable[E_BLOCK_SNOW] = false; + g_BlockIsSnowable[E_BLOCK_STAINED_GLASS] = false; + g_BlockIsSnowable[E_BLOCK_STAINED_GLASS_PANE] = false; + g_BlockIsSnowable[E_BLOCK_STATIONARY_LAVA] = false; + g_BlockIsSnowable[E_BLOCK_STATIONARY_WATER] = false; + g_BlockIsSnowable[E_BLOCK_TALL_GRASS] = false; + g_BlockIsSnowable[E_BLOCK_TNT] = false; + g_BlockIsSnowable[E_BLOCK_TORCH] = false; + g_BlockIsSnowable[E_BLOCK_VINES] = false; + g_BlockIsSnowable[E_BLOCK_WALLSIGN] = false; + g_BlockIsSnowable[E_BLOCK_WATER] = false; + + + // Blocks that don't drop without a special tool: + g_BlockRequiresSpecialTool[E_BLOCK_BRICK] = true; + g_BlockRequiresSpecialTool[E_BLOCK_CAULDRON] = true; + g_BlockRequiresSpecialTool[E_BLOCK_COAL_ORE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_COBBLESTONE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_COBBLESTONE_STAIRS] = true; + g_BlockRequiresSpecialTool[E_BLOCK_COBWEB] = true; + g_BlockRequiresSpecialTool[E_BLOCK_DIAMOND_BLOCK] = true; + g_BlockRequiresSpecialTool[E_BLOCK_DIAMOND_ORE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_DOUBLE_STONE_SLAB] = true; + g_BlockRequiresSpecialTool[E_BLOCK_EMERALD_ORE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_END_STONE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_GOLD_BLOCK] = true; + g_BlockRequiresSpecialTool[E_BLOCK_GOLD_ORE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_IRON_BLOCK] = true; + g_BlockRequiresSpecialTool[E_BLOCK_IRON_ORE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_LAPIS_BLOCK] = true; + g_BlockRequiresSpecialTool[E_BLOCK_LAPIS_ORE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_MOSSY_COBBLESTONE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_NETHERRACK] = true; + g_BlockRequiresSpecialTool[E_BLOCK_NETHER_BRICK] = true; + g_BlockRequiresSpecialTool[E_BLOCK_NETHER_BRICK_STAIRS] = true; + g_BlockRequiresSpecialTool[E_BLOCK_OBSIDIAN] = true; + g_BlockRequiresSpecialTool[E_BLOCK_REDSTONE_ORE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_REDSTONE_ORE_GLOWING] = true; + g_BlockRequiresSpecialTool[E_BLOCK_SANDSTONE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_SANDSTONE_STAIRS] = true; + g_BlockRequiresSpecialTool[E_BLOCK_SNOW] = true; + g_BlockRequiresSpecialTool[E_BLOCK_STONE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_STONE_BRICKS] = true; + g_BlockRequiresSpecialTool[E_BLOCK_STONE_BRICK_STAIRS] = true; + g_BlockRequiresSpecialTool[E_BLOCK_STONE_PRESSURE_PLATE] = true; + g_BlockRequiresSpecialTool[E_BLOCK_STONE_SLAB] = true; + g_BlockRequiresSpecialTool[E_BLOCK_VINES] = true; + + // Nonsolid blocks: + g_BlockIsSolid[E_BLOCK_ACTIVATOR_RAIL] = false; + g_BlockIsSolid[E_BLOCK_AIR] = false; + g_BlockIsSolid[E_BLOCK_BIG_FLOWER] = false; + g_BlockIsSolid[E_BLOCK_BROWN_MUSHROOM] = false; + g_BlockIsSolid[E_BLOCK_CARROTS] = false; + g_BlockIsSolid[E_BLOCK_COBWEB] = false; + g_BlockIsSolid[E_BLOCK_CROPS] = false; + g_BlockIsSolid[E_BLOCK_DANDELION] = false; + g_BlockIsSolid[E_BLOCK_DETECTOR_RAIL] = false; + g_BlockIsSolid[E_BLOCK_END_PORTAL] = false; + g_BlockIsSolid[E_BLOCK_FIRE] = false; + g_BlockIsSolid[E_BLOCK_FLOWER] = false; + g_BlockIsSolid[E_BLOCK_HEAVY_WEIGHTED_PRESSURE_PLATE] = false; + g_BlockIsSolid[E_BLOCK_LAVA] = false; + g_BlockIsSolid[E_BLOCK_LEVER] = false; + g_BlockIsSolid[E_BLOCK_LIGHT_WEIGHTED_PRESSURE_PLATE] = false; + g_BlockIsSolid[E_BLOCK_MELON_STEM] = false; + g_BlockIsSolid[E_BLOCK_NETHER_PORTAL] = false; + g_BlockIsSolid[E_BLOCK_PISTON_EXTENSION] = false; + g_BlockIsSolid[E_BLOCK_RAIL] = false; + g_BlockIsSolid[E_BLOCK_REDSTONE_TORCH_OFF] = false; + g_BlockIsSolid[E_BLOCK_REDSTONE_TORCH_ON] = false; + g_BlockIsSolid[E_BLOCK_REDSTONE_WIRE] = false; + g_BlockIsSolid[E_BLOCK_RED_MUSHROOM] = false; + g_BlockIsSolid[E_BLOCK_REEDS] = false; + g_BlockIsSolid[E_BLOCK_SAPLING] = false; + g_BlockIsSolid[E_BLOCK_SIGN_POST] = false; + g_BlockIsSolid[E_BLOCK_SNOW] = false; + g_BlockIsSolid[E_BLOCK_STATIONARY_LAVA] = false; + g_BlockIsSolid[E_BLOCK_STATIONARY_WATER] = false; + g_BlockIsSolid[E_BLOCK_STONE_BUTTON] = false; + g_BlockIsSolid[E_BLOCK_STONE_PRESSURE_PLATE] = false; + g_BlockIsSolid[E_BLOCK_TALL_GRASS] = false; + g_BlockIsSolid[E_BLOCK_TORCH] = false; + g_BlockIsSolid[E_BLOCK_TRIPWIRE] = false; + g_BlockIsSolid[E_BLOCK_VINES] = false; + g_BlockIsSolid[E_BLOCK_WALLSIGN] = false; + g_BlockIsSolid[E_BLOCK_WATER] = false; + g_BlockIsSolid[E_BLOCK_WOODEN_BUTTON] = false; + g_BlockIsSolid[E_BLOCK_WOODEN_PRESSURE_PLATE] = false; + g_BlockIsSolid[E_BLOCK_WOODEN_SLAB] = false; + + // Torch placeable blocks: + g_BlockIsTorchPlaceable[E_BLOCK_BEDROCK] = true; + g_BlockIsTorchPlaceable[E_BLOCK_BLOCK_OF_COAL] = true; + g_BlockIsTorchPlaceable[E_BLOCK_BLOCK_OF_REDSTONE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_BOOKCASE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_BRICK] = true; + g_BlockIsTorchPlaceable[E_BLOCK_CLAY] = true; + g_BlockIsTorchPlaceable[E_BLOCK_COAL_ORE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_COBBLESTONE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_COMMAND_BLOCK] = true; + g_BlockIsTorchPlaceable[E_BLOCK_CRAFTING_TABLE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_DIAMOND_BLOCK] = true; + g_BlockIsTorchPlaceable[E_BLOCK_DIAMOND_ORE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_DIRT] = true; + g_BlockIsTorchPlaceable[E_BLOCK_DISPENSER] = true; + g_BlockIsTorchPlaceable[E_BLOCK_DOUBLE_STONE_SLAB] = true; + g_BlockIsTorchPlaceable[E_BLOCK_DOUBLE_WOODEN_SLAB] = true; + g_BlockIsTorchPlaceable[E_BLOCK_DROPPER] = true; + g_BlockIsTorchPlaceable[E_BLOCK_EMERALD_BLOCK] = true; + g_BlockIsTorchPlaceable[E_BLOCK_EMERALD_ORE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_END_STONE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_FURNACE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_GLOWSTONE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_GOLD_BLOCK] = true; + g_BlockIsTorchPlaceable[E_BLOCK_GOLD_ORE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_GRASS] = true; + g_BlockIsTorchPlaceable[E_BLOCK_GRAVEL] = true; + g_BlockIsTorchPlaceable[E_BLOCK_HARDENED_CLAY] = true; + g_BlockIsTorchPlaceable[E_BLOCK_HAY_BALE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_HUGE_BROWN_MUSHROOM] = true; + g_BlockIsTorchPlaceable[E_BLOCK_HUGE_RED_MUSHROOM] = true; + g_BlockIsTorchPlaceable[E_BLOCK_IRON_BLOCK] = true; + g_BlockIsTorchPlaceable[E_BLOCK_IRON_ORE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_JACK_O_LANTERN] = true; + g_BlockIsTorchPlaceable[E_BLOCK_JUKEBOX] = true; + g_BlockIsTorchPlaceable[E_BLOCK_LAPIS_BLOCK] = true; + g_BlockIsTorchPlaceable[E_BLOCK_LAPIS_ORE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_LOG] = true; + g_BlockIsTorchPlaceable[E_BLOCK_MELON] = true; + g_BlockIsTorchPlaceable[E_BLOCK_MOSSY_COBBLESTONE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_MYCELIUM] = true; + g_BlockIsTorchPlaceable[E_BLOCK_NETHERRACK] = true; + g_BlockIsTorchPlaceable[E_BLOCK_NETHER_BRICK] = true; + g_BlockIsTorchPlaceable[E_BLOCK_NETHER_QUARTZ_ORE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_NOTE_BLOCK] = true; + g_BlockIsTorchPlaceable[E_BLOCK_OBSIDIAN] = true; + g_BlockIsTorchPlaceable[E_BLOCK_PACKED_ICE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_PLANKS] = true; + g_BlockIsTorchPlaceable[E_BLOCK_PUMPKIN] = true; + g_BlockIsTorchPlaceable[E_BLOCK_QUARTZ_BLOCK] = true; + g_BlockIsTorchPlaceable[E_BLOCK_REDSTONE_LAMP_OFF] = true; + g_BlockIsTorchPlaceable[E_BLOCK_REDSTONE_LAMP_ON] = true; + g_BlockIsTorchPlaceable[E_BLOCK_REDSTONE_ORE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_REDSTONE_ORE_GLOWING] = true; + g_BlockIsTorchPlaceable[E_BLOCK_SANDSTONE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_SAND] = true; + g_BlockIsTorchPlaceable[E_BLOCK_SILVERFISH_EGG] = true; + g_BlockIsTorchPlaceable[E_BLOCK_SPONGE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_STAINED_CLAY] = true; + g_BlockIsTorchPlaceable[E_BLOCK_WOOL] = true; + g_BlockIsTorchPlaceable[E_BLOCK_STONE] = true; + g_BlockIsTorchPlaceable[E_BLOCK_STONE_BRICKS] = true; + } +} BlockPropertiesInitializer; + + + + + diff --git a/source/BlockID.h b/src/BlockID.h index f3cbc46d6..f3cbc46d6 100644 --- a/source/BlockID.h +++ b/src/BlockID.h diff --git a/source/BlockTracer.h b/src/BlockTracer.h index d0a34811d..d0a34811d 100644 --- a/source/BlockTracer.h +++ b/src/BlockTracer.h diff --git a/source/Blocks/BlockBed.cpp b/src/Blocks/BlockBed.cpp index 66eb9130c..66eb9130c 100644 --- a/source/Blocks/BlockBed.cpp +++ b/src/Blocks/BlockBed.cpp diff --git a/source/Blocks/BlockBed.h b/src/Blocks/BlockBed.h index 8a289b22c..8a289b22c 100644 --- a/source/Blocks/BlockBed.h +++ b/src/Blocks/BlockBed.h diff --git a/source/Blocks/BlockBrewingStand.h b/src/Blocks/BlockBrewingStand.h index 57642bcb6..57642bcb6 100644 --- a/source/Blocks/BlockBrewingStand.h +++ b/src/Blocks/BlockBrewingStand.h diff --git a/source/Blocks/BlockButton.cpp b/src/Blocks/BlockButton.cpp index 19b055b62..19b055b62 100644 --- a/source/Blocks/BlockButton.cpp +++ b/src/Blocks/BlockButton.cpp diff --git a/source/Blocks/BlockButton.h b/src/Blocks/BlockButton.h index 15649acc0..15649acc0 100644 --- a/source/Blocks/BlockButton.h +++ b/src/Blocks/BlockButton.h diff --git a/source/Blocks/BlockCactus.h b/src/Blocks/BlockCactus.h index 4147ad473..4147ad473 100644 --- a/source/Blocks/BlockCactus.h +++ b/src/Blocks/BlockCactus.h diff --git a/source/Blocks/BlockCarpet.h b/src/Blocks/BlockCarpet.h index 5eafd8c21..5eafd8c21 100644 --- a/source/Blocks/BlockCarpet.h +++ b/src/Blocks/BlockCarpet.h diff --git a/source/Blocks/BlockCauldron.h b/src/Blocks/BlockCauldron.h index b0e00f869..b0e00f869 100644 --- a/source/Blocks/BlockCauldron.h +++ b/src/Blocks/BlockCauldron.h diff --git a/source/Blocks/BlockChest.h b/src/Blocks/BlockChest.h index 488c58ac5..488c58ac5 100644 --- a/source/Blocks/BlockChest.h +++ b/src/Blocks/BlockChest.h diff --git a/source/Blocks/BlockCloth.h b/src/Blocks/BlockCloth.h index a136d3b9d..a136d3b9d 100644 --- a/source/Blocks/BlockCloth.h +++ b/src/Blocks/BlockCloth.h diff --git a/source/Blocks/BlockCobWeb.h b/src/Blocks/BlockCobWeb.h index 982bfaa30..982bfaa30 100644 --- a/source/Blocks/BlockCobWeb.h +++ b/src/Blocks/BlockCobWeb.h diff --git a/source/Blocks/BlockComparator.cpp b/src/Blocks/BlockComparator.cpp index 8bc0ac5ac..8bc0ac5ac 100644 --- a/source/Blocks/BlockComparator.cpp +++ b/src/Blocks/BlockComparator.cpp diff --git a/source/Blocks/BlockComparator.h b/src/Blocks/BlockComparator.h index cb2941d3c..cb2941d3c 100644 --- a/source/Blocks/BlockComparator.h +++ b/src/Blocks/BlockComparator.h diff --git a/source/Blocks/BlockCrops.h b/src/Blocks/BlockCrops.h index 9dd65aae2..9dd65aae2 100644 --- a/source/Blocks/BlockCrops.h +++ b/src/Blocks/BlockCrops.h diff --git a/source/Blocks/BlockDeadBush.h b/src/Blocks/BlockDeadBush.h index 14617d006..14617d006 100644 --- a/source/Blocks/BlockDeadBush.h +++ b/src/Blocks/BlockDeadBush.h diff --git a/source/Blocks/BlockDirt.h b/src/Blocks/BlockDirt.h index c694d79f6..c694d79f6 100644 --- a/source/Blocks/BlockDirt.h +++ b/src/Blocks/BlockDirt.h diff --git a/source/Blocks/BlockDoor.cpp b/src/Blocks/BlockDoor.cpp index e71ccd368..e71ccd368 100644 --- a/source/Blocks/BlockDoor.cpp +++ b/src/Blocks/BlockDoor.cpp diff --git a/source/Blocks/BlockDoor.h b/src/Blocks/BlockDoor.h index 03a79d47d..03a79d47d 100644 --- a/source/Blocks/BlockDoor.h +++ b/src/Blocks/BlockDoor.h diff --git a/source/Blocks/BlockDropSpenser.h b/src/Blocks/BlockDropSpenser.h index b7f20825d..b7f20825d 100644 --- a/source/Blocks/BlockDropSpenser.h +++ b/src/Blocks/BlockDropSpenser.h diff --git a/source/Blocks/BlockEnderchest.h b/src/Blocks/BlockEnderchest.h index 0ce813f1c..0ce813f1c 100644 --- a/source/Blocks/BlockEnderchest.h +++ b/src/Blocks/BlockEnderchest.h diff --git a/source/Blocks/BlockEntity.h b/src/Blocks/BlockEntity.h index 9c6b23665..9c6b23665 100644 --- a/source/Blocks/BlockEntity.h +++ b/src/Blocks/BlockEntity.h diff --git a/source/Blocks/BlockFarmland.h b/src/Blocks/BlockFarmland.h index 7bc71f7f3..7bc71f7f3 100644 --- a/source/Blocks/BlockFarmland.h +++ b/src/Blocks/BlockFarmland.h diff --git a/source/Blocks/BlockFenceGate.h b/src/Blocks/BlockFenceGate.h index 6423a7cb0..6423a7cb0 100644 --- a/source/Blocks/BlockFenceGate.h +++ b/src/Blocks/BlockFenceGate.h diff --git a/source/Blocks/BlockFire.h b/src/Blocks/BlockFire.h index 46b56d7e0..46b56d7e0 100644 --- a/source/Blocks/BlockFire.h +++ b/src/Blocks/BlockFire.h diff --git a/source/Blocks/BlockFlower.h b/src/Blocks/BlockFlower.h index 421e2d5d8..421e2d5d8 100644 --- a/source/Blocks/BlockFlower.h +++ b/src/Blocks/BlockFlower.h diff --git a/source/Blocks/BlockFlowerPot.h b/src/Blocks/BlockFlowerPot.h index b0faf5218..b0faf5218 100644 --- a/source/Blocks/BlockFlowerPot.h +++ b/src/Blocks/BlockFlowerPot.h diff --git a/source/Blocks/BlockFluid.h b/src/Blocks/BlockFluid.h index 0db2f60c4..0db2f60c4 100644 --- a/source/Blocks/BlockFluid.h +++ b/src/Blocks/BlockFluid.h diff --git a/source/Blocks/BlockFurnace.h b/src/Blocks/BlockFurnace.h index fe35893d5..fe35893d5 100644 --- a/source/Blocks/BlockFurnace.h +++ b/src/Blocks/BlockFurnace.h diff --git a/source/Blocks/BlockGlass.h b/src/Blocks/BlockGlass.h index f6958bbb6..f6958bbb6 100644 --- a/source/Blocks/BlockGlass.h +++ b/src/Blocks/BlockGlass.h diff --git a/source/Blocks/BlockGlowstone.h b/src/Blocks/BlockGlowstone.h index 5f0d95dee..5f0d95dee 100644 --- a/source/Blocks/BlockGlowstone.h +++ b/src/Blocks/BlockGlowstone.h diff --git a/source/Blocks/BlockGravel.h b/src/Blocks/BlockGravel.h index e1c9ff390..e1c9ff390 100644 --- a/source/Blocks/BlockGravel.h +++ b/src/Blocks/BlockGravel.h diff --git a/source/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index cd07b3021..cd07b3021 100644 --- a/source/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp diff --git a/source/Blocks/BlockHandler.h b/src/Blocks/BlockHandler.h index 81d9f240c..81d9f240c 100644 --- a/source/Blocks/BlockHandler.h +++ b/src/Blocks/BlockHandler.h diff --git a/source/Blocks/BlockHopper.h b/src/Blocks/BlockHopper.h index 3998276d7..3998276d7 100644 --- a/source/Blocks/BlockHopper.h +++ b/src/Blocks/BlockHopper.h diff --git a/source/Blocks/BlockIce.h b/src/Blocks/BlockIce.h index af4961114..af4961114 100644 --- a/source/Blocks/BlockIce.h +++ b/src/Blocks/BlockIce.h diff --git a/source/Blocks/BlockLadder.h b/src/Blocks/BlockLadder.h index c0aa25f60..c0aa25f60 100644 --- a/source/Blocks/BlockLadder.h +++ b/src/Blocks/BlockLadder.h diff --git a/source/Blocks/BlockLeaves.h b/src/Blocks/BlockLeaves.h index 6e015b8fa..6e015b8fa 100644 --- a/source/Blocks/BlockLeaves.h +++ b/src/Blocks/BlockLeaves.h diff --git a/source/Blocks/BlockLever.cpp b/src/Blocks/BlockLever.cpp index 2739fa3a9..2739fa3a9 100644 --- a/source/Blocks/BlockLever.cpp +++ b/src/Blocks/BlockLever.cpp diff --git a/source/Blocks/BlockLever.h b/src/Blocks/BlockLever.h index fe7ecdf7e..fe7ecdf7e 100644 --- a/source/Blocks/BlockLever.h +++ b/src/Blocks/BlockLever.h diff --git a/source/Blocks/BlockMelon.h b/src/Blocks/BlockMelon.h index 2f7d9a461..2f7d9a461 100644 --- a/source/Blocks/BlockMelon.h +++ b/src/Blocks/BlockMelon.h diff --git a/source/Blocks/BlockMushroom.h b/src/Blocks/BlockMushroom.h index 2846a6317..2846a6317 100644 --- a/source/Blocks/BlockMushroom.h +++ b/src/Blocks/BlockMushroom.h diff --git a/source/Blocks/BlockMycelium.h b/src/Blocks/BlockMycelium.h index 7f897c72a..7f897c72a 100644 --- a/source/Blocks/BlockMycelium.h +++ b/src/Blocks/BlockMycelium.h diff --git a/source/Blocks/BlockNote.h b/src/Blocks/BlockNote.h index fef38d845..fef38d845 100644 --- a/source/Blocks/BlockNote.h +++ b/src/Blocks/BlockNote.h diff --git a/source/Blocks/BlockOre.h b/src/Blocks/BlockOre.h index 9684dbb19..9684dbb19 100644 --- a/source/Blocks/BlockOre.h +++ b/src/Blocks/BlockOre.h diff --git a/source/Blocks/BlockPiston.cpp b/src/Blocks/BlockPiston.cpp index d5750ebdd..d5750ebdd 100644 --- a/source/Blocks/BlockPiston.cpp +++ b/src/Blocks/BlockPiston.cpp diff --git a/source/Blocks/BlockPiston.h b/src/Blocks/BlockPiston.h index 109f5ea8b..109f5ea8b 100644 --- a/source/Blocks/BlockPiston.h +++ b/src/Blocks/BlockPiston.h diff --git a/source/Blocks/BlockPlanks.h b/src/Blocks/BlockPlanks.h index f3b8dbfb6..f3b8dbfb6 100644 --- a/source/Blocks/BlockPlanks.h +++ b/src/Blocks/BlockPlanks.h diff --git a/source/Blocks/BlockPortal.h b/src/Blocks/BlockPortal.h index c56f0cbc8..c56f0cbc8 100644 --- a/source/Blocks/BlockPortal.h +++ b/src/Blocks/BlockPortal.h diff --git a/source/Blocks/BlockPumpkin.h b/src/Blocks/BlockPumpkin.h index 76abc6818..76abc6818 100644 --- a/source/Blocks/BlockPumpkin.h +++ b/src/Blocks/BlockPumpkin.h diff --git a/source/Blocks/BlockRail.h b/src/Blocks/BlockRail.h index 24a101652..24a101652 100644 --- a/source/Blocks/BlockRail.h +++ b/src/Blocks/BlockRail.h diff --git a/source/Blocks/BlockRedstone.cpp b/src/Blocks/BlockRedstone.cpp index 35cdc34cf..35cdc34cf 100644 --- a/source/Blocks/BlockRedstone.cpp +++ b/src/Blocks/BlockRedstone.cpp diff --git a/source/Blocks/BlockRedstone.h b/src/Blocks/BlockRedstone.h index f28f3f2d6..f28f3f2d6 100644 --- a/source/Blocks/BlockRedstone.h +++ b/src/Blocks/BlockRedstone.h diff --git a/source/Blocks/BlockRedstoneRepeater.cpp b/src/Blocks/BlockRedstoneRepeater.cpp index 3ab5bc559..3ab5bc559 100644 --- a/source/Blocks/BlockRedstoneRepeater.cpp +++ b/src/Blocks/BlockRedstoneRepeater.cpp diff --git a/source/Blocks/BlockRedstoneRepeater.h b/src/Blocks/BlockRedstoneRepeater.h index a61121d3a..a61121d3a 100644 --- a/source/Blocks/BlockRedstoneRepeater.h +++ b/src/Blocks/BlockRedstoneRepeater.h diff --git a/source/Blocks/BlockRedstoneTorch.h b/src/Blocks/BlockRedstoneTorch.h index cb897ba3f..cb897ba3f 100644 --- a/source/Blocks/BlockRedstoneTorch.h +++ b/src/Blocks/BlockRedstoneTorch.h diff --git a/source/Blocks/BlockSand.h b/src/Blocks/BlockSand.h index 3fc271483..3fc271483 100644 --- a/source/Blocks/BlockSand.h +++ b/src/Blocks/BlockSand.h diff --git a/source/Blocks/BlockSapling.h b/src/Blocks/BlockSapling.h index fff2fa88b..fff2fa88b 100644 --- a/source/Blocks/BlockSapling.h +++ b/src/Blocks/BlockSapling.h diff --git a/source/Blocks/BlockSign.h b/src/Blocks/BlockSign.h index 7fbe61893..7fbe61893 100644 --- a/source/Blocks/BlockSign.h +++ b/src/Blocks/BlockSign.h diff --git a/source/Blocks/BlockSlab.h b/src/Blocks/BlockSlab.h index 7c1251b28..7c1251b28 100644 --- a/source/Blocks/BlockSlab.h +++ b/src/Blocks/BlockSlab.h diff --git a/source/Blocks/BlockSnow.h b/src/Blocks/BlockSnow.h index b8d48362c..b8d48362c 100644 --- a/source/Blocks/BlockSnow.h +++ b/src/Blocks/BlockSnow.h diff --git a/source/Blocks/BlockStairs.h b/src/Blocks/BlockStairs.h index 8d259eee3..8d259eee3 100644 --- a/source/Blocks/BlockStairs.h +++ b/src/Blocks/BlockStairs.h diff --git a/source/Blocks/BlockStems.h b/src/Blocks/BlockStems.h index ce02d9cb8..ce02d9cb8 100644 --- a/source/Blocks/BlockStems.h +++ b/src/Blocks/BlockStems.h diff --git a/source/Blocks/BlockStone.h b/src/Blocks/BlockStone.h index af4c6509a..af4c6509a 100644 --- a/source/Blocks/BlockStone.h +++ b/src/Blocks/BlockStone.h diff --git a/source/Blocks/BlockSugarcane.h b/src/Blocks/BlockSugarcane.h index 28a60df80..28a60df80 100644 --- a/source/Blocks/BlockSugarcane.h +++ b/src/Blocks/BlockSugarcane.h diff --git a/source/Blocks/BlockTallGrass.h b/src/Blocks/BlockTallGrass.h index cd27ab7e6..cd27ab7e6 100644 --- a/source/Blocks/BlockTallGrass.h +++ b/src/Blocks/BlockTallGrass.h diff --git a/source/Blocks/BlockTorch.h b/src/Blocks/BlockTorch.h index 72a313126..72a313126 100644 --- a/source/Blocks/BlockTorch.h +++ b/src/Blocks/BlockTorch.h diff --git a/source/Blocks/BlockVine.h b/src/Blocks/BlockVine.h index 2c9f67cab..2c9f67cab 100644 --- a/source/Blocks/BlockVine.h +++ b/src/Blocks/BlockVine.h diff --git a/source/Blocks/BlockWood.h b/src/Blocks/BlockWood.h index cb5ee995a..cb5ee995a 100644 --- a/source/Blocks/BlockWood.h +++ b/src/Blocks/BlockWood.h diff --git a/source/Blocks/BlockWorkbench.h b/src/Blocks/BlockWorkbench.h index a2cc6119c..a2cc6119c 100644 --- a/source/Blocks/BlockWorkbench.h +++ b/src/Blocks/BlockWorkbench.h diff --git a/source/BoundingBox.cpp b/src/BoundingBox.cpp index 02602992e..02602992e 100644 --- a/source/BoundingBox.cpp +++ b/src/BoundingBox.cpp diff --git a/source/BoundingBox.h b/src/BoundingBox.h index ff9963989..ff9963989 100644 --- a/source/BoundingBox.h +++ b/src/BoundingBox.h diff --git a/source/ByteBuffer.cpp b/src/ByteBuffer.cpp index 8f2b76c1f..8f2b76c1f 100644 --- a/source/ByteBuffer.cpp +++ b/src/ByteBuffer.cpp diff --git a/source/ByteBuffer.h b/src/ByteBuffer.h index a9dd7f5ea..a9dd7f5ea 100644 --- a/source/ByteBuffer.h +++ b/src/ByteBuffer.h diff --git a/source/ChatColor.cpp b/src/ChatColor.cpp index 2b223ee76..2b223ee76 100644 --- a/source/ChatColor.cpp +++ b/src/ChatColor.cpp diff --git a/source/ChatColor.h b/src/ChatColor.h index 85b10f400..85b10f400 100644 --- a/source/ChatColor.h +++ b/src/ChatColor.h diff --git a/src/Chunk.cpp b/src/Chunk.cpp new file mode 100644 index 000000000..b3b24e339 --- /dev/null +++ b/src/Chunk.cpp @@ -0,0 +1,2776 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#ifndef _WIN32 + #include <cstdlib> +#endif + + +#include "Chunk.h" +#include "World.h" +#include "ClientHandle.h" +#include "Server.h" +#include "zlib/zlib.h" +#include "Defines.h" +#include "BlockEntities/ChestEntity.h" +#include "BlockEntities/DispenserEntity.h" +#include "BlockEntities/DropperEntity.h" +#include "BlockEntities/FurnaceEntity.h" +#include "BlockEntities/HopperEntity.h" +#include "BlockEntities/JukeboxEntity.h" +#include "BlockEntities/NoteEntity.h" +#include "BlockEntities/SignEntity.h" +#include "Entities/Pickup.h" +#include "Item.h" +#include "Noise.h" +#include "Root.h" +#include "MersenneTwister.h" +#include "Entities/Player.h" +#include "BlockArea.h" +#include "PluginManager.h" +#include "Blocks/BlockHandler.h" +#include "Simulator/FluidSimulator.h" +#include "MobCensus.h" +#include "MobSpawner.h" + + +#include "json/json.h" + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// sSetBlock: + +sSetBlock::sSetBlock( int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta ) // absolute block position + : x( a_BlockX ) + , y( a_BlockY ) + , z( a_BlockZ ) + , BlockType( a_BlockType ) + , BlockMeta( a_BlockMeta ) +{ + cChunkDef::AbsoluteToRelative(x, y, z, ChunkX, ChunkZ); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cChunk: + +cChunk::cChunk( + int a_ChunkX, int a_ChunkY, int a_ChunkZ, + cChunkMap * a_ChunkMap, cWorld * a_World, + cChunk * a_NeighborXM, cChunk * a_NeighborXP, cChunk * a_NeighborZM, cChunk * a_NeighborZP +) + : m_PosX( a_ChunkX ) + , m_PosY( a_ChunkY ) + , m_PosZ( a_ChunkZ ) + , m_BlockTickX( 0 ) + , m_BlockTickY( 0 ) + , m_BlockTickZ( 0 ) + , m_World( a_World ) + , m_ChunkMap(a_ChunkMap) + , m_IsValid(false) + , m_IsLightValid(false) + , m_IsDirty(false) + , m_IsSaving(false) + , m_StayCount(0) + , m_NeighborXM(a_NeighborXM) + , m_NeighborXP(a_NeighborXP) + , m_NeighborZM(a_NeighborZM) + , m_NeighborZP(a_NeighborZP) + , m_WaterSimulatorData(a_World->GetWaterSimulator()->CreateChunkData()) + , m_LavaSimulatorData (a_World->GetLavaSimulator ()->CreateChunkData()) +{ + if (a_NeighborXM != NULL) + { + a_NeighborXM->m_NeighborXP = this; + } + if (a_NeighborXP != NULL) + { + a_NeighborXP->m_NeighborXM = this; + } + if (a_NeighborZM != NULL) + { + a_NeighborZM->m_NeighborZP = this; + } + if (a_NeighborZP != NULL) + { + a_NeighborZP->m_NeighborZM = this; + } +} + + + + + +cChunk::~cChunk() +{ + cPluginManager::Get()->CallHookChunkUnloaded(m_World, m_PosX, m_PosZ); + + // LOGINFO("### delete cChunk() (%i, %i) from %p, thread 0x%x ###", m_PosX, m_PosZ, this, GetCurrentThreadId() ); + + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) + { + delete *itr; + } + m_BlockEntities.clear(); + + // Remove and destroy all entities that are not players: + cEntityList Entities; + std::swap(Entities, m_Entities); // Need another list because cEntity destructors check if they've been removed from chunk + for (cEntityList::const_iterator itr = Entities.begin(); itr != Entities.end(); ++itr) + { + if (!(*itr)->IsPlayer()) + { + (*itr)->Destroy(false); + delete *itr; + } + } + + if (m_NeighborXM != NULL) + { + m_NeighborXM->m_NeighborXP = NULL; + } + if (m_NeighborXP != NULL) + { + m_NeighborXP->m_NeighborXM = NULL; + } + if (m_NeighborZM != NULL) + { + m_NeighborZM->m_NeighborZP = NULL; + } + if (m_NeighborZP != NULL) + { + m_NeighborZP->m_NeighborZM = NULL; + } + delete m_WaterSimulatorData; + delete m_LavaSimulatorData; +} + + + + + +void cChunk::SetValid(void) +{ + m_IsValid = true; + + m_World->GetChunkMap()->ChunkValidated(); +} + + + + + +void cChunk::MarkRegenerating(void) +{ + // Tell all clients attached to this chunk that they want this chunk: + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) + { + (*itr)->AddWantedChunk(m_PosX, m_PosZ); + } // for itr - m_LoadedByClient[] +} + + + + + +bool cChunk::CanUnload(void) +{ + return m_LoadedByClient.empty() && !m_IsDirty && (m_StayCount == 0); +} + + + + + +void cChunk::MarkSaving(void) +{ + m_IsSaving = true; +} + + + + + +void cChunk::MarkSaved(void) +{ + if (!m_IsSaving) + { + return; + } + m_IsDirty = false; +} + + + + + +void cChunk::MarkLoaded(void) +{ + m_IsDirty = false; + SetValid(); +} + + + + + +void cChunk::MarkLoadFailed(void) +{ + if (m_IsValid) + { + return; + } + + m_HasLoadFailed = true; +} + + + + + +void cChunk::GetAllData(cChunkDataCallback & a_Callback) +{ + a_Callback.HeightMap (&m_HeightMap); + a_Callback.BiomeData (&m_BiomeMap); + a_Callback.BlockTypes (m_BlockTypes); + a_Callback.BlockMeta (m_BlockMeta); + a_Callback.LightIsValid (m_IsLightValid); + a_Callback.BlockLight (m_BlockLight); + a_Callback.BlockSkyLight(m_BlockSkyLight); + + for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr) + { + a_Callback.Entity(*itr); + } + + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) + { + a_Callback.BlockEntity(*itr); + } +} + + + + + +void cChunk::SetAllData( + const BLOCKTYPE * a_BlockTypes, + const NIBBLETYPE * a_BlockMeta, + const NIBBLETYPE * a_BlockLight, + const NIBBLETYPE * a_BlockSkyLight, + const HeightMap * a_HeightMap, + const BiomeMap & a_BiomeMap, + cBlockEntityList & a_BlockEntities +) +{ + memcpy(m_BiomeMap, a_BiomeMap, sizeof(m_BiomeMap)); + + if (a_HeightMap != NULL) + { + memcpy(m_HeightMap, a_HeightMap, sizeof(m_HeightMap)); + } + + memcpy(m_BlockTypes, a_BlockTypes, sizeof(m_BlockTypes)); + memcpy(m_BlockMeta, a_BlockMeta, sizeof(m_BlockMeta)); + if (a_BlockLight != NULL) + { + memcpy(m_BlockLight, a_BlockLight, sizeof(m_BlockLight)); + } + if (a_BlockSkyLight != NULL) + { + memcpy(m_BlockSkyLight, a_BlockSkyLight, sizeof(m_BlockSkyLight)); + } + + m_IsLightValid = (a_BlockLight != NULL) && (a_BlockSkyLight != NULL); + + if (a_HeightMap == NULL) + { + CalculateHeightmap(); + } + + // Clear the block entities present - either the loader / saver has better, or we'll create empty ones: + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) + { + delete *itr; + } + std::swap(a_BlockEntities, m_BlockEntities); + + // Set all block entities' World variable: + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) + { + (*itr)->SetWorld(m_World); + } + + // Create block entities that the loader didn't load; fill them with defaults + CreateBlockEntities(); + + // Set the chunk data as valid. This may be needed for some simulators that perform actions upon block adding (Vaporize) + SetValid(); + + // Wake up all simulators for their respective blocks: + WakeUpSimulators(); + + m_HasLoadFailed = false; +} + + + + + +void cChunk::SetLight( + const cChunkDef::BlockNibbles & a_BlockLight, + const cChunkDef::BlockNibbles & a_SkyLight +) +{ + // TODO: We might get cases of wrong lighting when a chunk changes in the middle of a lighting calculation. + // Postponing until we see how bad it is :) + memcpy(m_BlockLight, a_BlockLight, sizeof(m_BlockLight)); + memcpy(m_BlockSkyLight, a_SkyLight, sizeof(m_BlockSkyLight)); + m_IsLightValid = true; +} + + + + + +void cChunk::GetBlockTypes(BLOCKTYPE * a_BlockTypes) +{ + memcpy(a_BlockTypes, m_BlockTypes, NumBlocks); +} + + + + + +void cChunk::WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) +{ + if ((a_DataTypes & (cBlockArea::baTypes | cBlockArea::baMetas)) != (cBlockArea::baTypes | cBlockArea::baMetas)) + { + LOGWARNING("cChunk::WriteBlockArea(): unsupported datatype request, can write only types + metas (0x%x), requested 0x%x. Ignoring.", + (cBlockArea::baTypes | cBlockArea::baMetas), a_DataTypes & (cBlockArea::baTypes | cBlockArea::baMetas) + ); + return; + } + + // SizeX, SizeZ are the dimensions of the block data to copy to the chunk (size of the geometric union) + + int BlockStartX = std::max(a_MinBlockX, m_PosX * cChunkDef::Width); + int BlockEndX = std::min(a_MinBlockX + a_Area.GetSizeX(), (m_PosX + 1) * cChunkDef::Width); + int BlockStartZ = std::max(a_MinBlockZ, m_PosZ * cChunkDef::Width); + int BlockEndZ = std::min(a_MinBlockZ + a_Area.GetSizeZ(), (m_PosZ + 1) * cChunkDef::Width); + int SizeX = BlockEndX - BlockStartX; + int SizeZ = BlockEndZ - BlockStartZ; + int OffX = BlockStartX - m_PosX * cChunkDef::Width; + int OffZ = BlockStartZ - m_PosZ * cChunkDef::Width; + int BaseX = BlockStartX - a_MinBlockX; + int BaseZ = BlockStartZ - a_MinBlockZ; + int SizeY = a_Area.GetSizeY(); + + // TODO: Improve this by not calling FastSetBlock() and doing the processing here + // so that the heightmap is touched only once for each column. + BLOCKTYPE * AreaBlockTypes = a_Area.GetBlockTypes(); + NIBBLETYPE * AreaBlockMetas = a_Area.GetBlockMetas(); + for (int y = 0; y < SizeY; y++) + { + int ChunkY = a_MinBlockY + y; + int AreaY = y; + for (int z = 0; z < SizeZ; z++) + { + int ChunkZ = OffZ + z; + int AreaZ = BaseZ + z; + for (int x = 0; x < SizeX; x++) + { + int ChunkX = OffX + x; + int AreaX = BaseX + x; + int idx = a_Area.MakeIndex(AreaX, AreaY, AreaZ); + BLOCKTYPE BlockType = AreaBlockTypes[idx]; + NIBBLETYPE BlockMeta = AreaBlockMetas[idx]; + FastSetBlock(ChunkX, ChunkY, ChunkZ, BlockType, BlockMeta); + } // for x + } // for z + } // for y +} + + + + + +/// Returns true if there is a block entity at the coords specified +bool cChunk::HasBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) + { + if ( + ((*itr)->GetPosX() == a_BlockX) && + ((*itr)->GetPosY() == a_BlockY) && + ((*itr)->GetPosZ() == a_BlockZ) + ) + { + return true; + } + } // for itr - m_BlockEntities[] + return false; +} + + + + + +/// Sets or resets the internal flag that prevents chunk from being unloaded +void cChunk::Stay(bool a_Stay) +{ + m_StayCount += (a_Stay ? 1 : -1); + ASSERT(m_StayCount >= 0); +} + + + + +void cChunk::CollectMobCensus(cMobCensus& toFill) +{ + toFill.CollectSpawnableChunk(*this); + std::list<const Vector3d*> playerPositions; + cPlayer* currentPlayer; + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr) + { + currentPlayer = (*itr)->GetPlayer(); + playerPositions.push_back(&(currentPlayer->GetPosition())); + } + + Vector3d currentPosition; + for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr) + { + //LOGD("Counting entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass()); + if ((*itr)->IsMob()) + { + cMonster& Monster = (cMonster&)(**itr); + currentPosition = Monster.GetPosition(); + for (std::list<const Vector3d*>::const_iterator itr2 = playerPositions.begin(); itr2 != playerPositions.end(); itr2 ++) + { + toFill.CollectMob(Monster,*this,(currentPosition-**itr2).SqrLength()); + } + } + } // for itr - m_Entitites[] +} + + + + +void cChunk::getThreeRandomNumber(int& a_X, int& a_Y, int& a_Z,int a_MaxX, int a_MaxY, int a_MaxZ) +{ + ASSERT(a_MaxX * a_MaxY * a_MaxZ * 8 < 0x00ffffff); + int Random = m_World->GetTickRandomNumber(0x00ffffff); + a_X = Random % (a_MaxX * 2); + a_Y = (Random / (a_MaxX * 2)) % (a_MaxY * 2); + a_Z = ((Random / (a_MaxX * 2)) / (a_MaxY * 2)) % (a_MaxZ * 2); + a_X /= 2; + a_Y /= 2; + a_Z /= 2; +} + + + + + +void cChunk::getRandomBlockCoords(int& a_X, int& a_Y, int& a_Z) +{ + // MG TODO : check if this kind of optimization (only one random call) is still needed + // MG TODO : if so propagate it + + getThreeRandomNumber(a_X, a_Y, a_Z, Width, Height-2, Width); + a_Y++; +} + + + + + +void cChunk::SpawnMobs(cMobSpawner& a_MobSpawner) +{ + int Center_X,Center_Y,Center_Z; + getRandomBlockCoords(Center_X,Center_Y,Center_Z); + + BLOCKTYPE PackCenterBlock = GetBlock(Center_X, Center_Y, Center_Z); + if (a_MobSpawner.CheckPackCenter(PackCenterBlock)) + { + a_MobSpawner.NewPack(); + int NumberOfTries = 0; + int NumberOfSuccess = 0; + int MaxNbOfSuccess = 4; // this can be changed during the process for Wolves and Ghass + while (NumberOfTries < 12 && NumberOfSuccess < MaxNbOfSuccess) + { + const int HorizontalRange = 20; // MG TODO : relocate + const int VerticalRange = 0; // MG TODO : relocate + int Try_X, Try_Y, Try_Z; + getThreeRandomNumber(Try_X, Try_Y, Try_Z, 2*HorizontalRange+1 , 2*VerticalRange+1 , 2*HorizontalRange+1); + Try_X -= HorizontalRange; + Try_Y -= VerticalRange; + Try_Z -= HorizontalRange; + Try_X += Center_X; + Try_Y += Center_Y; + Try_Z += Center_Z; + + ASSERT(Try_Y > 0); + ASSERT(Try_Y < cChunkDef::Height-1); + + EMCSBiome Biome = m_ChunkMap->GetBiomeAt (Try_X, Try_Z); + // MG TODO : + // Moon cycle (for slime) + // check player and playerspawn presence < 24 blocks + // check mobs presence on the block + + // MG TODO : check that "Level" really means Y + + NIBBLETYPE SkyLight = 0; + + NIBBLETYPE BlockLight = 0; + + if (IsLightValid()) + { + cEntity* newMob = a_MobSpawner.TryToSpawnHere(this, Try_X, Try_Y, Try_Z, Biome, MaxNbOfSuccess); + if (newMob) + { + int WorldX, WorldY, WorldZ; + PositionToWorldPosition(Try_X, Try_Y, Try_Z, WorldX, WorldY, WorldZ); + double ActualX = WorldX + 0.5; + double ActualZ = WorldZ + 0.5; + newMob->SetPosition(ActualX, WorldY, ActualZ); + LOGD("Spawning %s #%i at %d,%d,%d",newMob->GetClass(),newMob->GetUniqueID(),WorldX, WorldY, WorldZ); + NumberOfSuccess++; + } + } + + NumberOfTries++; + } + } + +} + + + + + +void cChunk::Tick(float a_Dt) +{ + BroadcastPendingBlockChanges(); + + // Unload the chunk from all clients that have queued unloading: + for (cClientHandleList::iterator itr = m_UnloadQuery.begin(), end = m_UnloadQuery.end(); itr != end; ++itr) + { + (*itr)->SendUnloadChunk(m_PosX, m_PosZ); + } + m_UnloadQuery.clear(); + + // Set all blocks that have been queued for setting later: + ProcessQueuedSetBlocks(); + + CheckBlocks(); + + // Tick simulators: + m_World->GetSimulatorManager()->SimulateChunk(a_Dt, m_PosX, m_PosZ, this); + + TickBlocks(); + + // Tick all block entities in this chunk: + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) + { + m_IsDirty = (*itr)->Tick(a_Dt, *this) | m_IsDirty; + } + + // Tick all entities in this chunk (except mobs): + for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr) + { + // Mobs are tickes inside MobTick (as we don't have to tick them if they are far away from players) + if (!((*itr)->IsMob())) + { + (*itr)->Tick(a_Dt, *this); + } + } // for itr - m_Entitites[] + + // Remove all entities that were scheduled for removal: + for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end();) + { + if ((*itr)->IsDestroyed()) + { + LOGD("Destroying entity #%i (%s)", (*itr)->GetUniqueID(), (*itr)->GetClass()); + cEntity * ToDelete = *itr; + itr = m_Entities.erase(itr); + delete ToDelete; + continue; + } + itr++; + } // for itr - m_Entitites[] + + // If any entity moved out of the chunk, move it to the neighbor: + for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end();) + { + if ( + ((*itr)->GetChunkX() != m_PosX) || + ((*itr)->GetChunkZ() != m_PosZ) + ) + { + MoveEntityToNewChunk(*itr); + itr = m_Entities.erase(itr); + } + else + { + ++itr; + } + } + + ApplyWeatherToTop(); +} + + + + + +void cChunk::MoveEntityToNewChunk(cEntity * a_Entity) +{ + cChunk * Neighbor = GetNeighborChunk(a_Entity->GetChunkX() * cChunkDef::Width, a_Entity->GetChunkZ() * cChunkDef::Width); + if (Neighbor == NULL) + { + Neighbor = m_ChunkMap->GetChunkNoLoad(a_Entity->GetChunkX(), ZERO_CHUNK_Y, a_Entity->GetChunkZ()); + if (Neighbor == NULL) + { + // TODO: What to do with this? + LOGWARNING("%s: Failed to move entity, destination chunk unreachable. Entity lost", __FUNCTION__); + return; + } + } + + ASSERT(Neighbor != this); // Moving into the same chunk? wtf? + + Neighbor->AddEntity(a_Entity); + + class cMover : + public cClientDiffCallback + { + virtual void Removed(cClientHandle * a_Client) override + { + a_Client->SendDestroyEntity(*m_Entity); + } + + virtual void Added(cClientHandle * a_Client) override + { + m_Entity->SpawnOn(*a_Client); + } + + cEntity * m_Entity; + + public: + cMover(cEntity * a_Entity) : + m_Entity(a_Entity) + {} + } Mover(a_Entity); + + m_ChunkMap->CompareChunkClients(this, Neighbor, Mover); +} + + + + + +void cChunk::ProcessQueuedSetBlocks(void) +{ + Int64 CurrTick = m_World->GetWorldAge(); + for (sSetBlockQueueVector::iterator itr = m_SetBlockQueue.begin(); itr != m_SetBlockQueue.end();) + { + if (itr->m_Tick <= CurrTick) + { + // Current world age is bigger than/equal to target world age - delay time reached + SetBlock(itr->m_RelX, itr->m_RelY, itr->m_RelZ, itr->m_BlockType, itr->m_BlockMeta); + itr = m_SetBlockQueue.erase(itr); + } + else + { + // Not yet + ++itr; + continue; + } + } // for itr - m_SetBlockQueue[] +} + + + + + +void cChunk::BroadcastPendingBlockChanges(void) +{ + if (m_PendingSendBlocks.empty()) + { + return; + } + + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(), end = m_LoadedByClient.end(); itr != end; ++itr) + { + (*itr)->SendBlockChanges(m_PosX, m_PosZ, m_PendingSendBlocks); + } + m_PendingSendBlocks.clear(); +} + + + + + +void cChunk::CheckBlocks(void) +{ + if (m_ToTickBlocks.size() == 0) + { + return; + } + std::vector<unsigned int> ToTickBlocks; + std::swap(m_ToTickBlocks, ToTickBlocks); + + for (std::vector<unsigned int>::const_iterator itr = ToTickBlocks.begin(), end = ToTickBlocks.end(); itr != end; ++itr) + { + unsigned int index = (*itr); + Vector3i BlockPos = IndexToCoordinate(index); + + cBlockHandler * Handler = BlockHandler(GetBlock(index)); + Handler->Check(BlockPos.x, BlockPos.y, BlockPos.z, *this); + } // for itr - ToTickBlocks[] +} + + + + + +void cChunk::TickBlocks(void) +{ + // Tick dem blocks + // _X: We must limit the random number or else we get a nasty int overflow bug ( http://forum.mc-server.org/showthread.php?tid=457 ) + int RandomX = m_World->GetTickRandomNumber(0x00ffffff); + int RandomY = m_World->GetTickRandomNumber(0x00ffffff); + int RandomZ = m_World->GetTickRandomNumber(0x00ffffff); + int TickX = m_BlockTickX; + int TickY = m_BlockTickY; + int TickZ = m_BlockTickZ; + + // This for loop looks disgusting, but it actually does a simple thing - first processes m_BlockTick, then adds random to it + // This is so that SetNextBlockTick() works + for (int i = 0; i < 50; i++, + + // This weird construct (*2, then /2) is needed, + // otherwise the blocktick distribution is too biased towards even coords! + + TickX = (TickX + RandomX) % (Width * 2), + TickY = (TickY + RandomY) % (Height * 2), + TickZ = (TickZ + RandomZ) % (Width * 2), + m_BlockTickX = TickX / 2, + m_BlockTickY = TickY / 2, + m_BlockTickZ = TickZ / 2 + ) + { + + if (m_BlockTickY > cChunkDef::GetHeight(m_HeightMap, m_BlockTickX, m_BlockTickZ)) + { + continue; // It's all air up here + } + + unsigned int Index = MakeIndexNoCheck(m_BlockTickX, m_BlockTickY, m_BlockTickZ); + cBlockHandler * Handler = BlockHandler(m_BlockTypes[Index]); + ASSERT(Handler != NULL); // Happenned on server restart, FS #243 + Handler->OnUpdate(m_World, m_BlockTickX + m_PosX * Width, m_BlockTickY, m_BlockTickZ + m_PosZ * Width); + } // for i - tickblocks +} + + + + + +void cChunk::ApplyWeatherToTop() +{ + if ( + (m_World->GetTickRandomNumber(100) != 0) || + ( + (m_World->GetWeather() != eWeather_Rain) && + (m_World->GetWeather() != eWeather_ThunderStorm) + ) + ) + { + // Not the right weather, or not at this tick; bail out + return; + } + + int X = m_World->GetTickRandomNumber(15); + int Z = m_World->GetTickRandomNumber(15); + switch (GetBiomeAt(X, Z)) + { + case biTaiga: + case biFrozenOcean: + case biFrozenRiver: + case biIcePlains: + case biIceMountains: + case biTaigaHills: + { + // TODO: Check light levels, don't snow over when the BlockLight is higher than (7?) + int Height = GetHeight(X, Z); + BLOCKTYPE TopBlock = GetBlock(X, Height, Z); + NIBBLETYPE TopMeta = GetMeta (X, Height, Z); + if (m_World->IsDeepSnowEnabled() && (TopBlock == E_BLOCK_SNOW)) + { + int MaxSize = 7; + BLOCKTYPE BlockType[4]; + NIBBLETYPE BlockMeta[4]; + UnboundedRelGetBlock(X - 1, Height, Z, BlockType[0], BlockMeta[0]); + UnboundedRelGetBlock(X + 1, Height, Z, BlockType[1], BlockMeta[1]); + UnboundedRelGetBlock(X, Height, Z - 1, BlockType[2], BlockMeta[2]); + UnboundedRelGetBlock(X, Height, Z + 1, BlockType[3], BlockMeta[3]); + for (int i = 0; i < 4; i++) + { + switch (BlockType[i]) + { + case E_BLOCK_AIR: + { + MaxSize = 0; + break; + } + case E_BLOCK_SNOW: + { + MaxSize = std::min(BlockMeta[i] + 1, MaxSize); + break; + } + } + } + if (TopMeta < MaxSize) + { + FastSetBlock(X, Height, Z, E_BLOCK_SNOW, TopMeta + 1); + } + else if (TopMeta > MaxSize) + { + FastSetBlock(X, Height, Z, E_BLOCK_SNOW, TopMeta - 1); + } + } + else if (g_BlockIsSnowable[TopBlock]) + { + SetBlock(X, Height + 1, Z, E_BLOCK_SNOW, 0); + } + else if ((TopBlock == E_BLOCK_WATER) || (TopBlock == E_BLOCK_STATIONARY_WATER)) + { + SetBlock(X, Height, Z, E_BLOCK_ICE, 0); + } + else if ( + (m_World->IsDeepSnowEnabled()) && + ( + (TopBlock == E_BLOCK_RED_ROSE) || + (TopBlock == E_BLOCK_YELLOW_FLOWER) || + (TopBlock == E_BLOCK_RED_MUSHROOM) || + (TopBlock == E_BLOCK_BROWN_MUSHROOM) + ) + ) + { + SetBlock(X, Height, Z, E_BLOCK_SNOW, 0); + } + break; + } // case (snowy biomes) + + // TODO: Rainy biomes should check for farmland and cauldrons + } // switch (biome) +} + + + + + +void cChunk::GrowMelonPumpkin(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, MTRand & a_TickRandom) +{ + // Convert the stem BlockType into produce BlockType + BLOCKTYPE ProduceType; + switch (a_BlockType) + { + case E_BLOCK_MELON_STEM: ProduceType = E_BLOCK_MELON; break; + case E_BLOCK_PUMPKIN_STEM: ProduceType = E_BLOCK_PUMPKIN; break; + default: + { + ASSERT(!"Unhandled blocktype in TickMelonPumpkin()"); + return; + } + } + + // Check if there's another melon / pumpkin around that stem, if so, abort: + bool IsValid; + BLOCKTYPE BlockType[4]; + NIBBLETYPE BlockMeta; // unused + IsValid = UnboundedRelGetBlock(a_RelX + 1, a_RelY, a_RelZ, BlockType[0], BlockMeta); + IsValid = IsValid && UnboundedRelGetBlock(a_RelX - 1, a_RelY, a_RelZ, BlockType[1], BlockMeta); + IsValid = IsValid && UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ + 1, BlockType[2], BlockMeta); + IsValid = IsValid && UnboundedRelGetBlock(a_RelX, a_RelY, a_RelZ - 1, BlockType[3], BlockMeta); + if ( + !IsValid || + (BlockType[0] == ProduceType) || + (BlockType[1] == ProduceType) || + (BlockType[2] == ProduceType) || + (BlockType[3] == ProduceType) + ) + { + // Neighbors not valid or already taken by the same produce + return; + } + + // Pick a direction in which to place the produce: + int x = 0, z = 0; + int CheckType = a_TickRandom.randInt(3); // The index to the neighbors array which should be checked for emptiness + switch (CheckType) + { + case 0: x = 1; break; + case 1: x = -1; break; + case 2: z = 1; break; + case 3: z = -1; break; + } + + // Check that the block in that direction is empty: + switch (BlockType[CheckType]) + { + case E_BLOCK_AIR: + case E_BLOCK_SNOW: + case E_BLOCK_TALL_GRASS: + case E_BLOCK_DEAD_BUSH: + { + break; + } + default: return; + } + + // Check if there's soil under the neighbor. We already know the neighbors are valid. Place produce if ok + BLOCKTYPE Soil; + UnboundedRelGetBlock(a_RelX + x, a_RelY - 1, a_RelZ + z, Soil, BlockMeta); + switch (Soil) + { + case E_BLOCK_DIRT: + case E_BLOCK_GRASS: + case E_BLOCK_FARMLAND: + { + // DEBUG: This is here to catch FS #349 - melons growing over other crops. + LOG("Growing melon/pumpkin overwriting %s, growing on %s", + ItemTypeToString(BlockType[CheckType]).c_str(), + ItemTypeToString(Soil).c_str() + ); + // Place a randomly-facing produce: + UnboundedRelFastSetBlock(a_RelX + x, a_RelY, a_RelZ + z, ProduceType, (NIBBLETYPE)(a_TickRandom.randInt(4) % 4)); + break; + } + } +} + + + + + +void cChunk::GrowSugarcane(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks) +{ + // Check the total height of the sugarcane blocks here: + int Top = a_RelY + 1; + while ( + (Top < cChunkDef::Height) && + (GetBlock(a_RelX, Top, a_RelZ) == E_BLOCK_SUGARCANE) + ) + { + ++Top; + } + int Bottom = a_RelY - 1; + while ( + (Bottom > 0) && + (GetBlock(a_RelX, Bottom, a_RelZ) == E_BLOCK_SUGARCANE) + ) + { + --Bottom; + } + + // Grow by at most a_NumBlocks, but no more than max height: + int ToGrow = std::min(a_NumBlocks, m_World->GetMaxSugarcaneHeight() + 1 - (Top - Bottom)); + for (int i = 0; i < ToGrow; i++) + { + BLOCKTYPE BlockType; + NIBBLETYPE BlockMeta; + if (UnboundedRelGetBlock(a_RelX, Top + i, a_RelZ, BlockType, BlockMeta) && (BlockType == E_BLOCK_AIR)) + { + UnboundedRelFastSetBlock(a_RelX, Top + i, a_RelZ, E_BLOCK_SUGARCANE, 0); + } + else + { + break; + } + } // for i +} + + + + + +void cChunk::GrowCactus(int a_RelX, int a_RelY, int a_RelZ, int a_NumBlocks) +{ + // Check the total height of the sugarcane blocks here: + int Top = a_RelY + 1; + while ( + (Top < cChunkDef::Height) && + (GetBlock(a_RelX, Top, a_RelZ) == E_BLOCK_CACTUS) + ) + { + ++Top; + } + int Bottom = a_RelY - 1; + while ( + (Bottom > 0) && + (GetBlock(a_RelX, Bottom, a_RelZ) == E_BLOCK_CACTUS) + ) + { + --Bottom; + } + + // Grow by at most a_NumBlocks, but no more than max height: + int ToGrow = std::min(a_NumBlocks, m_World->GetMaxCactusHeight() + 1 - (Top - Bottom)); + for (int i = 0; i < ToGrow; i++) + { + BLOCKTYPE BlockType; + NIBBLETYPE BlockMeta; + if (UnboundedRelGetBlock(a_RelX, Top + i, a_RelZ, BlockType, BlockMeta) && (BlockType == E_BLOCK_AIR)) + { + // TODO: Check the surrounding blocks, if they aren't air, break the cactus block into pickups (and continue breaking blocks above in the next loop iterations) + UnboundedRelFastSetBlock(a_RelX, Top + i, a_RelZ, E_BLOCK_CACTUS, 0); + } + else + { + break; + } + } // for i +} + + + + + +bool cChunk::UnboundedRelGetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) const +{ + if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) + { + LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); + return false; + } + cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + // The chunk is not available, bail out + return false; + } + Chunk->GetBlockTypeMeta(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta); + return true; +} + + + + + +bool cChunk::UnboundedRelGetBlockType(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType) const +{ + if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) + { + LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); + return false; + } + cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + // The chunk is not available, bail out + return false; + } + a_BlockType = Chunk->GetBlock(a_RelX, a_RelY, a_RelZ); + return true; +} + + + + + +bool cChunk::UnboundedRelGetBlockMeta(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockMeta) const +{ + if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) + { + LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); + return false; + } + cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + // The chunk is not available, bail out + return false; + } + a_BlockMeta = Chunk->GetMeta(a_RelX, a_RelY, a_RelZ); + return true; +} + + + + + +bool cChunk::UnboundedRelGetBlockBlockLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockBlockLight) const +{ + if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) + { + LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); + return false; + } + cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + // The chunk is not available, bail out + return false; + } + a_BlockBlockLight = Chunk->GetBlockLight(a_RelX, a_RelY, a_RelZ); + return true; +} + + + + + +bool cChunk::UnboundedRelGetBlockSkyLight(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockSkyLight) const +{ + if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) + { + LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); + return false; + } + cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + // The chunk is not available, bail out + return false; + } + a_BlockSkyLight = Chunk->GetSkyLight(a_RelX, a_RelY, a_RelZ); + return true; +} + + + + + +bool cChunk::UnboundedRelGetBlockLights(int a_RelX, int a_RelY, int a_RelZ, NIBBLETYPE & a_BlockLight, NIBBLETYPE & a_SkyLight) const +{ + if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) + { + LOGWARNING("%s: requesting a block with a_RelY out of range: %d", __FUNCTION__, a_RelY); + return false; + } + cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + // The chunk is not available, bail out + return false; + } + int idx = Chunk->MakeIndex(a_RelX, a_RelY, a_RelZ); + a_BlockLight = Chunk->GetBlockLight(idx); + a_SkyLight = Chunk->GetSkyLight(idx); + return true; +} + + + + + +bool cChunk::UnboundedRelSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + if ((a_RelY < 0) || (a_RelY > cChunkDef::Height)) + { + LOGWARNING("UnboundedRelSetBlock(): requesting a block with a_RelY out of range: %d", a_RelY); + return false; + } + cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + // The chunk is not available, bail out + return false; + } + Chunk->SetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta); + return true; +} + + + + + +bool cChunk::UnboundedRelFastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + if ((a_RelY < 0) || (a_RelY > cChunkDef::Height)) + { + LOGWARNING("UnboundedRelFastSetBlock(): requesting a block with a_RelY out of range: %d", a_RelY); + return false; + } + cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + // The chunk is not available, bail out + return false; + } + Chunk->FastSetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta); + return true; +} + + + + + +void cChunk::UnboundedQueueTickBlock(int a_RelX, int a_RelY, int a_RelZ) +{ + if ((a_RelY < 0) || (a_RelY >= cChunkDef::Height)) + { + // Outside of chunkmap + return; + } + cChunk * Chunk = GetRelNeighborChunkAdjustCoords(a_RelX, a_RelZ); + if ((Chunk != NULL) && Chunk->IsValid()) + { + Chunk->QueueTickBlock(a_RelX, a_RelY, a_RelZ); + } +} + + + + + +int cChunk::GetHeight(int a_X, int a_Z) +{ + ASSERT((a_X >= 0) && (a_X < Width) && (a_Z >= 0) && (a_Z < Width)); + + if ((a_X >= 0) && (a_X < Width) && (a_Z >= 0) && (a_Z < Width)) + { + return m_HeightMap[a_X + a_Z * Width]; + } + return 0; +} + + + + + +void cChunk::CreateBlockEntities(void) +{ + for (int x = 0; x < Width; x++) + { + for (int z = 0; z < Width; z++) + { + for (int y = 0; y < Height; y++) + { + BLOCKTYPE BlockType = cChunkDef::GetBlock(m_BlockTypes, x, y, z); + switch (BlockType) + { + case E_BLOCK_CHEST: + case E_BLOCK_DISPENSER: + case E_BLOCK_DROPPER: + case E_BLOCK_LIT_FURNACE: + case E_BLOCK_FURNACE: + case E_BLOCK_HOPPER: + case E_BLOCK_SIGN_POST: + case E_BLOCK_WALLSIGN: + case E_BLOCK_NOTE_BLOCK: + case E_BLOCK_JUKEBOX: + { + if (!HasBlockEntityAt(x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width)) + { + m_BlockEntities.push_back(cBlockEntity::CreateByBlockType( + BlockType, GetMeta(x, y, z), + x + m_PosX * Width, y + m_PosY * Height, z + m_PosZ * Width, m_World + )); + } + break; + } + } // switch (BlockType) + } // for y + } // for z + } // for x +} + + + + + +void cChunk::WakeUpSimulators(void) +{ + cSimulator * WaterSimulator = m_World->GetWaterSimulator(); + cSimulator * LavaSimulator = m_World->GetLavaSimulator(); + int BaseX = m_PosX * cChunkDef::Width; + int BaseZ = m_PosZ * cChunkDef::Width; + for (int x = 0; x < Width; x++) + { + int BlockX = x + BaseX; + for (int z = 0; z < Width; z++) + { + int BlockZ = z + BaseZ; + for (int y = GetHeight(x, z); y >= 0; y--) + { + switch (cChunkDef::GetBlock(m_BlockTypes, x, y, z)) + { + case E_BLOCK_WATER: + { + WaterSimulator->AddBlock(BlockX, y, BlockZ, this); + break; + } + case E_BLOCK_LAVA: + { + LavaSimulator->AddBlock(BlockX, y, BlockZ, this); + break; + } + } // switch (BlockType) + } // for y + } // for z + } // for x +} + + + + + +void cChunk::CalculateHeightmap() +{ + for (int x = 0; x < Width; x++) + { + for (int z = 0; z < Width; z++) + { + for (int y = Height - 1; y > -1; y--) + { + int index = MakeIndex( x, y, z ); + if (m_BlockTypes[index] != E_BLOCK_AIR) + { + m_HeightMap[x + z * Width] = (unsigned char)y; + break; + } + } // for y + } // for z + } // for x +} + + + + + +void cChunk::SetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + FastSetBlock(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta); + + const int index = MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ); + + // Tick this block and its neighbors: + m_ToTickBlocks.push_back(index); + QueueTickBlockNeighbors(a_RelX, a_RelY, a_RelZ); + + // If there was a block entity, remove it: + Vector3i WorldPos = PositionToWorldPosition(a_RelX, a_RelY, a_RelZ); + cBlockEntity * BlockEntity = GetBlockEntity(WorldPos); + if (BlockEntity != NULL) + { + BlockEntity->Destroy(); + RemoveBlockEntity(BlockEntity); + delete BlockEntity; + } + + // If the new block is a block entity, create the entity object: + switch (a_BlockType) + { + case E_BLOCK_CHEST: + case E_BLOCK_DISPENSER: + case E_BLOCK_DROPPER: + case E_BLOCK_LIT_FURNACE: + case E_BLOCK_FURNACE: + case E_BLOCK_HOPPER: + case E_BLOCK_SIGN_POST: + case E_BLOCK_WALLSIGN: + case E_BLOCK_NOTE_BLOCK: + case E_BLOCK_JUKEBOX: + { + AddBlockEntity(cBlockEntity::CreateByBlockType(a_BlockType, a_BlockMeta, WorldPos.x, WorldPos.y, WorldPos.z, m_World)); + break; + } + } // switch (a_BlockType) +} + + + + + +void cChunk::QueueSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, Int64 a_Tick) +{ + m_SetBlockQueue.push_back(sSetBlockQueueItem(a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta, a_Tick)); +} + + + + + +void cChunk::QueueTickBlock(int a_RelX, int a_RelY, int a_RelZ) +{ + ASSERT ( + (a_RelX >= 0) && (a_RelX < Width) && + (a_RelY >= 0) && (a_RelY < Height) && + (a_RelZ >= 0) && (a_RelZ < Width) + ); // Coords need to be valid + + if (!IsValid()) + { + return; + } + + m_ToTickBlocks.push_back(MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ)); +} + + + + + +void cChunk::QueueTickBlockNeighbors(int a_RelX, int a_RelY, int a_RelZ) +{ + struct + { + int x, y, z; + } + Coords[] = + { + { 1, 0, 0}, + {-1, 0, 0}, + { 0, 1, 0}, + { 0, -1, 0}, + { 0, 0, 1}, + { 0, 0, -1}, + } ; + for (int i = 0; i < ARRAYCOUNT(Coords); i++) + { + UnboundedQueueTickBlock(a_RelX + Coords[i].x, a_RelY + Coords[i].y, a_RelZ + Coords[i].z); + } // for i - Coords[] +} + + + + + +void cChunk::FastSetBlock(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta) +{ + ASSERT(!((a_RelX < 0) || (a_RelX >= Width) || (a_RelY < 0) || (a_RelY >= Height) || (a_RelZ < 0) || (a_RelZ >= Width))); + + ASSERT(IsValid()); + + const int index = MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ); + const BLOCKTYPE OldBlockType = cChunkDef::GetBlock(m_BlockTypes, index); + const BLOCKTYPE OldBlockMeta = GetNibble(m_BlockMeta, index); + if ((OldBlockType == a_BlockType) && (OldBlockMeta == a_BlockMeta)) + { + return; + } + + MarkDirty(); + + m_BlockTypes[index] = a_BlockType; + + // The client doesn't need to distinguish between stationary and nonstationary fluids: + if ( + (OldBlockMeta != a_BlockMeta) || // Different meta always gets sent to the client + !( + ((OldBlockType == E_BLOCK_STATIONARY_WATER) && (a_BlockType == E_BLOCK_WATER)) || // Replacing stationary water with water + ((OldBlockType == E_BLOCK_WATER) && (a_BlockType == E_BLOCK_STATIONARY_WATER)) || // Replacing water with stationary water + ((OldBlockType == E_BLOCK_STATIONARY_LAVA) && (a_BlockType == E_BLOCK_LAVA)) || // Replacing stationary water with water + ((OldBlockType == E_BLOCK_LAVA) && (a_BlockType == E_BLOCK_STATIONARY_LAVA)) // Replacing water with stationary water + ) + ) + { + m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, a_BlockType, a_BlockMeta)); + } + + SetNibble(m_BlockMeta, index, a_BlockMeta); + + // ONLY recalculate lighting if it's necessary! + if( + (g_BlockLightValue[OldBlockType ] != g_BlockLightValue[a_BlockType]) || + (g_BlockSpreadLightFalloff[OldBlockType] != g_BlockSpreadLightFalloff[a_BlockType]) || + (g_BlockTransparent[OldBlockType] != g_BlockTransparent[a_BlockType]) + ) + { + m_IsLightValid = false; + } + + // Update heightmap, if needed: + if (a_RelY >= m_HeightMap[a_RelX + a_RelZ * Width]) + { + if (a_BlockType != E_BLOCK_AIR) + { + m_HeightMap[a_RelX + a_RelZ * Width] = (unsigned char)a_RelY; + } + else + { + for (int y = a_RelY - 1; y > 0; --y) + { + if (m_BlockTypes[MakeIndexNoCheck(a_RelX, y, a_RelZ)] != E_BLOCK_AIR) + { + m_HeightMap[a_RelX + a_RelZ * Width] = (unsigned char)y; + break; + } + } // for y - column in m_BlockData + } + } +} + + + + + +void cChunk::SendBlockTo(int a_RelX, int a_RelY, int a_RelZ, cClientHandle * a_Client) +{ + // The coords must be valid, because the upper level already does chunk lookup. No need to check them again. + // There's an debug-time assert in MakeIndexNoCheck anyway + unsigned int index = MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ); + + if (a_Client == NULL) + { + // Queue the block for all clients in the chunk (will be sent in Tick()) + m_PendingSendBlocks.push_back(sSetBlock(m_PosX, m_PosZ, a_RelX, a_RelY, a_RelZ, GetBlock(index), GetMeta(index))); + return; + } + + Vector3i wp = PositionToWorldPosition(a_RelX, a_RelY, a_RelZ); + a_Client->SendBlockChange(wp.x, wp.y, wp.z, GetBlock(index), GetMeta(index)); + + // FS #268 - if a BlockEntity digging is cancelled by a plugin, the entire block entity must be re-sent to the client: + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), end = m_BlockEntities.end(); itr != end; ++itr) + { + if (((*itr)->GetPosX() == wp.x) && ((*itr)->GetPosY() == wp.y) && ((*itr)->GetPosZ() == wp.z)) + { + (*itr)->SendTo(*a_Client); + } + } // for itr - m_BlockEntities +} + + + + + +void cChunk::AddBlockEntity(cBlockEntity * a_BlockEntity) +{ + MarkDirty(); + m_BlockEntities.push_back(a_BlockEntity); +} + + + + + +cBlockEntity * cChunk::GetBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) + { + if ( + ((*itr)->GetPosX() == a_BlockX) && + ((*itr)->GetPosY() == a_BlockY) && + ((*itr)->GetPosZ() == a_BlockZ) + ) + { + return *itr; + } + } // for itr - m_BlockEntities[] + + return NULL; +} + + + + + +void cChunk::UseBlockEntity(cPlayer * a_Player, int a_X, int a_Y, int a_Z) +{ + cBlockEntity * be = GetBlockEntity(a_X, a_Y, a_Z); + if (be != NULL) + { + be->UsedBy(a_Player); + } +} + + + + + +void cChunk::CollectPickupsByPlayer(cPlayer * a_Player) +{ + double PosX = a_Player->GetPosX(); + double PosY = a_Player->GetPosY(); + double PosZ = a_Player->GetPosZ(); + + for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr) + { + if ((!(*itr)->IsPickup()) && (!(*itr)->IsProjectile())) + { + continue; // Only pickups and projectiles + } + float DiffX = (float)((*itr)->GetPosX() - PosX ); + float DiffY = (float)((*itr)->GetPosY() - PosY ); + float DiffZ = (float)((*itr)->GetPosZ() - PosZ ); + float SqrDist = DiffX * DiffX + DiffY * DiffY + DiffZ * DiffZ; + if (SqrDist < 1.5f * 1.5f) // 1.5 block + { + /* + LOG("Pickup %d being collected by player \"%s\", distance %f", + (*itr)->GetUniqueID(), a_Player->GetName().c_str(), SqrDist + ); + */ + MarkDirty(); + if ((*itr)->IsPickup()) + { + (reinterpret_cast<cPickup *>(*itr))->CollectedBy(a_Player); + } + else + { + (reinterpret_cast<cProjectileEntity *>(*itr))->CollectedBy(a_Player); + } + } + else if (SqrDist < 5 * 5) + { + /* + LOG("Pickup %d close to player \"%s\", but still too far to collect: %f", + (*itr)->GetUniqueID(), a_Player->GetName().c_str(), SqrDist + ); + */ + } + } +} + + + + + +bool cChunk::SetSignLines(int a_PosX, int a_PosY, int a_PosZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) +{ + // Also sends update packets to all clients in the chunk + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) + { + if ( + ((*itr)->GetPosX() == a_PosX) && + ((*itr)->GetPosY() == a_PosY) && + ((*itr)->GetPosZ() == a_PosZ) && + ( + ((*itr)->GetBlockType() == E_BLOCK_WALLSIGN) || + ((*itr)->GetBlockType() == E_BLOCK_SIGN_POST) + ) + ) + { + MarkDirty(); + (reinterpret_cast<cSignEntity *>(*itr))->SetLines(a_Line1, a_Line2, a_Line3, a_Line4); + m_World->BroadcastBlockEntity(a_PosX, a_PosY, a_PosZ); + return true; + } + } // for itr - m_BlockEntities[] + return false; +} + + + + + +void cChunk::RemoveBlockEntity( cBlockEntity* a_BlockEntity ) +{ + MarkDirty(); + m_BlockEntities.remove(a_BlockEntity); +} + + + + + +bool cChunk::AddClient(cClientHandle* a_Client) +{ + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) + { + if (a_Client == *itr) + { + // Already there, nothing needed + return false; + } + } + m_LoadedByClient.push_back( a_Client ); + + for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr ) + { + LOGD("cChunk: Entity #%d (%s) at [%i, %i, %i] spawning for player \"%s\"", (*itr)->GetUniqueID(), (*itr)->GetClass(), m_PosX, m_PosY, m_PosZ, a_Client->GetUsername().c_str()); + (*itr)->SpawnOn(*a_Client); + } + return true; +} + + + + + +void cChunk::RemoveClient( cClientHandle* a_Client ) +{ + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) + { + if (*itr != a_Client) + { + continue; + } + + m_LoadedByClient.erase(itr); + + if (!a_Client->IsDestroyed()) + { + for (cEntityList::iterator itr = m_Entities.begin(); itr != m_Entities.end(); ++itr ) + { + LOGD("chunk [%i, %i] destroying entity #%i for player \"%s\"", m_PosX, m_PosZ, (*itr)->GetUniqueID(), a_Client->GetUsername().c_str() ); + a_Client->SendDestroyEntity(*(*itr)); + } + } + return; + } // for itr - m_LoadedByClient[] +} + + + + + +bool cChunk::HasClient( cClientHandle* a_Client ) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr) + { + if ((*itr) == a_Client) + { + return true; + } + } + return false; +} + + + + + +bool cChunk::HasAnyClients(void) +{ + return !m_LoadedByClient.empty(); +} + + + + + +void cChunk::AddEntity(cEntity * a_Entity) +{ + if (!a_Entity->IsPlayer()) + { + MarkDirty(); + } + + ASSERT(std::find(m_Entities.begin(), m_Entities.end(), a_Entity) == m_Entities.end()); // Not there already + + m_Entities.push_back(a_Entity); +} + + + + + +void cChunk::RemoveEntity(cEntity * a_Entity) +{ + size_t SizeBefore = m_Entities.size(); + m_Entities.remove(a_Entity); + size_t SizeAfter = m_Entities.size(); + + if (SizeBefore != SizeAfter) + { + // Mark as dirty if it was a server-generated entity: + if (!a_Entity->IsPlayer()) + { + MarkDirty(); + } + } +} + + + + + +bool cChunk::HasEntity(int a_EntityID) +{ + for (cEntityList::const_iterator itr = m_Entities.begin(), end = m_Entities.end(); itr != end; ++itr) + { + if ((*itr)->GetUniqueID() == a_EntityID) + { + return true; + } + } // for itr - m_Entities[] + return false; +} + + + + + +bool cChunk::ForEachEntity(cEntityCallback & a_Callback) +{ + // The entity list is locked by the parent chunkmap's CS + for (cEntityList::iterator itr = m_Entities.begin(), itr2 = itr; itr != m_Entities.end(); itr = itr2) + { + ++itr2; + if (a_Callback.Item(*itr)) + { + return false; + } + } // for itr - m_Entitites[] + return true; +} + + + + + +bool cChunk::DoWithEntityByID(int a_EntityID, cEntityCallback & a_Callback, bool & a_CallbackResult) +{ + // The entity list is locked by the parent chunkmap's CS + for (cEntityList::iterator itr = m_Entities.begin(), end = m_Entities.end(); itr != end; ++itr) + { + if ((*itr)->GetUniqueID() == a_EntityID) + { + a_CallbackResult = a_Callback.Item(*itr); + return true; + } + } // for itr - m_Entitites[] + return false; +} + + + + + +bool cChunk::ForEachBlockEntity(cBlockEntityCallback & a_Callback) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) + { + ++itr2; + if (a_Callback.Item(*itr)) + { + return false; + } + } // for itr - m_BlockEntitites[] + return true; +} + + + + + +bool cChunk::ForEachChest(cChestCallback & a_Callback) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) + { + ++itr2; + if ((*itr)->GetBlockType() != E_BLOCK_CHEST) + { + continue; + } + if (a_Callback.Item((cChestEntity *)*itr)) + { + return false; + } + } // for itr - m_BlockEntitites[] + return true; +} + + + + + +bool cChunk::ForEachDispenser(cDispenserCallback & a_Callback) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) + { + ++itr2; + if ((*itr)->GetBlockType() != E_BLOCK_DISPENSER) + { + continue; + } + if (a_Callback.Item((cDispenserEntity *)*itr)) + { + return false; + } + } // for itr - m_BlockEntitites[] + return true; +} + + + + + +bool cChunk::ForEachDropper(cDropperCallback & a_Callback) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) + { + ++itr2; + if ((*itr)->GetBlockType() != E_BLOCK_DROPPER) + { + continue; + } + if (a_Callback.Item((cDropperEntity *)*itr)) + { + return false; + } + } // for itr - m_BlockEntitites[] + return true; +} + + + + + +bool cChunk::ForEachDropSpenser(cDropSpenserCallback & a_Callback) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) + { + ++itr2; + if (((*itr)->GetBlockType() != E_BLOCK_DISPENSER) && ((*itr)->GetBlockType() != E_BLOCK_DROPPER)) + { + continue; + } + if (a_Callback.Item((cDropSpenserEntity *)*itr)) + { + return false; + } + } // for itr - m_BlockEntitites[] + return true; +} + + + + + +bool cChunk::ForEachFurnace(cFurnaceCallback & a_Callback) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) + { + ++itr2; + switch ((*itr)->GetBlockType()) + { + case E_BLOCK_FURNACE: + case E_BLOCK_LIT_FURNACE: + { + break; + } + default: + { + continue; + } + } + if (a_Callback.Item((cFurnaceEntity *)*itr)) + { + return false; + } + } // for itr - m_BlockEntitites[] + return true; +} + + + + + +bool cChunk::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) + { + ++itr2; + if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) + { + continue; + } + + if (a_Callback.Item(*itr)) + { + return false; + } + return true; + } // for itr - m_BlockEntitites[] + + // Not found: + return false; +} + + + + + +bool cChunk::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) + { + ++itr2; + if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) + { + continue; + } + if ((*itr)->GetBlockType() != E_BLOCK_CHEST) + { + // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out + return false; + } + + // The correct block entity is here + if (a_Callback.Item((cChestEntity *)*itr)) + { + return false; + } + return true; + } // for itr - m_BlockEntitites[] + + // Not found: + return false; +} + + + + + +bool cChunk::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) + { + ++itr2; + if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) + { + continue; + } + if ((*itr)->GetBlockType() != E_BLOCK_DISPENSER) + { + // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out + return false; + } + + // The correct block entity is here + if (a_Callback.Item((cDispenserEntity *)*itr)) + { + return false; + } + return true; + } // for itr - m_BlockEntitites[] + + // Not found: + return false; +} + + + + + +bool cChunk::DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) + { + ++itr2; + if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) + { + continue; + } + if ((*itr)->GetBlockType() != E_BLOCK_DROPPER) + { + // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out + return false; + } + + // The correct block entity is here + if (a_Callback.Item((cDropperEntity *)*itr)) + { + return false; + } + return true; + } // for itr - m_BlockEntitites[] + + // Not found: + return false; +} + + + + + +bool cChunk::DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) + { + ++itr2; + if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) + { + continue; + } + if (((*itr)->GetBlockType() != E_BLOCK_DISPENSER) && ((*itr)->GetBlockType() != E_BLOCK_DROPPER)) + { + // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out + return false; + } + + // The correct block entity is here + if (a_Callback.Item((cDropSpenserEntity *)*itr)) + { + return false; + } + return true; + } // for itr - m_BlockEntitites[] + + // Not found: + return false; +} + + + + + +bool cChunk::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(), itr2 = itr; itr != m_BlockEntities.end(); itr = itr2) + { + ++itr2; + if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) + { + continue; + } + switch ((*itr)->GetBlockType()) + { + case E_BLOCK_FURNACE: + case E_BLOCK_LIT_FURNACE: + { + break; + } + default: + { + // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out + return false; + } + } // switch (BlockType) + + // The correct block entity is here, + if (a_Callback.Item((cFurnaceEntity *)*itr)) + { + return false; + } + return true; + } // for itr - m_BlockEntitites[] + + // Not found: + return false; +} + + + + + +bool cChunk::GetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4) +{ + // The blockentity list is locked by the parent chunkmap's CS + for (cBlockEntityList::iterator itr = m_BlockEntities.begin(); itr != m_BlockEntities.end(); ++itr) + { + if (((*itr)->GetPosX() != a_BlockX) || ((*itr)->GetPosY() != a_BlockY) || ((*itr)->GetPosZ() != a_BlockZ)) + { + continue; + } + switch ((*itr)->GetBlockType()) + { + case E_BLOCK_WALLSIGN: + case E_BLOCK_SIGN_POST: + { + a_Line1 = ((cSignEntity *)*itr)->GetLine(0); + a_Line2 = ((cSignEntity *)*itr)->GetLine(1); + a_Line3 = ((cSignEntity *)*itr)->GetLine(2); + a_Line4 = ((cSignEntity *)*itr)->GetLine(3); + return true; + } + } // switch (BlockType) + + // There is a block entity here, but of different type. No other block entity can be here, so we can safely bail out + return false; + } // for itr - m_BlockEntitites[] + + // Not found: + return false; +} + + + + + +BLOCKTYPE cChunk::GetBlock(int a_RelX, int a_RelY, int a_RelZ) const +{ + if ( + (a_RelX < 0) || (a_RelX >= Width) || + (a_RelY < 0) || (a_RelY >= Height) || + (a_RelZ < 0) || (a_RelZ >= Width) + ) + { + ASSERT(!"GetBlock(x, y, z) out of bounds!"); + return 0; // Clip + } + + return m_BlockTypes[MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ)]; +} + + + + + +BLOCKTYPE cChunk::GetBlock(int a_BlockIdx) const +{ + if ((a_BlockIdx < 0) || (a_BlockIdx >= NumBlocks)) + { + ASSERT(!"GetBlock(idx) out of bounds!"); + return 0; + } + + return m_BlockTypes[ a_BlockIdx ]; +} + + + + + +void cChunk::GetBlockTypeMeta(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) +{ + int Idx = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ); + a_BlockType = cChunkDef::GetBlock (m_BlockTypes, a_RelX, a_RelY, a_RelZ); + a_BlockMeta = cChunkDef::GetNibble(m_BlockMeta, a_RelX, a_RelY, a_RelZ); +} + + + + + +void cChunk::GetBlockInfo(int a_RelX, int a_RelY, int a_RelZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight) +{ + int Idx = cChunkDef::MakeIndexNoCheck(a_RelX, a_RelY, a_RelZ); + a_BlockType = cChunkDef::GetBlock (m_BlockTypes, Idx); + a_Meta = cChunkDef::GetNibble(m_BlockMeta, Idx); + a_SkyLight = cChunkDef::GetNibble(m_BlockSkyLight, Idx); + a_BlockLight = cChunkDef::GetNibble(m_BlockLight, Idx); +} + + + + + +cChunk * cChunk::GetNeighborChunk(int a_BlockX, int a_BlockZ) +{ + // Convert coords to relative, then call the relative version: + a_BlockX -= m_PosX * cChunkDef::Width; + a_BlockZ -= m_PosZ * cChunkDef::Width; + return GetRelNeighborChunk(a_BlockX, a_BlockZ); +} + + + + + +cChunk * cChunk::GetRelNeighborChunk(int a_RelX, int a_RelZ) +{ + bool ReturnThis = true; + if (a_RelX < 0) + { + if (m_NeighborXM != NULL) + { + cChunk * Candidate = m_NeighborXM->GetRelNeighborChunk(a_RelX + cChunkDef::Width, a_RelZ); + if (Candidate != NULL) + { + return Candidate; + } + } + // Going X first failed, but if the request is crossing Z as well, let's try the Z first later on. + ReturnThis = false; + } + else if (a_RelX >= cChunkDef::Width) + { + if (m_NeighborXP != NULL) + { + cChunk * Candidate = m_NeighborXP->GetRelNeighborChunk(a_RelX - cChunkDef::Width, a_RelZ); + if (Candidate != NULL) + { + return Candidate; + } + } + // Going X first failed, but if the request is crossing Z as well, let's try the Z first later on. + ReturnThis = false; + } + + if (a_RelZ < 0) + { + if (m_NeighborZM != NULL) + { + return m_NeighborZM->GetRelNeighborChunk(a_RelX, a_RelZ + cChunkDef::Width); + // For requests crossing both X and Z, the X-first way has been already tried + } + return NULL; + } + else if (a_RelZ >= cChunkDef::Width) + { + if (m_NeighborZP != NULL) + { + return m_NeighborZP->GetRelNeighborChunk(a_RelX, a_RelZ - cChunkDef::Width); + // For requests crossing both X and Z, the X-first way has been already tried + } + return NULL; + } + + return (ReturnThis ? this : NULL); +} + + + + + +cChunk * cChunk::GetRelNeighborChunkAdjustCoords(int & a_RelX, int & a_RelZ) const +{ + cChunk * ToReturn = const_cast<cChunk *>(this); + + // The most common case: inside this chunk: + if ( + (a_RelX >= 0) && (a_RelX < Width) && + (a_RelZ >= 0) && (a_RelZ < Width) + ) + { + return ToReturn; + } + + // Request for a different chunk, calculate chunk offset: + int RelX = a_RelX; // Make a local copy of the coords (faster access) + int RelZ = a_RelZ; + while ((RelX >= Width) && (ToReturn != NULL)) + { + RelX -= Width; + ToReturn = ToReturn->m_NeighborXP; + } + while ((RelX < 0) && (ToReturn != NULL)) + { + RelX += Width; + ToReturn = ToReturn->m_NeighborXM; + } + while ((RelZ >= Width) && (ToReturn != NULL)) + { + RelZ -= Width; + ToReturn = ToReturn->m_NeighborZP; + } + while ((RelZ < 0) && (ToReturn != NULL)) + { + RelZ += Width; + ToReturn = ToReturn->m_NeighborZM; + } + if (ToReturn != NULL) + { + a_RelX = RelX; + a_RelZ = RelZ; + return ToReturn; + } + + // The chunk cannot be walked through neighbors, find it through the chunkmap: + int AbsX = a_RelX + m_PosX * Width; + int AbsZ = a_RelZ + m_PosZ * Width; + int DstChunkX, DstChunkZ; + BlockToChunk(AbsX, AbsZ, DstChunkX, DstChunkZ); + ToReturn = m_ChunkMap->FindChunk(DstChunkX, DstChunkZ); + a_RelX = AbsX - DstChunkX * Width; + a_RelZ = AbsZ - DstChunkZ * Width; + return ToReturn; +} + + + + + +void cChunk::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity * a_Vehicle) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + (*itr)->SendAttachEntity(a_Entity, a_Vehicle); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendBlockAction(a_BlockX, a_BlockY, a_BlockZ, a_Byte1, a_Byte2, a_BlockType); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastBlockBreakAnimation(int a_entityID, int a_blockX, int a_blockY, int a_blockZ, char a_stage, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendBlockBreakAnim(a_entityID, a_blockX, a_blockY, a_blockZ, a_stage); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) +{ + // We can operate on entity pointers, we're inside the ChunkMap's CS lock which guards the list + cBlockEntity * Entity = GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ); + if (Entity == NULL) + { + return; + } + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + Entity->SendTo(*(*itr)); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastChunkData(cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendChunkData(m_PosX, m_PosZ, a_Serializer); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendCollectPickup(a_Pickup, a_Player); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendDestroyEntity(a_Entity); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendEntityEquipment(a_Entity, a_SlotNum, a_Item); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastEntityHeadLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendEntityHeadLook(a_Entity); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastEntityLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendEntityLook(a_Entity); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastEntityMetadata(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendEntityMetadata(a_Entity); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendEntityRelMove(a_Entity, a_RelX, a_RelY, a_RelZ); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendEntityRelMoveLook(a_Entity, a_RelX, a_RelY, a_RelZ); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendEntityStatus(a_Entity, a_Status); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendEntityVelocity(a_Entity); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::const_iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendPlayerAnimation(a_Player, a_Animation); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendSoundEffect(a_SoundName, a_SrcX, a_SrcY, a_SrcZ, a_Volume, a_Pitch); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendSoundParticleEffect(a_EffectID, a_SrcX, a_SrcY, a_SrcZ, a_Data); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + a_Entity.SpawnOn(*(*itr)); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) +{ + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + if (*itr == a_Exclude) + { + continue; + } + (*itr)->SendThunderbolt(a_BlockX, a_BlockY, a_BlockZ); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) +{ + for (cClientHandleList::iterator itr = m_LoadedByClient.begin(); itr != m_LoadedByClient.end(); ++itr ) + { + (*itr)->SendUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ); + } // for itr - LoadedByClient[] +} + + + + + +void cChunk::SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client) +{ + cBlockEntity * Entity = GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ); + if (Entity == NULL) + { + return; + } + Entity->SendTo(a_Client); +} + + + + + +void cChunk::PositionToWorldPosition(int a_RelX, int a_RelY, int a_RelZ, int & a_BlockX, int & a_BlockY, int & a_BlockZ) +{ + a_BlockY = a_RelY; + a_BlockX = m_PosX * Width + a_RelX; + a_BlockZ = m_PosZ * Width + a_RelZ; +} + + + + + +Vector3i cChunk::PositionToWorldPosition(int a_RelX, int a_RelY, int a_RelZ) +{ + return Vector3i(m_PosX * Width + a_RelX, m_PosY * Height + a_RelY, m_PosZ * Width + a_RelZ); +} + + + + + +NIBBLETYPE cChunk::GetTimeAlteredLight(NIBBLETYPE a_Skylight) const +{ + a_Skylight -= m_World->GetSkyDarkness(); + // Because NIBBLETYPE is unsigned, we clamp it to 0 .. 15 by checking for values above 15 + return (a_Skylight < 16)? a_Skylight : 0; +} + + + + + +#if !C_CHUNK_USE_INLINE +# include "cChunk.inl.h" +#endif + + + + diff --git a/source/Chunk.h b/src/Chunk.h index 895b407a3..895b407a3 100644 --- a/source/Chunk.h +++ b/src/Chunk.h diff --git a/source/Chunk.inl.h b/src/Chunk.inl.h index fb9c4dad1..fb9c4dad1 100644 --- a/source/Chunk.inl.h +++ b/src/Chunk.inl.h diff --git a/source/ChunkDef.h b/src/ChunkDef.h index d6630df7e..d6630df7e 100644 --- a/source/ChunkDef.h +++ b/src/ChunkDef.h diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp new file mode 100644 index 000000000..611e9f24e --- /dev/null +++ b/src/ChunkMap.cpp @@ -0,0 +1,2701 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "ChunkMap.h" +#include "World.h" +#include "Root.h" +#include "Entities/Player.h" +#include "Item.h" +#include "Entities/Pickup.h" +#include "Chunk.h" +#include "Generating/Trees.h" // used in cChunkMap::ReplaceTreeBlocks() for tree block discrimination +#include "BlockArea.h" +#include "PluginManager.h" +#include "Entities/TNTEntity.h" +#include "Blocks/BlockHandler.h" +#include "MobCensus.h" +#include "MobSpawner.h" + +#ifndef _WIN32 + #include <cstdlib> // abs +#endif + +#include "zlib/zlib.h" +#include "json/json.h" + + + + + +//////////////////////////////////////////////////////////////////////////////// +// cChunkMap: + +cChunkMap::cChunkMap(cWorld * a_World ) + : m_World( a_World ) +{ +} + + + + + +cChunkMap::~cChunkMap() +{ + cCSLock Lock(m_CSLayers); + while (!m_Layers.empty()) + { + delete m_Layers.back(); + m_Layers.pop_back(); // Must pop, because further chunk deletions query the chunkmap for entities and that would touch deleted data + } +} + + + + + +void cChunkMap::RemoveLayer( cChunkLayer* a_Layer ) +{ + cCSLock Lock(m_CSLayers); + m_Layers.remove(a_Layer); +} + + + + + +cChunkMap::cChunkLayer * cChunkMap::GetLayer(int a_LayerX, int a_LayerZ) +{ + cCSLock Lock(m_CSLayers); + for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + if (((*itr)->GetX() == a_LayerX) && ((*itr)->GetZ() == a_LayerZ)) + { + return *itr; + } + } + + // Not found, create new: + cChunkLayer * Layer = new cChunkLayer(a_LayerX, a_LayerZ, this); + if (Layer == NULL) + { + LOGERROR("cChunkMap: Cannot create new layer, server out of memory?"); + return NULL; + } + m_Layers.push_back(Layer); + return Layer; +} + + + + + +cChunkMap::cChunkLayer * cChunkMap::FindLayerForChunk(int a_ChunkX, int a_ChunkZ) +{ + const int LayerX = FAST_FLOOR_DIV(a_ChunkX, LAYER_SIZE); + const int LayerZ = FAST_FLOOR_DIV(a_ChunkZ, LAYER_SIZE); + return FindLayer(LayerX, LayerZ); +} + + + + + +cChunkMap::cChunkLayer * cChunkMap::FindLayer(int a_LayerX, int a_LayerZ) +{ + ASSERT(m_CSLayers.IsLockedByCurrentThread()); + + for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + if (((*itr)->GetX() == a_LayerX) && ((*itr)->GetZ() == a_LayerZ)) + { + return *itr; + } + } // for itr - m_Layers[] + + // Not found + return NULL; +} + + + + + +cChunkMap::cChunkLayer * cChunkMap::GetLayerForChunk(int a_ChunkX, int a_ChunkZ) +{ + const int LayerX = FAST_FLOOR_DIV(a_ChunkX, LAYER_SIZE); + const int LayerZ = FAST_FLOOR_DIV(a_ChunkZ, LAYER_SIZE); + return GetLayer(LayerX, LayerZ); +} + + + + + +cChunkPtr cChunkMap::GetChunk( int a_ChunkX, int a_ChunkY, int a_ChunkZ ) +{ + // No need to lock m_CSLayers, since it's already locked by the operation that called us + ASSERT(m_CSLayers.IsLockedByCurrentThread()); + + cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ ); + if (Layer == NULL) + { + // An error must have occurred, since layers are automatically created if they don't exist + return NULL; + } + + cChunkPtr Chunk = Layer->GetChunk(a_ChunkX, a_ChunkY, a_ChunkZ); + if (Chunk == NULL) + { + return NULL; + } + if (!(Chunk->IsValid())) + { + m_World->GetStorage().QueueLoadChunk(a_ChunkX, a_ChunkY, a_ChunkZ, true); + } + return Chunk; +} + + + + + +cChunkPtr cChunkMap::GetChunkNoGen( int a_ChunkX, int a_ChunkY, int a_ChunkZ ) +{ + // No need to lock m_CSLayers, since it's already locked by the operation that called us + cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ ); + if (Layer == NULL) + { + // An error must have occurred, since layers are automatically created if they don't exist + return NULL; + } + + cChunkPtr Chunk = Layer->GetChunk(a_ChunkX, a_ChunkY, a_ChunkZ); + if (Chunk == NULL) + { + return NULL; + } + if (!(Chunk->IsValid())) + { + m_World->GetStorage().QueueLoadChunk(a_ChunkX, a_ChunkY, a_ChunkZ, false); + } + + return Chunk; +} + + + + + +cChunkPtr cChunkMap::GetChunkNoLoad( int a_ChunkX, int a_ChunkY, int a_ChunkZ ) +{ + // No need to lock m_CSLayers, since it's already locked by the operation that called us + cChunkLayer * Layer = GetLayerForChunk( a_ChunkX, a_ChunkZ ); + if (Layer == NULL) + { + // An error must have occurred, since layers are automatically created if they don't exist + return NULL; + } + + return Layer->GetChunk(a_ChunkX, a_ChunkY, a_ChunkZ); +} + + + + + +bool cChunkMap::LockedGetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) +{ + // We already have m_CSLayers locked since this can be called only from within the tick thread + ASSERT(m_CSLayers.IsLockedByCurrentThread()); + + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk == NULL) + { + return false; + } + + int Index = cChunkDef::MakeIndexNoCheck(a_BlockX, a_BlockY, a_BlockZ); + a_BlockType = Chunk->GetBlock(Index); + a_BlockMeta = Chunk->GetMeta(Index); + return true; +} + + + + + +bool cChunkMap::LockedGetBlockType(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType) +{ + // We already have m_CSLayers locked since this can be called only from within the tick thread + ASSERT(m_CSLayers.IsLockedByCurrentThread()); + + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk == NULL) + { + return false; + } + + int Index = cChunkDef::MakeIndexNoCheck(a_BlockX, a_BlockY, a_BlockZ); + a_BlockType = Chunk->GetBlock(Index); + return true; +} + + + + + +bool cChunkMap::LockedGetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE & a_BlockMeta) +{ + // We already have m_CSLayers locked since this can be called only from within the tick thread + ASSERT(m_CSLayers.IsLockedByCurrentThread()); + + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk == NULL) + { + return false; + } + + int Index = cChunkDef::MakeIndexNoCheck(a_BlockX, a_BlockY, a_BlockZ); + a_BlockMeta = Chunk->GetMeta(Index); + return true; +} + + + + + +bool cChunkMap::LockedSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + // We already have m_CSLayers locked since this can be called only from within the tick thread + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk == NULL) + { + return false; + } + + Chunk->SetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); + return true; +} + + + + + +bool cChunkMap::LockedFastSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + // We already have m_CSLayers locked since this can be called only from within the tick thread + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk == NULL) + { + return false; + } + + Chunk->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); + return true; +} + + + + + +cChunk * cChunkMap::FindChunk(int a_ChunkX, int a_ChunkZ) +{ + ASSERT(m_CSLayers.IsLockedByCurrentThread()); + + cChunkLayer * Layer = FindLayerForChunk(a_ChunkX, a_ChunkZ); + if (Layer == NULL) + { + return NULL; + } + return Layer->FindChunk(a_ChunkX, a_ChunkZ); +} + + + + + +void cChunkMap::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity * a_Vehicle) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastAttachEntity(a_Entity, a_Vehicle); +} + + + + + +void cChunkMap::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + int x, y, z, ChunkX, ChunkZ; + x = a_BlockX; + y = a_BlockY; + z = a_BlockZ; + cChunkDef::BlockToChunk(x, z, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastBlockAction(a_BlockX, a_BlockY, a_BlockZ, a_Byte1, a_Byte2, a_BlockType, a_Exclude); +} + + + + + +void cChunkMap::BroadcastBlockBreakAnimation(int a_entityID, int a_blockX, int a_blockY, int a_blockZ, char a_stage, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + int ChunkX, ChunkZ; + + cChunkDef::BlockToChunk(a_blockX, a_blockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastBlockBreakAnimation(a_entityID, a_blockX, a_blockY, a_blockZ, a_stage, a_Exclude); +} + + + + + +void cChunkMap::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + int ChunkX, ChunkZ; + cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + return; + } + Chunk->BroadcastBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Exclude); +} + + + + + +void cChunkMap::BroadcastChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, 0, a_ChunkZ); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastChunkData(a_Serializer, a_Exclude); +} + + + + + +void cChunkMap::BroadcastCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Pickup.GetChunkX(), ZERO_CHUNK_Y, a_Pickup.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastCollectPickup(a_Pickup, a_Player, a_Exclude); +} + + + + + +void cChunkMap::BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastDestroyEntity(a_Entity, a_Exclude); +} + + + + + +void cChunkMap::BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastEntityEquipment(a_Entity, a_SlotNum, a_Item, a_Exclude); +} + + + + + +void cChunkMap::BroadcastEntityHeadLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastEntityHeadLook(a_Entity, a_Exclude); +} + + + + + +void cChunkMap::BroadcastEntityLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastEntityLook(a_Entity, a_Exclude); +} + + + + + +void cChunkMap::BroadcastEntityMetadata(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastEntityMetadata(a_Entity, a_Exclude); +} + + + + + +void cChunkMap::BroadcastEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastEntityRelMove(a_Entity, a_RelX, a_RelY, a_RelZ, a_Exclude); +} + + + + + +void cChunkMap::BroadcastEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastEntityRelMoveLook(a_Entity, a_RelX, a_RelY, a_RelZ, a_Exclude); +} + + + + + +void cChunkMap::BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastEntityStatus(a_Entity, a_Status, a_Exclude); +} + + + + + +void cChunkMap::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastEntityVelocity(a_Entity, a_Exclude); +} + + + + + +void cChunkMap::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Player.GetChunkX(), ZERO_CHUNK_Y, a_Player.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastPlayerAnimation(a_Player, a_Animation, a_Exclude); +} + + + + + +void cChunkMap::BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + int ChunkX, ChunkZ; + + cChunkDef::BlockToChunk(a_SrcX / 8, a_SrcZ / 8, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastSoundEffect(a_SoundName, a_SrcX, a_SrcY, a_SrcZ, a_Volume, a_Pitch, a_Exclude); +} + + + + + +void cChunkMap::BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + int ChunkX, ChunkZ; + + cChunkDef::BlockToChunk(a_SrcX, a_SrcZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastSoundParticleEffect(a_EffectID, a_SrcX, a_SrcY, a_SrcZ, a_Data, a_Exclude); +} + + + + + +void cChunkMap::BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity.GetChunkX(), ZERO_CHUNK_Y, a_Entity.GetChunkZ()); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastSpawnEntity(a_Entity, a_Exclude); +} + + + + + +void cChunkMap::BroadcastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSLayers); + int ChunkX, ChunkZ; + cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastThunderbolt(a_BlockX, a_BlockY, a_BlockZ, a_Exclude); +} + + + + + +void cChunkMap::BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) +{ + cCSLock Lock(m_CSLayers); + int ChunkX, ChunkZ; + + cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); + if (Chunk == NULL) + { + return; + } + // It's perfectly legal to broadcast packets even to invalid chunks! + Chunk->BroadcastUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ); +} + + + + + +void cChunkMap::SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client) +{ + cCSLock Lock(m_CSLayers); + int ChunkX, ChunkZ; + cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + return; + } + Chunk->SendBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Client); +} + + + + + +void cChunkMap::UseBlockEntity(cPlayer * a_Player, int a_BlockX, int a_BlockY, int a_BlockZ) +{ + // a_Player rclked block entity at the coords specified, handle it + cCSLock Lock(m_CSLayers); + int ChunkX, ChunkZ; + cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + return; + } + Chunk->UseBlockEntity(a_Player, a_BlockX, a_BlockY, a_BlockZ); +} + + + + + +bool cChunkMap::DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if (Chunk == NULL) + { + return false; + } + return a_Callback.Item(Chunk); +} + + + + + +void cChunkMap::WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + cCSLock Lock(m_CSLayers); + int ChunkX, ChunkZ; + cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, 0, ChunkZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + return; + } + m_World->GetSimulatorManager()->WakeUp(a_BlockX, a_BlockY, a_BlockZ, Chunk); +} + + + + + +/// Wakes up the simulators for the specified area of blocks +void cChunkMap::WakeUpSimulatorsInArea(int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ) +{ + cSimulatorManager * SimMgr = m_World->GetSimulatorManager(); + int MinChunkX, MinChunkZ, MaxChunkX, MaxChunkZ; + cChunkDef::BlockToChunk(a_MinBlockX, a_MinBlockZ, MinChunkX, MinChunkZ); + cChunkDef::BlockToChunk(a_MaxBlockX, a_MaxBlockZ, MaxChunkX, MaxChunkZ); + for (int z = MinChunkZ; z <= MaxChunkZ; z++) + { + int MinZ = std::max(a_MinBlockZ, z * cChunkDef::Width); + int MaxZ = std::min(a_MaxBlockZ, z * cChunkDef::Width + cChunkDef::Width - 1); + for (int x = MinChunkX; x <= MaxChunkX; x++) + { + cChunkPtr Chunk = GetChunkNoGen(x, 0, z); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + continue; + } + int MinX = std::max(a_MinBlockX, x * cChunkDef::Width); + int MaxX = std::min(a_MaxBlockX, x * cChunkDef::Width + cChunkDef::Width - 1); + for (int BlockY = a_MinBlockY; BlockY <= a_MaxBlockY; BlockY++) + { + for (int BlockZ = MinZ; BlockZ <= MaxZ; BlockZ++) + { + for (int BlockX = MinX; BlockX <= MaxX; BlockX++) + { + SimMgr->WakeUp(BlockX, BlockY, BlockZ, Chunk); + } // for BlockX + } // for BlockZ + } // for BlockY + } // for x - chunks + } // for z = chunks +} + + + + + +void cChunkMap::MarkChunkDirty (int a_ChunkX, int a_ChunkZ) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + return; + } + Chunk->MarkDirty(); +} + + + + + +void cChunkMap::MarkChunkSaving(int a_ChunkX, int a_ChunkZ) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + return; + } + Chunk->MarkSaving(); +} + + + + + +void cChunkMap::MarkChunkSaved (int a_ChunkX, int a_ChunkZ) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + return; + } + Chunk->MarkSaved(); +} + + + + + +void cChunkMap::SetChunkData( + int a_ChunkX, int a_ChunkZ, + const BLOCKTYPE * a_BlockTypes, + const NIBBLETYPE * a_BlockMeta, + const NIBBLETYPE * a_BlockLight, + const NIBBLETYPE * a_BlockSkyLight, + const cChunkDef::HeightMap * a_HeightMap, + const cChunkDef::BiomeMap & a_BiomeMap, + cBlockEntityList & a_BlockEntities, + bool a_MarkDirty +) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if (Chunk == NULL) + { + return; + } + Chunk->SetAllData(a_BlockTypes, a_BlockMeta, a_BlockLight, a_BlockSkyLight, a_HeightMap, a_BiomeMap, a_BlockEntities); + + if (a_MarkDirty) + { + Chunk->MarkDirty(); + } + + // Notify plugins of the chunk becoming available + cPluginManager::Get()->CallHookChunkAvailable(m_World, a_ChunkX, a_ChunkZ); +} + + + + + +void cChunkMap::ChunkLighted( + int a_ChunkX, int a_ChunkZ, + const cChunkDef::BlockNibbles & a_BlockLight, + const cChunkDef::BlockNibbles & a_SkyLight +) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if (Chunk == NULL) + { + return; + } + Chunk->SetLight(a_BlockLight, a_SkyLight); + Chunk->MarkDirty(); +} + + + + + +bool cChunkMap::GetChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + return false; + } + Chunk->GetAllData(a_Callback); + return true; +} + + + + + +bool cChunkMap::GetChunkBlockTypes(int a_ChunkX, int a_ChunkZ, BLOCKTYPE * a_BlockTypes) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + return false; + } + Chunk->GetBlockTypes(a_BlockTypes); + return true; +} + + + + + +bool cChunkMap::IsChunkValid(int a_ChunkX, int a_ChunkZ) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + return (Chunk != NULL) && Chunk->IsValid(); +} + + + + + +bool cChunkMap::HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + return (Chunk != NULL) && Chunk->HasAnyClients(); +} + + + + + +int cChunkMap::GetHeight(int a_BlockX, int a_BlockZ) +{ + while (true) + { + cCSLock Lock(m_CSLayers); + int ChunkX, ChunkZ, BlockY = 0; + cChunkDef::AbsoluteToRelative(a_BlockX, BlockY, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk == NULL) + { + return 0; + } + + if (Chunk->IsValid()) + { + return Chunk->GetHeight(a_BlockX, a_BlockZ); + } + + // The chunk is not valid, wait for it to become valid: + cCSUnlock Unlock(Lock); + m_evtChunkValid.Wait(); + } // while (true) +} + + + + + +bool cChunkMap::TryGetHeight(int a_BlockX, int a_BlockZ, int & a_Height) +{ + // Returns false if chunk not loaded / generated + cCSLock Lock(m_CSLayers); + int ChunkX, ChunkZ, BlockY = 0; + cChunkDef::AbsoluteToRelative(a_BlockX, BlockY, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + return false; + } + a_Height = Chunk->GetHeight(a_BlockX, a_BlockZ); + return true; +} + + + + + +void cChunkMap::FastSetBlocks(sSetBlockList & a_BlockList) +{ + sSetBlockList Failed; + + // Process all items from a_BlockList, either successfully or by placing into Failed + while (!a_BlockList.empty()) + { + int ChunkX = a_BlockList.front().ChunkX; + int ChunkZ = a_BlockList.front().ChunkZ; + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk != NULL) && Chunk->IsValid()) + { + for (sSetBlockList::iterator itr = a_BlockList.begin(); itr != a_BlockList.end();) + { + if ((itr->ChunkX == ChunkX) && (itr->ChunkZ == ChunkZ)) + { + Chunk->FastSetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta); + itr = a_BlockList.erase(itr); + } + else + { + ++itr; + } + } // for itr - a_BlockList[] + } + else + { + // The chunk is not valid, move all blocks within this chunk to Failed + for (sSetBlockList::iterator itr = a_BlockList.begin(); itr != a_BlockList.end();) + { + if ((itr->ChunkX == ChunkX) && (itr->ChunkZ == ChunkZ)) + { + Failed.push_back(*itr); + itr = a_BlockList.erase(itr); + } + else + { + ++itr; + } + } // for itr - a_BlockList[] + } + } + + // Return the failed: + std::swap(Failed, a_BlockList); +} + + + + + +void cChunkMap::CollectPickupsByPlayer(cPlayer * a_Player) +{ + int BlockX = (int)(a_Player->GetPosX()); // Truncating doesn't matter much; we're scanning entire chunks anyway + int BlockY = (int)(a_Player->GetPosY()); + int BlockZ = (int)(a_Player->GetPosZ()); + int ChunkX, ChunkZ, ChunkY = ZERO_CHUNK_Y; + cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); + int OtherChunkX = ChunkX + ((BlockX > 8) ? 1 : -1); + int OtherChunkZ = ChunkZ + ((BlockZ > 8) ? 1 : -1); + + // We suppose that each player keeps their chunks in memory, therefore it makes little sense to try to re-load or even generate them. + // The only time the chunks are not valid is when the player is downloading the initial world and they should not call this at that moment + + cCSLock Lock(m_CSLayers); + GetChunkNoLoad(ChunkX, ChunkY, ChunkZ)->CollectPickupsByPlayer(a_Player); + + // Check the neighboring chunks as well: + GetChunkNoLoad(OtherChunkX, ChunkY, ChunkZ )->CollectPickupsByPlayer(a_Player); + GetChunkNoLoad(OtherChunkX, ChunkY, OtherChunkZ)->CollectPickupsByPlayer(a_Player); + GetChunkNoLoad(ChunkX, ChunkY, ChunkZ )->CollectPickupsByPlayer(a_Player); + GetChunkNoLoad(ChunkX, ChunkY, OtherChunkZ)->CollectPickupsByPlayer(a_Player); +} + + + + + +BLOCKTYPE cChunkMap::GetBlock(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk != NULL) && Chunk->IsValid()) + { + return Chunk->GetBlock(a_BlockX, a_BlockY, a_BlockZ); + } + return 0; +} + + + + + +NIBBLETYPE cChunkMap::GetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); + if ((Chunk != NULL) && Chunk->IsValid() ) + { + return Chunk->GetMeta(a_BlockX, a_BlockY, a_BlockZ); + } + return 0; +} + + + + + +NIBBLETYPE cChunkMap::GetBlockSkyLight(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); + if ((Chunk != NULL) && Chunk->IsValid() ) + { + return Chunk->GetSkyLight(a_BlockX, a_BlockY, a_BlockZ); + } + return 0; +} + + + + + +NIBBLETYPE cChunkMap::GetBlockBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); + if ((Chunk != NULL) && Chunk->IsValid() ) + { + return Chunk->GetBlockLight(a_BlockX, a_BlockY, a_BlockZ); + } + return 0; +} + + + + + +void cChunkMap::SetBlockMeta(int a_BlockX, int a_BlockY, int a_BlockZ, NIBBLETYPE a_BlockMeta) +{ + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + // a_BlockXYZ now contains relative coords! + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk != NULL) && Chunk->IsValid()) + { + Chunk->SetMeta(a_BlockX, a_BlockY, a_BlockZ, a_BlockMeta); + Chunk->MarkDirty(); + Chunk->SendBlockTo(a_BlockX, a_BlockY, a_BlockZ, NULL); + } +} + + + + + +void cChunkMap::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta) +{ + int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ; + cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); + if ((Chunk != NULL) && Chunk->IsValid()) + { + Chunk->SetBlock(X, Y, Z, a_BlockType, a_BlockMeta ); + m_World->GetSimulatorManager()->WakeUp(a_BlockX, a_BlockY, a_BlockZ, Chunk); + } +} + + + + + +void cChunkMap::QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, BLOCKTYPE a_BlockMeta, Int64 a_Tick) +{ + int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ; + cChunkDef::AbsoluteToRelative(X, Y, Z, ChunkX, ChunkZ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk != NULL) && Chunk->IsValid()) + { + Chunk->QueueSetBlock(X, Y, Z, a_BlockType, a_BlockMeta, a_Tick); + } +} + + + + + +bool cChunkMap::GetBlockTypeMeta(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) +{ + int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ; + cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); + if ((Chunk != NULL) && Chunk->IsValid()) + { + Chunk->GetBlockTypeMeta(X, Y, Z, a_BlockType, a_BlockMeta); + return true; + } + return false; +} + + + + + +bool cChunkMap::GetBlockInfo(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight) +{ + int ChunkX, ChunkZ, X = a_BlockX, Y = a_BlockY, Z = a_BlockZ; + cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); + if ((Chunk != NULL) && Chunk->IsValid()) + { + Chunk->GetBlockInfo(X, Y, Z, a_BlockType, a_Meta, a_SkyLight, a_BlockLight); + return true; + } + return false; +} + + + + + +void cChunkMap::ReplaceBlocks(const sSetBlockVector & a_Blocks, BLOCKTYPE a_FilterBlockType) +{ + cCSLock Lock(m_CSLayers); + for (sSetBlockVector::const_iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr) + { + cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + continue; + } + if (Chunk->GetBlock(itr->x, itr->y, itr->z) == a_FilterBlockType) + { + Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta); + } + } +} + + + + + +void cChunkMap::ReplaceTreeBlocks(const sSetBlockVector & a_Blocks) +{ + cCSLock Lock(m_CSLayers); + for (sSetBlockVector::const_iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr) + { + cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + continue; + } + switch (Chunk->GetBlock(itr->x, itr->y, itr->z)) + { + CASE_TREE_OVERWRITTEN_BLOCKS: + { + Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta); + break; + } + case E_BLOCK_LEAVES: + { + if (itr->BlockType == E_BLOCK_LOG) + { + Chunk->SetBlock(itr->x, itr->y, itr->z, itr->BlockType, itr->BlockMeta); + } + break; + } + } + } // for itr - a_Blocks[] +} + + + + + +EMCSBiome cChunkMap::GetBiomeAt (int a_BlockX, int a_BlockZ) +{ + int ChunkX, ChunkZ, X = a_BlockX, Y = 0, Z = a_BlockZ; + cChunkDef::AbsoluteToRelative( X, Y, Z, ChunkX, ChunkZ ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); + if ((Chunk != NULL) && Chunk->IsValid()) + { + return Chunk->GetBiomeAt(X, Z); + } + else + { + return m_World->GetGenerator().GetBiomeAt(a_BlockX, a_BlockZ); + } +} + + + + + +bool cChunkMap::GetBlocks(sSetBlockVector & a_Blocks, bool a_ContinueOnFailure) +{ + bool res = true; + cCSLock Lock(m_CSLayers); + for (sSetBlockVector::iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr) + { + cChunkPtr Chunk = GetChunk(itr->ChunkX, ZERO_CHUNK_Y, itr->ChunkZ ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + if (!a_ContinueOnFailure) + { + return false; + } + res = false; + continue; + } + int idx = cChunkDef::MakeIndexNoCheck(itr->x, itr->y, itr->z); + itr->BlockType = Chunk->GetBlock(idx); + itr->BlockMeta = Chunk->GetMeta(idx); + } + return res; +} + + + + + +bool cChunkMap::DigBlock(int a_X, int a_Y, int a_Z) +{ + int PosX = a_X, PosY = a_Y, PosZ = a_Z, ChunkX, ChunkZ; + + cChunkDef::AbsoluteToRelative( PosX, PosY, PosZ, ChunkX, ChunkZ ); + + { + cCSLock Lock(m_CSLayers); + cChunkPtr DestChunk = GetChunk( ChunkX, ZERO_CHUNK_Y, ChunkZ ); + if ((DestChunk == NULL) || !DestChunk->IsValid()) + { + return false; + } + + DestChunk->SetBlock(PosX, PosY, PosZ, E_BLOCK_AIR, 0 ); + m_World->GetSimulatorManager()->WakeUp(a_X, a_Y, a_Z, DestChunk); + } + + return true; +} + + + + + +void cChunkMap::SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer * a_Player) +{ + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_X, a_Y, a_Z, ChunkX, ChunkZ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunk(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk->IsValid()) + { + Chunk->SendBlockTo(a_X, a_Y, a_Z, a_Player->GetClientHandle()); + } +} + + + + + +void cChunkMap::CompareChunkClients(int a_ChunkX1, int a_ChunkZ1, int a_ChunkX2, int a_ChunkZ2, cClientDiffCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk1 = GetChunkNoGen(a_ChunkX1, ZERO_CHUNK_Y, a_ChunkZ1); + if (Chunk1 == NULL) + { + return; + } + cChunkPtr Chunk2 = GetChunkNoGen(a_ChunkX2, ZERO_CHUNK_Y, a_ChunkZ2); + if (Chunk2 == NULL) + { + return; + } + + CompareChunkClients(Chunk1, Chunk2, a_Callback); +} + + + + + +void cChunkMap::CompareChunkClients(cChunk * a_Chunk1, cChunk * a_Chunk2, cClientDiffCallback & a_Callback) +{ + cClientHandleList Clients1(a_Chunk1->GetAllClients()); + cClientHandleList Clients2(a_Chunk2->GetAllClients()); + + // Find "removed" clients: + for (cClientHandleList::iterator itr1 = Clients1.begin(); itr1 != Clients1.end(); ++itr1) + { + bool Found = false; + for (cClientHandleList::iterator itr2 = Clients2.begin(); itr2 != Clients2.end(); ++itr2) + { + if (*itr1 == *itr2) + { + Found = true; + break; + } + } // for itr2 - Clients2[] + if (!Found) + { + a_Callback.Removed(*itr1); + } + } // for itr1 - Clients1[] + + // Find "added" clients: + for (cClientHandleList::iterator itr2 = Clients2.begin(); itr2 != Clients2.end(); ++itr2) + { + bool Found = false; + for (cClientHandleList::iterator itr1 = Clients1.begin(); itr1 != Clients1.end(); ++itr1) + { + if (*itr1 == *itr2) + { + Found = true; + break; + } + } // for itr1 - Clients1[] + if (!Found) + { + a_Callback.Added(*itr2); + } + } // for itr2 - Clients2[] +} + + + + + +bool cChunkMap::AddChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunk(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if (Chunk == NULL) + { + return false; + } + return Chunk->AddClient(a_Client); +} + + + + + +void cChunkMap::RemoveChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if (Chunk == NULL) + { + return; + } + Chunk->RemoveClient(a_Client); +} + + + + + +void cChunkMap::RemoveClientFromChunks(cClientHandle * a_Client) +{ + cCSLock Lock(m_CSLayers); + + for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + (*itr)->RemoveClient(a_Client); + } // for itr - m_Layers[] +} + + + + + +void cChunkMap::AddEntity(cEntity * a_Entity) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity->GetChunkX(), ZERO_CHUNK_Y, a_Entity->GetChunkZ()); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + LOGWARNING("Entity at %p (%s, ID %d) spawning in a non-existent chunk, the entity is lost.", + a_Entity, a_Entity->GetClass(), a_Entity->GetUniqueID() + ); + return; + } + Chunk->AddEntity(a_Entity); +} + + + + + +bool cChunkMap::HasEntity(int a_UniqueID) +{ + cCSLock Lock(m_CSLayers); + for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + if ((*itr)->HasEntity(a_UniqueID)) + { + return true; + } + } + return false; +} + + + + + +void cChunkMap::RemoveEntity(cEntity * a_Entity) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_Entity->GetChunkX(), ZERO_CHUNK_Y, a_Entity->GetChunkZ()); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return; + } + Chunk->RemoveEntity(a_Entity); +} + + + + + +bool cChunkMap::ForEachEntity(cEntityCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + if (!(*itr)->ForEachEntity(a_Callback)) + { + return false; + } + } + return true; +} + + + + + +bool cChunkMap::ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, cEntityCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->ForEachEntity(a_Callback); +} + + + + + +void cChunkMap::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, cVector3iArray & a_BlocksAffected) +{ + // Don't explode if outside of Y range (prevents the following test running into unallocated memory): + if ((a_BlockY < 0) || (a_BlockY > cChunkDef::Height - 1)) + { + return; + } + + // Don't explode if the explosion center is inside a liquid block: + switch (m_World->GetBlock((int)floor(a_BlockX), (int)floor(a_BlockY), (int)floor(a_BlockZ))) + { + case E_BLOCK_WATER: + case E_BLOCK_STATIONARY_WATER: + case E_BLOCK_LAVA: + case E_BLOCK_STATIONARY_LAVA: + { + return; + } + } + + cBlockArea area; + int bx = (int)floor(a_BlockX); + int by = (int)floor(a_BlockY); + int bz = (int)floor(a_BlockZ); + int ExplosionSizeInt = (int) ceil(a_ExplosionSize); + int ExplosionSizeSq = ExplosionSizeInt * ExplosionSizeInt; + a_BlocksAffected.reserve(8 * ExplosionSizeInt * ExplosionSizeInt * ExplosionSizeInt); + int MinY = std::max((int)floor(a_BlockY - ExplosionSizeInt), 0); + int MaxY = std::min((int)ceil(a_BlockY + ExplosionSizeInt), cChunkDef::Height - 1); + area.Read(m_World, bx - ExplosionSizeInt, (int)ceil(a_BlockX + ExplosionSizeInt), MinY, MaxY, bz - ExplosionSizeInt, (int)ceil(a_BlockZ + ExplosionSizeInt)); + for (int x = -ExplosionSizeInt; x < ExplosionSizeInt; x++) + { + for (int y = -ExplosionSizeInt; y < ExplosionSizeInt; y++) + { + if ((by + y >= cChunkDef::Height) || (by + y < 0)) + { + // Outside of the world + continue; + } + for (int z = -ExplosionSizeInt; z < ExplosionSizeInt; z++) + { + if ((x * x + y * y + z * z) > ExplosionSizeSq) + { + // Too far away + continue; + } + + BLOCKTYPE Block = area.GetBlockType(bx + x, by + y, bz + z); + switch (Block) + { + case E_BLOCK_TNT: + { + // Activate the TNT, with a random fuse between 10 to 30 game ticks + double FuseTime = (double)(10 + m_World->GetTickRandomNumber(20)) / 20; + m_World->SpawnPrimedTNT(a_BlockX + x + 0.5, a_BlockY + y + 0.5, a_BlockZ + z + 0.5, FuseTime); + area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_AIR); + a_BlocksAffected.push_back(Vector3i(bx + x, by + y, bz + z)); + break; + } + case E_BLOCK_OBSIDIAN: + case E_BLOCK_BEDROCK: + case E_BLOCK_WATER: + case E_BLOCK_LAVA: + { + // These blocks are not affected by explosions + break; + } + + case E_BLOCK_STATIONARY_WATER: + { + // Turn into simulated water: + area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_WATER); + break; + } + + case E_BLOCK_STATIONARY_LAVA: + { + // Turn into simulated lava: + area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_LAVA); + break; + } + + case E_BLOCK_AIR: + { + // No pickups for air + break; + } + + default: + { + if (m_World->GetTickRandomNumber(10) == 5) + { + cItems Drops; + cBlockHandler * Handler = BlockHandler(Block); + + Handler->ConvertToPickups(Drops, area.GetBlockMeta(bx + x, by + y, bz + z)); + m_World->SpawnItemPickups(Drops, bx + x, by + y, bz + z); + } + area.SetBlockType(bx + x, by + y, bz + z, E_BLOCK_AIR); + a_BlocksAffected.push_back(Vector3i(bx + x, by + y, bz + z)); + } + } // switch (BlockType) + } // for z + } // for y + } // for x + area.Write(m_World, bx - ExplosionSizeInt, MinY, bz - ExplosionSizeInt); + + // Wake up all simulators for the area, so that water and lava flows and sand falls into the blasted holes (FS #391): + WakeUpSimulatorsInArea( + bx - ExplosionSizeInt, bx + ExplosionSizeInt + 1, + MinY, MaxY, + bz - ExplosionSizeInt, bz + ExplosionSizeInt + 1 + ); +} + + + + + +bool cChunkMap::DoWithEntityByID(int a_UniqueID, cEntityCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + bool res = false; + for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + if ((*itr)->DoWithEntityByID(a_UniqueID, a_Callback, res)) + { + return res; + } + } + return false; +} + + + + + +bool cChunkMap::ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, cBlockEntityCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->ForEachBlockEntity(a_Callback); +} + + + + + +bool cChunkMap::ForEachChestInChunk(int a_ChunkX, int a_ChunkZ, cChestCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->ForEachChest(a_Callback); +} + + + + + +bool cChunkMap::ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->ForEachDispenser(a_Callback); +} + + + + + +bool cChunkMap::ForEachDropperInChunk(int a_ChunkX, int a_ChunkZ, cDropperCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->ForEachDropper(a_Callback); +} + + + + + +bool cChunkMap::ForEachDropSpenserInChunk(int a_ChunkX, int a_ChunkZ, cDropSpenserCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->ForEachDropSpenser(a_Callback); +} + + + + + +bool cChunkMap::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->ForEachFurnace(a_Callback); +} + + + + + +bool cChunkMap::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback) +{ + int ChunkX, ChunkZ; + int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; + cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + +bool cChunkMap::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback) +{ + int ChunkX, ChunkZ; + int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; + cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->DoWithChestAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + +bool cChunkMap::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback) +{ + int ChunkX, ChunkZ; + int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; + cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->DoWithDispenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + +bool cChunkMap::DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback) +{ + int ChunkX, ChunkZ; + int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; + cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->DoWithDropperAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + +bool cChunkMap::DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback) +{ + int ChunkX, ChunkZ; + int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; + cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->DoWithDropSpenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + +bool cChunkMap::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback) +{ + int ChunkX, ChunkZ; + int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; + cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->DoWithFurnaceAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + +bool cChunkMap::GetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4) +{ + int ChunkX, ChunkZ; + int BlockX = a_BlockX, BlockY = a_BlockY, BlockZ = a_BlockZ; + cChunkDef::AbsoluteToRelative(BlockX, BlockY, BlockZ, ChunkX, ChunkZ); + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk == NULL) && !Chunk->IsValid()) + { + return false; + } + return Chunk->GetSignLines(a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4); +} + + + + + +void cChunkMap::TouchChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +{ + cCSLock Lock(m_CSLayers); + GetChunk(a_ChunkX, a_ChunkY, a_ChunkZ); +} + + + + + +/// Loads the chunk synchronously, if not already loaded. Doesn't generate. Returns true if chunk valid (even if already loaded before) +bool cChunkMap::LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +{ + { + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoGen(a_ChunkX, a_ChunkY, a_ChunkZ); + if (Chunk == NULL) + { + // Internal error + return false; + } + if (Chunk->IsValid()) + { + // Already loaded + return true; + } + if (Chunk->HasLoadFailed()) + { + // Already tried loading and it failed + return false; + } + } + return m_World->GetStorage().LoadChunk(a_ChunkX, a_ChunkY, a_ChunkZ); +} + + + + + +/// Loads the chunks specified. Doesn't report failure, other than chunks being !IsValid() +void cChunkMap::LoadChunks(const cChunkCoordsList & a_Chunks) +{ + for (cChunkCoordsList::const_iterator itr = a_Chunks.begin(); itr != a_Chunks.end(); ++itr) + { + LoadChunk(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ); + } // for itr - a_Chunks[] +} + + + + + +void cChunkMap::ChunkLoadFailed(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, a_ChunkY, a_ChunkZ); + if (Chunk == NULL) + { + return; + } + Chunk->MarkLoadFailed(); +} + + + + + +bool cChunkMap::SetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) +{ + cCSLock Lock(m_CSLayers); + int ChunkX, ChunkZ; + cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, ChunkX, ChunkZ); + cChunkPtr Chunk = GetChunkNoGen(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if ((Chunk == NULL) || !Chunk->IsValid()) + { + return false; + } + return Chunk->SetSignLines(a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4); +} + + + + + +void cChunkMap::ChunksStay(const cChunkCoordsList & a_Chunks, bool a_Stay) +{ + cCSLock Lock(m_CSLayers); + for (cChunkCoordsList::const_iterator itr = a_Chunks.begin(); itr != a_Chunks.end(); ++itr) + { + cChunkPtr Chunk = GetChunkNoLoad(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ); + if (Chunk == NULL) + { + continue; + } + Chunk->Stay(a_Stay); + } +} + + + + + +void cChunkMap::MarkChunkRegenerating(int a_ChunkX, int a_ChunkZ) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if (Chunk == NULL) + { + // Not present + return; + } + Chunk->MarkRegenerating(); +} + + + + + +bool cChunkMap::IsChunkLighted(int a_ChunkX, int a_ChunkZ) +{ + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); + if (Chunk == NULL) + { + // Not present + return false; + } + return Chunk->IsLightValid(); +} + + + + + +bool cChunkMap::ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) +{ + bool Result = true; + cCSLock Lock(m_CSLayers); + for (int z = a_MinChunkZ; z <= a_MaxChunkZ; z++) + { + for (int x = a_MinChunkX; x <= a_MaxChunkX; x++) + { + cChunkPtr Chunk = GetChunkNoLoad(x, ZERO_CHUNK_Y, z); + if ((Chunk == NULL) || (!Chunk->IsValid())) + { + // Not present / not valid + Result = false; + continue; + } + if (!a_Callback.Coords(x, z)) + { + continue; + } + Chunk->GetAllData(a_Callback); + } + } + return Result; +} + + + + + +bool cChunkMap::WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) +{ + // Convert block coords to chunks coords: + int MinChunkX, MaxChunkX; + int MinChunkZ, MaxChunkZ; + int MinBlockX = a_MinBlockX; + int MinBlockY = a_MinBlockY; + int MinBlockZ = a_MinBlockZ; + int MaxBlockX = a_MinBlockX + a_Area.GetSizeX(); + int MaxBlockY = a_MinBlockY + a_Area.GetSizeY(); + int MaxBlockZ = a_MinBlockZ + a_Area.GetSizeZ(); + cChunkDef::AbsoluteToRelative(MinBlockX, MinBlockY, MinBlockZ, MinChunkX, MinChunkZ); + cChunkDef::AbsoluteToRelative(MaxBlockX, MaxBlockY, MaxBlockZ, MaxChunkX, MaxChunkZ); + + // Iterate over chunks, write data into each: + bool Result = true; + cCSLock Lock(m_CSLayers); + for (int z = MinChunkZ; z <= MaxChunkZ; z++) + { + for (int x = MinChunkX; x <= MaxChunkX; x++) + { + cChunkPtr Chunk = GetChunkNoLoad(x, ZERO_CHUNK_Y, z); + if ((Chunk == NULL) || (!Chunk->IsValid())) + { + // Not present / not valid + Result = false; + continue; + } + Chunk->WriteBlockArea(a_Area, a_MinBlockX, a_MinBlockY, a_MinBlockZ, a_DataTypes); + } // for x + } // for z + return Result; +} + + + + + +void cChunkMap::GetChunkStats(int & a_NumChunksValid, int & a_NumChunksDirty) +{ + a_NumChunksValid = 0; + a_NumChunksDirty = 0; + cCSLock Lock(m_CSLayers); + for (cChunkLayerList::const_iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + int NumValid = 0, NumDirty = 0; + (*itr)->GetChunkStats(NumValid, NumDirty); + a_NumChunksValid += NumValid; + a_NumChunksDirty += NumDirty; + } // for itr - m_Layers[] +} + + + + + +void cChunkMap::GrowMelonPumpkin(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, MTRand & a_Rand) +{ + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk != NULL) + { + Chunk->GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_Rand); + } +} + + + + + +void cChunkMap::GrowSugarcane(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow) +{ + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk != NULL) + { + Chunk->GrowSugarcane(a_BlockX, a_BlockY, a_BlockZ, a_NumBlocksToGrow); + } +} + + + + + +void cChunkMap::GrowCactus(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow) +{ + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk != NULL) + { + Chunk->GrowCactus(a_BlockX, a_BlockY, a_BlockZ, a_NumBlocksToGrow); + } +} + + + + + +void cChunkMap::SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk != NULL) + { + Chunk->SetNextBlockTick(a_BlockX, a_BlockY, a_BlockZ); + } +} + + + + +void cChunkMap::CollectMobCensus(cMobCensus& a_ToFill) +{ + cCSLock Lock(m_CSLayers); + for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + (*itr)->CollectMobCensus(a_ToFill); + } // for itr - m_Layers +} + + + + + + +void cChunkMap::SpawnMobs(cMobSpawner& a_MobSpawner) +{ + cCSLock Lock(m_CSLayers); + for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + (*itr)->SpawnMobs(a_MobSpawner); + } // for itr - m_Layers +} + + + + + +void cChunkMap::Tick(float a_Dt) +{ + cCSLock Lock(m_CSLayers); + for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + (*itr)->Tick(a_Dt); + } // for itr - m_Layers +} + + + + + +void cChunkMap::UnloadUnusedChunks() +{ + cCSLock Lock(m_CSLayers); + for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + (*itr)->UnloadUnusedChunks(); + } // for itr - m_Layers +} + + + + + +void cChunkMap::SaveAllChunks(void) +{ + cCSLock Lock(m_CSLayers); + for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + (*itr)->Save(); + } // for itr - m_Layers[] +} + + + + + +int cChunkMap::GetNumChunks(void) +{ + cCSLock Lock(m_CSLayers); + int NumChunks = 0; + for (cChunkLayerList::iterator itr = m_Layers.begin(); itr != m_Layers.end(); ++itr) + { + NumChunks += (*itr)->GetNumChunksLoaded(); + } + return NumChunks; +} + + + + + +void cChunkMap::ChunkValidated(void) +{ + m_evtChunkValid.Set(); +} + + + + + +void cChunkMap::QueueTickBlock(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(a_BlockX, a_BlockY, a_BlockZ, ChunkX, ChunkZ); + // a_BlockXYZ now contains relative coords! + + cCSLock Lock(m_CSLayers); + cChunkPtr Chunk = GetChunkNoLoad(ChunkX, ZERO_CHUNK_Y, ChunkZ); + if (Chunk != NULL) + { + Chunk->QueueTickBlock(a_BlockX, a_BlockY, a_BlockZ); + } +} + + + + + +//////////////////////////////////////////////////////////////////////////////// +// cChunkMap::cChunkLayer: + +cChunkMap::cChunkLayer::cChunkLayer(int a_LayerX, int a_LayerZ, cChunkMap * a_Parent) + : m_LayerX( a_LayerX ) + , m_LayerZ( a_LayerZ ) + , m_Parent( a_Parent ) + , m_NumChunksLoaded( 0 ) +{ + memset(m_Chunks, 0, sizeof(m_Chunks)); +} + + + + + +cChunkMap::cChunkLayer::~cChunkLayer() +{ + for (int i = 0; i < ARRAYCOUNT(m_Chunks); ++i) + { + delete m_Chunks[i]; + m_Chunks[i] = NULL; // // Must zero out, because further chunk deletions query the chunkmap for entities and that would touch deleted data + } // for i - m_Chunks[] +} + + + + + +cChunkPtr cChunkMap::cChunkLayer::GetChunk( int a_ChunkX, int a_ChunkY, int a_ChunkZ ) +{ + // Always returns an assigned chunkptr, but the chunk needn't be valid (loaded / generated) - callers must check + + const int LocalX = a_ChunkX - m_LayerX * LAYER_SIZE; + const int LocalZ = a_ChunkZ - m_LayerZ * LAYER_SIZE; + + if (!((LocalX < LAYER_SIZE) && (LocalZ < LAYER_SIZE) && (LocalX > -1) && (LocalZ > -1))) + { + ASSERT(!"Asking a cChunkLayer for a chunk that doesn't belong to it!"); + return NULL; + } + + int Index = LocalX + LocalZ * LAYER_SIZE; + if (m_Chunks[Index] == NULL) + { + cChunk * neixm = (LocalX > 0) ? m_Chunks[Index - 1] : m_Parent->FindChunk(a_ChunkX - 1, a_ChunkZ); + cChunk * neixp = (LocalX < LAYER_SIZE - 1) ? m_Chunks[Index + 1] : m_Parent->FindChunk(a_ChunkX + 1, a_ChunkZ); + cChunk * neizm = (LocalZ > 0) ? m_Chunks[Index - LAYER_SIZE] : m_Parent->FindChunk(a_ChunkX , a_ChunkZ - 1); + cChunk * neizp = (LocalZ < LAYER_SIZE - 1) ? m_Chunks[Index + LAYER_SIZE] : m_Parent->FindChunk(a_ChunkX , a_ChunkZ + 1); + m_Chunks[Index] = new cChunk(a_ChunkX, 0, a_ChunkZ, m_Parent, m_Parent->GetWorld(), neixm, neixp, neizm, neizp); + } + return m_Chunks[Index]; +} + + + + + +cChunk * cChunkMap::cChunkLayer::FindChunk(int a_ChunkX, int a_ChunkZ) +{ + const int LocalX = a_ChunkX - m_LayerX * LAYER_SIZE; + const int LocalZ = a_ChunkZ - m_LayerZ * LAYER_SIZE; + + if (!((LocalX < LAYER_SIZE) && (LocalZ < LAYER_SIZE) && (LocalX > -1) && (LocalZ > -1))) + { + ASSERT(!"Asking a cChunkLayer for a chunk that doesn't belong to it!"); + return NULL; + } + + int Index = LocalX + LocalZ * LAYER_SIZE; + return m_Chunks[Index]; +} + + + + +void cChunkMap::cChunkLayer::CollectMobCensus(cMobCensus& a_ToFill) +{ + for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) + { + // We do count every Mobs in the world. But we are assuming that every chunk not loaded by any client + // doesn't affect us. Normally they should not have mobs because every "too far" mobs despawn + // If they have (f.i. when player disconnect) we assume we don't have to make them live or despawn + if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->HasAnyClients()) + { + m_Chunks[i]->CollectMobCensus(a_ToFill); + } + } // for i - m_Chunks[] +} + + + + + + +void cChunkMap::cChunkLayer::SpawnMobs(cMobSpawner& a_MobSpawner) +{ + for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) + { + // We only spawn close to players + if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->HasAnyClients()) + { + m_Chunks[i]->SpawnMobs(a_MobSpawner); + } + } // for i - m_Chunks[] +} + + + +void cChunkMap::cChunkLayer::Tick(float a_Dt) +{ + for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) + { + // Only tick chunks that are valid and have clients: + if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->HasAnyClients()) + { + m_Chunks[i]->Tick(a_Dt); + } + } // for i - m_Chunks[] +} + + + + + +void cChunkMap::cChunkLayer::RemoveClient(cClientHandle * a_Client) +{ + for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) + { + if (m_Chunks[i] != NULL) + { + m_Chunks[i]->RemoveClient(a_Client); + } + } // for i - m_Chunks[] +} + + + + + +bool cChunkMap::cChunkLayer::ForEachEntity(cEntityCallback & a_Callback) +{ + // Calls the callback for each entity in the entire world; returns true if all entities processed, false if the callback aborted by returning true + for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) + { + if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid()) + { + if (!m_Chunks[i]->ForEachEntity(a_Callback)) + { + return false; + } + } + } + return true; +} + + + + + +bool cChunkMap::cChunkLayer::DoWithEntityByID(int a_EntityID, cEntityCallback & a_Callback, bool & a_CallbackReturn) +{ + // Calls the callback if the entity with the specified ID is found, with the entity object as the callback param. Returns true if entity found. + for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) + { + if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid()) + { + if (m_Chunks[i]->DoWithEntityByID(a_EntityID, a_Callback, a_CallbackReturn)) + { + return true; + } + } + } + return false; +} + + + + + +bool cChunkMap::cChunkLayer::HasEntity(int a_EntityID) +{ + for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) + { + if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid()) + { + if (m_Chunks[i]->HasEntity(a_EntityID)) + { + return true; + } + } + } + return false; +} + + + + + +int cChunkMap::cChunkLayer::GetNumChunksLoaded(void) const +{ + int NumChunks = 0; + for ( int i = 0; i < ARRAYCOUNT(m_Chunks); ++i ) + { + if (m_Chunks[i] != NULL) + { + NumChunks++; + } + } // for i - m_Chunks[] + return NumChunks; +} + + + + + +void cChunkMap::cChunkLayer::GetChunkStats(int & a_NumChunksValid, int & a_NumChunksDirty) const +{ + int NumValid = 0; + int NumDirty = 0; + for ( int i = 0; i < ARRAYCOUNT(m_Chunks); ++i ) + { + if (m_Chunks[i] == NULL) + { + continue; + } + NumValid++; + if (m_Chunks[i]->IsDirty()) + { + NumDirty++; + } + } // for i - m_Chunks[] + a_NumChunksValid = NumValid; + a_NumChunksDirty = NumDirty; +} + + + + + +void cChunkMap::cChunkLayer::Save(void) +{ + cWorld * World = m_Parent->GetWorld(); + for (int i = 0; i < ARRAYCOUNT(m_Chunks); ++i) + { + if ((m_Chunks[i] != NULL) && m_Chunks[i]->IsValid() && m_Chunks[i]->IsDirty()) + { + World->GetStorage().QueueSaveChunk(m_Chunks[i]->GetPosX(), m_Chunks[i]->GetPosY(), m_Chunks[i]->GetPosZ()); + } + } // for i - m_Chunks[] +} + + + + + +void cChunkMap::cChunkLayer::UnloadUnusedChunks(void) +{ + for (int i = 0; i < ARRAYCOUNT(m_Chunks); i++) + { + if ( + (m_Chunks[i] != NULL) && // Is valid + (m_Chunks[i]->CanUnload()) && // Can unload + !cPluginManager::Get()->CallHookChunkUnloading(m_Parent->GetWorld(), m_Chunks[i]->GetPosX(), m_Chunks[i]->GetPosZ()) // Plugins agree + ) + { + // The cChunk destructor calls our GetChunk() while removing its entities + // so we still need to be able to return the chunk. Therefore we first delete, then NULLify + // Doing otherwise results in bug http://forum.mc-server.org/showthread.php?tid=355 + delete m_Chunks[i]; + m_Chunks[i] = NULL; + } + } // for i - m_Chunks[] +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cChunkStay: + +cChunkStay::cChunkStay(cWorld * a_World) : + m_World(a_World), + m_IsEnabled(false) +{ +} + + + + + +cChunkStay::~cChunkStay() +{ + Clear(); +} + + + + + +void cChunkStay::Clear(void) +{ + if (m_IsEnabled) + { + Disable(); + } + m_Chunks.clear(); +} + + + + + +void cChunkStay::Add(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +{ + ASSERT(!m_IsEnabled); + + for (cChunkCoordsList::const_iterator itr = m_Chunks.begin(); itr != m_Chunks.end(); ++itr) + { + if ((itr->m_ChunkX == a_ChunkX) && (itr->m_ChunkY == a_ChunkY) && (itr->m_ChunkZ == a_ChunkZ)) + { + // Already present + return; + } + } // for itr - Chunks[] + m_Chunks.push_back(cChunkCoords(a_ChunkX, a_ChunkY, a_ChunkZ)); +} + + + + + +void cChunkStay::Remove(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +{ + ASSERT(!m_IsEnabled); + + for (cChunkCoordsList::iterator itr = m_Chunks.begin(); itr != m_Chunks.end(); ++itr) + { + if ((itr->m_ChunkX == a_ChunkX) && (itr->m_ChunkY == a_ChunkY) && (itr->m_ChunkZ == a_ChunkZ)) + { + // Found, un-"stay" + m_Chunks.erase(itr); + return; + } + } // for itr - m_Chunks[] +} + + + + + +void cChunkStay::Enable(void) +{ + ASSERT(!m_IsEnabled); + + m_World->ChunksStay(*this, true); + m_IsEnabled = true; +} + + + + + +void cChunkStay::Load(void) +{ + for (cChunkCoordsList::iterator itr = m_Chunks.begin(); itr != m_Chunks.end(); ++itr) + { + m_World->TouchChunk(itr->m_ChunkX, itr->m_ChunkY, itr->m_ChunkZ); + } // for itr - m_Chunks[] +} + + + + + +void cChunkStay::Disable(void) +{ + ASSERT(m_IsEnabled); + + m_World->ChunksStay(*this, false); + m_IsEnabled = false; +} + + + + diff --git a/source/ChunkMap.h b/src/ChunkMap.h index 2a1d78ff8..2a1d78ff8 100644 --- a/source/ChunkMap.h +++ b/src/ChunkMap.h diff --git a/source/ChunkSender.cpp b/src/ChunkSender.cpp index 005cfe29d..005cfe29d 100644 --- a/source/ChunkSender.cpp +++ b/src/ChunkSender.cpp diff --git a/source/ChunkSender.h b/src/ChunkSender.h index a26f764a7..a26f764a7 100644 --- a/source/ChunkSender.h +++ b/src/ChunkSender.h diff --git a/source/ClientHandle.cpp b/src/ClientHandle.cpp index b3e12ce77..b3e12ce77 100644 --- a/source/ClientHandle.cpp +++ b/src/ClientHandle.cpp diff --git a/source/ClientHandle.h b/src/ClientHandle.h index b3550110d..b3550110d 100644 --- a/source/ClientHandle.h +++ b/src/ClientHandle.h diff --git a/source/CommandOutput.cpp b/src/CommandOutput.cpp index c221682a1..c221682a1 100644 --- a/source/CommandOutput.cpp +++ b/src/CommandOutput.cpp diff --git a/source/CommandOutput.h b/src/CommandOutput.h index bdf675238..bdf675238 100644 --- a/source/CommandOutput.h +++ b/src/CommandOutput.h diff --git a/source/CraftingRecipes.cpp b/src/CraftingRecipes.cpp index 9dc471781..9dc471781 100644 --- a/source/CraftingRecipes.cpp +++ b/src/CraftingRecipes.cpp diff --git a/source/CraftingRecipes.h b/src/CraftingRecipes.h index 9d92cbfab..9d92cbfab 100644 --- a/source/CraftingRecipes.h +++ b/src/CraftingRecipes.h diff --git a/source/Cuboid.cpp b/src/Cuboid.cpp index ea6f7c453..ea6f7c453 100644 --- a/source/Cuboid.cpp +++ b/src/Cuboid.cpp diff --git a/source/Cuboid.h b/src/Cuboid.h index 44db7b98e..44db7b98e 100644 --- a/source/Cuboid.h +++ b/src/Cuboid.h diff --git a/source/DeadlockDetect.cpp b/src/DeadlockDetect.cpp index c774c9dce..c774c9dce 100644 --- a/source/DeadlockDetect.cpp +++ b/src/DeadlockDetect.cpp diff --git a/source/DeadlockDetect.h b/src/DeadlockDetect.h index 2559c3fff..2559c3fff 100644 --- a/source/DeadlockDetect.h +++ b/src/DeadlockDetect.h diff --git a/source/Defines.h b/src/Defines.h index 06410cab4..06410cab4 100644 --- a/source/Defines.h +++ b/src/Defines.h diff --git a/source/Enchantments.cpp b/src/Enchantments.cpp index 6b53d0b52..6b53d0b52 100644 --- a/source/Enchantments.cpp +++ b/src/Enchantments.cpp diff --git a/source/Enchantments.h b/src/Enchantments.h index 7581b87b5..7581b87b5 100644 --- a/source/Enchantments.h +++ b/src/Enchantments.h diff --git a/source/Endianness.h b/src/Endianness.h index 86eb369f5..86eb369f5 100644 --- a/source/Endianness.h +++ b/src/Endianness.h diff --git a/source/Entities/Boat.cpp b/src/Entities/Boat.cpp index 56e766dd4..56e766dd4 100644 --- a/source/Entities/Boat.cpp +++ b/src/Entities/Boat.cpp diff --git a/source/Entities/Boat.h b/src/Entities/Boat.h index 8c51ab86c..8c51ab86c 100644 --- a/source/Entities/Boat.h +++ b/src/Entities/Boat.h diff --git a/source/Entities/Entity.cpp b/src/Entities/Entity.cpp index 3bea7bc01..3bea7bc01 100644 --- a/source/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp diff --git a/source/Entities/Entity.h b/src/Entities/Entity.h index de5f176ae..de5f176ae 100644 --- a/source/Entities/Entity.h +++ b/src/Entities/Entity.h diff --git a/source/Entities/ExpOrb.cpp b/src/Entities/ExpOrb.cpp index 1e5ee00ce..1e5ee00ce 100644 --- a/source/Entities/ExpOrb.cpp +++ b/src/Entities/ExpOrb.cpp diff --git a/source/Entities/ExpOrb.h b/src/Entities/ExpOrb.h index a062eedd3..a062eedd3 100644 --- a/source/Entities/ExpOrb.h +++ b/src/Entities/ExpOrb.h diff --git a/source/Entities/FallingBlock.cpp b/src/Entities/FallingBlock.cpp index 9fcd9ac80..9fcd9ac80 100644 --- a/source/Entities/FallingBlock.cpp +++ b/src/Entities/FallingBlock.cpp diff --git a/source/Entities/FallingBlock.h b/src/Entities/FallingBlock.h index 5ba9909bb..5ba9909bb 100644 --- a/source/Entities/FallingBlock.h +++ b/src/Entities/FallingBlock.h diff --git a/source/Entities/Minecart.cpp b/src/Entities/Minecart.cpp index f75e23d8b..f75e23d8b 100644 --- a/source/Entities/Minecart.cpp +++ b/src/Entities/Minecart.cpp diff --git a/source/Entities/Minecart.h b/src/Entities/Minecart.h index b1b48be4e..b1b48be4e 100644 --- a/source/Entities/Minecart.h +++ b/src/Entities/Minecart.h diff --git a/source/Entities/Pawn.cpp b/src/Entities/Pawn.cpp index fffefd538..fffefd538 100644 --- a/source/Entities/Pawn.cpp +++ b/src/Entities/Pawn.cpp diff --git a/source/Entities/Pawn.h b/src/Entities/Pawn.h index e76337d86..e76337d86 100644 --- a/source/Entities/Pawn.h +++ b/src/Entities/Pawn.h diff --git a/source/Entities/Pickup.cpp b/src/Entities/Pickup.cpp index f8aae9703..f8aae9703 100644 --- a/source/Entities/Pickup.cpp +++ b/src/Entities/Pickup.cpp diff --git a/source/Entities/Pickup.h b/src/Entities/Pickup.h index d39eda298..d39eda298 100644 --- a/source/Entities/Pickup.h +++ b/src/Entities/Pickup.h diff --git a/src/Entities/Player.cpp b/src/Entities/Player.cpp new file mode 100644 index 000000000..910613e98 --- /dev/null +++ b/src/Entities/Player.cpp @@ -0,0 +1,1765 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Player.h" +#include "../Server.h" +#include "../ClientHandle.h" +#include "../UI/Window.h" +#include "../UI/WindowOwner.h" +#include "../World.h" +#include "Pickup.h" +#include "../PluginManager.h" +#include "../BlockEntities/BlockEntity.h" +#include "../GroupManager.h" +#include "../Group.h" +#include "../ChatColor.h" +#include "../Item.h" +#include "../Tracer.h" +#include "../Root.h" +#include "../OSSupport/Timer.h" +#include "../MersenneTwister.h" +#include "../Chunk.h" +#include "../Items/ItemHandler.h" + +#include "../Vector3d.h" +#include "../Vector3f.h" + +#include "inifile/iniFile.h" +#include "json/json.h" + +#define float2int(x) ((x)<0 ? ((int)(x))-1 : (int)(x)) + + + + + + +cPlayer::cPlayer(cClientHandle* a_Client, const AString & a_PlayerName) + : super(etPlayer, 0.6, 1.8) + , m_GameMode(eGameMode_NotSet) + , m_IP("") + , m_LastBlockActionTime( 0 ) + , m_LastBlockActionCnt( 0 ) + , m_AirLevel( MAX_AIR_LEVEL ) + , m_AirTickTimer( DROWNING_TICKS ) + , m_bVisible( true ) + , m_LastGroundHeight( 0 ) + , m_bTouchGround( false ) + , m_Stance( 0.0 ) + , m_Inventory(*this) + , m_CurrentWindow(NULL) + , m_InventoryWindow(NULL) + , m_TimeLastPickupCheck( 0.f ) + , m_Color('-') + , m_ClientHandle( a_Client ) + , m_FoodLevel(MAX_FOOD_LEVEL) + , m_FoodSaturationLevel(5) + , m_FoodTickTimer(0) + , m_FoodExhaustionLevel(0) + , m_FoodPoisonedTicksRemaining(0) + , m_NormalMaxSpeed(0.1) + , m_SprintingMaxSpeed(0.13) + , m_IsCrouched(false) + , m_IsSprinting(false) + , m_IsSwimming(false) + , m_IsSubmerged(false) + , m_EatingFinishTick(-1) + , m_IsChargingBow(false) + , m_BowCharge(0) + , m_CurrentXp(0) + , m_LifetimeTotalXp(0) + , m_bDirtyExperience(false) +{ + LOGD("Created a player object for \"%s\" @ \"%s\" at %p, ID %d", + a_PlayerName.c_str(), a_Client->GetIPString().c_str(), + this, GetUniqueID() + ); + + m_InventoryWindow = new cInventoryWindow(*this); + m_CurrentWindow = m_InventoryWindow; + m_InventoryWindow->OpenedByPlayer(*this); + + SetMaxHealth(MAX_HEALTH); + m_Health = MAX_HEALTH; + + cTimer t1; + m_LastPlayerListTime = t1.GetNowTime(); + + m_TimeLastTeleportPacket = 0; + m_TimeLastPickupCheck = 0; + + m_PlayerName = a_PlayerName; + m_bDirtyPosition = true; // So chunks are streamed to player at spawn + + if (!LoadFromDisk()) + { + m_Inventory.Clear(); + SetPosX(cRoot::Get()->GetDefaultWorld()->GetSpawnX()); + SetPosY(cRoot::Get()->GetDefaultWorld()->GetSpawnY()); + SetPosZ(cRoot::Get()->GetDefaultWorld()->GetSpawnZ()); + + LOGD("Player \"%s\" is connecting for the first time, spawning at default world spawn {%.2f, %.2f, %.2f}", + a_PlayerName.c_str(), GetPosX(), GetPosY(), GetPosZ() + ); + } + m_LastJumpHeight = (float)(GetPosY()); + m_LastGroundHeight = (float)(GetPosY()); + m_Stance = GetPosY() + 1.62; + + cRoot::Get()->GetServer()->PlayerCreated(this); +} + + + + + +cPlayer::~cPlayer(void) +{ + LOGD("Deleting cPlayer \"%s\" at %p, ID %d", m_PlayerName.c_str(), this, GetUniqueID()); + + // Notify the server that the player is being destroyed + cRoot::Get()->GetServer()->PlayerDestroying(this); + + SaveToDisk(); + + m_World->RemovePlayer( this ); + + m_ClientHandle = NULL; + + delete m_InventoryWindow; + + LOGD("Player %p deleted", this); +} + + + + + +bool cPlayer::Initialize(cWorld * a_World) +{ + ASSERT(a_World != NULL); + + if (super::Initialize(a_World)) + { + // Remove the client handle from the server, it will be ticked from this object from now on + if (m_ClientHandle != NULL) + { + cRoot::Get()->GetServer()->ClientMovedToWorld(m_ClientHandle); + } + + GetWorld()->AddPlayer(this); + return true; + } + return false; +} + + + + + +void cPlayer::Destroyed() +{ + CloseWindow(false); + + m_ClientHandle = NULL; +} + + + + + +void cPlayer::SpawnOn(cClientHandle & a_Client) +{ + if (!m_bVisible || (m_ClientHandle == (&a_Client))) + { + return; + } + a_Client.SendPlayerSpawn(*this); + a_Client.SendEntityHeadLook(*this); + a_Client.SendEntityEquipment(*this, 0, m_Inventory.GetEquippedItem() ); + a_Client.SendEntityEquipment(*this, 1, m_Inventory.GetEquippedBoots() ); + a_Client.SendEntityEquipment(*this, 2, m_Inventory.GetEquippedLeggings() ); + a_Client.SendEntityEquipment(*this, 3, m_Inventory.GetEquippedChestplate() ); + a_Client.SendEntityEquipment(*this, 4, m_Inventory.GetEquippedHelmet() ); +} + + + + + +void cPlayer::Tick(float a_Dt, cChunk & a_Chunk) +{ + if (m_ClientHandle != NULL) + { + if (m_ClientHandle->IsDestroyed()) + { + // This should not happen, because destroying a client will remove it from the world, but just in case + m_ClientHandle = NULL; + return; + } + + if (!m_ClientHandle->IsPlaying()) + { + // We're not yet in the game, ignore everything + return; + } + } + + if (!a_Chunk.IsValid()) + { + // This may happen if the cPlayer is created before the chunks have the chance of being loaded / generated (#83) + return; + } + + super::Tick(a_Dt, a_Chunk); + + // Set player swimming state + SetSwimState(a_Chunk); + + // Handle air drowning stuff + HandleAir(); + + // Handle charging the bow: + if (m_IsChargingBow) + { + m_BowCharge += 1; + } + + //handle updating experience + if (m_bDirtyExperience) + { + SendExperience(); + } + + if (m_bDirtyPosition) + { + // Apply food exhaustion from movement: + ApplyFoodExhaustionFromMovement(); + + cRoot::Get()->GetPluginManager()->CallHookPlayerMoving(*this); + BroadcastMovementUpdate(m_ClientHandle); + m_ClientHandle->StreamChunks(); + } + else + { + BroadcastMovementUpdate(m_ClientHandle); + } + + if (m_Health > 0) // make sure player is alive + { + m_World->CollectPickupsByPlayer(this); + + if ((m_EatingFinishTick >= 0) && (m_EatingFinishTick <= m_World->GetWorldAge())) + { + FinishEating(); + } + + HandleFood(); + } + + // Send Player List (Once per m_LastPlayerListTime/1000 ms) + cTimer t1; + if (m_LastPlayerListTime + cPlayer::PLAYER_LIST_TIME_MS <= t1.GetNowTime()) + { + m_World->SendPlayerList(this); + m_LastPlayerListTime = t1.GetNowTime(); + } +} + + + + + +short cPlayer::CalcLevelFromXp(short a_XpTotal) +{ + //level 0 to 15 + if(a_XpTotal <= XP_TO_LEVEL15) + { + return a_XpTotal / XP_PER_LEVEL_TO15; + } + + //level 30+ + if(a_XpTotal > XP_TO_LEVEL30) + { + return (short) (151.5 + sqrt( 22952.25 - (14 * (2220 - a_XpTotal)))) / 7; + } + + //level 16 to 30 + return (short) ( 29.5 + sqrt( 870.25 - (6 * ( 360 - a_XpTotal )))) / 3; +} + + + + + +short cPlayer::XpForLevel(short a_Level) +{ + //level 0 to 15 + if(a_Level <= 15) + { + return a_Level * XP_PER_LEVEL_TO15; + } + + //level 30+ + if(a_Level >= 31) + { + return (short) ( (3.5 * a_Level * a_Level) - (151.5 * a_Level) + 2220 ); + } + + //level 16 to 30 + return (short) ( (1.5 * a_Level * a_Level) - (29.5 * a_Level) + 360 ); +} + + + + + +short cPlayer::GetXpLevel() +{ + return CalcLevelFromXp(m_CurrentXp); +} + + + + + +float cPlayer::GetXpPercentage() +{ + short int currentLevel = CalcLevelFromXp(m_CurrentXp); + short int currentLevel_XpBase = XpForLevel(currentLevel); + + return (float)(m_CurrentXp - currentLevel_XpBase) / + (float)(XpForLevel(1+currentLevel) - currentLevel_XpBase); +} + + + + + +bool cPlayer::SetCurrentExperience(short int a_CurrentXp) +{ + if(!(a_CurrentXp >= 0) || (a_CurrentXp > (SHRT_MAX - m_LifetimeTotalXp))) + { + LOGWARNING("Tried to update experiece with an invalid Xp value: %d", a_CurrentXp); + return false; //oops, they gave us a dodgey number + } + + m_CurrentXp = a_CurrentXp; + + // Set experience to be updated + m_bDirtyExperience = true; + + return true; +} + + + + + +short cPlayer::DeltaExperience(short a_Xp_delta) +{ + if (a_Xp_delta > (SHRT_MAX - m_CurrentXp)) + { + // Value was bad, abort and report + LOGWARNING("Attempt was made to increment Xp by %d, which overflowed the short datatype. Ignoring.", + a_Xp_delta); + return -1; // Should we instead just return the current Xp? + } + + m_CurrentXp += a_Xp_delta; + + // Make sure they didn't subtract too much + if (m_CurrentXp < 0) + { + m_CurrentXp = 0; + } + + // Update total for score calculation + if (a_Xp_delta > 0) + { + m_LifetimeTotalXp += a_Xp_delta; + } + + LOGD("Player \"%s\" gained/lost %d experience, total is now: %d", + m_PlayerName.c_str(), a_Xp_delta, m_CurrentXp); + + // Set experience to be updated + m_bDirtyExperience = true; + + return m_CurrentXp; +} + + + + + +void cPlayer::StartChargingBow(void) +{ + LOGD("Player \"%s\" started charging their bow", m_PlayerName.c_str()); + m_IsChargingBow = true; + m_BowCharge = 0; +} + + + + + +int cPlayer::FinishChargingBow(void) +{ + LOGD("Player \"%s\" finished charging their bow at a charge of %d", m_PlayerName.c_str(), m_BowCharge); + int res = m_BowCharge; + m_IsChargingBow = false; + m_BowCharge = 0; + return res; +} + + + + + +void cPlayer::CancelChargingBow(void) +{ + LOGD("Player \"%s\" cancelled charging their bow at a charge of %d", m_PlayerName.c_str(), m_BowCharge); + m_IsChargingBow = false; + m_BowCharge = 0; +} + + + + + +void cPlayer::SetTouchGround(bool a_bTouchGround) +{ + m_bTouchGround = a_bTouchGround; + + if (!m_bTouchGround) + { + if (GetPosY() > m_LastJumpHeight) + { + m_LastJumpHeight = (float)GetPosY(); + } + cWorld * World = GetWorld(); + if ((GetPosY() >= 0) && (GetPosY() < cChunkDef::Height)) + { + BLOCKTYPE BlockType = World->GetBlock(float2int(GetPosX()), float2int(GetPosY()), float2int(GetPosZ())); + if (BlockType != E_BLOCK_AIR) + { + m_bTouchGround = true; + } + if ( + (BlockType == E_BLOCK_WATER) || + (BlockType == E_BLOCK_STATIONARY_WATER) || + (BlockType == E_BLOCK_LADDER) || + (BlockType == E_BLOCK_VINES) + ) + { + m_LastGroundHeight = (float)GetPosY(); + } + } + } + else + { + float Dist = (float)(m_LastGroundHeight - floor(GetPosY())); + int Damage = (int)(Dist - 3.f); + if (m_LastJumpHeight > m_LastGroundHeight) Damage++; + m_LastJumpHeight = (float)GetPosY(); + + if ((Damage > 0) && (!IsGameModeCreative())) + { + TakeDamage(dtFalling, NULL, Damage, Damage, 0); + } + + m_LastGroundHeight = (float)GetPosY(); + } +} + + + + + +void cPlayer::Heal(int a_Health) +{ + super::Heal(a_Health); + SendHealth(); +} + + + + + +void cPlayer::SetFoodLevel(int a_FoodLevel) +{ + m_FoodLevel = std::max(0, std::min(a_FoodLevel, (int)MAX_FOOD_LEVEL)); + SendHealth(); +} + + + + + +void cPlayer::SetFoodSaturationLevel(double a_FoodSaturationLevel) +{ + m_FoodSaturationLevel = std::max(0.0, std::min(a_FoodSaturationLevel, (double)m_FoodLevel)); +} + + + + + +void cPlayer::SetFoodTickTimer(int a_FoodTickTimer) +{ + m_FoodTickTimer = a_FoodTickTimer; +} + + + + + +void cPlayer::SetFoodExhaustionLevel(double a_FoodExhaustionLevel) +{ + m_FoodExhaustionLevel = std::max(0.0, std::min(a_FoodExhaustionLevel, 4.0)); +} + + + + + +void cPlayer::SetFoodPoisonedTicksRemaining(int a_FoodPoisonedTicksRemaining) +{ + m_FoodPoisonedTicksRemaining = a_FoodPoisonedTicksRemaining; +} + + + + + +bool cPlayer::Feed(int a_Food, double a_Saturation) +{ + if (m_FoodLevel >= MAX_FOOD_LEVEL) + { + return false; + } + + m_FoodLevel = std::min(a_Food + m_FoodLevel, (int)MAX_FOOD_LEVEL); + m_FoodSaturationLevel = std::min(m_FoodSaturationLevel + a_Saturation, (double)m_FoodLevel); + + SendHealth(); + return true; +} + + + + + +void cPlayer::FoodPoison(int a_NumTicks) +{ + bool HasBeenFoodPoisoned = (m_FoodPoisonedTicksRemaining > 0); + m_FoodPoisonedTicksRemaining = std::max(m_FoodPoisonedTicksRemaining, a_NumTicks); + if (!HasBeenFoodPoisoned) + { + // TODO: Send the poisoning indication to the client - how? + SendHealth(); + } +} + + + + + +void cPlayer::StartEating(void) +{ + // Set the timer: + m_EatingFinishTick = m_World->GetWorldAge() + EATING_TICKS; + + // Send the packets: + m_World->BroadcastPlayerAnimation(*this, 5); + m_World->BroadcastEntityMetadata(*this); +} + + + + + +void cPlayer::FinishEating(void) +{ + // Reset the timer: + m_EatingFinishTick = -1; + + // Send the packets: + m_ClientHandle->SendEntityStatus(*this, ENTITY_STATUS_EATING_ACCEPTED); + m_World->BroadcastPlayerAnimation(*this, 0); + m_World->BroadcastEntityMetadata(*this); + + // consume the item: + cItem Item(GetEquippedItem()); + Item.m_ItemCount = 1; + cItemHandler * ItemHandler = cItemHandler::GetItemHandler(Item.m_ItemType); + if (!ItemHandler->EatItem(this, &Item)) + { + return; + } + ItemHandler->OnFoodEaten(m_World, this, &Item); + + GetInventory().RemoveOneEquippedItem(); + + //if the food is mushroom soup, return a bowl to the inventory + if( Item.m_ItemType == E_ITEM_MUSHROOM_SOUP ) { + cItem emptyBowl(E_ITEM_BOWL, 1, 0, ""); + GetInventory().AddItem(emptyBowl, true, true); + } +} + + + + + +void cPlayer::AbortEating(void) +{ + m_EatingFinishTick = -1; + m_World->BroadcastPlayerAnimation(*this, 0); + m_World->BroadcastEntityMetadata(*this); +} + + + + + +void cPlayer::SendHealth(void) +{ + if (m_ClientHandle != NULL) + { + m_ClientHandle->SendHealth(); + } +} + + + + + +void cPlayer::SendExperience(void) +{ + if (m_ClientHandle != NULL) + { + m_ClientHandle->SendExperience(); + m_bDirtyExperience = false; + } +} + + + + + +void cPlayer::ClearInventoryPaintSlots(void) +{ + // Clear the list of slots that are being inventory-painted. Used by cWindow only + m_InventoryPaintSlots.clear(); +} + + + + + +void cPlayer::AddInventoryPaintSlot(int a_SlotNum) +{ + // Add a slot to the list for inventory painting. Used by cWindow only + m_InventoryPaintSlots.push_back(a_SlotNum); +} + + + + + +const cSlotNums & cPlayer::GetInventoryPaintSlots(void) const +{ + // Return the list of slots currently stored for inventory painting. Used by cWindow only + return m_InventoryPaintSlots; +} + + + + + +double cPlayer::GetMaxSpeed(void) const +{ + return m_IsSprinting ? m_SprintingMaxSpeed : m_NormalMaxSpeed; +} + + + + + +void cPlayer::SetNormalMaxSpeed(double a_Speed) +{ + m_NormalMaxSpeed = a_Speed; + if (!m_IsSprinting) + { + m_ClientHandle->SendPlayerMaxSpeed(); + } +} + + + + + +void cPlayer::SetSprintingMaxSpeed(double a_Speed) +{ + m_SprintingMaxSpeed = a_Speed; + if (m_IsSprinting) + { + m_ClientHandle->SendPlayerMaxSpeed(); + } +} + + + + + +void cPlayer::SetCrouch(bool a_IsCrouched) +{ + // Set the crouch status, broadcast to all visible players + + if (a_IsCrouched == m_IsCrouched) + { + // No change + return; + } + m_IsCrouched = a_IsCrouched; + m_World->BroadcastEntityMetadata(*this); +} + + + + + +void cPlayer::SetSprint(bool a_IsSprinting) +{ + if (a_IsSprinting == m_IsSprinting) + { + // No change + return; + } + + m_IsSprinting = a_IsSprinting; + m_ClientHandle->SendPlayerMaxSpeed(); +} + + + + + +void cPlayer::DoTakeDamage(TakeDamageInfo & a_TDI) +{ + if (a_TDI.DamageType != dtInVoid) + { + if (IsGameModeCreative()) + { + // No damage / health in creative mode + return; + } + } + + super::DoTakeDamage(a_TDI); + + // Any kind of damage adds food exhaustion + AddFoodExhaustion(0.3f); + + SendHealth(); +} + + + + + +void cPlayer::KilledBy(cEntity * a_Killer) +{ + super::KilledBy(a_Killer); + + if (m_Health > 0) + { + return; // not dead yet =] + } + + m_bVisible = false; // So new clients don't see the player + + // Puke out all the items + cItems Pickups; + m_Inventory.CopyToItems(Pickups); + m_Inventory.Clear(); + m_World->SpawnItemPickups(Pickups, GetPosX(), GetPosY(), GetPosZ(), 10); + SaveToDisk(); // Save it, yeah the world is a tough place ! +} + + + + + +void cPlayer::Respawn(void) +{ + m_Health = GetMaxHealth(); + + // Reset food level: + m_FoodLevel = MAX_FOOD_LEVEL; + m_FoodSaturationLevel = 5; + + // Reset Experience + m_CurrentXp = 0; + m_LifetimeTotalXp = 0; + // ToDo: send score to client? How? + + m_ClientHandle->SendRespawn(); + + // Extinguish the fire: + StopBurning(); + + TeleportToCoords(GetWorld()->GetSpawnX(), GetWorld()->GetSpawnY(), GetWorld()->GetSpawnZ()); + + SetVisible(true); +} + + + + + +double cPlayer::GetEyeHeight(void) const +{ + return m_Stance; +} + + + + +Vector3d cPlayer::GetEyePosition(void) const +{ + return Vector3d( GetPosX(), m_Stance, GetPosZ() ); +} + + + + + +bool cPlayer::IsGameModeCreative(void) const +{ + return (m_GameMode == gmCreative) || // Either the player is explicitly in Creative + ((m_GameMode == gmNotSet) && m_World->IsGameModeCreative()); // or they inherit from the world and the world is Creative +} + + + + + +bool cPlayer::IsGameModeSurvival(void) const +{ + return (m_GameMode == gmSurvival) || // Either the player is explicitly in Survival + ((m_GameMode == gmNotSet) && m_World->IsGameModeSurvival()); // or they inherit from the world and the world is Survival +} + + + + + +bool cPlayer::IsGameModeAdventure(void) const +{ + return (m_GameMode == gmCreative) || // Either the player is explicitly in Adventure + ((m_GameMode == gmNotSet) && m_World->IsGameModeCreative()); // or they inherit from the world and the world is Adventure +} + + + + + +void cPlayer::OpenWindow(cWindow * a_Window) +{ + if (a_Window != m_CurrentWindow) + { + CloseWindow(false); + } + a_Window->OpenedByPlayer(*this); + m_CurrentWindow = a_Window; + a_Window->SendWholeWindow(*GetClientHandle()); +} + + + + + +void cPlayer::CloseWindow(bool a_CanRefuse) +{ + if (m_CurrentWindow == NULL) + { + m_CurrentWindow = m_InventoryWindow; + return; + } + + if (m_CurrentWindow->ClosedByPlayer(*this, a_CanRefuse) || !a_CanRefuse) + { + // Close accepted, go back to inventory window (the default): + m_CurrentWindow = m_InventoryWindow; + } + else + { + // Re-open the window + m_CurrentWindow->OpenedByPlayer(*this); + m_CurrentWindow->SendWholeWindow(*GetClientHandle()); + } +} + + + + + +void cPlayer::CloseWindowIfID(char a_WindowID, bool a_CanRefuse) +{ + if ((m_CurrentWindow == NULL) || (m_CurrentWindow->GetWindowID() != a_WindowID)) + { + return; + } + CloseWindow(); +} + + + + + +void cPlayer::SetLastBlockActionTime() +{ + if (m_World != NULL) + { + m_LastBlockActionTime = m_World->GetWorldAge() / 20.0f; + } +} + + + + + +void cPlayer::SetLastBlockActionCnt( int a_LastBlockActionCnt ) +{ + m_LastBlockActionCnt = a_LastBlockActionCnt; +} + + + + + +void cPlayer::SetGameMode(eGameMode a_GameMode) +{ + if ((a_GameMode < gmMin) || (a_GameMode >= gmMax)) + { + LOGWARNING("%s: Setting invalid gamemode: %d", GetName().c_str(), a_GameMode); + return; + } + + if (m_GameMode == a_GameMode) + { + // Gamemode already set + return; + } + + m_GameMode = a_GameMode; + m_ClientHandle->SendGameMode(a_GameMode); +} + + + + + +void cPlayer::LoginSetGameMode( eGameMode a_GameMode ) +{ + m_GameMode = a_GameMode; +} + + + + + +void cPlayer::SetIP(const AString & a_IP) +{ + m_IP = a_IP; +} + + + + + +void cPlayer::SendMessage(const AString & a_Message) +{ + m_ClientHandle->SendChat(a_Message); +} + + + + + +void cPlayer::TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) +{ + SetPosition( a_PosX, a_PosY, a_PosZ ); + m_LastGroundHeight = (float)a_PosY; + + m_World->BroadcastTeleportEntity(*this, GetClientHandle()); + m_ClientHandle->SendPlayerMoveLook(); +} + + + + + +Vector3d cPlayer::GetThrowStartPos(void) const +{ + Vector3d res = GetEyePosition(); + + // Adjust the position to be just outside the player's bounding box: + res.x += 0.16 * cos(GetPitch()); + res.y += -0.1; + res.z += 0.16 * sin(GetPitch()); + + return res; +} + + + + + +Vector3d cPlayer::GetThrowSpeed(double a_SpeedCoeff) const +{ + Vector3d res = GetLookVector(); + res.Normalize(); + + // TODO: Add a slight random change (+-0.0075 in each direction) + + return res * a_SpeedCoeff; +} + + + + + +void cPlayer::MoveTo( const Vector3d & a_NewPos ) +{ + if ((a_NewPos.y < -990) && (GetPosY() > -100)) + { + // When attached to an entity, the client sends position packets with weird coords: + // Y = -999 and X, Z = attempting to create speed, usually up to 0.03 + // We cannot test m_AttachedTo, because when deattaching, the server thinks the client is already deattached while + // the client may still send more of these nonsensical packets. + if (m_AttachedTo != NULL) + { + Vector3d AddSpeed(a_NewPos); + AddSpeed.y = 0; + m_AttachedTo->AddSpeed(AddSpeed); + } + return; + } + + // TODO: should do some checks to see if player is not moving through terrain + // TODO: Official server refuses position packets too far away from each other, kicking "hacked" clients; we should, too + + SetPosition( a_NewPos ); + SetStance(a_NewPos.y + 1.62); +} + + + + + +void cPlayer::SetVisible(bool a_bVisible) +{ + if (a_bVisible && !m_bVisible) // Make visible + { + m_bVisible = true; + m_World->BroadcastSpawnEntity(*this); + } + if (!a_bVisible && m_bVisible) + { + m_bVisible = false; + m_World->BroadcastDestroyEntity(*this, m_ClientHandle); // Destroy on all clients + } +} + + + + + +void cPlayer::AddToGroup( const AString & a_GroupName ) +{ + cGroup* Group = cRoot::Get()->GetGroupManager()->GetGroup( a_GroupName ); + m_Groups.push_back( Group ); + LOGD("Added %s to group %s", m_PlayerName.c_str(), a_GroupName.c_str() ); + ResolveGroups(); + ResolvePermissions(); +} + + + + + +void cPlayer::RemoveFromGroup( const AString & a_GroupName ) +{ + bool bRemoved = false; + for( GroupList::iterator itr = m_Groups.begin(); itr != m_Groups.end(); ++itr ) + { + if( (*itr)->GetName().compare(a_GroupName ) == 0 ) + { + m_Groups.erase( itr ); + bRemoved = true; + break; + } + } + + if( bRemoved ) + { + LOGD("Removed %s from group %s", m_PlayerName.c_str(), a_GroupName.c_str() ); + ResolveGroups(); + ResolvePermissions(); + } + else + { + LOGWARN("Tried to remove %s from group %s but was not in that group", m_PlayerName.c_str(), a_GroupName.c_str() ); + } +} + + + + + +bool cPlayer::CanUseCommand( const AString & a_Command ) +{ + for( GroupList::iterator itr = m_Groups.begin(); itr != m_Groups.end(); ++itr ) + { + if( (*itr)->HasCommand( a_Command ) ) return true; + } + return false; +} + + + + + +bool cPlayer::HasPermission(const AString & a_Permission) +{ + if (a_Permission.empty()) + { + // Empty permission request is always granted + return true; + } + + AStringVector Split = StringSplit( a_Permission, "." ); + PermissionMap Possibilities = m_ResolvedPermissions; + // Now search the namespaces + while( Possibilities.begin() != Possibilities.end() ) + { + PermissionMap::iterator itr = Possibilities.begin(); + if( itr->second ) + { + AStringVector OtherSplit = StringSplit( itr->first, "." ); + if( OtherSplit.size() <= Split.size() ) + { + unsigned int i; + for( i = 0; i < OtherSplit.size(); ++i ) + { + if( OtherSplit[i].compare( Split[i] ) != 0 ) + { + if( OtherSplit[i].compare("*") == 0 ) return true; // WildCard man!! WildCard! + break; + } + } + if( i == Split.size() ) return true; + } + } + Possibilities.erase( itr ); + } + + // Nothing that matched :( + return false; +} + + + + + +bool cPlayer::IsInGroup( const AString & a_Group ) +{ + for( GroupList::iterator itr = m_ResolvedGroups.begin(); itr != m_ResolvedGroups.end(); ++itr ) + { + if( a_Group.compare( (*itr)->GetName().c_str() ) == 0 ) + return true; + } + return false; +} + + + + + +void cPlayer::ResolvePermissions() +{ + m_ResolvedPermissions.clear(); // Start with an empty map yo~ + + // Copy all player specific permissions into the resolved permissions map + for( PermissionMap::iterator itr = m_Permissions.begin(); itr != m_Permissions.end(); ++itr ) + { + m_ResolvedPermissions[ itr->first ] = itr->second; + } + + for( GroupList::iterator GroupItr = m_ResolvedGroups.begin(); GroupItr != m_ResolvedGroups.end(); ++GroupItr ) + { + const cGroup::PermissionMap & Permissions = (*GroupItr)->GetPermissions(); + for( cGroup::PermissionMap::const_iterator itr = Permissions.begin(); itr != Permissions.end(); ++itr ) + { + m_ResolvedPermissions[ itr->first ] = itr->second; + } + } +} + + + + + +void cPlayer::ResolveGroups() +{ + // Clear resolved groups first + m_ResolvedGroups.clear(); + + // Get a complete resolved list of all groups the player is in + std::map< cGroup*, bool > AllGroups; // Use a map, because it's faster than iterating through a list to find duplicates + GroupList ToIterate; + for( GroupList::iterator GroupItr = m_Groups.begin(); GroupItr != m_Groups.end(); ++GroupItr ) + { + ToIterate.push_back( *GroupItr ); + } + while( ToIterate.begin() != ToIterate.end() ) + { + cGroup* CurrentGroup = *ToIterate.begin(); + if( AllGroups.find( CurrentGroup ) != AllGroups.end() ) + { + LOGWARNING("ERROR: Player \"%s\" is in the group multiple times (\"%s\"). Please fix your settings in users.ini!", + m_PlayerName.c_str(), CurrentGroup->GetName().c_str() + ); + } + else + { + AllGroups[ CurrentGroup ] = true; + m_ResolvedGroups.push_back( CurrentGroup ); // Add group to resolved list + const cGroup::GroupList & Inherits = CurrentGroup->GetInherits(); + for( cGroup::GroupList::const_iterator itr = Inherits.begin(); itr != Inherits.end(); ++itr ) + { + if( AllGroups.find( *itr ) != AllGroups.end() ) + { + LOGERROR("ERROR: Player %s is in the same group multiple times due to inheritance (%s). FIX IT!", m_PlayerName.c_str(), (*itr)->GetName().c_str() ); + continue; + } + ToIterate.push_back( *itr ); + } + } + ToIterate.erase( ToIterate.begin() ); + } +} + + + + + +AString cPlayer::GetColor(void) const +{ + if ( m_Color != '-' ) + { + return cChatColor::MakeColor( m_Color ); + } + + if ( m_Groups.size() < 1 ) + { + return cChatColor::White; + } + + return (*m_Groups.begin())->GetColor(); +} + + + + + +void cPlayer::TossItem( + bool a_bDraggingItem, + char a_Amount /* = 1 */, + short a_CreateType /* = 0 */, + short a_CreateHealth /* = 0 */ +) +{ + cItems Drops; + if (a_CreateType != 0) + { + // Just create item without touching the inventory (used in creative mode) + Drops.push_back(cItem(a_CreateType, a_Amount, a_CreateHealth)); + } + else + { + // Drop an item from the inventory: + if (a_bDraggingItem) + { + cItem & Item = GetDraggingItem(); + if (!Item.IsEmpty()) + { + char OriginalItemAmount = Item.m_ItemCount; + Item.m_ItemCount = std::min(OriginalItemAmount, a_Amount); + Drops.push_back(Item); + if (OriginalItemAmount > a_Amount) + { + Item.m_ItemCount = OriginalItemAmount - (char)a_Amount; + } + else + { + Item.Empty(); + } + } + } + else + { + // Else drop equipped item + cItem DroppedItem(GetInventory().GetEquippedItem()); + if (!DroppedItem.IsEmpty()) + { + if (GetInventory().RemoveOneEquippedItem()) + { + DroppedItem.m_ItemCount = 1; // RemoveItem decreases the count, so set it to 1 again + Drops.push_back(DroppedItem); + } + } + } + } + double vX = 0, vY = 0, vZ = 0; + EulerToVector(-GetRotation(), GetPitch(), vZ, vX, vY); + vY = -vY * 2 + 1.f; + m_World->SpawnItemPickups(Drops, GetPosX(), GetPosY() + 1.6f, GetPosZ(), vX * 3, vY * 3, vZ * 3, true); // 'true' because created by player +} + + + + + +bool cPlayer::MoveToWorld(const char * a_WorldName) +{ + cWorld * World = cRoot::Get()->GetWorld(a_WorldName); + if (World == NULL) + { + LOG("%s: Couldn't find world \"%s\".", __FUNCTION__, a_WorldName); + return false; + } + + eDimension OldDimension = m_World->GetDimension(); + + // Remove all links to the old world + m_World->RemovePlayer(this); + m_ClientHandle->RemoveFromAllChunks(); + m_World->RemoveEntity(this); + + // If the dimension is different, we can send the respawn packet + // http://wiki.vg/Protocol#0x09 says "don't send if dimension is the same" as of 2013_07_02 + m_ClientHandle->MoveToWorld(*World, (OldDimension != World->GetDimension())); + + // Add player to all the necessary parts of the new world + SetWorld(World); + World->AddEntity(this); + World->AddPlayer(this); + + return true; +} + + + + + +void cPlayer::LoadPermissionsFromDisk() +{ + m_Groups.clear(); + m_Permissions.clear(); + + cIniFile IniFile; + if (IniFile.ReadFile("users.ini")) + { + std::string Groups = IniFile.GetValue(m_PlayerName, "Groups", ""); + if (!Groups.empty()) + { + AStringVector Split = StringSplit( Groups, "," ); + for( unsigned int i = 0; i < Split.size(); i++ ) + { + AddToGroup( Split[i].c_str() ); + } + } + else + { + AddToGroup("Default"); + } + + m_Color = IniFile.GetValue(m_PlayerName, "Color", "-")[0]; + } + else + { + LOGWARN("Failed to read the users.ini file. The player will be added only to the Default group."); + AddToGroup("Default"); + } + ResolvePermissions(); +} + + + + +bool cPlayer::LoadFromDisk() +{ + LoadPermissionsFromDisk(); + + // Log player permissions, cause it's what the cool kids do + LOGINFO("Player %s has permissions:", m_PlayerName.c_str() ); + for( PermissionMap::iterator itr = m_ResolvedPermissions.begin(); itr != m_ResolvedPermissions.end(); ++itr ) + { + if( itr->second ) LOGINFO("%s", itr->first.c_str() ); + } + + AString SourceFile; + Printf(SourceFile, "players/%s.json", m_PlayerName.c_str() ); + + cFile f; + if (!f.Open(SourceFile, cFile::fmRead)) + { + // This is a new player whom we haven't seen yet, bail out, let them have the defaults + return false; + } + + AString buffer; + if (f.ReadRestOfFile(buffer) != f.GetSize()) + { + LOGWARNING("Cannot read player data from file \"%s\"", SourceFile.c_str()); + return false; + } + f.Close(); //cool kids play nice + + Json::Value root; + Json::Reader reader; + if (!reader.parse(buffer, root, false)) + { + LOGWARNING("Cannot parse player data in file \"%s\", player will be reset", SourceFile.c_str()); + } + + Json::Value & JSON_PlayerPosition = root["position"]; + if (JSON_PlayerPosition.size() == 3) + { + SetPosX(JSON_PlayerPosition[(unsigned int)0].asDouble()); + SetPosY(JSON_PlayerPosition[(unsigned int)1].asDouble()); + SetPosZ(JSON_PlayerPosition[(unsigned int)2].asDouble()); + m_LastPosX = GetPosX(); + m_LastPosY = GetPosY(); + m_LastPosZ = GetPosZ(); + m_LastFoodPos = GetPosition(); + } + + Json::Value & JSON_PlayerRotation = root["rotation"]; + if (JSON_PlayerRotation.size() == 3) + { + SetRotation ((float)JSON_PlayerRotation[(unsigned int)0].asDouble()); + SetPitch ((float)JSON_PlayerRotation[(unsigned int)1].asDouble()); + SetRoll ((float)JSON_PlayerRotation[(unsigned int)2].asDouble()); + } + + m_Health = root.get("health", 0).asInt(); + m_AirLevel = root.get("air", MAX_AIR_LEVEL).asInt(); + m_FoodLevel = root.get("food", MAX_FOOD_LEVEL).asInt(); + m_FoodSaturationLevel = root.get("foodSaturation", MAX_FOOD_LEVEL).asDouble(); + m_FoodTickTimer = root.get("foodTickTimer", 0).asInt(); + m_FoodExhaustionLevel = root.get("foodExhaustion", 0).asDouble(); + m_LifetimeTotalXp = (short) root.get("xpTotal", 0).asInt(); + m_CurrentXp = (short) root.get("xpCurrent", 0).asInt(); + + //SetExperience(root.get("experience", 0).asInt()); + + m_GameMode = (eGameMode) root.get("gamemode", eGameMode_NotSet).asInt(); + + m_Inventory.LoadFromJson(root["inventory"]); + + m_LoadedWorldName = root.get("world", "world").asString(); + + LOGD("Player \"%s\" was read from file, spawning at {%.2f, %.2f, %.2f} in world \"%s\"", + m_PlayerName.c_str(), GetPosX(), GetPosY(), GetPosZ(), m_LoadedWorldName.c_str() + ); + + return true; +} + + + + + +bool cPlayer::SaveToDisk() +{ + cFile::CreateFolder(FILE_IO_PREFIX + AString("players")); + + // create the JSON data + Json::Value JSON_PlayerPosition; + JSON_PlayerPosition.append(Json::Value(GetPosX())); + JSON_PlayerPosition.append(Json::Value(GetPosY())); + JSON_PlayerPosition.append(Json::Value(GetPosZ())); + + Json::Value JSON_PlayerRotation; + JSON_PlayerRotation.append(Json::Value(GetRotation())); + JSON_PlayerRotation.append(Json::Value(GetPitch())); + JSON_PlayerRotation.append(Json::Value(GetRoll())); + + Json::Value JSON_Inventory; + m_Inventory.SaveToJson(JSON_Inventory); + + Json::Value root; + root["position"] = JSON_PlayerPosition; + root["rotation"] = JSON_PlayerRotation; + root["inventory"] = JSON_Inventory; + root["health"] = m_Health; + root["xpTotal"] = m_LifetimeTotalXp; + root["xpCurrent"] = m_CurrentXp; + root["air"] = m_AirLevel; + root["food"] = m_FoodLevel; + root["foodSaturation"] = m_FoodSaturationLevel; + root["foodTickTimer"] = m_FoodTickTimer; + root["foodExhaustion"] = m_FoodExhaustionLevel; + root["world"] = GetWorld()->GetName(); + + if (m_GameMode == GetWorld()->GetGameMode()) + { + root["gamemode"] = (int) eGameMode_NotSet; + } + else + { + root["gamemode"] = (int) m_GameMode; + } + + Json::StyledWriter writer; + std::string JsonData = writer.write(root); + + AString SourceFile; + Printf(SourceFile, "players/%s.json", m_PlayerName.c_str() ); + + cFile f; + if (!f.Open(SourceFile, cFile::fmWrite)) + { + LOGERROR("ERROR WRITING PLAYER \"%s\" TO FILE \"%s\" - cannot open file", m_PlayerName.c_str(), SourceFile.c_str()); + return false; + } + if (f.Write(JsonData.c_str(), JsonData.size()) != (int)JsonData.size()) + { + LOGERROR("ERROR WRITING PLAYER JSON TO FILE \"%s\"", SourceFile.c_str()); + return false; + } + return true; +} + + + + + +cPlayer::StringList cPlayer::GetResolvedPermissions() +{ + StringList Permissions; + + const PermissionMap& ResolvedPermissions = m_ResolvedPermissions; + for( PermissionMap::const_iterator itr = ResolvedPermissions.begin(); itr != ResolvedPermissions.end(); ++itr ) + { + if( itr->second ) Permissions.push_back( itr->first ); + } + + return Permissions; +} + + + + + +void cPlayer::UseEquippedItem(void) +{ + if (IsGameModeCreative()) // No damage in creative + { + return; + } + + GetInventory().DamageEquippedItem(); +} + + + + + +void cPlayer::SetSwimState(cChunk & a_Chunk) +{ + int RelY = (int)floor(m_LastPosY + 0.1); + if ((RelY < 0) || (RelY >= cChunkDef::Height - 1)) + { + m_IsSwimming = false; + m_IsSubmerged = false; + return; + } + + BLOCKTYPE BlockIn; + int RelX = (int)floor(m_LastPosX) - a_Chunk.GetPosX() * cChunkDef::Width; + int RelZ = (int)floor(m_LastPosZ) - a_Chunk.GetPosZ() * cChunkDef::Width; + + // Check if the player is swimming: + // Use Unbounded, because we're being called *after* processing super::Tick(), which could have changed our chunk + if (!a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockIn)) + { + // This sometimes happens on Linux machines + // Ref.: http://forum.mc-server.org/showthread.php?tid=1244 + LOGD("SetSwimState failure: RelX = %d, RelZ = %d, LastPos = {%.02f, %.02f}, Pos = %.02f, %.02f}", + RelX, RelY, m_LastPosX, m_LastPosZ, GetPosX(), GetPosZ() + ); + m_IsSwimming = false; + m_IsSubmerged = false; + return; + } + m_IsSwimming = IsBlockWater(BlockIn); + + // Check if the player is submerged: + VERIFY(a_Chunk.UnboundedRelGetBlockType(RelX, RelY + 1, RelZ, BlockIn)); + m_IsSubmerged = IsBlockWater(BlockIn); +} + + + + + +void cPlayer::HandleAir(void) +{ + // Ref.: http://www.minecraftwiki.net/wiki/Chunk_format + // see if the player is /submerged/ water (block above is water) + // Get the type of block the player's standing in: + + if (IsSubmerged()) + { + // either reduce air level or damage player + if (m_AirLevel < 1) + { + if (m_AirTickTimer < 1) + { + // damage player + TakeDamage(dtDrowning, NULL, 1, 1, 0); + // reset timer + m_AirTickTimer = DROWNING_TICKS; + } + else + { + m_AirTickTimer -= 1; + } + } + else + { + // reduce air supply + m_AirLevel -= 1; + } + } + else + { + // set the air back to maximum + m_AirLevel = MAX_AIR_LEVEL; + m_AirTickTimer = DROWNING_TICKS; + } +} + + + + + +void cPlayer::HandleFood(void) +{ + // Ref.: http://www.minecraftwiki.net/wiki/Hunger + + // Remember the food level before processing, for later comparison + int LastFoodLevel = m_FoodLevel; + + // Heal or damage, based on the food level, using the m_FoodTickTimer: + if ((m_FoodLevel > 17) || (m_FoodLevel <= 0)) + { + m_FoodTickTimer++; + if (m_FoodTickTimer >= 80) + { + m_FoodTickTimer = 0; + + if (m_FoodLevel >= 17) + { + // Regenerate health from food, incur 3 pts of food exhaustion: + Heal(1); + m_FoodExhaustionLevel += 3; + } + else if (m_FoodLevel <= 0) + { + // Damage from starving + TakeDamage(dtStarving, NULL, 1, 1, 0); + } + } + } + + // Apply food poisoning food exhaustion: + if (m_FoodPoisonedTicksRemaining > 0) + { + m_FoodPoisonedTicksRemaining--; + m_FoodExhaustionLevel += 0.025; // 0.5 per second = 0.025 per tick + } + + // Apply food exhaustion that has accumulated: + if (m_FoodExhaustionLevel >= 4) + { + m_FoodExhaustionLevel -= 4; + + if (m_FoodSaturationLevel >= 1) + { + m_FoodSaturationLevel -= 1; + } + else + { + m_FoodLevel = std::max(m_FoodLevel - 1, 0); + } + } + + if (m_FoodLevel != LastFoodLevel) + { + SendHealth(); + } +} + + + + + +void cPlayer::ApplyFoodExhaustionFromMovement() +{ + if (IsGameModeCreative()) + { + return; + } + + // Calculate the distance travelled, update the last pos: + Vector3d Movement(GetPosition() - m_LastFoodPos); + Movement.y = 0; // Only take XZ movement into account + m_LastFoodPos = GetPosition(); + + // If riding anything, apply no food exhaustion + if (m_AttachedTo != NULL) + { + return; + } + + // Apply the exhaustion based on distance travelled: + double BaseExhaustion = Movement.Length(); + if (IsSprinting()) + { + // 0.1 pt per meter sprinted + BaseExhaustion = BaseExhaustion * 0.1; + } + else if (IsSwimming()) + { + // 0.015 pt per meter swum + BaseExhaustion = BaseExhaustion * 0.015; + } + else + { + // 0.01 pt per meter walked / sneaked + BaseExhaustion = BaseExhaustion * 0.01; + } + m_FoodExhaustionLevel += BaseExhaustion; +} + + + + diff --git a/source/Entities/Player.h b/src/Entities/Player.h index 44cab7d74..44cab7d74 100644 --- a/source/Entities/Player.h +++ b/src/Entities/Player.h diff --git a/source/Entities/ProjectileEntity.cpp b/src/Entities/ProjectileEntity.cpp index fb25aea35..fb25aea35 100644 --- a/source/Entities/ProjectileEntity.cpp +++ b/src/Entities/ProjectileEntity.cpp diff --git a/source/Entities/ProjectileEntity.h b/src/Entities/ProjectileEntity.h index 959e81ae5..959e81ae5 100644 --- a/source/Entities/ProjectileEntity.h +++ b/src/Entities/ProjectileEntity.h diff --git a/source/Entities/TNTEntity.cpp b/src/Entities/TNTEntity.cpp index 339107b2e..339107b2e 100644 --- a/source/Entities/TNTEntity.cpp +++ b/src/Entities/TNTEntity.cpp diff --git a/source/Entities/TNTEntity.h b/src/Entities/TNTEntity.h index eb5040e8a..eb5040e8a 100644 --- a/source/Entities/TNTEntity.h +++ b/src/Entities/TNTEntity.h diff --git a/source/FastRandom.cpp b/src/FastRandom.cpp index 887e4426d..887e4426d 100644 --- a/source/FastRandom.cpp +++ b/src/FastRandom.cpp diff --git a/source/FastRandom.h b/src/FastRandom.h index bf70822cf..bf70822cf 100644 --- a/source/FastRandom.h +++ b/src/FastRandom.h diff --git a/source/FurnaceRecipe.cpp b/src/FurnaceRecipe.cpp index 2e2276981..2e2276981 100644 --- a/source/FurnaceRecipe.cpp +++ b/src/FurnaceRecipe.cpp diff --git a/source/FurnaceRecipe.h b/src/FurnaceRecipe.h index 2f91e9bcb..2f91e9bcb 100644 --- a/source/FurnaceRecipe.h +++ b/src/FurnaceRecipe.h diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp new file mode 100644 index 000000000..1cd7c70e7 --- /dev/null +++ b/src/Generating/BioGen.cpp @@ -0,0 +1,707 @@ + +// BioGen.cpp + +// Implements the various biome generators + +#include "Globals.h" +#include "BioGen.h" +#include "inifile/iniFile.h" +#include "../LinearUpscale.h" + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cBioGenConstant: + +void cBioGenConstant::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) +{ + for (int i = 0; i < ARRAYCOUNT(a_BiomeMap); i++) + { + a_BiomeMap[i] = m_Biome; + } +} + + + + + +void cBioGenConstant::InitializeBiomeGen(cIniFile & a_IniFile) +{ + AString Biome = a_IniFile.GetValueSet("Generator", "ConstantBiome", "Plains"); + m_Biome = StringToBiome(Biome); + if (m_Biome == -1) + { + LOGWARN("[Generator]::ConstantBiome value \"%s\" not recognized, using \"Plains\".", Biome.c_str()); + m_Biome = biPlains; + } +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cBioGenCache: + +cBioGenCache::cBioGenCache(cBiomeGen * a_BioGenToCache, int a_CacheSize) : + m_BioGenToCache(a_BioGenToCache), + m_CacheSize(a_CacheSize), + m_CacheOrder(new int[a_CacheSize]), + m_CacheData(new sCacheData[a_CacheSize]), + m_NumHits(0), + m_NumMisses(0), + m_TotalChain(0) +{ + for (int i = 0; i < m_CacheSize; i++) + { + m_CacheOrder[i] = i; + m_CacheData[i].m_ChunkX = 0x7fffffff; + m_CacheData[i].m_ChunkZ = 0x7fffffff; + } +} + + + + + +cBioGenCache::~cBioGenCache() +{ + delete[] m_CacheData; + delete[] m_CacheOrder; +} + + + + + +void cBioGenCache::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) +{ + if (((m_NumHits + m_NumMisses) % 1024) == 10) + { + LOGD("BioGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses)); + LOGD("BioGenCache: Avg cache chain length: %.2f", (float)m_TotalChain / m_NumHits); + } + + for (int i = 0; i < m_CacheSize; i++) + { + if ( + (m_CacheData[m_CacheOrder[i]].m_ChunkX != a_ChunkX) || + (m_CacheData[m_CacheOrder[i]].m_ChunkZ != a_ChunkZ) + ) + { + continue; + } + // Found it in the cache + int Idx = m_CacheOrder[i]; + + // Move to front: + for (int j = i; j > 0; j--) + { + m_CacheOrder[j] = m_CacheOrder[j - 1]; + } + m_CacheOrder[0] = Idx; + + // Use the cached data: + memcpy(a_BiomeMap, m_CacheData[Idx].m_BiomeMap, sizeof(a_BiomeMap)); + + m_NumHits++; + m_TotalChain += i; + return; + } // for i - cache + + // Not in the cache: + m_NumMisses++; + m_BioGenToCache->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap); + + // Insert it as the first item in the MRU order: + int Idx = m_CacheOrder[m_CacheSize - 1]; + for (int i = m_CacheSize - 1; i > 0; i--) + { + m_CacheOrder[i] = m_CacheOrder[i - 1]; + } // for i - m_CacheOrder[] + m_CacheOrder[0] = Idx; + memcpy(m_CacheData[Idx].m_BiomeMap, a_BiomeMap, sizeof(a_BiomeMap)); + m_CacheData[Idx].m_ChunkX = a_ChunkX; + m_CacheData[Idx].m_ChunkZ = a_ChunkZ; +} + + + + + +void cBioGenCache::InitializeBiomeGen(cIniFile & a_IniFile) +{ + super::InitializeBiomeGen(a_IniFile); + m_BioGenToCache->InitializeBiomeGen(a_IniFile); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cBiomeGenList: + +void cBiomeGenList::InitializeBiomes(const AString & a_Biomes) +{ + AStringVector Split = StringSplit(a_Biomes, ","); + + // Convert each string in the list into biome: + for (AStringVector::const_iterator itr = Split.begin(); itr != Split.end(); ++itr) + { + AStringVector Split2 = StringSplit(*itr, ":"); + if (Split2.size() < 1) + { + continue; + } + int Count = 1; + if (Split2.size() >= 2) + { + Count = atol(Split2[1].c_str()); + if (Count <= 0) + { + LOGWARNING("Cannot decode biome count: \"%s\"; using 1.", Split2[1].c_str()); + Count = 1; + } + } + EMCSBiome Biome = StringToBiome(Split2[0]); + if (Biome != -1) + { + for (int i = 0; i < Count; i++) + { + m_Biomes.push_back(Biome); + } + } + else + { + LOGWARNING("Cannot decode biome name: \"%s\"; skipping", Split2[0].c_str()); + } + } // for itr - Split[] + if (!m_Biomes.empty()) + { + m_BiomesCount = (int)m_Biomes.size(); + return; + } + + // There were no biomes, add default biomes: + static EMCSBiome Biomes[] = + { + biOcean, + biPlains, + biDesert, + biExtremeHills, + biForest, + biTaiga, + biSwampland, + biRiver, + biFrozenOcean, + biFrozenRiver, + biIcePlains, + biIceMountains, + biMushroomIsland, + biMushroomShore, + biBeach, + biDesertHills, + biForestHills, + biTaigaHills, + biExtremeHillsEdge, + biJungle, + biJungleHills, + } ; + m_Biomes.reserve(ARRAYCOUNT(Biomes)); + for (int i = 0; i < ARRAYCOUNT(Biomes); i++) + { + m_Biomes.push_back(Biomes[i]); + } + m_BiomesCount = (int)m_Biomes.size(); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cBioGenCheckerboard: + +void cBioGenCheckerboard::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) +{ + for (int z = 0; z < cChunkDef::Width; z++) + { + int Base = cChunkDef::Width * a_ChunkZ + z; + for (int x = 0; x < cChunkDef::Width; x++) + { + int Add = cChunkDef::Width * a_ChunkX + x; + a_BiomeMap[x + cChunkDef::Width * z] = m_Biomes[(Base / m_BiomeSize + Add / m_BiomeSize) % m_BiomesCount]; + } + } +} + + + + + +void cBioGenCheckerboard::InitializeBiomeGen(cIniFile & a_IniFile) +{ + super::InitializeBiomeGen(a_IniFile); + AString Biomes = a_IniFile.GetValueSet ("Generator", "CheckerBoardBiomes", ""); + m_BiomeSize = a_IniFile.GetValueSetI("Generator", "CheckerboardBiomeSize", 64); + m_BiomeSize = (m_BiomeSize < 8) ? 8 : m_BiomeSize; + InitializeBiomes(Biomes); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cBioGenVoronoi : + +void cBioGenVoronoi::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) +{ + int BaseZ = cChunkDef::Width * a_ChunkZ; + int BaseX = cChunkDef::Width * a_ChunkX; + for (int z = 0; z < cChunkDef::Width; z++) + { + int AbsoluteZ = BaseZ + z; + for (int x = 0; x < cChunkDef::Width; x++) + { + cChunkDef::SetBiome(a_BiomeMap, x, z, VoronoiBiome(BaseX + x, AbsoluteZ)); + } // for x + } // for z +} + + + + + +void cBioGenVoronoi::InitializeBiomeGen(cIniFile & a_IniFile) +{ + super::InitializeBiomeGen(a_IniFile); + m_CellSize = a_IniFile.GetValueSetI("Generator", "VoronoiCellSize", 64); + AString Biomes = a_IniFile.GetValueSet ("Generator", "VoronoiBiomes", ""); + InitializeBiomes(Biomes); +} + + + + + +EMCSBiome cBioGenVoronoi::VoronoiBiome(int a_BlockX, int a_BlockZ) +{ + int CellX = a_BlockX / m_CellSize; + int CellZ = a_BlockZ / m_CellSize; + + // Note that Noise values need to be divided by 8 to gain a uniform modulo-2^n distribution + + // Get 5x5 neighboring cell seeds, compare distance to each. Return the biome in the minumim-distance cell + int MinDist = m_CellSize * m_CellSize * 16; // There has to be a cell closer than this + EMCSBiome res = biPlains; // Will be overriden + for (int x = CellX - 2; x <= CellX + 2; x++) + { + int BaseX = x * m_CellSize; + for (int z = CellZ - 2; z < CellZ + 2; z++) + { + int OffsetX = (m_Noise.IntNoise3DInt(x, 16 * x + 32 * z, z) / 8) % m_CellSize; + int OffsetZ = (m_Noise.IntNoise3DInt(x, 32 * x - 16 * z, z) / 8) % m_CellSize; + int SeedX = BaseX + OffsetX; + int SeedZ = z * m_CellSize + OffsetZ; + + int Dist = (SeedX - a_BlockX) * (SeedX - a_BlockX) + (SeedZ - a_BlockZ) * (SeedZ - a_BlockZ); + if (Dist < MinDist) + { + MinDist = Dist; + res = m_Biomes[(m_Noise.IntNoise3DInt(x, x - z + 1000, z) / 8) % m_BiomesCount]; + } + } // for z + } // for x + + return res; +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cBioGenDistortedVoronoi: + +void cBioGenDistortedVoronoi::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) +{ + int BaseZ = cChunkDef::Width * a_ChunkZ; + int BaseX = cChunkDef::Width * a_ChunkX; + + // Distortions for linear interpolation: + int DistortX[cChunkDef::Width + 1][cChunkDef::Width + 1]; + int DistortZ[cChunkDef::Width + 1][cChunkDef::Width + 1]; + for (int x = 0; x <= 4; x++) for (int z = 0; z <= 4; z++) + { + Distort(BaseX + x * 4, BaseZ + z * 4, DistortX[4 * x][4 * z], DistortZ[4 * x][4 * z]); + } + + LinearUpscale2DArrayInPlace(&DistortX[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); + LinearUpscale2DArrayInPlace(&DistortZ[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); + + for (int z = 0; z < cChunkDef::Width; z++) + { + int AbsoluteZ = BaseZ + z; + for (int x = 0; x < cChunkDef::Width; x++) + { + // Distort(BaseX + x, AbsoluteZ, DistX, DistZ); + cChunkDef::SetBiome(a_BiomeMap, x, z, VoronoiBiome(DistortX[x][z], DistortZ[x][z])); + } // for x + } // for z +} + + + + + +void cBioGenDistortedVoronoi::InitializeBiomeGen(cIniFile & a_IniFile) +{ + // Do NOT call super::InitializeBiomeGen(), as it would try to read Voronoi params instead of DistortedVoronoi params + m_CellSize = a_IniFile.GetValueSetI("Generator", "DistortedVoronoiCellSize", 96); + AString Biomes = a_IniFile.GetValueSet ("Generator", "DistortedVoronoiBiomes", ""); + InitializeBiomes(Biomes); +} + + + + +void cBioGenDistortedVoronoi::Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ) +{ + double NoiseX = m_Noise.CubicNoise3D((float)a_BlockX / m_CellSize, (float)a_BlockZ / m_CellSize, 1000); + NoiseX += 0.5 * m_Noise.CubicNoise3D(2 * (float)a_BlockX / m_CellSize, 2 * (float)a_BlockZ / m_CellSize, 2000); + NoiseX += 0.08 * m_Noise.CubicNoise3D(16 * (float)a_BlockX / m_CellSize, 16 * (float)a_BlockZ / m_CellSize, 3000); + double NoiseZ = m_Noise.CubicNoise3D((float)a_BlockX / m_CellSize, (float)a_BlockZ / m_CellSize, 4000); + NoiseZ += 0.5 * m_Noise.CubicNoise3D(2 * (float)a_BlockX / m_CellSize, 2 * (float)a_BlockZ / m_CellSize, 5000); + NoiseZ += 0.08 * m_Noise.CubicNoise3D(16 * (float)a_BlockX / m_CellSize, 16 * (float)a_BlockZ / m_CellSize, 6000); + + a_DistortedX = a_BlockX + (int)(m_CellSize * 0.5 * NoiseX); + a_DistortedZ = a_BlockZ + (int)(m_CellSize * 0.5 * NoiseZ); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cBioGenMultiStepMap : + +cBioGenMultiStepMap::cBioGenMultiStepMap(int a_Seed) : + m_Noise1(a_Seed + 1000), + m_Noise2(a_Seed + 2000), + m_Noise3(a_Seed + 3000), + m_Noise4(a_Seed + 4000), + m_Noise5(a_Seed + 5000), + m_Noise6(a_Seed + 6000), + m_Seed(a_Seed), + m_OceanCellSize(384), + m_MushroomIslandSize(64), + m_RiverCellSize(384), + m_RiverWidthThreshold(0.125), + m_LandBiomesSize(1024) +{ +} + + + + + +void cBioGenMultiStepMap::InitializeBiomeGen(cIniFile & a_IniFile) +{ + m_OceanCellSize = a_IniFile.GetValueSetI("Generator", "MultiStepMapOceanCellSize", m_OceanCellSize); + m_MushroomIslandSize = a_IniFile.GetValueSetI("Generator", "MultiStepMapMushroomIslandSize", m_MushroomIslandSize); + m_RiverCellSize = a_IniFile.GetValueSetI("Generator", "MultiStepMapRiverCellSize", m_RiverCellSize); + m_RiverWidthThreshold = a_IniFile.GetValueSetF("Generator", "MultiStepMapRiverWidth", m_RiverWidthThreshold); + m_LandBiomesSize = (float)a_IniFile.GetValueSetI("Generator", "MultiStepMapLandBiomeSize", (int)m_LandBiomesSize); +} + + + + + +void cBioGenMultiStepMap::GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) +{ + DecideOceanLandMushroom(a_ChunkX, a_ChunkZ, a_BiomeMap); + AddRivers(a_ChunkX, a_ChunkZ, a_BiomeMap); + ApplyTemperatureHumidity(a_ChunkX, a_ChunkZ, a_BiomeMap); +} + + + + + +void cBioGenMultiStepMap::DecideOceanLandMushroom(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) +{ + // Distorted Voronoi over 3 biomes, with mushroom having only a special occurence. + + // Prepare a distortion lookup table, by distorting a 5x5 area and using that as 1:4 zoom (linear interpolate): + int BaseZ = cChunkDef::Width * a_ChunkZ; + int BaseX = cChunkDef::Width * a_ChunkX; + int DistortX[cChunkDef::Width + 1][cChunkDef::Width + 1]; + int DistortZ[cChunkDef::Width + 1][cChunkDef::Width + 1]; + int DistortSize = m_OceanCellSize / 2; + for (int x = 0; x <= 4; x++) for (int z = 0; z <= 4; z++) + { + Distort(BaseX + x * 4, BaseZ + z * 4, DistortX[4 * x][4 * z], DistortZ[4 * x][4 * z], DistortSize); + } + LinearUpscale2DArrayInPlace(&DistortX[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); + LinearUpscale2DArrayInPlace(&DistortZ[0][0], cChunkDef::Width + 1, cChunkDef::Width + 1, 4, 4); + + // Prepare a 9x9 area of neighboring cell seeds + // (assuming that 7x7 cell area is larger than a chunk being generated) + const int NEIGHBORHOOD_SIZE = 4; // How many seeds in each direction to check + int CellX = BaseX / m_OceanCellSize; + int CellZ = BaseZ / m_OceanCellSize; + int SeedX[2 * NEIGHBORHOOD_SIZE + 1][2 * NEIGHBORHOOD_SIZE + 1]; + int SeedZ[2 * NEIGHBORHOOD_SIZE + 1][2 * NEIGHBORHOOD_SIZE + 1]; + EMCSBiome SeedV[2 * NEIGHBORHOOD_SIZE + 1][2 * NEIGHBORHOOD_SIZE + 1]; + for (int xc = 0; xc < 2 * NEIGHBORHOOD_SIZE + 1; xc++) + { + int RealCellX = xc + CellX - NEIGHBORHOOD_SIZE; + int CellBlockX = RealCellX * m_OceanCellSize; + for (int zc = 0; zc < 2 * NEIGHBORHOOD_SIZE + 1; zc++) + { + int RealCellZ = zc + CellZ - NEIGHBORHOOD_SIZE; + int CellBlockZ = RealCellZ * m_OceanCellSize; + int OffsetX = (m_Noise2.IntNoise3DInt(RealCellX, 16 * RealCellX + 32 * RealCellZ, RealCellZ) / 8) % m_OceanCellSize; + int OffsetZ = (m_Noise4.IntNoise3DInt(RealCellX, 32 * RealCellX - 16 * RealCellZ, RealCellZ) / 8) % m_OceanCellSize; + SeedX[xc][zc] = CellBlockX + OffsetX; + SeedZ[xc][zc] = CellBlockZ + OffsetZ; + SeedV[xc][zc] = (((m_Noise6.IntNoise3DInt(RealCellX, RealCellX - RealCellZ + 1000, RealCellZ) / 11) % 256) > 90) ? biOcean : ((EMCSBiome)(-1)); + } // for z + } // for x + + for (int xc = 1; xc < 2 * NEIGHBORHOOD_SIZE; xc++) for (int zc = 1; zc < 2 * NEIGHBORHOOD_SIZE; zc++) + { + if ( + (SeedV[xc ][zc] == biOcean) && + (SeedV[xc - 1][zc] == biOcean) && + (SeedV[xc + 1][zc] == biOcean) && + (SeedV[xc ][zc - 1] == biOcean) && + (SeedV[xc ][zc + 1] == biOcean) && + (SeedV[xc - 1][zc - 1] == biOcean) && + (SeedV[xc + 1][zc - 1] == biOcean) && + (SeedV[xc - 1][zc + 1] == biOcean) && + (SeedV[xc + 1][zc + 1] == biOcean) + ) + { + SeedV[xc][zc] = biMushroomIsland; + } + } + + // For each column find the nearest distorted cell and use its value as the biome: + int MushroomOceanThreshold = m_OceanCellSize * m_OceanCellSize * m_MushroomIslandSize / 1024; + int MushroomShoreThreshold = m_OceanCellSize * m_OceanCellSize * m_MushroomIslandSize / 2048; + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + int AbsoluteZ = DistortZ[x][z]; + int AbsoluteX = DistortX[x][z]; + int MinDist = m_OceanCellSize * m_OceanCellSize * 16; // There has to be a cell closer than this + EMCSBiome Biome = biPlains; + // Find the nearest cell seed: + for (int xs = 1; xs < 2 * NEIGHBORHOOD_SIZE; xs++) for (int zs = 1; zs < 2 * NEIGHBORHOOD_SIZE; zs++) + { + int Dist = (SeedX[xs][zs] - AbsoluteX) * (SeedX[xs][zs] - AbsoluteX) + (SeedZ[xs][zs] - AbsoluteZ) * (SeedZ[xs][zs] - AbsoluteZ); + if (Dist >= MinDist) + { + continue; + } + MinDist = Dist; + Biome = SeedV[xs][zs]; + // Shrink mushroom biome and add a shore: + if (Biome == biMushroomIsland) + { + if (Dist > MushroomOceanThreshold) + { + Biome = biOcean; + } + else if (Dist > MushroomShoreThreshold) + { + Biome = biMushroomShore; + } + } + } // for zs, xs + + cChunkDef::SetBiome(a_BiomeMap, x, z, Biome); + } // for x + } // for z +} + + + + + +void cBioGenMultiStepMap::AddRivers(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) +{ + for (int z = 0; z < cChunkDef::Width; z++) + { + float NoiseCoordZ = (float)(a_ChunkZ * cChunkDef::Width + z) / m_RiverCellSize; + for (int x = 0; x < cChunkDef::Width; x++) + { + if (cChunkDef::GetBiome(a_BiomeMap, x, z) != -1) + { + // Biome already set, skip this column + continue; + } + + float NoiseCoordX = (float)(a_ChunkX * cChunkDef::Width + x) / m_RiverCellSize; + + double Noise = m_Noise1.CubicNoise2D( NoiseCoordX, NoiseCoordZ); + Noise += 0.5 * m_Noise3.CubicNoise2D(2 * NoiseCoordX, 2 * NoiseCoordZ); + Noise += 0.1 * m_Noise5.CubicNoise2D(8 * NoiseCoordX, 8 * NoiseCoordZ); + + if ((Noise > 0) && (Noise < m_RiverWidthThreshold)) + { + cChunkDef::SetBiome(a_BiomeMap, x, z, biRiver); + } + } // for x + } // for z +} + + + + + +void cBioGenMultiStepMap::ApplyTemperatureHumidity(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) +{ + IntMap TemperatureMap; + IntMap HumidityMap; + BuildTemperatureHumidityMaps(a_ChunkX, a_ChunkZ, TemperatureMap, HumidityMap); + + FreezeWaterBiomes(a_BiomeMap, TemperatureMap); + DecideLandBiomes(a_BiomeMap, TemperatureMap, HumidityMap); +} + + + + + +void cBioGenMultiStepMap::Distort(int a_BlockX, int a_BlockZ, int & a_DistortedX, int & a_DistortedZ, int a_CellSize) +{ + double NoiseX = m_Noise3.CubicNoise2D( (float)a_BlockX / a_CellSize, (float)a_BlockZ / a_CellSize); + NoiseX += 0.5 * m_Noise2.CubicNoise2D(2 * (float)a_BlockX / a_CellSize, 2 * (float)a_BlockZ / a_CellSize); + NoiseX += 0.1 * m_Noise1.CubicNoise2D(16 * (float)a_BlockX / a_CellSize, 16 * (float)a_BlockZ / a_CellSize); + double NoiseZ = m_Noise6.CubicNoise2D( (float)a_BlockX / a_CellSize, (float)a_BlockZ / a_CellSize); + NoiseZ += 0.5 * m_Noise5.CubicNoise2D(2 * (float)a_BlockX / a_CellSize, 2 * (float)a_BlockZ / a_CellSize); + NoiseZ += 0.1 * m_Noise4.CubicNoise2D(16 * (float)a_BlockX / a_CellSize, 16 * (float)a_BlockZ / a_CellSize); + + a_DistortedX = a_BlockX + (int)(a_CellSize * 0.5 * NoiseX); + a_DistortedZ = a_BlockZ + (int)(a_CellSize * 0.5 * NoiseZ); +} + + + + + +void cBioGenMultiStepMap::BuildTemperatureHumidityMaps(int a_ChunkX, int a_ChunkZ, IntMap & a_TemperatureMap, IntMap & a_HumidityMap) +{ + // Linear interpolation over 8x8 blocks; use double for better precision: + DblMap TemperatureMap; + DblMap HumidityMap; + for (int z = 0; z < 17; z += 8) + { + float NoiseCoordZ = (float)(a_ChunkZ * cChunkDef::Width + z) / m_LandBiomesSize; + for (int x = 0; x < 17; x += 8) + { + float NoiseCoordX = (float)(a_ChunkX * cChunkDef::Width + x) / m_LandBiomesSize; + + double NoiseT = m_Noise1.CubicNoise2D( NoiseCoordX, NoiseCoordZ); + NoiseT += 0.5 * m_Noise2.CubicNoise2D(2 * NoiseCoordX, 2 * NoiseCoordZ); + NoiseT += 0.1 * m_Noise3.CubicNoise2D(8 * NoiseCoordX, 8 * NoiseCoordZ); + TemperatureMap[x + 17 * z] = NoiseT; + + double NoiseH = m_Noise4.CubicNoise2D( NoiseCoordX, NoiseCoordZ); + NoiseH += 0.5 * m_Noise5.CubicNoise2D(2 * NoiseCoordX, 2 * NoiseCoordZ); + NoiseH += 0.1 * m_Noise6.CubicNoise2D(8 * NoiseCoordX, 8 * NoiseCoordZ); + HumidityMap[x + 17 * z] = NoiseH; + } // for x + } // for z + LinearUpscale2DArrayInPlace(TemperatureMap, 17, 17, 8, 8); + LinearUpscale2DArrayInPlace(HumidityMap, 17, 17, 8, 8); + + // Re-map into integral values in [0 .. 255] range: + for (int idx = 0; idx < ARRAYCOUNT(a_TemperatureMap); idx++) + { + a_TemperatureMap[idx] = std::max(0, std::min(255, (int)(128 + TemperatureMap[idx] * 128))); + a_HumidityMap[idx] = std::max(0, std::min(255, (int)(128 + HumidityMap[idx] * 128))); + } +} + + + + + +void cBioGenMultiStepMap::DecideLandBiomes(cChunkDef::BiomeMap & a_BiomeMap, const IntMap & a_TemperatureMap, const IntMap & a_HumidityMap) +{ + static const EMCSBiome BiomeMap[] = + { + // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + /* 0 */ biTundra, biTundra, biTundra, biTundra, biPlains, biPlains, biPlains, biPlains, biPlains, biPlains, biDesert, biDesert, biDesert, biDesert, biDesert, biDesert, + /* 1 */ biTundra, biTundra, biTundra, biTundra, biPlains, biPlains, biPlains, biPlains, biPlains, biPlains, biDesert, biDesert, biDesert, biDesert, biDesert, biDesert, + /* 2 */ biTundra, biTundra, biTundra, biTundra, biPlains, biExtremeHills, biPlains, biPlains, biPlains, biPlains, biDesert, biDesert, biDesertHills, biDesertHills, biDesert, biDesert, + /* 3 */ biTundra, biTundra, biTundra, biTundra, biExtremeHills, biExtremeHills, biPlains, biPlains, biPlains, biPlains, biDesert, biDesert, biDesertHills, biDesertHills, biDesert, biDesert, + /* 4 */ biTundra, biTundra, biIceMountains, biIceMountains, biExtremeHills, biExtremeHills, biPlains, biPlains, biPlains, biPlains, biForestHills, biForestHills, biExtremeHills, biExtremeHills, biDesertHills, biDesert, + /* 5 */ biTundra, biTundra, biIceMountains, biIceMountains, biExtremeHills, biExtremeHills, biPlains, biPlains, biPlains, biPlains, biForestHills, biForestHills, biExtremeHills, biExtremeHills, biDesertHills, biDesert, + /* 6 */ biTundra, biTundra, biIceMountains, biIceMountains, biForestHills, biForestHills, biForest, biForest, biForest, biForest, biForest, biForestHills, biExtremeHills, biExtremeHills, biPlains, biPlains, + /* 7 */ biTundra, biTundra, biIceMountains, biIceMountains, biForestHills, biForestHills, biForest, biForest, biForest, biForest, biForest, biForestHills, biExtremeHills, biExtremeHills, biPlains, biPlains, + /* 8 */ biTundra, biTundra, biTaiga, biTaiga, biForest, biForest, biForest, biForest, biForest, biForest, biForest, biForestHills, biExtremeHills, biExtremeHills, biPlains, biPlains, + /* 9 */ biTundra, biTundra, biTaiga, biTaiga, biForest, biForest, biForest, biForest, biForest, biForest, biForest, biForestHills, biExtremeHills, biExtremeHills, biPlains, biPlains, + /* 10 */ biTaiga, biTaiga, biTaiga, biIceMountains, biForestHills, biForestHills, biForest, biForest, biForest, biForest, biJungle, biJungle, biSwampland, biSwampland, biSwampland, biSwampland, + /* 11 */ biTaiga, biTaiga, biIceMountains, biIceMountains, biExtremeHills, biForestHills, biForest, biForest, biForest, biForest, biJungle, biJungle, biSwampland, biSwampland, biSwampland, biSwampland, + /* 12 */ biTaiga, biTaiga, biIceMountains, biIceMountains, biExtremeHills, biJungleHills, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biSwampland, biSwampland, biSwampland, biSwampland, + /* 13 */ biTaiga, biTaiga, biTaiga, biIceMountains, biJungleHills, biJungleHills, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biSwampland, biSwampland, biSwampland, biSwampland, + /* 14 */ biTaiga, biTaiga, biTaiga, biTaiga, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biSwampland, biSwampland, biSwampland, biSwampland, + /* 15 */ biTaiga, biTaiga, biTaiga, biTaiga, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biJungle, biSwampland, biSwampland, biSwampland, biSwampland, + } ; + for (int z = 0; z < cChunkDef::Width; z++) + { + int idxZ = 17 * z; + for (int x = 0; x < cChunkDef::Width; x++) + { + if (cChunkDef::GetBiome(a_BiomeMap, x, z) != -1) + { + // Already set before + continue; + } + int idx = idxZ + x; + int Temperature = a_TemperatureMap[idx] / 16; // -> [0..15] range + int Humidity = a_HumidityMap[idx] / 16; // -> [0..15] range + cChunkDef::SetBiome(a_BiomeMap, x, z, BiomeMap[Temperature + 16 * Humidity]); + } // for x + } // for z +} + + + + + +void cBioGenMultiStepMap::FreezeWaterBiomes(cChunkDef::BiomeMap & a_BiomeMap, const IntMap & a_TemperatureMap) +{ + int idx = 0; + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++, idx++) + { + if (a_TemperatureMap[idx] > 4 * 16) + { + // Not frozen + continue; + } + switch (cChunkDef::GetBiome(a_BiomeMap, x, z)) + { + case biRiver: cChunkDef::SetBiome(a_BiomeMap, x, z, biFrozenRiver); break; + case biOcean: cChunkDef::SetBiome(a_BiomeMap, x, z, biFrozenOcean); break; + } + } // for x + idx += 1; + } // for z +} + + + + diff --git a/source/Generating/BioGen.h b/src/Generating/BioGen.h index bc70bfab2..bc70bfab2 100644 --- a/source/Generating/BioGen.h +++ b/src/Generating/BioGen.h diff --git a/source/Generating/Caves.cpp b/src/Generating/Caves.cpp index df45bb4c2..df45bb4c2 100644 --- a/source/Generating/Caves.cpp +++ b/src/Generating/Caves.cpp diff --git a/source/Generating/Caves.h b/src/Generating/Caves.h index 70cf6fe8c..70cf6fe8c 100644 --- a/source/Generating/Caves.h +++ b/src/Generating/Caves.h diff --git a/source/Generating/ChunkDesc.cpp b/src/Generating/ChunkDesc.cpp index 6050430fd..6050430fd 100644 --- a/source/Generating/ChunkDesc.cpp +++ b/src/Generating/ChunkDesc.cpp diff --git a/source/Generating/ChunkDesc.h b/src/Generating/ChunkDesc.h index e130c463f..e130c463f 100644 --- a/source/Generating/ChunkDesc.h +++ b/src/Generating/ChunkDesc.h diff --git a/src/Generating/ChunkGenerator.cpp b/src/Generating/ChunkGenerator.cpp new file mode 100644 index 000000000..f28504441 --- /dev/null +++ b/src/Generating/ChunkGenerator.cpp @@ -0,0 +1,329 @@ + +#include "Globals.h" + +#include "ChunkGenerator.h" +#include "../World.h" +#include "inifile/iniFile.h" +#include "../Root.h" +#include "../PluginManager.h" +#include "ChunkDesc.h" +#include "ComposableGenerator.h" +#include "Noise3DGenerator.h" + + + + + +/// If the generation queue size exceeds this number, a warning will be output +const unsigned int QUEUE_WARNING_LIMIT = 1000; + +/// If the generation queue size exceeds this number, chunks with no clients will be skipped +const unsigned int QUEUE_SKIP_LIMIT = 500; + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cChunkGenerator: + +cChunkGenerator::cChunkGenerator(void) : + super("cChunkGenerator"), + m_World(NULL), + m_Generator(NULL) +{ +} + + + + + +cChunkGenerator::~cChunkGenerator() +{ + Stop(); +} + + + + + +bool cChunkGenerator::Start(cWorld * a_World, cIniFile & a_IniFile) +{ + MTRand rnd; + m_World = a_World; + m_Seed = a_IniFile.GetValueSetI("Seed", "Seed", rnd.randInt()); + AString GeneratorName = a_IniFile.GetValueSet("Generator", "Generator", "Composable"); + + if (NoCaseCompare(GeneratorName, "Noise3D") == 0) + { + m_Generator = new cNoise3DGenerator(*this); + } + else + { + if (NoCaseCompare(GeneratorName, "composable") != 0) + { + LOGWARN("[Generator]::Generator value \"%s\" not recognized, using \"Composable\".", GeneratorName.c_str()); + } + m_Generator = new cComposableGenerator(*this); + } + + if (m_Generator == NULL) + { + LOGERROR("Generator could not start, aborting the server"); + return false; + } + + m_Generator->Initialize(a_World, a_IniFile); + + return super::Start(); +} + + + + + +void cChunkGenerator::Stop(void) +{ + m_ShouldTerminate = true; + m_Event.Set(); + m_evtRemoved.Set(); // Wake up anybody waiting for empty queue + Wait(); + + delete m_Generator; + m_Generator = NULL; +} + + + + + +void cChunkGenerator::QueueGenerateChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +{ + { + cCSLock Lock(m_CS); + + // Check if it is already in the queue: + for (cChunkCoordsList::iterator itr = m_Queue.begin(); itr != m_Queue.end(); ++itr) + { + if ((itr->m_ChunkX == a_ChunkX) && (itr->m_ChunkY == a_ChunkY) && (itr->m_ChunkZ == a_ChunkZ)) + { + // Already in the queue, bail out + return; + } + } // for itr - m_Queue[] + + // Add to queue, issue a warning if too many: + if (m_Queue.size() >= QUEUE_WARNING_LIMIT) + { + LOGWARN("WARNING: Adding chunk [%i, %i] to generation queue; Queue is too big! (%i)", a_ChunkX, a_ChunkZ, m_Queue.size()); + } + m_Queue.push_back(cChunkCoords(a_ChunkX, a_ChunkY, a_ChunkZ)); + } + + m_Event.Set(); +} + + + + + +void cChunkGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) +{ + if (m_Generator != NULL) + { + m_Generator->GenerateBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap); + } +} + + + + + +void cChunkGenerator::WaitForQueueEmpty(void) +{ + cCSLock Lock(m_CS); + while (!m_ShouldTerminate && !m_Queue.empty()) + { + cCSUnlock Unlock(Lock); + m_evtRemoved.Wait(); + } +} + + + + + +int cChunkGenerator::GetQueueLength(void) +{ + cCSLock Lock(m_CS); + return (int)m_Queue.size(); +} + + + + + +EMCSBiome cChunkGenerator::GetBiomeAt(int a_BlockX, int a_BlockZ) +{ + ASSERT(m_Generator != NULL); + return m_Generator->GetBiomeAt(a_BlockX, a_BlockZ); +} + + + + + +BLOCKTYPE cChunkGenerator::GetIniBlock(cIniFile & a_IniFile, const AString & a_SectionName, const AString & a_ValueName, const AString & a_Default) +{ + AString BlockType = a_IniFile.GetValueSet(a_SectionName, a_ValueName, a_Default); + BLOCKTYPE Block = BlockStringToType(BlockType); + if (Block < 0) + { + LOGWARN("[&s].%s Could not parse block value \"%s\". Using default: \"%s\".", a_SectionName.c_str(), a_ValueName.c_str(), BlockType.c_str(),a_Default.c_str()); + return BlockStringToType(a_Default); + } + return Block; +} + + + + + +void cChunkGenerator::Execute(void) +{ + // To be able to display performance information, the generator counts the chunks generated. + // When the queue gets empty, the count is reset, so that waiting for the queue is not counted into the total time. + int NumChunksGenerated = 0; // Number of chunks generated since the queue was last empty + clock_t GenerationStart = clock(); // Clock tick when the queue started to fill + clock_t LastReportTick = clock(); // Clock tick of the last report made (so that performance isn't reported too often) + + while (!m_ShouldTerminate) + { + cCSLock Lock(m_CS); + while (m_Queue.size() == 0) + { + if ((NumChunksGenerated > 16) && (clock() - LastReportTick > CLOCKS_PER_SEC)) + { + LOG("Chunk generator performance: %.2f ch/s (%d ch total)", + (double)NumChunksGenerated * CLOCKS_PER_SEC/ (clock() - GenerationStart), + NumChunksGenerated + ); + } + cCSUnlock Unlock(Lock); + m_Event.Wait(); + if (m_ShouldTerminate) + { + return; + } + NumChunksGenerated = 0; + GenerationStart = clock(); + LastReportTick = clock(); + } + + cChunkCoords coords = m_Queue.front(); // Get next coord from queue + m_Queue.erase( m_Queue.begin() ); // Remove coordinate from queue + bool SkipEnabled = (m_Queue.size() > QUEUE_SKIP_LIMIT); + Lock.Unlock(); // Unlock ASAP + m_evtRemoved.Set(); + + // Display perf info once in a while: + if ((NumChunksGenerated > 16) && (clock() - LastReportTick > 2 * CLOCKS_PER_SEC)) + { + LOG("Chunk generator performance: %.2f ch/s (%d ch total)", + (double)NumChunksGenerated * CLOCKS_PER_SEC / (clock() - GenerationStart), + NumChunksGenerated + ); + LastReportTick = clock(); + } + + // Hack for regenerating chunks: if Y != 0, the chunk is considered invalid, even if it has its data set + if ((coords.m_ChunkY == 0) && m_World->IsChunkValid(coords.m_ChunkX, coords.m_ChunkZ)) + { + LOGD("Chunk [%d, %d] already generated, skipping generation", coords.m_ChunkX, coords.m_ChunkZ); + // Already generated, ignore request + continue; + } + + if (SkipEnabled && !m_World->HasChunkAnyClients(coords.m_ChunkX, coords.m_ChunkZ)) + { + LOGWARNING("Chunk generator overloaded, skipping chunk [%d, %d]", coords.m_ChunkX, coords.m_ChunkZ); + continue; + } + + LOGD("Generating chunk [%d, %d, %d]", coords.m_ChunkX, coords.m_ChunkY, coords.m_ChunkZ); + DoGenerate(coords.m_ChunkX, coords.m_ChunkY, coords.m_ChunkZ); + + // Save the chunk right after generating, so that we don't have to generate it again on next run + m_World->GetStorage().QueueSaveChunk(coords.m_ChunkX, coords.m_ChunkY, coords.m_ChunkZ); + + NumChunksGenerated++; + } // while (!bStop) +} + + + + +void cChunkGenerator::DoGenerate(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +{ + cChunkDesc ChunkDesc(a_ChunkX, a_ChunkZ); + cRoot::Get()->GetPluginManager()->CallHookChunkGenerating(m_World, a_ChunkX, a_ChunkZ, &ChunkDesc); + m_Generator->DoGenerate(a_ChunkX, a_ChunkZ, ChunkDesc); + cRoot::Get()->GetPluginManager()->CallHookChunkGenerated(m_World, a_ChunkX, a_ChunkZ, &ChunkDesc); + + #ifdef _DEBUG + // Verify that the generator has produced valid data: + ChunkDesc.VerifyHeightmap(); + #endif + + cChunkDef::BlockNibbles BlockMetas; + ChunkDesc.CompressBlockMetas(BlockMetas); + + m_World->SetChunkData( + a_ChunkX, a_ChunkZ, + ChunkDesc.GetBlockTypes(), BlockMetas, + NULL, NULL, // We don't have lighting, chunk will be lighted when needed + &ChunkDesc.GetHeightMap(), &ChunkDesc.GetBiomeMap(), + ChunkDesc.GetEntities(), ChunkDesc.GetBlockEntities(), + true + ); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cChunkGenerator::cGenerator: + +cChunkGenerator::cGenerator::cGenerator(cChunkGenerator & a_ChunkGenerator) : + m_ChunkGenerator(a_ChunkGenerator) +{ +} + + + + + +void cChunkGenerator::cGenerator::Initialize(cWorld * a_World, cIniFile & a_IniFile) +{ + m_World = a_World; + UNUSED(a_IniFile); +} + + + + + +EMCSBiome cChunkGenerator::cGenerator::GetBiomeAt(int a_BlockX, int a_BlockZ) +{ + cChunkDef::BiomeMap Biomes; + int Y = 0; + int ChunkX, ChunkZ; + cWorld::AbsoluteToRelative(a_BlockX, Y, a_BlockZ, ChunkX, Y, ChunkZ); + GenerateBiomes(ChunkX, ChunkZ, Biomes); + return cChunkDef::GetBiome(Biomes, a_BlockX, a_BlockZ); +} + + + + diff --git a/source/Generating/ChunkGenerator.h b/src/Generating/ChunkGenerator.h index 2d3bb8082..2d3bb8082 100644 --- a/source/Generating/ChunkGenerator.h +++ b/src/Generating/ChunkGenerator.h diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp new file mode 100644 index 000000000..03a65a457 --- /dev/null +++ b/src/Generating/CompoGen.cpp @@ -0,0 +1,634 @@ + +// CompoGen.cpp + +/* Implements the various terrain composition generators: + - cCompoGenSameBlock + - cCompoGenDebugBiomes + - cCompoGenClassic +*/ + +#include "Globals.h" +#include "CompoGen.h" +#include "../BlockID.h" +#include "../Item.h" +#include "../LinearUpscale.h" +#include "inifile/iniFile.h" + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cCompoGenSameBlock: + +void cCompoGenSameBlock::ComposeTerrain(cChunkDesc & a_ChunkDesc) +{ + a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + int Start; + if (m_IsBedrocked) + { + a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); + Start = 1; + } + else + { + Start = 0; + } + for (int y = a_ChunkDesc.GetHeight(x, z); y >= Start; y--) + { + a_ChunkDesc.SetBlockType(x, y, z, m_BlockType); + } // for y + } // for z + } // for x +} + + + + + +void cCompoGenSameBlock::InitializeCompoGen(cIniFile & a_IniFile) +{ + m_BlockType = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "SameBlockType", "stone").m_ItemType); + m_IsBedrocked = (a_IniFile.GetValueSetI("Generator", "SameBlockBedrocked", 1) != 0); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cCompoGenDebugBiomes: + +void cCompoGenDebugBiomes::ComposeTerrain(cChunkDesc & a_ChunkDesc) +{ + static BLOCKTYPE Blocks[] = + { + E_BLOCK_STONE, + E_BLOCK_COBBLESTONE, + E_BLOCK_LOG, + E_BLOCK_PLANKS, + E_BLOCK_SANDSTONE, + E_BLOCK_WOOL, + E_BLOCK_COAL_ORE, + E_BLOCK_IRON_ORE, + E_BLOCK_GOLD_ORE, + E_BLOCK_DIAMOND_ORE, + E_BLOCK_LAPIS_ORE, + E_BLOCK_REDSTONE_ORE, + E_BLOCK_IRON_BLOCK, + E_BLOCK_GOLD_BLOCK, + E_BLOCK_DIAMOND_BLOCK, + E_BLOCK_LAPIS_BLOCK, + E_BLOCK_BRICK, + E_BLOCK_MOSSY_COBBLESTONE, + E_BLOCK_OBSIDIAN, + E_BLOCK_NETHERRACK, + E_BLOCK_SOULSAND, + E_BLOCK_NETHER_BRICK, + E_BLOCK_BEDROCK, + } ; + + a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); + + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + BLOCKTYPE BlockType = Blocks[a_ChunkDesc.GetBiome(x, z)]; + for (int y = a_ChunkDesc.GetHeight(x, z); y >= 0; y--) + { + a_ChunkDesc.SetBlockType(x, y, z, BlockType); + } // for y + } // for z + } // for x +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cCompoGenClassic: + +cCompoGenClassic::cCompoGenClassic(void) : + m_SeaLevel(60), + m_BeachHeight(2), + m_BeachDepth(4), + m_BlockTop(E_BLOCK_GRASS), + m_BlockMiddle(E_BLOCK_DIRT), + m_BlockBottom(E_BLOCK_STONE), + m_BlockBeach(E_BLOCK_SAND), + m_BlockBeachBottom(E_BLOCK_SANDSTONE), + m_BlockSea(E_BLOCK_STATIONARY_WATER) +{ +} + + + + + +void cCompoGenClassic::ComposeTerrain(cChunkDesc & a_ChunkDesc) +{ + /* The classic composition means: + - 1 layer of grass, 3 of dirt and the rest stone, if the height > sealevel + beachheight + - 3 sand and a 1 sandstone, rest stone if between sealevel and sealevel + beachheight + - water from waterlevel to height, then 3 sand, 1 sandstone, the rest stone, if water depth < beachdepth + - water from waterlevel, then 3 dirt, the rest stone otherwise + - bedrock at the bottom + */ + + a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); + + // The patterns to use for different situations, must be same length! + const BLOCKTYPE PatternGround[] = {m_BlockTop, m_BlockMiddle, m_BlockMiddle, m_BlockMiddle} ; + const BLOCKTYPE PatternBeach[] = {m_BlockBeach, m_BlockBeach, m_BlockBeach, m_BlockBeachBottom} ; + const BLOCKTYPE PatternOcean[] = {m_BlockMiddle, m_BlockMiddle, m_BlockMiddle, m_BlockBottom} ; + static int PatternLength = ARRAYCOUNT(PatternGround); + ASSERT(ARRAYCOUNT(PatternGround) == ARRAYCOUNT(PatternBeach)); + ASSERT(ARRAYCOUNT(PatternGround) == ARRAYCOUNT(PatternOcean)); + + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + int Height = a_ChunkDesc.GetHeight(x, z); + const BLOCKTYPE * Pattern; + if (Height > m_SeaLevel + m_BeachHeight) + { + Pattern = PatternGround; + } + else if (Height > m_SeaLevel - m_BeachDepth) + { + Pattern = PatternBeach; + } + else + { + Pattern = PatternOcean; + } + + // Fill water from sealevel down to height (if any): + for (int y = m_SeaLevel; y >= Height; --y) + { + a_ChunkDesc.SetBlockType(x, y, z, m_BlockSea); + } + + // Fill from height till the bottom: + for (int y = Height; y >= 1; y--) + { + a_ChunkDesc.SetBlockType(x, y, z, (Height - y < PatternLength) ? Pattern[Height - y] : m_BlockBottom); + } + + // The last layer is always bedrock: + a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); + } // for x + } // for z +} + + + + + +void cCompoGenClassic::InitializeCompoGen(cIniFile & a_IniFile) +{ + m_SeaLevel = a_IniFile.GetValueSetI("Generator", "ClassicSeaLevel", m_SeaLevel); + m_BeachHeight = a_IniFile.GetValueSetI("Generator", "ClassicBeachHeight", m_BeachHeight); + m_BeachDepth = a_IniFile.GetValueSetI("Generator", "ClassicBeachDepth", m_BeachDepth); + m_BlockTop = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "ClassicBlockTop", "grass").m_ItemType); + m_BlockMiddle = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "ClassicBlockMiddle", "dirt").m_ItemType); + m_BlockBottom = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "ClassicBlockBottom", "stone").m_ItemType); + m_BlockBeach = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "ClassicBlockBeach", "sand").m_ItemType); + m_BlockBeachBottom = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "ClassicBlockBeachBottom", "sandstone").m_ItemType); + m_BlockSea = (BLOCKTYPE)(GetIniItemSet(a_IniFile, "Generator", "ClassicBlockSea", "stationarywater").m_ItemType); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cCompoGenBiomal: + +void cCompoGenBiomal::ComposeTerrain(cChunkDesc & a_ChunkDesc) +{ + a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); + + int ChunkX = a_ChunkDesc.GetChunkX(); + int ChunkZ = a_ChunkDesc.GetChunkZ(); + + /* + _X 2013_04_22: + There's no point in generating the whole cubic noise at once, because the noise values are used in + only about 20 % of the cases, so the speed gained by precalculating is lost by precalculating too much data + */ + + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + int Height = a_ChunkDesc.GetHeight(x, z); + if (Height > m_SeaLevel) + { + switch (a_ChunkDesc.GetBiome(x, z)) + { + case biOcean: + case biPlains: + case biExtremeHills: + case biForest: + case biTaiga: + case biSwampland: + case biRiver: + case biFrozenOcean: + case biFrozenRiver: + case biIcePlains: + case biIceMountains: + case biForestHills: + case biTaigaHills: + case biExtremeHillsEdge: + case biJungle: + case biJungleHills: + { + FillColumnGrass(x, z, Height, a_ChunkDesc.GetBlockTypes()); + break; + } + case biDesertHills: + case biDesert: + case biBeach: + { + FillColumnSand(x, z, Height, a_ChunkDesc.GetBlockTypes()); + break; + } + case biMushroomIsland: + case biMushroomShore: + { + FillColumnMycelium(x, z, Height, a_ChunkDesc.GetBlockTypes()); + break; + } + default: + { + // TODO + ASSERT(!"CompoGenBiomal: Biome not implemented yet!"); + break; + } + } + } + else + { + switch (a_ChunkDesc.GetBiome(x, z)) + { + case biDesert: + case biBeach: + { + // Fill with water, sand, sandstone and stone + FillColumnWaterSand(x, z, Height, a_ChunkDesc.GetBlockTypes()); + break; + } + default: + { + // Fill with water, sand/dirt/clay mix and stone + if (m_Noise.CubicNoise2D(0.3f * (cChunkDef::Width * ChunkX + x), 0.3f * (cChunkDef::Width * ChunkZ + z)) < 0) + { + FillColumnWaterSand(x, z, Height, a_ChunkDesc.GetBlockTypes()); + } + else + { + FillColumnWaterDirt(x, z, Height, a_ChunkDesc.GetBlockTypes()); + } + break; + } + } // switch (biome) + a_ChunkDesc.SetHeight(x, z, m_SeaLevel + 1); + } // else (under water) + a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); + } // for x + } // for z +} + + + + + +void cCompoGenBiomal::InitializeCompoGen(cIniFile & a_IniFile) +{ + m_SeaLevel = a_IniFile.GetValueSetI("Generator", "BiomalSeaLevel", m_SeaLevel) - 1; +} + + + + + +void cCompoGenBiomal::FillColumnGrass(int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes) +{ + BLOCKTYPE Pattern[] = + { + E_BLOCK_GRASS, + E_BLOCK_DIRT, + E_BLOCK_DIRT, + E_BLOCK_DIRT, + } ; + FillColumnPattern(a_RelX, a_RelZ, a_Height, a_BlockTypes, Pattern, ARRAYCOUNT(Pattern)); + + for (int y = a_Height - ARRAYCOUNT(Pattern); y > 0; y--) + { + cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, E_BLOCK_STONE); + } +} + + + + + +void cCompoGenBiomal::FillColumnSand(int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes) +{ + BLOCKTYPE Pattern[] = + { + E_BLOCK_SAND, + E_BLOCK_SAND, + E_BLOCK_SAND, + E_BLOCK_SANDSTONE, + } ; + FillColumnPattern(a_RelX, a_RelZ, a_Height, a_BlockTypes, Pattern, ARRAYCOUNT(Pattern)); + + for (int y = a_Height - ARRAYCOUNT(Pattern); y > 0; y--) + { + cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, E_BLOCK_STONE); + } +} + + + + + + +void cCompoGenBiomal::FillColumnMycelium (int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes) +{ + BLOCKTYPE Pattern[] = + { + E_BLOCK_MYCELIUM, + E_BLOCK_DIRT, + E_BLOCK_DIRT, + E_BLOCK_DIRT, + } ; + FillColumnPattern(a_RelX, a_RelZ, a_Height, a_BlockTypes, Pattern, ARRAYCOUNT(Pattern)); + + for (int y = a_Height - ARRAYCOUNT(Pattern); y > 0; y--) + { + cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, E_BLOCK_STONE); + } +} + + + + + +void cCompoGenBiomal::FillColumnWaterSand(int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes) +{ + FillColumnSand(a_RelX, a_RelZ, a_Height, a_BlockTypes); + for (int y = a_Height + 1; y <= m_SeaLevel + 1; y++) + { + cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, E_BLOCK_STATIONARY_WATER); + } +} + + + + + +void cCompoGenBiomal::FillColumnWaterDirt(int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes) +{ + // Dirt + BLOCKTYPE Pattern[] = + { + E_BLOCK_DIRT, + E_BLOCK_DIRT, + E_BLOCK_DIRT, + E_BLOCK_DIRT, + } ; + FillColumnPattern(a_RelX, a_RelZ, a_Height, a_BlockTypes, Pattern, ARRAYCOUNT(Pattern)); + + for (int y = a_Height - ARRAYCOUNT(Pattern); y > 0; y--) + { + cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, E_BLOCK_STONE); + } + for (int y = a_Height + 1; y <= m_SeaLevel + 1; y++) + { + cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, E_BLOCK_STATIONARY_WATER); + } +} + + + + + + +void cCompoGenBiomal::FillColumnPattern(int a_RelX, int a_RelZ, int a_Height, cChunkDef::BlockTypes & a_BlockTypes, const BLOCKTYPE * a_Pattern, int a_PatternSize) +{ + for (int y = a_Height, idx = 0; (y >= 0) && (idx < a_PatternSize); y--, idx++) + { + cChunkDef::SetBlock(a_BlockTypes, a_RelX, y, a_RelZ, a_Pattern[idx]); + } +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cCompoGenNether: + +cCompoGenNether::cCompoGenNether(int a_Seed) : + m_Noise1(a_Seed + 10), + m_Noise2(a_Seed * a_Seed * 10 + a_Seed * 1000 + 6000), + m_Threshold(0) +{ +} + + + + + +void cCompoGenNether::ComposeTerrain(cChunkDesc & a_ChunkDesc) +{ + HEIGHTTYPE MaxHeight = a_ChunkDesc.GetMaxHeight(); + + const int SEGMENT_HEIGHT = 8; + const int INTERPOL_X = 16; // Must be a divisor of 16 + const int INTERPOL_Z = 16; // Must be a divisor of 16 + // Interpolate the chunk in 16 * SEGMENT_HEIGHT * 16 "segments", each SEGMENT_HEIGHT blocks high and each linearly interpolated separately. + // Have two buffers, one for the lowest floor and one for the highest floor, so that Y-interpolation can be done between them + // Then swap the buffers and use the previously-top one as the current-bottom, without recalculating it. + + int FloorBuf1[17 * 17]; + int FloorBuf2[17 * 17]; + int * FloorHi = FloorBuf1; + int * FloorLo = FloorBuf2; + int BaseX = a_ChunkDesc.GetChunkX() * cChunkDef::Width; + int BaseZ = a_ChunkDesc.GetChunkZ() * cChunkDef::Width; + + // Interpolate the lowest floor: + for (int z = 0; z <= 16 / INTERPOL_Z; z++) for (int x = 0; x <= 16 / INTERPOL_X; x++) + { + FloorLo[INTERPOL_X * x + 17 * INTERPOL_Z * z] = + m_Noise1.IntNoise3DInt(BaseX + INTERPOL_X * x, 0, BaseZ + INTERPOL_Z * z) * + m_Noise2.IntNoise3DInt(BaseX + INTERPOL_X * x, 0, BaseZ + INTERPOL_Z * z) / + 256; + } // for x, z - FloorLo[] + LinearUpscale2DArrayInPlace(FloorLo, 17, 17, INTERPOL_X, INTERPOL_Z); + + // Interpolate segments: + for (int Segment = 0; Segment < MaxHeight; Segment += SEGMENT_HEIGHT) + { + // First update the high floor: + for (int z = 0; z <= 16 / INTERPOL_Z; z++) for (int x = 0; x <= 16 / INTERPOL_X; x++) + { + FloorHi[INTERPOL_X * x + 17 * INTERPOL_Z * z] = + m_Noise1.IntNoise3DInt(BaseX + INTERPOL_X * x, Segment + SEGMENT_HEIGHT, BaseZ + INTERPOL_Z * z) * + m_Noise2.IntNoise3DInt(BaseX + INTERPOL_Z * x, Segment + SEGMENT_HEIGHT, BaseZ + INTERPOL_Z * z) / + 256; + } // for x, z - FloorLo[] + LinearUpscale2DArrayInPlace(FloorHi, 17, 17, INTERPOL_X, INTERPOL_Z); + + // Interpolate between FloorLo and FloorHi: + for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++) + { + int Lo = FloorLo[x + 17 * z] / 256; + int Hi = FloorHi[x + 17 * z] / 256; + for (int y = 0; y < SEGMENT_HEIGHT; y++) + { + int Val = Lo + (Hi - Lo) * y / SEGMENT_HEIGHT; + a_ChunkDesc.SetBlockType(x, y + Segment, z, (Val < m_Threshold) ? E_BLOCK_NETHERRACK : E_BLOCK_AIR); + } + } + + // Swap the floors: + std::swap(FloorLo, FloorHi); + } + + // Bedrock at the bottom and at the top: + for (int z = 0; z < 16; z++) for (int x = 0; x < 16; x++) + { + a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); + a_ChunkDesc.SetBlockType(x, a_ChunkDesc.GetHeight(x, z), z, E_BLOCK_BEDROCK); + } +} + + + + + +void cCompoGenNether::InitializeCompoGen(cIniFile & a_IniFile) +{ + m_Threshold = a_IniFile.GetValueSetI("Generator", "NetherThreshold", m_Threshold); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cCompoGenCache: + +cCompoGenCache::cCompoGenCache(cTerrainCompositionGen & a_Underlying, int a_CacheSize) : + m_Underlying(a_Underlying), + m_CacheSize(a_CacheSize), + m_CacheOrder(new int[a_CacheSize]), + m_CacheData(new sCacheData[a_CacheSize]), + m_NumHits(0), + m_NumMisses(0), + m_TotalChain(0) +{ + for (int i = 0; i < m_CacheSize; i++) + { + m_CacheOrder[i] = i; + m_CacheData[i].m_ChunkX = 0x7fffffff; + m_CacheData[i].m_ChunkZ = 0x7fffffff; + } +} + + + + + +cCompoGenCache::~cCompoGenCache() +{ + delete[] m_CacheData; + delete[] m_CacheOrder; +} + + + + + +void cCompoGenCache::ComposeTerrain(cChunkDesc & a_ChunkDesc) +{ + #ifdef _DEBUG + if (((m_NumHits + m_NumMisses) % 1024) == 10) + { + LOGD("CompoGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses)); + LOGD("CompoGenCache: Avg cache chain length: %.2f", (float)m_TotalChain / m_NumHits); + } + #endif // _DEBUG + + int ChunkX = a_ChunkDesc.GetChunkX(); + int ChunkZ = a_ChunkDesc.GetChunkZ(); + + for (int i = 0; i < m_CacheSize; i++) + { + if ( + (m_CacheData[m_CacheOrder[i]].m_ChunkX != ChunkX) || + (m_CacheData[m_CacheOrder[i]].m_ChunkZ != ChunkZ) + ) + { + continue; + } + // Found it in the cache + int Idx = m_CacheOrder[i]; + + // Move to front: + for (int j = i; j > 0; j--) + { + m_CacheOrder[j] = m_CacheOrder[j - 1]; + } + m_CacheOrder[0] = Idx; + + // Use the cached data: + memcpy(a_ChunkDesc.GetBlockTypes(), m_CacheData[Idx].m_BlockTypes, sizeof(a_ChunkDesc.GetBlockTypes())); + memcpy(a_ChunkDesc.GetBlockMetasUncompressed(), m_CacheData[Idx].m_BlockMetas, sizeof(a_ChunkDesc.GetBlockMetasUncompressed())); + + m_NumHits++; + m_TotalChain += i; + return; + } // for i - cache + + // Not in the cache: + m_NumMisses++; + m_Underlying.ComposeTerrain(a_ChunkDesc); + + // Insert it as the first item in the MRU order: + int Idx = m_CacheOrder[m_CacheSize - 1]; + for (int i = m_CacheSize - 1; i > 0; i--) + { + m_CacheOrder[i] = m_CacheOrder[i - 1]; + } // for i - m_CacheOrder[] + m_CacheOrder[0] = Idx; + memcpy(m_CacheData[Idx].m_BlockTypes, a_ChunkDesc.GetBlockTypes(), sizeof(a_ChunkDesc.GetBlockTypes())); + memcpy(m_CacheData[Idx].m_BlockMetas, a_ChunkDesc.GetBlockMetasUncompressed(), sizeof(a_ChunkDesc.GetBlockMetasUncompressed())); + m_CacheData[Idx].m_ChunkX = ChunkX; + m_CacheData[Idx].m_ChunkZ = ChunkZ; +} + + + + + +void cCompoGenCache::InitializeCompoGen(cIniFile & a_IniFile) +{ + m_Underlying.InitializeCompoGen(a_IniFile); +} + + + + diff --git a/source/Generating/CompoGen.h b/src/Generating/CompoGen.h index 2ee286b06..2ee286b06 100644 --- a/source/Generating/CompoGen.h +++ b/src/Generating/CompoGen.h diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp new file mode 100644 index 000000000..01070963c --- /dev/null +++ b/src/Generating/ComposableGenerator.cpp @@ -0,0 +1,501 @@ + +// ComposableGenerator.cpp + +// Implements the cComposableGenerator class representing the chunk generator that takes the composition approach to generating chunks + +#include "Globals.h" + +#include "ComposableGenerator.h" +#include "../World.h" +#include "inifile/iniFile.h" +#include "../Root.h" + +// Individual composed algorithms: +#include "BioGen.h" +#include "HeiGen.h" +#include "CompoGen.h" +#include "StructGen.h" +#include "FinishGen.h" + +#include "Caves.h" +#include "DistortedHeightmap.h" +#include "EndGen.h" +#include "MineShafts.h" +#include "Noise3DGenerator.h" +#include "Ravines.h" + + + + + + + + + + +cComposableGenerator::cComposableGenerator(cChunkGenerator & a_ChunkGenerator) : + super(a_ChunkGenerator), + m_BiomeGen(NULL), + m_HeightGen(NULL), + m_CompositionGen(NULL), + m_UnderlyingBiomeGen(NULL), + m_UnderlyingHeightGen(NULL), + m_UnderlyingCompositionGen(NULL) +{ +} + + + + + +cComposableGenerator::~cComposableGenerator() +{ + // Delete the generating composition: + for (cFinishGenList::const_iterator itr = m_FinishGens.begin(); itr != m_FinishGens.end(); ++itr) + { + delete *itr; + } + m_FinishGens.clear(); + for (cStructureGenList::const_iterator itr = m_StructureGens.begin(); itr != m_StructureGens.end(); ++itr) + { + delete *itr; + } + m_StructureGens.clear(); + + delete m_CompositionGen; + m_CompositionGen = NULL; + delete m_HeightGen; + m_HeightGen = NULL; + delete m_BiomeGen; + m_BiomeGen = NULL; + delete m_UnderlyingCompositionGen; + m_UnderlyingCompositionGen = NULL; + delete m_UnderlyingHeightGen; + m_UnderlyingHeightGen = NULL; + delete m_UnderlyingBiomeGen; + m_UnderlyingBiomeGen = NULL; +} + + + + + +void cComposableGenerator::Initialize(cWorld * a_World, cIniFile & a_IniFile) +{ + super::Initialize(a_World, a_IniFile); + + InitBiomeGen(a_IniFile); + InitHeightGen(a_IniFile); + InitCompositionGen(a_IniFile); + InitStructureGens(a_IniFile); + InitFinishGens(a_IniFile); +} + + + + + +void cComposableGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) +{ + if (m_BiomeGen != NULL) // Quick fix for generator deinitializing before the world storage finishes loading + { + m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap); + } +} + + + + + +void cComposableGenerator::DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc) +{ + if (a_ChunkDesc.IsUsingDefaultBiomes()) + { + m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, a_ChunkDesc.GetBiomeMap()); + } + + if (a_ChunkDesc.IsUsingDefaultHeight()) + { + m_HeightGen->GenHeightMap(a_ChunkX, a_ChunkZ, a_ChunkDesc.GetHeightMap()); + } + + if (a_ChunkDesc.IsUsingDefaultComposition()) + { + m_CompositionGen->ComposeTerrain(a_ChunkDesc); + } + + if (a_ChunkDesc.IsUsingDefaultStructures()) + { + for (cStructureGenList::iterator itr = m_StructureGens.begin(); itr != m_StructureGens.end(); ++itr) + { + (*itr)->GenStructures(a_ChunkDesc); + } // for itr - m_StructureGens[] + } + + if (a_ChunkDesc.IsUsingDefaultFinish()) + { + for (cFinishGenList::iterator itr = m_FinishGens.begin(); itr != m_FinishGens.end(); ++itr) + { + (*itr)->GenFinish(a_ChunkDesc); + } // for itr - m_FinishGens[] + } +} + + + + + +void cComposableGenerator::InitBiomeGen(cIniFile & a_IniFile) +{ + AString BiomeGenName = a_IniFile.GetValueSet("Generator", "BiomeGen", ""); + if (BiomeGenName.empty()) + { + LOGWARN("[Generator] BiomeGen value not set in world.ini, using \"MultiStepMap\"."); + BiomeGenName = "MultiStepMap"; + } + + int Seed = m_ChunkGenerator.GetSeed(); + bool CacheOffByDefault = false; + if (NoCaseCompare(BiomeGenName, "constant") == 0) + { + m_BiomeGen = new cBioGenConstant; + CacheOffByDefault = true; // we're generating faster than a cache would retrieve data :) + } + else if (NoCaseCompare(BiomeGenName, "checkerboard") == 0) + { + m_BiomeGen = new cBioGenCheckerboard; + CacheOffByDefault = true; // we're (probably) generating faster than a cache would retrieve data + } + else if (NoCaseCompare(BiomeGenName, "voronoi") == 0) + { + m_BiomeGen = new cBioGenVoronoi(Seed); + } + else if (NoCaseCompare(BiomeGenName, "distortedvoronoi") == 0) + { + m_BiomeGen = new cBioGenDistortedVoronoi(Seed); + } + else + { + if (NoCaseCompare(BiomeGenName, "multistepmap") != 0) + { + LOGWARNING("Unknown BiomeGen \"%s\", using \"MultiStepMap\" instead.", BiomeGenName.c_str()); + } + m_BiomeGen = new cBioGenMultiStepMap(Seed); + + /* + // Performance-testing: + LOGINFO("Measuring performance of cBioGenMultiStepMap..."); + clock_t BeginTick = clock(); + for (int x = 0; x < 5000; x++) + { + cChunkDef::BiomeMap Biomes; + m_BiomeGen->GenBiomes(x * 5, x * 5, Biomes); + } + clock_t Duration = clock() - BeginTick; + LOGINFO("cBioGenMultiStepMap for 5000 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC); + //*/ + } + + // Add a cache, if requested: + int CacheSize = a_IniFile.GetValueSetI("Generator", "BiomeGenCacheSize", CacheOffByDefault ? 0 : 64); + if (CacheSize > 0) + { + if (CacheSize < 4) + { + LOGWARNING("Biomegen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d", + CacheSize, 4 + ); + CacheSize = 4; + } + LOGD("Using a cache for biomegen of size %d.", CacheSize); + m_UnderlyingBiomeGen = m_BiomeGen; + m_BiomeGen = new cBioGenCache(m_UnderlyingBiomeGen, CacheSize); + } + m_BiomeGen->InitializeBiomeGen(a_IniFile); +} + + + + + +void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile) +{ + AString HeightGenName = a_IniFile.GetValueSet("Generator", "HeightGen", ""); + if (HeightGenName.empty()) + { + LOGWARN("[Generator] HeightGen value not set in world.ini, using \"Biomal\"."); + HeightGenName = "Biomal"; + } + + int Seed = m_ChunkGenerator.GetSeed(); + bool CacheOffByDefault = false; + if (NoCaseCompare(HeightGenName, "flat") == 0) + { + m_HeightGen = new cHeiGenFlat; + CacheOffByDefault = true; // We're generating faster than a cache would retrieve data + } + else if (NoCaseCompare(HeightGenName, "classic") == 0) + { + m_HeightGen = new cHeiGenClassic(Seed); + } + else if (NoCaseCompare(HeightGenName, "DistortedHeightmap") == 0) + { + m_HeightGen = new cDistortedHeightmap(Seed, *m_BiomeGen); + } + else if (NoCaseCompare(HeightGenName, "End") == 0) + { + m_HeightGen = new cEndGen(Seed); + } + else if (NoCaseCompare(HeightGenName, "Noise3D") == 0) + { + m_HeightGen = new cNoise3DComposable(Seed); + } + else // "biomal" or <not found> + { + if (NoCaseCompare(HeightGenName, "biomal") != 0) + { + LOGWARN("Unknown HeightGen \"%s\", using \"Biomal\" instead.", HeightGenName.c_str()); + } + m_HeightGen = new cHeiGenBiomal(Seed, *m_BiomeGen); + + /* + // Performance-testing: + LOGINFO("Measuring performance of cHeiGenBiomal..."); + clock_t BeginTick = clock(); + for (int x = 0; x < 500; x++) + { + cChunkDef::HeightMap Heights; + m_HeightGen->GenHeightMap(x * 5, x * 5, Heights); + } + clock_t Duration = clock() - BeginTick; + LOGINFO("HeightGen for 500 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC); + //*/ + } + + // Read the settings: + m_HeightGen->InitializeHeightGen(a_IniFile); + + // Add a cache, if requested: + int CacheSize = a_IniFile.GetValueSetI("Generator", "HeightGenCacheSize", CacheOffByDefault ? 0 : 64); + if (CacheSize > 0) + { + if (CacheSize < 4) + { + LOGWARNING("Heightgen cache size set too low, would hurt performance instead of helping. Increasing from %d to %d", + CacheSize, 4 + ); + CacheSize = 4; + } + LOGD("Using a cache for Heightgen of size %d.", CacheSize); + m_UnderlyingHeightGen = m_HeightGen; + m_HeightGen = new cHeiGenCache(*m_UnderlyingHeightGen, CacheSize); + } +} + + + + + +void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile) +{ + int Seed = m_ChunkGenerator.GetSeed(); + AString CompoGenName = a_IniFile.GetValueSet("Generator", "CompositionGen", ""); + if (CompoGenName.empty()) + { + LOGWARN("[Generator] CompositionGen value not set in world.ini, using \"Biomal\"."); + CompoGenName = "Biomal"; + } + if (NoCaseCompare(CompoGenName, "sameblock") == 0) + { + m_CompositionGen = new cCompoGenSameBlock; + } + else if (NoCaseCompare(CompoGenName, "debugbiomes") == 0) + { + m_CompositionGen = new cCompoGenDebugBiomes; + } + else if (NoCaseCompare(CompoGenName, "classic") == 0) + { + m_CompositionGen = new cCompoGenClassic; + } + else if (NoCaseCompare(CompoGenName, "DistortedHeightmap") == 0) + { + m_CompositionGen = new cDistortedHeightmap(Seed, *m_BiomeGen); + } + else if (NoCaseCompare(CompoGenName, "end") == 0) + { + m_CompositionGen = new cEndGen(Seed); + } + else if (NoCaseCompare(CompoGenName, "nether") == 0) + { + m_CompositionGen = new cCompoGenNether(Seed); + } + else if (NoCaseCompare(CompoGenName, "Noise3D") == 0) + { + m_CompositionGen = new cNoise3DComposable(m_ChunkGenerator.GetSeed()); + } + else + { + if (NoCaseCompare(CompoGenName, "biomal") != 0) + { + LOGWARN("Unknown CompositionGen \"%s\", using \"biomal\" instead.", CompoGenName.c_str()); + } + m_CompositionGen = new cCompoGenBiomal(Seed); + + /* + // Performance-testing: + LOGINFO("Measuring performance of cCompoGenBiomal..."); + clock_t BeginTick = clock(); + for (int x = 0; x < 500; x++) + { + cChunkDesc Desc(200 + x * 8, 200 + x * 8); + m_BiomeGen->GenBiomes(Desc.GetChunkX(), Desc.GetChunkZ(), Desc.GetBiomeMap()); + m_HeightGen->GenHeightMap(Desc.GetChunkX(), Desc.GetChunkZ(), Desc.GetHeightMap()); + m_CompositionGen->ComposeTerrain(Desc); + } + clock_t Duration = clock() - BeginTick; + LOGINFO("CompositionGen for 500 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC); + //*/ + } + + // Read the settings from the ini file: + m_CompositionGen->InitializeCompoGen(a_IniFile); + + int CompoGenCacheSize = a_IniFile.GetValueSetI("Generator", "CompositionGenCacheSize", 64); + if (CompoGenCacheSize > 1) + { + m_UnderlyingCompositionGen = m_CompositionGen; + m_CompositionGen = new cCompoGenCache(*m_UnderlyingCompositionGen, 32); + } +} + + + + + +void cComposableGenerator::InitStructureGens(cIniFile & a_IniFile) +{ + AString Structures = a_IniFile.GetValueSet("Generator", "Structures", "Ravines, WormNestCaves, WaterLakes, LavaLakes, OreNests, Trees"); + + int Seed = m_ChunkGenerator.GetSeed(); + AStringVector Str = StringSplitAndTrim(Structures, ","); + for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr) + { + if (NoCaseCompare(*itr, "DualRidgeCaves") == 0) + { + float Threshold = (float)a_IniFile.GetValueSetF("Generator", "DualRidgeCavesThreshold", 0.3); + m_StructureGens.push_back(new cStructGenDualRidgeCaves(Seed, Threshold)); + } + else if (NoCaseCompare(*itr, "DirectOverhangs") == 0) + { + m_StructureGens.push_back(new cStructGenDirectOverhangs(Seed)); + } + else if (NoCaseCompare(*itr, "DistortedMembraneOverhangs") == 0) + { + m_StructureGens.push_back(new cStructGenDistortedMembraneOverhangs(Seed)); + } + else if (NoCaseCompare(*itr, "LavaLakes") == 0) + { + int Probability = a_IniFile.GetValueSetI("Generator", "LavaLakesProbability", 10); + m_StructureGens.push_back(new cStructGenLakes(Seed * 5 + 16873, E_BLOCK_STATIONARY_LAVA, *m_HeightGen, Probability)); + } + else if (NoCaseCompare(*itr, "MarbleCaves") == 0) + { + m_StructureGens.push_back(new cStructGenMarbleCaves(Seed)); + } + else if (NoCaseCompare(*itr, "MineShafts") == 0) + { + int GridSize = a_IniFile.GetValueSetI("Generator", "MineShaftsGridSize", 512); + int MaxSystemSize = a_IniFile.GetValueSetI("Generator", "MineShaftsMaxSystemSize", 160); + int ChanceCorridor = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCorridor", 600); + int ChanceCrossing = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceCrossing", 200); + int ChanceStaircase = a_IniFile.GetValueSetI("Generator", "MineShaftsChanceStaircase", 200); + m_StructureGens.push_back(new cStructGenMineShafts( + Seed, GridSize, MaxSystemSize, + ChanceCorridor, ChanceCrossing, ChanceStaircase + )); + } + else if (NoCaseCompare(*itr, "OreNests") == 0) + { + m_StructureGens.push_back(new cStructGenOreNests(Seed)); + } + else if (NoCaseCompare(*itr, "Ravines") == 0) + { + m_StructureGens.push_back(new cStructGenRavines(Seed, 128)); + } + else if (NoCaseCompare(*itr, "Trees") == 0) + { + m_StructureGens.push_back(new cStructGenTrees(Seed, m_BiomeGen, m_HeightGen, m_CompositionGen)); + } + else if (NoCaseCompare(*itr, "WaterLakes") == 0) + { + int Probability = a_IniFile.GetValueSetI("Generator", "WaterLakesProbability", 25); + m_StructureGens.push_back(new cStructGenLakes(Seed * 3 + 652, E_BLOCK_STATIONARY_WATER, *m_HeightGen, Probability)); + } + else if (NoCaseCompare(*itr, "WormNestCaves") == 0) + { + m_StructureGens.push_back(new cStructGenWormNestCaves(Seed)); + } + else + { + LOGWARNING("Unknown structure generator: \"%s\". Ignoring.", itr->c_str()); + } + } // for itr - Str[] +} + + + + + +void cComposableGenerator::InitFinishGens(cIniFile & a_IniFile) +{ + int Seed = m_ChunkGenerator.GetSeed(); + AString Structures = a_IniFile.GetValueSet("Generator", "Finishers", "SprinkleFoliage,Ice,Snow,Lilypads,BottomLava,DeadBushes,PreSimulator"); + + AStringVector Str = StringSplitAndTrim(Structures, ","); + for (AStringVector::const_iterator itr = Str.begin(); itr != Str.end(); ++itr) + { + // Finishers, alpha-sorted: + if (NoCaseCompare(*itr, "BottomLava") == 0) + { + int DefaultBottomLavaLevel = (m_World->GetDimension() == dimNether) ? 30 : 10; + int BottomLavaLevel = a_IniFile.GetValueSetI("Generator", "BottomLavaLevel", DefaultBottomLavaLevel); + m_FinishGens.push_back(new cFinishGenBottomLava(BottomLavaLevel)); + } + else if (NoCaseCompare(*itr, "DeadBushes") == 0) + { + m_FinishGens.push_back(new cFinishGenSingleBiomeSingleTopBlock(Seed, E_BLOCK_DEAD_BUSH, biDesert, 2, E_BLOCK_SAND, E_BLOCK_SAND)); + } + else if (NoCaseCompare(*itr, "Ice") == 0) + { + m_FinishGens.push_back(new cFinishGenIce); + } + else if (NoCaseCompare(*itr, "LavaSprings") == 0) + { + m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_LAVA, a_IniFile, *m_World)); + } + else if (NoCaseCompare(*itr, "Lilypads") == 0) + { + m_FinishGens.push_back(new cFinishGenSingleBiomeSingleTopBlock(Seed, E_BLOCK_LILY_PAD, biSwampland, 4, E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER)); + } + else if (NoCaseCompare(*itr, "PreSimulator") == 0) + { + m_FinishGens.push_back(new cFinishGenPreSimulator); + } + else if (NoCaseCompare(*itr, "Snow") == 0) + { + m_FinishGens.push_back(new cFinishGenSnow); + } + else if (NoCaseCompare(*itr, "SprinkleFoliage") == 0) + { + m_FinishGens.push_back(new cFinishGenSprinkleFoliage(Seed)); + } + else if (NoCaseCompare(*itr, "WaterSprings") == 0) + { + m_FinishGens.push_back(new cFinishGenFluidSprings(Seed, E_BLOCK_WATER, a_IniFile, *m_World)); + } + } // for itr - Str[] +} + + + + diff --git a/source/Generating/ComposableGenerator.h b/src/Generating/ComposableGenerator.h index d5e33a439..d5e33a439 100644 --- a/source/Generating/ComposableGenerator.h +++ b/src/Generating/ComposableGenerator.h diff --git a/src/Generating/DistortedHeightmap.cpp b/src/Generating/DistortedHeightmap.cpp new file mode 100644 index 000000000..95ea812fa --- /dev/null +++ b/src/Generating/DistortedHeightmap.cpp @@ -0,0 +1,444 @@ + +// DistortedHeightmap.cpp + +// Implements the cDistortedHeightmap class representing the height and composition generator capable of overhangs + +#include "Globals.h" + +#include "DistortedHeightmap.h" +#include "../OSSupport/File.h" +#include "inifile/iniFile.h" +#include "../LinearUpscale.h" + + + + + +/** This table assigns a relative maximum overhang size in each direction to biomes. +Both numbers indicate a number which will multiply the noise value for each coord; +this means that you can have different-sized overhangs in each direction. +Usually you'd want to keep both numbers the same. +The numbers are "relative", not absolute maximum; overhangs of a slightly larger size are possible +due to the way that noise is calculated. +*/ +const cDistortedHeightmap::sGenParam cDistortedHeightmap::m_GenParam[biNumBiomes] = +{ + /* Biome | AmpX | AmpZ */ + /* biOcean */ { 1.5f, 1.5f}, + /* biPlains */ { 0.5f, 0.5f}, + /* biDesert */ { 0.5f, 0.5f}, + /* biExtremeHills */ {16.0f, 16.0f}, + /* biForest */ { 3.0f, 3.0f}, + /* biTaiga */ { 1.5f, 1.5f}, + + /* biSwampland */ { 0.0f, 0.0f}, + /* biRiver */ { 0.0f, 0.0f}, + /* biNether */ { 0.0f, 0.0f}, // Unused, but must be here due to indexing + /* biSky */ { 0.0f, 0.0f}, // Unused, but must be here due to indexing + /* biFrozenOcean */ { 0.0f, 0.0f}, + /* biFrozenRiver */ { 0.0f, 0.0f}, + /* biIcePlains */ { 0.0f, 0.0f}, + /* biIceMountains */ { 8.0f, 8.0f}, + /* biMushroomIsland */ { 4.0f, 4.0f}, + /* biMushroomShore */ { 0.0f, 0.0f}, + /* biBeach */ { 0.0f, 0.0f}, + /* biDesertHills */ { 5.0f, 5.0f}, + /* biForestHills */ { 6.0f, 6.0f}, + /* biTaigaHills */ { 8.0f, 8.0f}, + /* biExtremeHillsEdge */ { 7.0f, 7.0f}, + /* biJungle */ { 0.0f, 0.0f}, + /* biJungleHills */ { 8.0f, 8.0f}, +} ; + + + + + +cDistortedHeightmap::cDistortedHeightmap(int a_Seed, cBiomeGen & a_BiomeGen) : + m_NoiseDistortX(a_Seed + 1000), + m_NoiseDistortZ(a_Seed + 2000), + m_OceanFloorSelect(a_Seed + 3000), + m_BiomeGen(a_BiomeGen), + m_UnderlyingHeiGen(a_Seed, a_BiomeGen), + m_HeightGen(m_UnderlyingHeiGen, 64) +{ + m_NoiseDistortX.AddOctave((NOISE_DATATYPE)1, (NOISE_DATATYPE)0.5); + m_NoiseDistortX.AddOctave((NOISE_DATATYPE)0.5, (NOISE_DATATYPE)1); + m_NoiseDistortX.AddOctave((NOISE_DATATYPE)0.25, (NOISE_DATATYPE)2); + + m_NoiseDistortZ.AddOctave((NOISE_DATATYPE)1, (NOISE_DATATYPE)0.5); + m_NoiseDistortZ.AddOctave((NOISE_DATATYPE)0.5, (NOISE_DATATYPE)1); + m_NoiseDistortZ.AddOctave((NOISE_DATATYPE)0.25, (NOISE_DATATYPE)2); +} + + + + + +void cDistortedHeightmap::Initialize(cIniFile & a_IniFile) +{ + if (m_IsInitialized) + { + return; + } + + // Read the params from the INI file: + m_SeaLevel = a_IniFile.GetValueSetI("Generator", "DistortedHeightmapSeaLevel", 62); + m_FrequencyX = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyX", 10); + m_FrequencyY = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyY", 10); + m_FrequencyZ = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "DistortedHeightmapFrequencyZ", 10); + + m_IsInitialized = true; +} + + + + + +void cDistortedHeightmap::PrepareState(int a_ChunkX, int a_ChunkZ) +{ + if ((m_CurChunkX == a_ChunkX) && (m_CurChunkZ == a_ChunkZ)) + { + return; + } + m_CurChunkX = a_ChunkX; + m_CurChunkZ = a_ChunkZ; + + + m_HeightGen.GenHeightMap(a_ChunkX, a_ChunkZ, m_CurChunkHeights); + UpdateDistortAmps(); + GenerateHeightArray(); +} + + + + + +void cDistortedHeightmap::GenerateHeightArray(void) +{ + // Generate distortion noise: + NOISE_DATATYPE DistortNoiseX[DIM_X * DIM_Y * DIM_Z]; + NOISE_DATATYPE DistortNoiseZ[DIM_X * DIM_Y * DIM_Z]; + NOISE_DATATYPE Workspace[DIM_X * DIM_Y * DIM_Z]; + NOISE_DATATYPE StartX = ((NOISE_DATATYPE)(m_CurChunkX * cChunkDef::Width)) / m_FrequencyX; + NOISE_DATATYPE EndX = ((NOISE_DATATYPE)((m_CurChunkX + 1) * cChunkDef::Width - 1)) / m_FrequencyX; + NOISE_DATATYPE StartY = 0; + NOISE_DATATYPE EndY = ((NOISE_DATATYPE)(257)) / m_FrequencyY; + NOISE_DATATYPE StartZ = ((NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width)) / m_FrequencyZ; + NOISE_DATATYPE EndZ = ((NOISE_DATATYPE)((m_CurChunkZ + 1) * cChunkDef::Width - 1)) / m_FrequencyZ; + + m_NoiseDistortX.Generate3D(DistortNoiseX, DIM_X, DIM_Y, DIM_Z, StartX, EndX, StartY, EndY, StartZ, EndZ, Workspace); + m_NoiseDistortZ.Generate3D(DistortNoiseZ, DIM_X, DIM_Y, DIM_Z, StartX, EndX, StartY, EndY, StartZ, EndZ, Workspace); + + // The distorted heightmap, before linear upscaling + NOISE_DATATYPE DistHei[DIM_X * DIM_Y * DIM_Z]; + + // Distort the heightmap using the distortion: + for (int z = 0; z < DIM_Z; z++) + { + int AmpIdx = z * DIM_X; + for (int y = 0; y < DIM_Y; y++) + { + int NoiseArrayIdx = z * DIM_X * DIM_Y + y * DIM_X; + for (int x = 0; x < DIM_X; x++) + { + NOISE_DATATYPE DistX = DistortNoiseX[NoiseArrayIdx + x] * m_DistortAmpX[AmpIdx + x]; + NOISE_DATATYPE DistZ = DistortNoiseZ[NoiseArrayIdx + x] * m_DistortAmpZ[AmpIdx + x]; + DistX += (NOISE_DATATYPE)(m_CurChunkX * cChunkDef::Width + x * INTERPOL_X); + DistZ += (NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width + z * INTERPOL_Z); + // Adding 0.5 helps alleviate the interpolation artifacts + DistHei[NoiseArrayIdx + x] = (NOISE_DATATYPE)GetHeightmapAt(DistX, DistZ) + (NOISE_DATATYPE)0.5; + } + } + } + + // Upscale the distorted heightmap into full dimensions: + LinearUpscale3DArray( + DistHei, DIM_X, DIM_Y, DIM_Z, + m_DistortedHeightmap, INTERPOL_X, INTERPOL_Y, INTERPOL_Z + ); + + // DEBUG: Debug3DNoise(m_DistortedHeightmap, 17, 257, 17, Printf("DistortedHeightmap_%d_%d", m_CurChunkX, m_CurChunkZ)); +} + + + + + +void cDistortedHeightmap::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) +{ + PrepareState(a_ChunkX, a_ChunkZ); + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + int NoiseArrayIdx = x + 17 * 257 * z; + cChunkDef::SetHeight(a_HeightMap, x, z, m_SeaLevel - 1); + for (int y = cChunkDef::Height - 1; y > m_SeaLevel - 1; y--) + { + int HeightMapHeight = (int)m_DistortedHeightmap[NoiseArrayIdx + 17 * y]; + if (y < HeightMapHeight) + { + cChunkDef::SetHeight(a_HeightMap, x, z, y); + break; + } + } // for y + } // for x + } // for z +} + + + + + +void cDistortedHeightmap::InitializeHeightGen(cIniFile & a_IniFile) +{ + Initialize(a_IniFile); +} + + + + + +void cDistortedHeightmap::ComposeTerrain(cChunkDesc & a_ChunkDesc) +{ + // Frequencies for the ocean floor selecting noise: + NOISE_DATATYPE FrequencyX = 3; + NOISE_DATATYPE FrequencyZ = 3; + + // Prepare the internal state for generating this chunk: + PrepareState(a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ()); + + // Compose: + a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + int NoiseArrayIdx = x + 17 * 257 * z; + int LastAir = a_ChunkDesc.GetHeight(x, z) + 1; + bool HasHadWater = false; + for (int y = LastAir - 1; y > 0; y--) + { + int HeightMapHeight = (int)m_DistortedHeightmap[NoiseArrayIdx + 17 * y]; + + if (y >= HeightMapHeight) + { + // "air" part + LastAir = y; + if (y < m_SeaLevel) + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_STATIONARY_WATER); + HasHadWater = true; + } + continue; + } + // "ground" part: + if (y < LastAir - 4) + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_STONE); + continue; + } + if (HasHadWater) + { + // Decide between clay, sand and dirt + NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(m_CurChunkX * cChunkDef::Width + x)) / FrequencyX; + NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)(m_CurChunkZ * cChunkDef::Width + z)) / FrequencyZ; + NOISE_DATATYPE Val = m_OceanFloorSelect.CubicNoise2D(NoiseX, NoiseY); + if (Val < -0.95) + { + // Clay: + switch (LastAir - y) + { + case 0: + case 1: + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_CLAY); + break; + } + case 2: + case 3: + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SAND); + break; + } + case 4: + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SANDSTONE); + break; + } + } // switch (floor depth) + } + else if (Val < 0) + { + a_ChunkDesc.SetBlockType(x, y, z, (y < LastAir - 3) ? E_BLOCK_SANDSTONE : E_BLOCK_SAND); + } + else + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_DIRT); + } + } + else + { + switch (a_ChunkDesc.GetBiome(x, z)) + { + case biOcean: + case biPlains: + case biExtremeHills: + case biForest: + case biTaiga: + case biSwampland: + case biRiver: + case biFrozenOcean: + case biFrozenRiver: + case biIcePlains: + case biIceMountains: + case biForestHills: + case biTaigaHills: + case biExtremeHillsEdge: + case biJungle: + case biJungleHills: + { + a_ChunkDesc.SetBlockType(x, y, z, (y == LastAir - 1) ? E_BLOCK_GRASS : E_BLOCK_DIRT); + break; + } + case biDesertHills: + case biDesert: + case biBeach: + { + a_ChunkDesc.SetBlockType(x, y, z, (y < LastAir - 3) ? E_BLOCK_SANDSTONE : E_BLOCK_SAND); + break; + } + case biMushroomIsland: + case biMushroomShore: + { + a_ChunkDesc.SetBlockType(x, y, z, (y == LastAir - 1) ? E_BLOCK_MYCELIUM : E_BLOCK_DIRT); + break; + } + } + } + } // for y + a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); + } // for x + } // for z +} + + + + + +void cDistortedHeightmap::InitializeCompoGen(cIniFile & a_IniFile) +{ + Initialize(a_IniFile); +} + + + + + +int cDistortedHeightmap::GetHeightmapAt(NOISE_DATATYPE a_X, NOISE_DATATYPE a_Z) +{ + int ChunkX = (int)floor(a_X / (NOISE_DATATYPE)16); + int ChunkZ = (int)floor(a_Z / (NOISE_DATATYPE)16); + int RelX = (int)(a_X - (NOISE_DATATYPE)ChunkX * cChunkDef::Width); + int RelZ = (int)(a_Z - (NOISE_DATATYPE)ChunkZ * cChunkDef::Width); + + // If we're withing the same chunk, return the pre-cached heightmap: + if ((ChunkX == m_CurChunkX) && (ChunkZ == m_CurChunkZ)) + { + return cChunkDef::GetHeight(m_CurChunkHeights, RelX, RelZ); + } + + // Ask the cache: + HEIGHTTYPE res = 0; + if (m_HeightGen.GetHeightAt(ChunkX, ChunkZ, RelX, RelZ, res)) + { + // The height was in the cache + return res; + } + + // The height is not in the cache, generate full heightmap and get it there: + cChunkDef::HeightMap Heightmap; + m_HeightGen.GenHeightMap(ChunkX, ChunkZ, Heightmap); + return cChunkDef::GetHeight(Heightmap, RelX, RelZ); +} + + + + + +void cDistortedHeightmap::UpdateDistortAmps(void) +{ + BiomeNeighbors Biomes; + for (int z = -1; z <= 1; z++) + { + for (int x = -1; x <= 1; x++) + { + m_BiomeGen.GenBiomes(m_CurChunkX + x, m_CurChunkZ + z, Biomes[x + 1][z + 1]); + } // for x + } // for z + + for (int z = 0; z < DIM_Z; z++) + { + for (int x = 0; x < DIM_Z; x++) + { + GetDistortAmpsAt(Biomes, x * INTERPOL_X, z * INTERPOL_Z, m_DistortAmpX[x + DIM_X * z], m_DistortAmpZ[x + DIM_X * z]); + } + } +} + + + + + +void cDistortedHeightmap::GetDistortAmpsAt(BiomeNeighbors & a_Neighbors, int a_RelX, int a_RelZ, NOISE_DATATYPE & a_DistortAmpX, NOISE_DATATYPE & a_DistortAmpZ) +{ + // Sum up how many biomes of each type there are in the neighborhood: + int BiomeCounts[biNumBiomes]; + memset(BiomeCounts, 0, sizeof(BiomeCounts)); + int Sum = 0; + for (int z = -8; z <= 8; z++) + { + int FinalZ = a_RelZ + z + cChunkDef::Width; + int IdxZ = FinalZ / cChunkDef::Width; + int ModZ = FinalZ % cChunkDef::Width; + int WeightZ = 9 - abs(z); + for (int x = -8; x <= 8; x++) + { + int FinalX = a_RelX + x + cChunkDef::Width; + int IdxX = FinalX / cChunkDef::Width; + int ModX = FinalX % cChunkDef::Width; + EMCSBiome Biome = cChunkDef::GetBiome(a_Neighbors[IdxX][IdxZ], ModX, ModZ); + if ((Biome < 0) || (Biome >= ARRAYCOUNT(BiomeCounts))) + { + continue; + } + int WeightX = 9 - abs(x); + BiomeCounts[Biome] += WeightX + WeightZ; + Sum += WeightX + WeightZ; + } // for x + } // for z + + if (Sum <= 0) + { + // No known biome around? Weird. Return a bogus value: + ASSERT(!"cHeiGenBiomal: Biome sum failed, no known biome around"); + a_DistortAmpX = 16; + a_DistortAmpZ = 16; + } + + // For each biome type that has a nonzero count, calc its amps and add it: + NOISE_DATATYPE AmpX = 0; + NOISE_DATATYPE AmpZ = 0; + for (unsigned int i = 0; i < ARRAYCOUNT(BiomeCounts); i++) + { + AmpX += BiomeCounts[i] * m_GenParam[i].m_DistortAmpX; + AmpZ += BiomeCounts[i] * m_GenParam[i].m_DistortAmpZ; + } + a_DistortAmpX = AmpX / Sum; + a_DistortAmpZ = AmpZ / Sum; +} + + + + diff --git a/source/Generating/DistortedHeightmap.h b/src/Generating/DistortedHeightmap.h index 6d7007375..6d7007375 100644 --- a/source/Generating/DistortedHeightmap.h +++ b/src/Generating/DistortedHeightmap.h diff --git a/src/Generating/EndGen.cpp b/src/Generating/EndGen.cpp new file mode 100644 index 000000000..1fa0fa121 --- /dev/null +++ b/src/Generating/EndGen.cpp @@ -0,0 +1,217 @@ + +// EndGen.cpp + +// Implements the cEndGen class representing the generator for the End, both as a HeightGen and CompositionGen + +#include "Globals.h" +#include "EndGen.h" +#include "inifile/iniFile.h" +#include "../LinearUpscale.h" + + + + + +enum +{ + // Interpolation cell size: + INTERPOL_X = 4, + INTERPOL_Y = 4, + INTERPOL_Z = 4, + + // Size of chunk data, downscaled before interpolation: + DIM_X = 16 / INTERPOL_X + 1, + DIM_Y = 256 / INTERPOL_Y + 1, + DIM_Z = 16 / INTERPOL_Z + 1, +} ; + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cEndGen: + +cEndGen::cEndGen(int a_Seed) : + m_Seed(a_Seed), + m_IslandSizeX(256), + m_IslandSizeY(96), + m_IslandSizeZ(256), + m_FrequencyX(80), + m_FrequencyY(80), + m_FrequencyZ(80) +{ + m_Perlin.AddOctave(1, 1); + m_Perlin.AddOctave(2, 0.5); + m_Perlin.AddOctave(4, 0.25); +} + + + + + +void cEndGen::Initialize(cIniFile & a_IniFile) +{ + m_IslandSizeX = a_IniFile.GetValueSetI("Generator", "EndGenIslandSizeX", m_IslandSizeX); + m_IslandSizeY = a_IniFile.GetValueSetI("Generator", "EndGenIslandSizeY", m_IslandSizeY); + m_IslandSizeZ = a_IniFile.GetValueSetI("Generator", "EndGenIslandSizeZ", m_IslandSizeZ); + + m_FrequencyX = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "EndGenFrequencyX", m_FrequencyX); + m_FrequencyY = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "EndGenFrequencyY", m_FrequencyY); + m_FrequencyZ = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "EndGenFrequencyZ", m_FrequencyZ); + + // Recalculate the min and max chunk coords of the island + m_MaxChunkX = (m_IslandSizeX + cChunkDef::Width - 1) / cChunkDef::Width; + m_MinChunkX = -m_MaxChunkX; + m_MaxChunkZ = (m_IslandSizeZ + cChunkDef::Width - 1) / cChunkDef::Width; + m_MinChunkZ = -m_MaxChunkZ; +} + + + + + +/// Unless the LastChunk coords are equal to coords given, prepares the internal state (noise array) +void cEndGen::PrepareState(int a_ChunkX, int a_ChunkZ) +{ + ASSERT(!IsChunkOutsideRange(a_ChunkX, a_ChunkZ)); // Should be filtered before calling this function + + if ((m_LastChunkX == a_ChunkX) && (m_LastChunkZ == a_ChunkZ)) + { + return; + } + + m_LastChunkX = a_ChunkX; + m_LastChunkZ = a_ChunkZ; + + GenerateNoiseArray(); +} + + + + + +/// Generates the m_NoiseArray array for the current chunk +void cEndGen::GenerateNoiseArray(void) +{ + NOISE_DATATYPE NoiseData[DIM_X * DIM_Y * DIM_Z]; // [x + DIM_X * z + DIM_X * DIM_Z * y] + NOISE_DATATYPE Workspace[DIM_X * DIM_Y * DIM_Z]; // [x + DIM_X * z + DIM_X * DIM_Z * y] + + // Generate the downscaled noise: + NOISE_DATATYPE StartX = ((NOISE_DATATYPE)(m_LastChunkX * cChunkDef::Width)) / m_FrequencyX; + NOISE_DATATYPE EndX = ((NOISE_DATATYPE)((m_LastChunkX + 1) * cChunkDef::Width)) / m_FrequencyX; + NOISE_DATATYPE StartZ = ((NOISE_DATATYPE)(m_LastChunkZ * cChunkDef::Width)) / m_FrequencyZ; + NOISE_DATATYPE EndZ = ((NOISE_DATATYPE)((m_LastChunkZ + 1) * cChunkDef::Width)) / m_FrequencyZ; + NOISE_DATATYPE StartY = 0; + NOISE_DATATYPE EndY = ((NOISE_DATATYPE)257) / m_FrequencyY; + m_Perlin.Generate3D(NoiseData, DIM_X, DIM_Z, DIM_Y, StartX, EndX, StartZ, EndZ, StartY, EndY, Workspace); + + // Add distance: + int idx = 0; + for (int y = 0; y < DIM_Y; y++) + { + NOISE_DATATYPE ValY = (NOISE_DATATYPE)(2 * INTERPOL_Y * y - m_IslandSizeY) / m_IslandSizeY; + ValY = ValY * ValY; + for (int z = 0; z < DIM_Z; z++) + { + NOISE_DATATYPE ValZ = (NOISE_DATATYPE)(m_LastChunkZ * cChunkDef::Width + (z * cChunkDef::Width / (DIM_Z - 1))) / m_IslandSizeZ; + ValZ = ValZ * ValZ; + for (int x = 0; x < DIM_X; x++) + { + // NOISE_DATATYPE ValX = StartX + (EndX - StartX) * x / (DIM_X - 1); + NOISE_DATATYPE ValX = (NOISE_DATATYPE)(m_LastChunkX * cChunkDef::Width + (x * cChunkDef::Width / (DIM_X - 1))) / m_IslandSizeX; + ValX = ValX * ValX; + NoiseData[idx++] += ValX + ValZ + ValY; + } // for x + } // for z + } // for y + + // Upscale into real chunk size: + LinearUpscale3DArray(NoiseData, DIM_X, DIM_Z, DIM_Y, m_NoiseArray, INTERPOL_X, INTERPOL_Z, INTERPOL_Y); +} + + + + + +/// Returns true if the chunk is outside of the island's dimensions +bool cEndGen::IsChunkOutsideRange(int a_ChunkX, int a_ChunkZ) +{ + return ( + (a_ChunkX < m_MinChunkX) || (a_ChunkX > m_MaxChunkX) || + (a_ChunkZ < m_MinChunkZ) || (a_ChunkZ > m_MaxChunkZ) + ); +} + + + + + +void cEndGen::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) +{ + if (IsChunkOutsideRange(a_ChunkX, a_ChunkZ)) + { + for (unsigned int i = 0; i < ARRAYCOUNT(a_HeightMap); i++) + { + a_HeightMap[i] = 0; + } + return; + } + + PrepareState(a_ChunkX, a_ChunkZ); + + int MaxY = std::min((int)(1.75 * m_IslandSizeY + 1), cChunkDef::Height - 1); + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + cChunkDef::SetHeight(a_HeightMap, x, z, MaxY); + for (int y = MaxY; y > 0; y--) + { + if (m_NoiseArray[y * 17 * 17 + z * 17 + x] <= 0) + { + cChunkDef::SetHeight(a_HeightMap, x, z, y); + break; + } + } // for y + } // for x + } // for z +} + + + + + +void cEndGen::ComposeTerrain(cChunkDesc & a_ChunkDesc) +{ + if (IsChunkOutsideRange(a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ())) + { + a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); + return; + } + + PrepareState(a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ()); + + int MaxY = std::min((int)(1.75 * m_IslandSizeY + 1), cChunkDef::Height - 1); + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + for (int y = MaxY; y > 0; y--) + { + if (m_NoiseArray[y * 17 * 17 + z * 17 + x] <= 0) + { + a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_END_STONE, 0); + } + else + { + a_ChunkDesc.SetBlockTypeMeta(x, y, z, E_BLOCK_AIR, 0); + } + } // for y + } // for x + } // for z +} + + + + diff --git a/source/Generating/EndGen.h b/src/Generating/EndGen.h index 4904a0e3d..4904a0e3d 100644 --- a/source/Generating/EndGen.h +++ b/src/Generating/EndGen.h diff --git a/source/Generating/FinishGen.cpp b/src/Generating/FinishGen.cpp index 8899e4bd0..8899e4bd0 100644 --- a/source/Generating/FinishGen.cpp +++ b/src/Generating/FinishGen.cpp diff --git a/source/Generating/FinishGen.h b/src/Generating/FinishGen.h index ed7df5909..ed7df5909 100644 --- a/source/Generating/FinishGen.h +++ b/src/Generating/FinishGen.h diff --git a/src/Generating/HeiGen.cpp b/src/Generating/HeiGen.cpp new file mode 100644 index 000000000..8aab3fe15 --- /dev/null +++ b/src/Generating/HeiGen.cpp @@ -0,0 +1,390 @@ + +// HeiGen.cpp + +// Implements the various terrain height generators + +#include "Globals.h" +#include "HeiGen.h" +#include "../LinearUpscale.h" +#include "inifile/iniFile.h" + + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cHeiGenFlat: + +void cHeiGenFlat::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) +{ + for (int i = 0; i < ARRAYCOUNT(a_HeightMap); i++) + { + a_HeightMap[i] = m_Height; + } +} + + + + + +void cHeiGenFlat::InitializeHeightGen(cIniFile & a_IniFile) +{ + m_Height = a_IniFile.GetValueSetI("Generator", "FlatHeight", m_Height); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cHeiGenCache: + +cHeiGenCache::cHeiGenCache(cTerrainHeightGen & a_HeiGenToCache, int a_CacheSize) : + m_HeiGenToCache(a_HeiGenToCache), + m_CacheSize(a_CacheSize), + m_CacheOrder(new int[a_CacheSize]), + m_CacheData(new sCacheData[a_CacheSize]), + m_NumHits(0), + m_NumMisses(0), + m_TotalChain(0) +{ + for (int i = 0; i < m_CacheSize; i++) + { + m_CacheOrder[i] = i; + m_CacheData[i].m_ChunkX = 0x7fffffff; + m_CacheData[i].m_ChunkZ = 0x7fffffff; + } +} + + + + + +cHeiGenCache::~cHeiGenCache() +{ + delete[] m_CacheData; + delete[] m_CacheOrder; +} + + + + + +void cHeiGenCache::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) +{ + /* + if (((m_NumHits + m_NumMisses) % 1024) == 10) + { + LOGD("HeiGenCache: %d hits, %d misses, saved %.2f %%", m_NumHits, m_NumMisses, 100.0 * m_NumHits / (m_NumHits + m_NumMisses)); + LOGD("HeiGenCache: Avg cache chain length: %.2f", (float)m_TotalChain / m_NumHits); + } + //*/ + + for (int i = 0; i < m_CacheSize; i++) + { + if ( + (m_CacheData[m_CacheOrder[i]].m_ChunkX != a_ChunkX) || + (m_CacheData[m_CacheOrder[i]].m_ChunkZ != a_ChunkZ) + ) + { + continue; + } + // Found it in the cache + int Idx = m_CacheOrder[i]; + + // Move to front: + for (int j = i; j > 0; j--) + { + m_CacheOrder[j] = m_CacheOrder[j - 1]; + } + m_CacheOrder[0] = Idx; + + // Use the cached data: + memcpy(a_HeightMap, m_CacheData[Idx].m_HeightMap, sizeof(a_HeightMap)); + + m_NumHits++; + m_TotalChain += i; + return; + } // for i - cache + + // Not in the cache: + m_NumMisses++; + m_HeiGenToCache.GenHeightMap(a_ChunkX, a_ChunkZ, a_HeightMap); + + // Insert it as the first item in the MRU order: + int Idx = m_CacheOrder[m_CacheSize - 1]; + for (int i = m_CacheSize - 1; i > 0; i--) + { + m_CacheOrder[i] = m_CacheOrder[i - 1]; + } // for i - m_CacheOrder[] + m_CacheOrder[0] = Idx; + memcpy(m_CacheData[Idx].m_HeightMap, a_HeightMap, sizeof(a_HeightMap)); + m_CacheData[Idx].m_ChunkX = a_ChunkX; + m_CacheData[Idx].m_ChunkZ = a_ChunkZ; +} + + + + + +void cHeiGenCache::InitializeHeightGen(cIniFile & a_IniFile) +{ + m_HeiGenToCache.InitializeHeightGen(a_IniFile); +} + + + + + +bool cHeiGenCache::GetHeightAt(int a_ChunkX, int a_ChunkZ, int a_RelX, int a_RelZ, HEIGHTTYPE & a_Height) +{ + for (int i = 0; i < m_CacheSize; i++) + { + if ((m_CacheData[i].m_ChunkX == a_ChunkX) && (m_CacheData[i].m_ChunkZ == a_ChunkZ)) + { + a_Height = cChunkDef::GetHeight(m_CacheData[i].m_HeightMap, a_RelX, a_RelZ); + return true; + } + } // for i - m_CacheData[] + return false; +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cHeiGenClassic: + +cHeiGenClassic::cHeiGenClassic(int a_Seed) : + m_Seed(a_Seed), + m_Noise(a_Seed) +{ +} + + + + + +float cHeiGenClassic::GetNoise(float x, float y) +{ + float oct1 = m_Noise.CubicNoise2D(x * m_HeightFreq1, y * m_HeightFreq1) * m_HeightAmp1; + float oct2 = m_Noise.CubicNoise2D(x * m_HeightFreq2, y * m_HeightFreq2) * m_HeightAmp2; + float oct3 = m_Noise.CubicNoise2D(x * m_HeightFreq3, y * m_HeightFreq3) * m_HeightAmp3; + + float height = m_Noise.CubicNoise2D(x * 0.1f, y * 0.1f ) * 2; + + float flatness = ((m_Noise.CubicNoise2D(x * 0.5f, y * 0.5f) + 1.f) * 0.5f) * 1.1f; // 0 ... 1.5 + flatness *= flatness * flatness; + + return (oct1 + oct2 + oct3) * flatness + height; +} + + + + + +void cHeiGenClassic::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) +{ + for (int z = 0; z < cChunkDef::Width; z++) + { + const float zz = (float)(a_ChunkZ * cChunkDef::Width + z); + for (int x = 0; x < cChunkDef::Width; x++) + { + const float xx = (float)(a_ChunkX * cChunkDef::Width + x); + + int hei = 64 + (int)(GetNoise(xx * 0.05f, zz * 0.05f) * 16); + if (hei < 10) + { + hei = 10; + } + if (hei > 250) + { + hei = 250; + } + cChunkDef::SetHeight(a_HeightMap, x , z, hei); + } // for x + } // for z +} + + + + + +void cHeiGenClassic::InitializeHeightGen(cIniFile & a_IniFile) +{ + m_HeightFreq1 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightFreq1", 0.1); + m_HeightFreq2 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightFreq2", 1.0); + m_HeightFreq3 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightFreq3", 2.0); + m_HeightAmp1 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp1", 1.0); + m_HeightAmp2 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp2", 0.5); + m_HeightAmp3 = (float)a_IniFile.GetValueSetF("Generator", "ClassicHeightAmp3", 0.5); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cHeiGenBiomal: + +const cHeiGenBiomal::sGenParam cHeiGenBiomal::m_GenParam[biNumBiomes] = +{ + /* Fast-changing | Middle-changing | Slow-changing |*/ + /* Biome | Freq1 | Amp1 | Freq2 | Amp2 | Freq3 | Amp3 | BaseHeight */ + /* biOcean */ { 0.1f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 40}, + /* biPlains */ { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 68}, + /* biDesert */ { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 68}, + /* biExtremeHills */ { 0.2f, 4.0f, 0.05f, 20.0f, 0.01f, 16.0f, 100}, + /* biForest */ { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 70}, + /* biTaiga */ { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 70}, + /* biSwampland */ { 0.1f, 1.1f, 0.05f, 1.5f, 0.02f, 2.5f, 61.5}, + /* biRiver */ { 0.2f, 0.1f, 0.05f, 0.1f, 0.01f, 0.1f, 56}, + /* biNether */ { 0.1f, 0.0f, 0.01f, 0.0f, 0.01f, 0.0f, 0}, // Unused, but must be here due to indexing + /* biSky */ { 0.1f, 0.0f, 0.01f, 0.0f, 0.01f, 0.0f, 0}, // Unused, but must be here due to indexing + /* biFrozenOcean */ { 0.1f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 40}, + /* biFrozenRiver */ { 0.2f, 0.1f, 0.05f, 0.1f, 0.01f, 0.1f, 56}, + /* biIcePlains */ { 0.1f, 1.0f, 0.05f, 1.5f, 0.01f, 4.0f, 68}, + /* biIceMountains */ { 0.2f, 2.0f, 0.05f, 10.0f, 0.01f, 8.0f, 80}, + /* biMushroomIsland */ { 0.1f, 2.0f, 0.05f, 8.0f, 0.01f, 6.0f, 80}, + /* biMushroomShore */ { 0.1f, 1.0f, 0.05f, 2.0f, 0.01f, 4.0f, 64}, + /* biBeach */ { 0.1f, 0.5f, 0.05f, 1.0f, 0.01f, 1.0f, 64}, + /* biDesertHills */ { 0.2f, 2.0f, 0.05f, 5.0f, 0.01f, 4.0f, 75}, + /* biForestHills */ { 0.2f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 80}, + /* biTaigaHills */ { 0.2f, 2.0f, 0.05f, 12.0f, 0.01f, 10.0f, 80}, + /* biExtremeHillsEdge */ { 0.2f, 3.0f, 0.05f, 16.0f, 0.01f, 12.0f, 80}, + /* biJungle */ { 0.1f, 3.0f, 0.05f, 6.0f, 0.01f, 6.0f, 70}, + /* biJungleHills */ { 0.2f, 3.0f, 0.05f, 12.0f, 0.01f, 10.0f, 80}, +} ; + + + + + +void cHeiGenBiomal::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) +{ + // Generate a 3x3 chunk area of biomes around this chunk: + BiomeNeighbors Biomes; + for (int z = -1; z <= 1; z++) + { + for (int x = -1; x <= 1; x++) + { + m_BiomeGen.GenBiomes(a_ChunkX + x, a_ChunkZ + z, Biomes[x + 1][z + 1]); + } // for x + } // for z + + /* + _X 2013_04_22: + There's no point in precalculating the entire perlin noise arrays, too many values are calculated uselessly, + resulting in speed DEcrease. + */ + + //* + // Linearly interpolate 4x4 blocks of heightmap: + // Must be done on a floating point datatype, else the results are ugly! + const int STEPZ = 4; // Must be a divisor of 16 + const int STEPX = 4; // Must be a divisor of 16 + NOISE_DATATYPE Height[17 * 17]; + for (int z = 0; z < 17; z += STEPZ) + { + for (int x = 0; x < 17; x += STEPX) + { + Height[x + 17 * z] = GetHeightAt(x, z, a_ChunkX, a_ChunkZ, Biomes); + } + } + LinearUpscale2DArrayInPlace(Height, 17, 17, STEPX, STEPZ); + + // Copy into the heightmap + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + cChunkDef::SetHeight(a_HeightMap, x, z, (int)Height[x + 17 * z]); + } + } + //*/ + + /* + // For each height, go through neighboring biomes and add up their idea of height: + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + cChunkDef::SetHeight(a_HeightMap, x, z, GetHeightAt(x, z, a_ChunkX, a_ChunkZ, Biomes)); + } // for x + } + //*/ +} + + + + + +void cHeiGenBiomal::InitializeHeightGen(cIniFile & a_IniFile) +{ + // No user-settable params +} + + + + + +NOISE_DATATYPE cHeiGenBiomal::GetHeightAt(int a_RelX, int a_RelZ, int a_ChunkX, int a_ChunkZ, const cHeiGenBiomal::BiomeNeighbors & a_BiomeNeighbors) +{ + // Sum up how many biomes of each type there are in the neighborhood: + int BiomeCounts[biNumBiomes]; + memset(BiomeCounts, 0, sizeof(BiomeCounts)); + int Sum = 0; + for (int z = -8; z <= 8; z++) + { + int FinalZ = a_RelZ + z + cChunkDef::Width; + int IdxZ = FinalZ / cChunkDef::Width; + int ModZ = FinalZ % cChunkDef::Width; + int WeightZ = 9 - abs(z); + for (int x = -8; x <= 8; x++) + { + int FinalX = a_RelX + x + cChunkDef::Width; + int IdxX = FinalX / cChunkDef::Width; + int ModX = FinalX % cChunkDef::Width; + EMCSBiome Biome = cChunkDef::GetBiome(a_BiomeNeighbors[IdxX][IdxZ], ModX, ModZ); + if ((Biome < 0) || (Biome >= ARRAYCOUNT(BiomeCounts))) + { + continue; + } + int WeightX = 9 - abs(x); + BiomeCounts[Biome] += WeightX + WeightZ; + Sum += WeightX + WeightZ; + } // for x + } // for z + + // For each biome type that has a nonzero count, calc its height and add it: + if (Sum > 0) + { + NOISE_DATATYPE Height = 0; + int BlockX = a_ChunkX * cChunkDef::Width + a_RelX; + int BlockZ = a_ChunkZ * cChunkDef::Width + a_RelZ; + for (int i = 0; i < ARRAYCOUNT(BiomeCounts); i++) + { + if (BiomeCounts[i] == 0) + { + continue; + } + NOISE_DATATYPE oct1 = m_Noise.CubicNoise2D(BlockX * m_GenParam[i].m_HeightFreq1, BlockZ * m_GenParam[i].m_HeightFreq1) * m_GenParam[i].m_HeightAmp1; + NOISE_DATATYPE oct2 = m_Noise.CubicNoise2D(BlockX * m_GenParam[i].m_HeightFreq2, BlockZ * m_GenParam[i].m_HeightFreq2) * m_GenParam[i].m_HeightAmp2; + NOISE_DATATYPE oct3 = m_Noise.CubicNoise2D(BlockX * m_GenParam[i].m_HeightFreq3, BlockZ * m_GenParam[i].m_HeightFreq3) * m_GenParam[i].m_HeightAmp3; + Height += BiomeCounts[i] * (m_GenParam[i].m_BaseHeight + oct1 + oct2 + oct3); + } + NOISE_DATATYPE res = Height / Sum; + return std::min((NOISE_DATATYPE)250, std::max(res, (NOISE_DATATYPE)5)); + } + + // No known biome around? Weird. Return a bogus value: + ASSERT(!"cHeiGenBiomal: Biome sum failed, no known biome around"); + return 5; +} + + + + + diff --git a/source/Generating/HeiGen.h b/src/Generating/HeiGen.h index 1b246c70a..1b246c70a 100644 --- a/source/Generating/HeiGen.h +++ b/src/Generating/HeiGen.h diff --git a/source/Generating/MineShafts.cpp b/src/Generating/MineShafts.cpp index f42240e55..f42240e55 100644 --- a/source/Generating/MineShafts.cpp +++ b/src/Generating/MineShafts.cpp diff --git a/source/Generating/MineShafts.h b/src/Generating/MineShafts.h index c53d3bc53..c53d3bc53 100644 --- a/source/Generating/MineShafts.h +++ b/src/Generating/MineShafts.h diff --git a/src/Generating/Noise3DGenerator.cpp b/src/Generating/Noise3DGenerator.cpp new file mode 100644 index 000000000..0c68957c0 --- /dev/null +++ b/src/Generating/Noise3DGenerator.cpp @@ -0,0 +1,576 @@ + +// Nosie3DGenerator.cpp + +// Generates terrain using 3D noise, rather than composing. Is a test. + +#include "Globals.h" +#include "Noise3DGenerator.h" +#include "../OSSupport/File.h" +#include "inifile/iniFile.h" +#include "../LinearInterpolation.h" +#include "../LinearUpscale.h" + + + + + +/* +// Perform an automatic test of upscaling upon program start (use breakpoints to debug): + +class Test +{ +public: + Test(void) + { + DoTest1(); + DoTest2(); + } + + + void DoTest1(void) + { + float In[3 * 3 * 3]; + for (int i = 0; i < ARRAYCOUNT(In); i++) + { + In[i] = (float)(i % 5); + } + Debug3DNoise(In, 3, 3, 3, "Upscale3D in"); + float Out[17 * 33 * 35]; + LinearUpscale3DArray(In, 3, 3, 3, Out, 8, 16, 17); + Debug3DNoise(Out, 17, 33, 35, "Upscale3D test"); + } + + + void DoTest2(void) + { + float In[3 * 3]; + for (int i = 0; i < ARRAYCOUNT(In); i++) + { + In[i] = (float)(i % 5); + } + Debug2DNoise(In, 3, 3, "Upscale2D in"); + float Out[17 * 33]; + LinearUpscale2DArray(In, 3, 3, Out, 8, 16); + Debug2DNoise(Out, 17, 33, "Upscale2D test"); + } + +} gTest; +//*/ + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cNoise3DGenerator: + +cNoise3DGenerator::cNoise3DGenerator(cChunkGenerator & a_ChunkGenerator) : + super(a_ChunkGenerator), + m_Perlin(1000), + m_Cubic(1000) +{ + m_Perlin.AddOctave(1, (NOISE_DATATYPE)0.5); + m_Perlin.AddOctave((NOISE_DATATYPE)0.5, 1); + m_Perlin.AddOctave((NOISE_DATATYPE)0.5, 2); + + #if 0 + // DEBUG: Test the noise generation: + // NOTE: In order to be able to run MCS with this code, you need to increase the default thread stack size + // In MSVC, it is done in Project Settings -> Configuration Properties -> Linker -> System, set Stack reserve size to at least 64M + m_SeaLevel = 62; + m_HeightAmplification = 0; + m_MidPoint = 75; + m_FrequencyX = 4; + m_FrequencyY = 4; + m_FrequencyZ = 4; + m_AirThreshold = 0.5; + + const int NumChunks = 4; + NOISE_DATATYPE Noise[NumChunks][cChunkDef::Width * cChunkDef::Width * cChunkDef::Height]; + for (int x = 0; x < NumChunks; x++) + { + GenerateNoiseArray(x, 5, Noise[x]); + } + + // Save in XY cuts: + cFile f1; + if (f1.Open("Test_XY.grab", cFile::fmWrite)) + { + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int y = 0; y < cChunkDef::Height; y++) + { + for (int i = 0; i < NumChunks; i++) + { + int idx = y * cChunkDef::Width + z * cChunkDef::Width * cChunkDef::Height; + unsigned char buf[cChunkDef::Width]; + for (int x = 0; x < cChunkDef::Width; x++) + { + buf[x] = (unsigned char)(std::min(256, std::max(0, (int)(128 + 32 * Noise[i][idx++])))); + } + f1.Write(buf, cChunkDef::Width); + } + } // for y + } // for z + } // if (XY file open) + + cFile f2; + if (f2.Open("Test_XZ.grab", cFile::fmWrite)) + { + for (int y = 0; y < cChunkDef::Height; y++) + { + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int i = 0; i < NumChunks; i++) + { + int idx = y * cChunkDef::Width + z * cChunkDef::Width * cChunkDef::Height; + unsigned char buf[cChunkDef::Width]; + for (int x = 0; x < cChunkDef::Width; x++) + { + buf[x] = (unsigned char)(std::min(256, std::max(0, (int)(128 + 32 * Noise[i][idx++])))); + } + f2.Write(buf, cChunkDef::Width); + } + } // for z + } // for y + } // if (XZ file open) + #endif // 0 +} + + + + + +cNoise3DGenerator::~cNoise3DGenerator() +{ + // Nothing needed yet +} + + + + + +void cNoise3DGenerator::Initialize(cWorld * a_World, cIniFile & a_IniFile) +{ + m_World = a_World; + + // Params: + m_SeaLevel = a_IniFile.GetValueSetI("Generator", "Noise3DSeaLevel", 62); + m_HeightAmplification = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DHeightAmplification", 0); + m_MidPoint = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DMidPoint", 75); + m_FrequencyX = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DFrequencyX", 8); + m_FrequencyY = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DFrequencyY", 8); + m_FrequencyZ = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DFrequencyZ", 8); + m_AirThreshold = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DAirThreshold", 0.5); +} + + + + + +void cNoise3DGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap) +{ + for (unsigned int i = 0; i < ARRAYCOUNT(a_BiomeMap); i++) + { + a_BiomeMap[i] = biExtremeHills; + } +} + + + + + +void cNoise3DGenerator::DoGenerate(int a_ChunkX, int a_ChunkZ, cChunkDesc & a_ChunkDesc) +{ + NOISE_DATATYPE Noise[17 * 257 * 17]; + GenerateNoiseArray(a_ChunkX, a_ChunkZ, Noise); + + // Output noise into chunk: + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int y = 0; y < cChunkDef::Height; y++) + { + int idx = z * 17 * 257 + y * 17; + for (int x = 0; x < cChunkDef::Width; x++) + { + NOISE_DATATYPE n = Noise[idx++]; + BLOCKTYPE BlockType; + if (n > m_AirThreshold) + { + BlockType = (y > m_SeaLevel) ? E_BLOCK_AIR : E_BLOCK_STATIONARY_WATER; + } + else + { + BlockType = E_BLOCK_STONE; + } + a_ChunkDesc.SetBlockType(x, y, z, BlockType); + } + } + } + + UpdateHeightmap(a_ChunkDesc); + ComposeTerrain (a_ChunkDesc); +} + + + + + +void cNoise3DGenerator::GenerateNoiseArray(int a_ChunkX, int a_ChunkZ, NOISE_DATATYPE * a_OutNoise) +{ + NOISE_DATATYPE NoiseO[DIM_X * DIM_Y * DIM_Z]; // Output for the Perlin noise + NOISE_DATATYPE NoiseW[DIM_X * DIM_Y * DIM_Z]; // Workspace that the noise calculation can use and trash + + // Our noise array has different layout, XZY, instead of regular chunk's XYZ, that's why the coords are "renamed" + NOISE_DATATYPE StartX = ((NOISE_DATATYPE)(a_ChunkX * cChunkDef::Width)) / m_FrequencyX; + NOISE_DATATYPE EndX = ((NOISE_DATATYPE)((a_ChunkX + 1) * cChunkDef::Width) - 1) / m_FrequencyX; + NOISE_DATATYPE StartZ = ((NOISE_DATATYPE)(a_ChunkZ * cChunkDef::Width)) / m_FrequencyZ; + NOISE_DATATYPE EndZ = ((NOISE_DATATYPE)((a_ChunkZ + 1) * cChunkDef::Width) - 1) / m_FrequencyZ; + NOISE_DATATYPE StartY = 0; + NOISE_DATATYPE EndY = ((NOISE_DATATYPE)256) / m_FrequencyY; + + m_Perlin.Generate3D(NoiseO, DIM_X, DIM_Y, DIM_Z, StartX, EndX, StartY, EndY, StartZ, EndZ, NoiseW); + + // DEBUG: Debug3DNoise(NoiseO, DIM_X, DIM_Y, DIM_Z, Printf("Chunk_%d_%d_orig", a_ChunkX, a_ChunkZ)); + + // Precalculate a "height" array: + NOISE_DATATYPE Height[DIM_X * DIM_Z]; // Output for the cubic noise heightmap ("source") + m_Cubic.Generate2D(Height, DIM_X, DIM_Z, StartX / 25, EndX / 25, StartZ / 25, EndZ / 25); + for (unsigned int i = 0; i < ARRAYCOUNT(Height); i++) + { + Height[i] = abs(Height[i]) * m_HeightAmplification + 1; + } + + // Modify the noise by height data: + for (int y = 0; y < DIM_Y; y++) + { + NOISE_DATATYPE AddHeight = (y * UPSCALE_Y - m_MidPoint) / 20; + AddHeight *= AddHeight * AddHeight; + for (int z = 0; z < DIM_Z; z++) + { + NOISE_DATATYPE * CurRow = &(NoiseO[y * DIM_X + z * DIM_X * DIM_Y]); + for (int x = 0; x < DIM_X; x++) + { + CurRow[x] += AddHeight / Height[x + DIM_X * z]; + } + } + } + + // DEBUG: Debug3DNoise(NoiseO, DIM_X, DIM_Y, DIM_Z, Printf("Chunk_%d_%d_hei", a_ChunkX, a_ChunkZ)); + + // Upscale the Perlin noise into full-blown chunk dimensions: + LinearUpscale3DArray( + NoiseO, DIM_X, DIM_Y, DIM_Z, + a_OutNoise, UPSCALE_X, UPSCALE_Y, UPSCALE_Z + ); + + // DEBUG: Debug3DNoise(a_OutNoise, 17, 257, 17, Printf("Chunk_%d_%d_lerp", a_ChunkX, a_ChunkZ)); +} + + + + + +void cNoise3DGenerator::UpdateHeightmap(cChunkDesc & a_ChunkDesc) +{ + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + for (int y = cChunkDef::Height - 1; y > 0; y--) + { + if (a_ChunkDesc.GetBlockType(x, y, z) != E_BLOCK_AIR) + { + a_ChunkDesc.SetHeight(x, z, y); + break; + } + } // for y + } // for x + } // for z +} + + + + + +void cNoise3DGenerator::ComposeTerrain(cChunkDesc & a_ChunkDesc) +{ + // Make basic terrain composition: + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + int LastAir = a_ChunkDesc.GetHeight(x, z) + 1; + bool HasHadWater = false; + for (int y = LastAir - 1; y > 0; y--) + { + switch (a_ChunkDesc.GetBlockType(x, y, z)) + { + case E_BLOCK_AIR: + { + LastAir = y; + break; + } + case E_BLOCK_STONE: + { + if (LastAir - y > 3) + { + break; + } + if (HasHadWater) + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SAND); + } + else + { + a_ChunkDesc.SetBlockType(x, y, z, (LastAir == y + 1) ? E_BLOCK_GRASS : E_BLOCK_DIRT); + } + break; + } + case E_BLOCK_STATIONARY_WATER: + { + LastAir = y; + HasHadWater = true; + break; + } + } // switch (GetBlockType()) + } // for y + a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); + } // for x + } // for z +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cNoise3DComposable: + +cNoise3DComposable::cNoise3DComposable(int a_Seed) : + m_Noise1(a_Seed + 1000), + m_Noise2(a_Seed + 2000), + m_Noise3(a_Seed + 3000) +{ +} + + + + + +void cNoise3DComposable::Initialize(cIniFile & a_IniFile) +{ + // Params: + m_SeaLevel = a_IniFile.GetValueSetI("Generator", "Noise3DSeaLevel", 62); + m_HeightAmplification = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DHeightAmplification", 0); + m_MidPoint = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DMidPoint", 75); + m_FrequencyX = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DFrequencyX", 10); + m_FrequencyY = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DFrequencyY", 10); + m_FrequencyZ = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DFrequencyZ", 10); + m_AirThreshold = (NOISE_DATATYPE)a_IniFile.GetValueSetF("Generator", "Noise3DAirThreshold", 0.5); +} + + + + + +void cNoise3DComposable::GenerateNoiseArrayIfNeeded(int a_ChunkX, int a_ChunkZ) +{ + if ((a_ChunkX == m_LastChunkX) && (a_ChunkZ == m_LastChunkZ)) + { + // The noise for this chunk is already generated in m_Noise + return; + } + m_LastChunkX = a_ChunkX; + m_LastChunkZ = a_ChunkZ; + + // Upscaling parameters: + const int UPSCALE_X = 8; + const int UPSCALE_Y = 4; + const int UPSCALE_Z = 8; + + // Precalculate a "height" array: + NOISE_DATATYPE Height[17 * 17]; // x + 17 * z + for (int z = 0; z < 17; z += UPSCALE_Z) + { + NOISE_DATATYPE NoiseZ = ((NOISE_DATATYPE)(a_ChunkZ * cChunkDef::Width + z)) / m_FrequencyZ; + for (int x = 0; x < 17; x += UPSCALE_X) + { + NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(a_ChunkX * cChunkDef::Width + x)) / m_FrequencyX; + NOISE_DATATYPE val = abs(m_Noise1.CubicNoise2D(NoiseX / 5, NoiseZ / 5)) * m_HeightAmplification + 1; + Height[x + 17 * z] = val * val * val; + } + } + + for (int y = 0; y < 257; y += UPSCALE_Y) + { + NOISE_DATATYPE NoiseY = ((NOISE_DATATYPE)y) / m_FrequencyY; + NOISE_DATATYPE AddHeight = (y - m_MidPoint) / 20; + AddHeight *= AddHeight * AddHeight; + NOISE_DATATYPE * CurFloor = &(m_NoiseArray[y * 17 * 17]); + for (int z = 0; z < 17; z += UPSCALE_Z) + { + NOISE_DATATYPE NoiseZ = ((NOISE_DATATYPE)(a_ChunkZ * cChunkDef::Width + z)) / m_FrequencyZ; + for (int x = 0; x < 17; x += UPSCALE_X) + { + NOISE_DATATYPE NoiseX = ((NOISE_DATATYPE)(a_ChunkX * cChunkDef::Width + x)) / m_FrequencyX; + CurFloor[x + 17 * z] = + m_Noise1.CubicNoise3D(NoiseX, NoiseY, NoiseZ) * (NOISE_DATATYPE)0.5 + + m_Noise2.CubicNoise3D(NoiseX / 2, NoiseY / 2, NoiseZ / 2) + + m_Noise3.CubicNoise3D(NoiseX / 4, NoiseY / 4, NoiseZ / 4) * 2 + + AddHeight / Height[x + 17 * z]; + } + } + // Linear-interpolate this XZ floor: + LinearUpscale2DArrayInPlace(CurFloor, 17, 17, UPSCALE_X, UPSCALE_Z); + } + + // Finish the 3D linear interpolation by interpolating between each XZ-floors on the Y axis + for (int y = 1; y < cChunkDef::Height; y++) + { + if ((y % UPSCALE_Y) == 0) + { + // This is the interpolation source floor, already calculated + continue; + } + int LoFloorY = (y / UPSCALE_Y) * UPSCALE_Y; + int HiFloorY = LoFloorY + UPSCALE_Y; + NOISE_DATATYPE * LoFloor = &(m_NoiseArray[LoFloorY * 17 * 17]); + NOISE_DATATYPE * HiFloor = &(m_NoiseArray[HiFloorY * 17 * 17]); + NOISE_DATATYPE * CurFloor = &(m_NoiseArray[y * 17 * 17]); + NOISE_DATATYPE Ratio = ((NOISE_DATATYPE)(y % UPSCALE_Y)) / UPSCALE_Y; + int idx = 0; + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + CurFloor[idx] = LoFloor[idx] + (HiFloor[idx] - LoFloor[idx]) * Ratio; + idx += 1; + } + idx += 1; // Skipping one X column + } + } + + // The noise array is now fully interpolated + /* + // DEBUG: Output two images of the array, sliced by XY and XZ: + cFile f1; + if (f1.Open(Printf("Chunk_%d_%d_XY.raw", a_ChunkX, a_ChunkZ), cFile::fmWrite)) + { + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int y = 0; y < cChunkDef::Height; y++) + { + int idx = y * 17 * 17 + z * 17; + unsigned char buf[16]; + for (int x = 0; x < cChunkDef::Width; x++) + { + buf[x] = (unsigned char)(std::min(256, std::max(0, (int)(128 + 128 * m_Noise[idx++])))); + } + f1.Write(buf, 16); + } // for y + } // for z + } // if (XY file open) + + cFile f2; + if (f2.Open(Printf("Chunk_%d_%d_XZ.raw", a_ChunkX, a_ChunkZ), cFile::fmWrite)) + { + for (int y = 0; y < cChunkDef::Height; y++) + { + for (int z = 0; z < cChunkDef::Width; z++) + { + int idx = y * 17 * 17 + z * 17; + unsigned char buf[16]; + for (int x = 0; x < cChunkDef::Width; x++) + { + buf[x] = (unsigned char)(std::min(256, std::max(0, (int)(128 + 128 * m_Noise[idx++])))); + } + f2.Write(buf, 16); + } // for z + } // for y + } // if (XZ file open) + */ +} + + + + + +void cNoise3DComposable::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) +{ + GenerateNoiseArrayIfNeeded(a_ChunkX, a_ChunkZ); + + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + cChunkDef::SetHeight(a_HeightMap, x, z, m_SeaLevel); + for (int y = cChunkDef::Height - 1; y > m_SeaLevel; y--) + { + if (m_NoiseArray[y * 17 * 17 + z * 17 + x] <= m_AirThreshold) + { + cChunkDef::SetHeight(a_HeightMap, x, z, y); + break; + } + } // for y + } // for x + } // for z +} + + + + + +void cNoise3DComposable::ComposeTerrain(cChunkDesc & a_ChunkDesc) +{ + GenerateNoiseArrayIfNeeded(a_ChunkDesc.GetChunkX(), a_ChunkDesc.GetChunkZ()); + + a_ChunkDesc.FillBlocks(E_BLOCK_AIR, 0); + + // Make basic terrain composition: + for (int z = 0; z < cChunkDef::Width; z++) + { + for (int x = 0; x < cChunkDef::Width; x++) + { + int LastAir = a_ChunkDesc.GetHeight(x, z) + 1; + bool HasHadWater = false; + for (int y = LastAir; y < m_SeaLevel; y++) + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_STATIONARY_WATER); + } + for (int y = LastAir - 1; y > 0; y--) + { + if (m_NoiseArray[x + 17 * z + 17 * 17 * y] > m_AirThreshold) + { + // "air" part + LastAir = y; + if (y < m_SeaLevel) + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_STATIONARY_WATER); + HasHadWater = true; + } + continue; + } + // "ground" part: + if (LastAir - y > 4) + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_STONE); + continue; + } + if (HasHadWater) + { + a_ChunkDesc.SetBlockType(x, y, z, E_BLOCK_SAND); + } + else + { + a_ChunkDesc.SetBlockType(x, y, z, (LastAir == y + 1) ? E_BLOCK_GRASS : E_BLOCK_DIRT); + } + } // for y + a_ChunkDesc.SetBlockType(x, 0, z, E_BLOCK_BEDROCK); + } // for x + } // for z +} + + + + diff --git a/source/Generating/Noise3DGenerator.h b/src/Generating/Noise3DGenerator.h index 0d211cddc..0d211cddc 100644 --- a/source/Generating/Noise3DGenerator.h +++ b/src/Generating/Noise3DGenerator.h diff --git a/source/Generating/Ravines.cpp b/src/Generating/Ravines.cpp index 6413b963b..6413b963b 100644 --- a/source/Generating/Ravines.cpp +++ b/src/Generating/Ravines.cpp diff --git a/source/Generating/Ravines.h b/src/Generating/Ravines.h index 05164a5b2..05164a5b2 100644 --- a/source/Generating/Ravines.h +++ b/src/Generating/Ravines.h diff --git a/source/Generating/StructGen.cpp b/src/Generating/StructGen.cpp index 2180261aa..2180261aa 100644 --- a/source/Generating/StructGen.cpp +++ b/src/Generating/StructGen.cpp diff --git a/source/Generating/StructGen.h b/src/Generating/StructGen.h index 853748bb8..853748bb8 100644 --- a/source/Generating/StructGen.h +++ b/src/Generating/StructGen.h diff --git a/source/Generating/Trees.cpp b/src/Generating/Trees.cpp index 7ca30c60f..7ca30c60f 100644 --- a/source/Generating/Trees.cpp +++ b/src/Generating/Trees.cpp diff --git a/source/Generating/Trees.h b/src/Generating/Trees.h index f5148ad6f..f5148ad6f 100644 --- a/source/Generating/Trees.h +++ b/src/Generating/Trees.h diff --git a/source/Globals.cpp b/src/Globals.cpp index 13c6ae709..13c6ae709 100644 --- a/source/Globals.cpp +++ b/src/Globals.cpp diff --git a/source/Globals.h b/src/Globals.h index ef79e4cf1..ef79e4cf1 100644 --- a/source/Globals.h +++ b/src/Globals.h diff --git a/source/Group.cpp b/src/Group.cpp index 448d29d87..448d29d87 100644 --- a/source/Group.cpp +++ b/src/Group.cpp diff --git a/source/Group.h b/src/Group.h index 65ee1a60a..65ee1a60a 100644 --- a/source/Group.h +++ b/src/Group.h diff --git a/src/GroupManager.cpp b/src/GroupManager.cpp new file mode 100644 index 000000000..df609f05b --- /dev/null +++ b/src/GroupManager.cpp @@ -0,0 +1,122 @@ +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "GroupManager.h" +#include "Group.h" +#include "inifile/iniFile.h" +#include "ChatColor.h" +#include "Root.h" + + + + + +typedef std::map< AString, cGroup* > GroupMap; + + + + + +struct cGroupManager::sGroupManagerState +{ + GroupMap Groups; +}; + + + + + +cGroupManager::~cGroupManager() +{ + for( GroupMap::iterator itr = m_pState->Groups.begin(); itr != m_pState->Groups.end(); ++itr ) + { + delete itr->second; + } + m_pState->Groups.clear(); + + delete m_pState; +} + + + + + +cGroupManager::cGroupManager() + : m_pState( new sGroupManagerState ) +{ + LOGD("-- Loading Groups --"); + cIniFile IniFile; + if (!IniFile.ReadFile("groups.ini")) + { + LOGWARNING("groups.ini inaccessible, no groups are defined"); + return; + } + + unsigned int NumKeys = IniFile.GetNumKeys(); + for( unsigned int i = 0; i < NumKeys; i++ ) + { + std::string KeyName = IniFile.GetKeyName( i ); + cGroup* Group = GetGroup( KeyName.c_str() ); + + LOGD("Loading group: %s", KeyName.c_str() ); + + Group->SetName( KeyName ); + char Color = IniFile.GetValue( KeyName, "Color", "-" )[0]; + if( Color != '-' ) + Group->SetColor( cChatColor::MakeColor(Color) ); + else + Group->SetColor( cChatColor::White ); + + std::string Commands = IniFile.GetValue( KeyName, "Commands", "" ); + if( Commands.size() > 0 ) + { + AStringVector Split = StringSplit( Commands, "," ); + for( unsigned int i = 0; i < Split.size(); i++) + { + Group->AddCommand( Split[i] ); + } + } + + std::string Permissions = IniFile.GetValue( KeyName, "Permissions", "" ); + if( Permissions.size() > 0 ) + { + AStringVector Split = StringSplit( Permissions, "," ); + for( unsigned int i = 0; i < Split.size(); i++) + { + Group->AddPermission( Split[i] ); + } + } + + std::string Groups = IniFile.GetValue( KeyName, "Inherits", "" ); + if( Groups.size() > 0 ) + { + AStringVector Split = StringSplit( Groups, "," ); + for( unsigned int i = 0; i < Split.size(); i++) + { + Group->InheritFrom( GetGroup( Split[i].c_str() ) ); + } + } + } + LOGD("-- Groups Successfully Loaded --"); +} + + + + + +cGroup* cGroupManager::GetGroup( const AString & a_Name ) +{ + GroupMap::iterator itr = m_pState->Groups.find( a_Name ); + if( itr != m_pState->Groups.end() ) + { + return itr->second; + } + + cGroup* Group = new cGroup(); + m_pState->Groups[a_Name] = Group; + + return Group; +} + + + + diff --git a/source/GroupManager.h b/src/GroupManager.h index d911f976c..d911f976c 100644 --- a/source/GroupManager.h +++ b/src/GroupManager.h diff --git a/source/HTTPServer/EnvelopeParser.cpp b/src/HTTPServer/EnvelopeParser.cpp index 8dbe05f14..8dbe05f14 100644 --- a/source/HTTPServer/EnvelopeParser.cpp +++ b/src/HTTPServer/EnvelopeParser.cpp diff --git a/source/HTTPServer/EnvelopeParser.h b/src/HTTPServer/EnvelopeParser.h index 6430fbebf..6430fbebf 100644 --- a/source/HTTPServer/EnvelopeParser.h +++ b/src/HTTPServer/EnvelopeParser.h diff --git a/source/HTTPServer/HTTPConnection.cpp b/src/HTTPServer/HTTPConnection.cpp index 68afdfc11..68afdfc11 100644 --- a/source/HTTPServer/HTTPConnection.cpp +++ b/src/HTTPServer/HTTPConnection.cpp diff --git a/source/HTTPServer/HTTPConnection.h b/src/HTTPServer/HTTPConnection.h index 14603bb70..14603bb70 100644 --- a/source/HTTPServer/HTTPConnection.h +++ b/src/HTTPServer/HTTPConnection.h diff --git a/source/HTTPServer/HTTPFormParser.cpp b/src/HTTPServer/HTTPFormParser.cpp index 596db424e..596db424e 100644 --- a/source/HTTPServer/HTTPFormParser.cpp +++ b/src/HTTPServer/HTTPFormParser.cpp diff --git a/source/HTTPServer/HTTPFormParser.h b/src/HTTPServer/HTTPFormParser.h index a554ca5a4..a554ca5a4 100644 --- a/source/HTTPServer/HTTPFormParser.h +++ b/src/HTTPServer/HTTPFormParser.h diff --git a/source/HTTPServer/HTTPMessage.cpp b/src/HTTPServer/HTTPMessage.cpp index ab23866e6..ab23866e6 100644 --- a/source/HTTPServer/HTTPMessage.cpp +++ b/src/HTTPServer/HTTPMessage.cpp diff --git a/source/HTTPServer/HTTPMessage.h b/src/HTTPServer/HTTPMessage.h index f5284c535..f5284c535 100644 --- a/source/HTTPServer/HTTPMessage.h +++ b/src/HTTPServer/HTTPMessage.h diff --git a/source/HTTPServer/HTTPServer.cpp b/src/HTTPServer/HTTPServer.cpp index f6f5b0f8b..f6f5b0f8b 100644 --- a/source/HTTPServer/HTTPServer.cpp +++ b/src/HTTPServer/HTTPServer.cpp diff --git a/src/HTTPServer/HTTPServer.h b/src/HTTPServer/HTTPServer.h new file mode 100644 index 000000000..24baf8c95 --- /dev/null +++ b/src/HTTPServer/HTTPServer.h @@ -0,0 +1,101 @@ + +// HTTPServer.h + +// Declares the cHTTPServer class representing a HTTP webserver that uses cListenThread and cSocketThreads for processing + + + + + +#pragma once + +#include "../OSSupport/ListenThread.h" +#include "../OSSupport/SocketThreads.h" +#include "inifile/iniFile.h" + + + + + +// fwd: +class cHTTPMessage; +class cHTTPRequest; +class cHTTPResponse; +class cHTTPConnection; + +typedef std::vector<cHTTPConnection *> cHTTPConnections; + + + + + + +class cHTTPServer : + public cListenThread::cCallback +{ +public: + class cCallbacks + { + public: + /** Called when a new request arrives over a connection and its headers have been parsed. + The request body needn't have arrived yet. + */ + virtual void OnRequestBegun(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) = 0; + + /// Called when another part of request body has arrived. + virtual void OnRequestBody(cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, int a_Size) = 0; + + /// Called when the request body has been fully received in previous calls to OnRequestBody() + virtual void OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) = 0; + } ; + + cHTTPServer(void); + ~cHTTPServer(); + + /// Initializes the server on the specified ports + bool Initialize(const AString & a_PortsIPv4, const AString & a_PortsIPv6); + + /// Starts the server and assigns the callbacks to use for incoming requests + bool Start(cCallbacks & a_Callbacks); + + /// Stops the server, drops all current connections + void Stop(void); + +protected: + friend class cHTTPConnection; + + cListenThread m_ListenThreadIPv4; + cListenThread m_ListenThreadIPv6; + + cSocketThreads m_SocketThreads; + + cCriticalSection m_CSConnections; + cHTTPConnections m_Connections; ///< All the connections that are currently being serviced + + /// The callbacks to call for various events + cCallbacks * m_Callbacks; + + + // cListenThread::cCallback overrides: + virtual void OnConnectionAccepted(cSocket & a_Socket) override; + + /// Called by cHTTPConnection to close the connection (presumably due to an error) + void CloseConnection(cHTTPConnection & a_Connection); + + /// Called by cHTTPConnection to notify SocketThreads that there's data to be sent for the connection + void NotifyConnectionWrite(cHTTPConnection & a_Connection); + + /// Called by cHTTPConnection when it finishes parsing the request header + void NewRequest(cHTTPConnection & a_Connection, cHTTPRequest & a_Request); + + /// Called by cHTTPConenction when it receives more data for the request body + void RequestBody(cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, int a_Size); + + /// Called by cHTTPConnection when it detects that the request has finished (all of its body has been received) + void RequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request); +} ; + + + + + diff --git a/source/HTTPServer/MultipartParser.cpp b/src/HTTPServer/MultipartParser.cpp index b49f6ec07..b49f6ec07 100644 --- a/source/HTTPServer/MultipartParser.cpp +++ b/src/HTTPServer/MultipartParser.cpp diff --git a/source/HTTPServer/MultipartParser.h b/src/HTTPServer/MultipartParser.h index d853929ed..d853929ed 100644 --- a/source/HTTPServer/MultipartParser.h +++ b/src/HTTPServer/MultipartParser.h diff --git a/source/HTTPServer/NameValueParser.cpp b/src/HTTPServer/NameValueParser.cpp index a27f07d19..a27f07d19 100644 --- a/source/HTTPServer/NameValueParser.cpp +++ b/src/HTTPServer/NameValueParser.cpp diff --git a/source/HTTPServer/NameValueParser.h b/src/HTTPServer/NameValueParser.h index 07dc0b942..07dc0b942 100644 --- a/source/HTTPServer/NameValueParser.h +++ b/src/HTTPServer/NameValueParser.h diff --git a/src/Inventory.cpp b/src/Inventory.cpp new file mode 100644 index 000000000..a9b4ab9c5 --- /dev/null +++ b/src/Inventory.cpp @@ -0,0 +1,682 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Inventory.h" +#include "Entities/Player.h" +#include "ClientHandle.h" +#include "UI/Window.h" +#include "Item.h" +#include "Root.h" +#include "World.h" + +#include "json/json.h" + +#include "Items/ItemHandler.h" + + + + + +cInventory::cInventory(cPlayer & a_Owner) : + m_ArmorSlots (1, 4), // 1 x 4 slots + m_InventorySlots(9, 3), // 9 x 3 slots + m_HotbarSlots (9, 1), // 9 x 1 slots + m_Owner(a_Owner) +{ + // Ask each ItemGrid to report changes to us: + m_ArmorSlots.AddListener(*this); + m_InventorySlots.AddListener(*this); + m_HotbarSlots.AddListener(*this); + + SetEquippedSlotNum(0); +} + + + + + +void cInventory::Clear(void) +{ + m_ArmorSlots.Clear(); + m_InventorySlots.Clear(); + m_HotbarSlots.Clear(); +} + + + + + +int cInventory::HowManyCanFit(const cItem & a_ItemStack, bool a_ConsiderEmptySlots) +{ + return HowManyCanFit(a_ItemStack, 0, invNumSlots - 1, a_ConsiderEmptySlots); +} + + + + + +int cInventory::HowManyCanFit(const cItem & a_ItemStack, int a_BeginSlotNum, int a_EndSlotNum, bool a_ConsiderEmptySlots) +{ + if ((a_BeginSlotNum < 0) || (a_BeginSlotNum >= invNumSlots)) + { + LOGWARNING("%s: Bad BeginSlotNum, got %d, there are %d slots; correcting to 0.", __FUNCTION__, a_BeginSlotNum, invNumSlots - 1); + a_BeginSlotNum = 0; + } + if ((a_EndSlotNum < 0) || (a_EndSlotNum >= invNumSlots)) + { + LOGWARNING("%s: Bad EndSlotNum, got %d, there are %d slots; correcting to %d.", __FUNCTION__, a_BeginSlotNum, invNumSlots, invNumSlots - 1); + a_EndSlotNum = invNumSlots - 1; + } + if (a_BeginSlotNum > a_EndSlotNum) + { + std::swap(a_BeginSlotNum, a_EndSlotNum); + } + + char NumLeft = a_ItemStack.m_ItemCount; + int MaxStack = ItemHandler(a_ItemStack.m_ItemType)->GetMaxStackSize(); + for (int i = a_BeginSlotNum; i <= a_EndSlotNum; i++) + { + const cItem & Slot = GetSlot(i); + if (Slot.IsEmpty()) + { + NumLeft -= MaxStack; + } + else if (Slot.IsStackableWith(a_ItemStack)) + { + NumLeft -= MaxStack - Slot.m_ItemCount; + } + if (NumLeft <= 0) + { + // All items fit + return a_ItemStack.m_ItemCount; + } + } // for i - m_Slots[] + return a_ItemStack.m_ItemCount - NumLeft; +} + + + + + +int cInventory::AddItem(const cItem & a_Item, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst) +{ + cItem ToAdd(a_Item); + int res = 0; + if (ItemCategory::IsArmor(a_Item.m_ItemType)) + { + res = m_ArmorSlots.AddItem(ToAdd, a_AllowNewStacks); + ToAdd.m_ItemCount -= res; + if (ToAdd.m_ItemCount == 0) + { + return res; + } + } + + res += m_HotbarSlots.AddItem(ToAdd, a_AllowNewStacks, a_tryToFillEquippedFirst ? m_EquippedSlotNum : -1); + ToAdd.m_ItemCount = a_Item.m_ItemCount - res; + if (ToAdd.m_ItemCount == 0) + { + return res; + } + + res += m_InventorySlots.AddItem(ToAdd, a_AllowNewStacks); + return res; +} + + + + + +int cInventory::AddItems(cItems & a_ItemStackList, bool a_AllowNewStacks, bool a_tryToFillEquippedFirst) +{ + int TotalAdded = 0; + for (cItems::iterator itr = a_ItemStackList.begin(); itr != a_ItemStackList.end();) + { + int NumAdded = AddItem(*itr, a_AllowNewStacks, a_tryToFillEquippedFirst); + if (itr->m_ItemCount == NumAdded) + { + itr = a_ItemStackList.erase(itr); + } + else + { + itr->m_ItemCount -= NumAdded; + ++itr; + } + TotalAdded += NumAdded; + } + return TotalAdded; +} + + + + + +bool cInventory::RemoveOneEquippedItem(void) +{ + if (m_HotbarSlots.GetSlot(m_EquippedSlotNum).IsEmpty()) + { + return false; + } + + m_HotbarSlots.ChangeSlotCount(m_EquippedSlotNum, -1); + return true; +} + + + + + +int cInventory::HowManyItems(const cItem & a_Item) +{ + return + m_ArmorSlots.HowManyItems(a_Item) + + m_InventorySlots.HowManyItems(a_Item) + + m_HotbarSlots.HowManyItems(a_Item); +} + + + + + +bool cInventory::HasItems(const cItem & a_ItemStack) +{ + int CurrentlyHave = HowManyItems(a_ItemStack); + return (CurrentlyHave >= a_ItemStack.m_ItemCount); +} + + + + + +void cInventory::SetSlot(int a_SlotNum, const cItem & a_Item) +{ + if ((a_SlotNum < 0) || (a_SlotNum >= invNumSlots)) + { + LOGWARNING("%s: requesting an invalid slot index: %d out of %d. Ignoring.", __FUNCTION__, a_SlotNum, invNumSlots - 1); + return; + } + + int GridSlotNum = 0; + cItemGrid * Grid = GetGridForSlotNum(a_SlotNum, GridSlotNum); + if (Grid == NULL) + { + LOGWARNING("%s(%d): requesting an invalid itemgrid. Ignoring.", __FUNCTION__, a_SlotNum); + return; + } + Grid->SetSlot(GridSlotNum, a_Item); +} + + + + + +void cInventory::SetArmorSlot(int a_ArmorSlotNum, const cItem & a_Item) +{ + m_ArmorSlots.SetSlot(a_ArmorSlotNum, a_Item); +} + + + + + +void cInventory::SetInventorySlot(int a_InventorySlotNum, const cItem & a_Item) +{ + m_InventorySlots.SetSlot(a_InventorySlotNum, a_Item); +} + + + + + +void cInventory::SetHotbarSlot(int a_HotBarSlotNum, const cItem & a_Item) +{ + m_HotbarSlots.SetSlot(a_HotBarSlotNum, a_Item); +} + + + + + +const cItem & cInventory::GetSlot(int a_SlotNum) const +{ + if ((a_SlotNum < 0) || (a_SlotNum >= invNumSlots)) + { + LOGWARNING("%s: requesting an invalid slot index: %d out of %d. Returning the first inventory slot instead.", __FUNCTION__, a_SlotNum, invNumSlots - 1); + return m_InventorySlots.GetSlot(0); + } + int GridSlotNum = 0; + const cItemGrid * Grid = GetGridForSlotNum(a_SlotNum, GridSlotNum); + if (Grid == NULL) + { + // Something went wrong, but we don't know what. We must return a value, so return the first inventory slot + LOGWARNING("%s(%d): requesting an invalid ItemGrid, returning the first inventory slot instead.", __FUNCTION__, a_SlotNum); + return m_InventorySlots.GetSlot(0); + } + return Grid->GetSlot(GridSlotNum); +} + + + + + +const cItem & cInventory::GetArmorSlot(int a_ArmorSlotNum) const +{ + if ((a_ArmorSlotNum < 0) || (a_ArmorSlotNum >= invArmorCount)) + { + LOGWARNING("%s: requesting an invalid slot index: %d out of %d. Returning the first one instead", __FUNCTION__, a_ArmorSlotNum, invArmorCount - 1); + return m_ArmorSlots.GetSlot(0); + } + return m_ArmorSlots.GetSlot(a_ArmorSlotNum); +} + + + + + +const cItem & cInventory::GetInventorySlot(int a_InventorySlotNum) const +{ + if ((a_InventorySlotNum < 0) || (a_InventorySlotNum >= invInventoryCount)) + { + LOGWARNING("%s: requesting an invalid slot index: %d out of %d. Returning the first one instead", __FUNCTION__, a_InventorySlotNum, invInventoryCount - 1); + return m_InventorySlots.GetSlot(0); + } + return m_InventorySlots.GetSlot(a_InventorySlotNum); +} + + + + + +const cItem & cInventory::GetHotbarSlot(int a_SlotNum) const +{ + if ((a_SlotNum < 0) || (a_SlotNum >= invHotbarCount)) + { + LOGWARNING("%s: requesting an invalid slot index: %d out of %d. Returning the first one instead", __FUNCTION__, a_SlotNum, invHotbarCount - 1); + return m_HotbarSlots.GetSlot(0); + } + return m_HotbarSlots.GetSlot(a_SlotNum); +} + + + + + +const cItem & cInventory::GetEquippedItem(void) const +{ + return GetHotbarSlot(m_EquippedSlotNum); +} + + + + + +void cInventory::SetEquippedSlotNum(int a_SlotNum) +{ + if ((a_SlotNum < 0) || (a_SlotNum >= invHotbarCount)) + { + LOGWARNING("%s: requesting invalid slot index: %d out of %d. Setting 0 instead.", __FUNCTION__, a_SlotNum, invHotbarCount - 1); + m_EquippedSlotNum = 0; + } + else + { + m_EquippedSlotNum = a_SlotNum; + } +} + + + + + +bool cInventory::DamageEquippedItem(short a_Amount) +{ + return DamageItem(invHotbarOffset + m_EquippedSlotNum, a_Amount); +} + + + + + +int cInventory::ChangeSlotCount(int a_SlotNum, int a_AddToCount) +{ + int GridSlotNum = 0; + cItemGrid * Grid = GetGridForSlotNum(a_SlotNum, GridSlotNum); + if (Grid == NULL) + { + LOGWARNING("%s: invalid slot number, expected 0 .. %d, got %d; ignoring", __FUNCTION__, invNumSlots, a_SlotNum); + return -1; + } + return Grid->ChangeSlotCount(GridSlotNum, a_AddToCount); +} + + + + + +bool cInventory::DamageItem(int a_SlotNum, short a_Amount) +{ + if ((a_SlotNum < 0) || (a_SlotNum >= invNumSlots)) + { + LOGWARNING("%s: requesting an invalid slot index: %d out of %d", __FUNCTION__, a_SlotNum, invNumSlots - 1); + return false; + } + + int GridSlotNum = 0; + cItemGrid * Grid = GetGridForSlotNum(a_SlotNum, GridSlotNum); + if (Grid == NULL) + { + LOGWARNING("%s(%d, %d): requesting an invalid grid, ignoring.", __FUNCTION__, a_SlotNum, a_Amount); + return false; + } + if (!Grid->DamageItem(GridSlotNum, a_Amount)) + { + // The item has been damaged, but did not break yet + return false; + } + + // The item has broken, remove it: + Grid->EmptySlot(GridSlotNum); + return true; +} + + + + + +void cInventory::CopyToItems(cItems & a_Items) +{ + m_ArmorSlots.CopyToItems(a_Items); + m_InventorySlots.CopyToItems(a_Items); + m_HotbarSlots.CopyToItems(a_Items); +} + + + + + +void cInventory::SendSlot(int a_SlotNum) +{ + cItem Item(GetSlot(a_SlotNum)); + if (Item.IsEmpty()) + { + // Sanitize items that are not completely empty (ie. count == 0, but type != empty) + Item.Empty(); + } + m_Owner.GetClientHandle()->SendInventorySlot(0, a_SlotNum + 5, Item); // Slots in the client are numbered "+ 5" because of crafting grid and result +} + + + + + +/* +int cInventory::MoveItem(short a_ItemType, short a_ItemDamage, int a_Count, int a_BeginSlot, int a_EndSlot) +{ + int res = 0; + for (int i = a_BeginSlot; i <= a_EndSlot; i++) + { + if ( + m_Slots[i].IsEmpty() || + ((m_Slots[i].m_ItemType == a_ItemType) && (m_Slots[i].m_ItemDamage == a_ItemDamage)) + ) + { + int MaxCount = ItemHandler(a_ItemType)->GetMaxStackSize(); + ASSERT(m_Slots[i].m_ItemCount <= MaxCount); + int NumToMove = std::min(a_Count, MaxCount - m_Slots[i].m_ItemCount); + m_Slots[i].m_ItemCount += NumToMove; + m_Slots[i].m_ItemDamage = a_ItemDamage; + m_Slots[i].m_ItemType = a_ItemType; + SendSlot(i); + res += NumToMove; + a_Count -= NumToMove; + if (a_Count <= 0) + { + // No more items to distribute + return res; + } + } + } // for i - m_Slots[] + // No more space to distribute to + return res; +} +*/ + + + + + +int cInventory::ArmorSlotNumToEntityEquipmentID(short a_ArmorSlotNum) +{ + switch (a_ArmorSlotNum) + { + case 0: return 4; // Helmet + case 1: return 3; // Chestplate + case 2: return 2; // Leggings + case 3: return 1; // Boots + } + LOGWARN("%s: invalid armor slot number: %d", __FUNCTION__, a_ArmorSlotNum); + return 0; +} + + + + + +#if 0 +bool cInventory::AddToBar( cItem & a_Item, const int a_Offset, const int a_Size, bool* a_bChangedSlots, int a_Mode /* = 0 */ ) +{ + // Fill already present stacks + if( a_Mode < 2 ) + { + int MaxStackSize = cItemHandler::GetItemHandler(a_Item.m_ItemType)->GetMaxStackSize(); + for(int i = 0; i < a_Size; i++) + { + if( m_Slots[i + a_Offset].m_ItemType == a_Item.m_ItemType && m_Slots[i + a_Offset].m_ItemCount < MaxStackSize && m_Slots[i + a_Offset].m_ItemDamage == a_Item.m_ItemDamage ) + { + int NumFree = MaxStackSize - m_Slots[i + a_Offset].m_ItemCount; + if( NumFree >= a_Item.m_ItemCount ) + { + + //printf("1. Adding %i items ( free: %i )\n", a_Item.m_ItemCount, NumFree ); + m_Slots[i + a_Offset].m_ItemCount += a_Item.m_ItemCount; + a_Item.m_ItemCount = 0; + a_bChangedSlots[i + a_Offset] = true; + break; + } + else + { + //printf("2. Adding %i items\n", NumFree ); + m_Slots[i + a_Offset].m_ItemCount += (char)NumFree; + a_Item.m_ItemCount -= (char)NumFree; + a_bChangedSlots[i + a_Offset] = true; + } + } + } + } + + if( a_Mode > 0 ) + { + // If we got more left, find first empty slot + for(int i = 0; i < a_Size && a_Item.m_ItemCount > 0; i++) + { + if( m_Slots[i + a_Offset].m_ItemType == -1 ) + { + m_Slots[i + a_Offset] = a_Item; + a_Item.m_ItemCount = 0; + a_bChangedSlots[i + a_Offset] = true; + } + } + } + + return true; +} +#endif + + + + + +void cInventory::SaveToJson(Json::Value & a_Value) +{ + // The JSON originally included the 4 crafting slots and the result, so we have to put empty items there, too: + cItem EmptyItem; + Json::Value EmptyItemJson; + EmptyItem.GetJson(EmptyItemJson); + for (int i = 0; i < 5; i++) + { + a_Value.append(EmptyItemJson); + } + + // The 4 armor slots follow: + for (int i = 0; i < invArmorCount; i++) + { + Json::Value JSON_Item; + m_ArmorSlots.GetSlot(i).GetJson(JSON_Item); + a_Value.append(JSON_Item); + } + + // Next comes the main inventory: + for (int i = 0; i < invInventoryCount; i++) + { + Json::Value JSON_Item; + m_InventorySlots.GetSlot(i).GetJson(JSON_Item); + a_Value.append(JSON_Item); + } + + // The hotbar is the last: + for (int i = 0; i < invHotbarCount; i++) + { + Json::Value JSON_Item; + m_HotbarSlots.GetSlot(i).GetJson(JSON_Item); + a_Value.append(JSON_Item); + } +} + + + + + +bool cInventory::LoadFromJson(Json::Value & a_Value) +{ + int SlotIdx = 0; + + for (Json::Value::iterator itr = a_Value.begin(); itr != a_Value.end(); ++itr, SlotIdx++) + { + cItem Item; + Item.FromJson(*itr); + + // The JSON originally included the 4 crafting slots and the result slot, so we need to skip the first 5 items: + if (SlotIdx < 5) + { + continue; + } + + // If we loaded all the slots, stop now, even if the JSON has more: + if (SlotIdx - 5 >= invNumSlots) + { + break; + } + + int GridSlotNum = 0; + cItemGrid * Grid = GetGridForSlotNum(SlotIdx - 5, GridSlotNum); + ASSERT(Grid != NULL); + Grid->SetSlot(GridSlotNum, Item); + } // for itr - a_Value[] + return true; +} + + + + + +const cItemGrid * cInventory::GetGridForSlotNum(int a_SlotNum, int & a_GridSlotNum) const +{ + ASSERT(a_SlotNum >= 0); + + if (a_SlotNum < invArmorCount) + { + a_GridSlotNum = a_SlotNum; + return &m_ArmorSlots; + } + a_SlotNum -= invArmorCount; + if (a_SlotNum < invInventoryCount) + { + a_GridSlotNum = a_SlotNum; + return &m_InventorySlots; + } + a_GridSlotNum = a_SlotNum - invInventoryCount; + return &m_HotbarSlots; +} + + + + + +cItemGrid * cInventory::GetGridForSlotNum(int a_SlotNum, int & a_GridSlotNum) +{ + ASSERT(a_SlotNum >= 0); + + if (a_SlotNum < invArmorCount) + { + a_GridSlotNum = a_SlotNum; + return &m_ArmorSlots; + } + a_SlotNum -= invArmorCount; + if (a_SlotNum < invInventoryCount) + { + a_GridSlotNum = a_SlotNum; + return &m_InventorySlots; + } + a_GridSlotNum = a_SlotNum - invInventoryCount; + return &m_HotbarSlots; +} + + + + + +void cInventory::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) +{ + // Send the neccessary updates to whoever needs them + + if (m_Owner.IsDestroyed()) + { + // Owner is not (yet) valid, skip for now + return; + } + + // Armor update needs broadcast to other players: + cWorld * World = m_Owner.GetWorld(); + if ((a_ItemGrid == &m_ArmorSlots) && (World != NULL)) + { + World->BroadcastEntityEquipment( + m_Owner, ArmorSlotNumToEntityEquipmentID(a_SlotNum), + m_ArmorSlots.GetSlot(a_SlotNum), m_Owner.GetClientHandle() + ); + } + + // Convert the grid-local a_SlotNum to our global SlotNum: + int Base = 0; + if (a_ItemGrid == &m_ArmorSlots) + { + Base = invArmorOffset; + } + else if (a_ItemGrid == &m_InventorySlots) + { + Base = invInventoryOffset; + } + else if (a_ItemGrid == &m_HotbarSlots) + { + Base = invHotbarOffset; + } + else + { + ASSERT(!"Unknown ItemGrid calling OnSlotChanged()"); + return; + } + + SendSlot(Base + a_SlotNum); +} + + + + diff --git a/source/Inventory.h b/src/Inventory.h index 3c6a19de8..3c6a19de8 100644 --- a/source/Inventory.h +++ b/src/Inventory.h diff --git a/src/Item.cpp b/src/Item.cpp new file mode 100644 index 000000000..196a260ef --- /dev/null +++ b/src/Item.cpp @@ -0,0 +1,261 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Item.h" +#include "json/json.h" +#include "Items/ItemHandler.h" + + + + + +cItem cItem::CopyOne(void) const +{ + cItem res(*this); + res.m_ItemCount = 1; + return res; +} + + + + + +cItem & cItem::AddCount(char a_AmountToAdd) +{ + m_ItemCount += a_AmountToAdd; + if (m_ItemCount <= 0) + { + Empty(); + } + return *this; +} + + + + + +short cItem::GetMaxDamage(void) const +{ + switch (m_ItemType) + { + case E_ITEM_BOW: return 384; + case E_ITEM_DIAMOND_AXE: return 1563; + case E_ITEM_DIAMOND_HOE: return 1563; + case E_ITEM_DIAMOND_PICKAXE: return 1563; + case E_ITEM_DIAMOND_SHOVEL: return 1563; + case E_ITEM_DIAMOND_SWORD: return 1563; + case E_ITEM_FLINT_AND_STEEL: return 65; + case E_ITEM_GOLD_AXE: return 32; + case E_ITEM_GOLD_HOE: return 32; + case E_ITEM_GOLD_PICKAXE: return 32; + case E_ITEM_GOLD_SHOVEL: return 32; + case E_ITEM_GOLD_SWORD: return 32; + case E_ITEM_IRON_AXE: return 251; + case E_ITEM_IRON_HOE: return 251; + case E_ITEM_IRON_PICKAXE: return 251; + case E_ITEM_IRON_SHOVEL: return 251; + case E_ITEM_IRON_SWORD: return 251; + case E_ITEM_SHEARS: return 251; + case E_ITEM_STONE_AXE: return 132; + case E_ITEM_STONE_HOE: return 132; + case E_ITEM_STONE_PICKAXE: return 132; + case E_ITEM_STONE_SHOVEL: return 132; + case E_ITEM_STONE_SWORD: return 132; + case E_ITEM_WOODEN_AXE: return 60; + case E_ITEM_WOODEN_HOE: return 60; + case E_ITEM_WOODEN_PICKAXE: return 60; + case E_ITEM_WOODEN_SHOVEL: return 60; + case E_ITEM_WOODEN_SWORD: return 60; + } + return 0; +} + + + + + +bool cItem::DamageItem(short a_Amount) +{ + short MaxDamage = GetMaxDamage(); + if (MaxDamage == 0) + { + // Item doesn't have damage + return false; + } + + m_ItemDamage += a_Amount; + return (m_ItemDamage >= MaxDamage); +} + + + + + +bool cItem::IsStackableWith(const cItem & a_OtherStack) const +{ + if (a_OtherStack.m_ItemType != m_ItemType) + { + return false; + } + if (a_OtherStack.m_ItemDamage != m_ItemDamage) + { + return false; + } + if (a_OtherStack.m_Enchantments != m_Enchantments) + { + return false; + } + + return true; +} + + + + + +bool cItem::IsFullStack(void) const +{ + return (m_ItemCount >= ItemHandler(m_ItemType)->GetMaxStackSize()); +} + + + + + +char cItem::GetMaxStackSize(void) const +{ + return ItemHandler(m_ItemType)->GetMaxStackSize(); +} + + + + + +/// Returns the cItemHandler responsible for this item type +cItemHandler * cItem::GetHandler(void) const +{ + return ItemHandler(m_ItemType); +} + + + + + +void cItem::GetJson(Json::Value & a_OutValue) const +{ + a_OutValue["ID"] = m_ItemType; + if (m_ItemType > 0) + { + a_OutValue["Count"] = m_ItemCount; + a_OutValue["Health"] = m_ItemDamage; + AString Enchantments(m_Enchantments.ToString()); + if (!Enchantments.empty()) + { + a_OutValue["ench"] = Enchantments; + } + } +} + + + + + +void cItem::FromJson(const Json::Value & a_Value) +{ + m_ItemType = (ENUM_ITEM_ID)a_Value.get("ID", -1 ).asInt(); + if (m_ItemType > 0) + { + m_ItemCount = (char)a_Value.get("Count", -1 ).asInt(); + m_ItemDamage = (short)a_Value.get("Health", -1 ).asInt(); + m_Enchantments.Clear(); + m_Enchantments.AddFromString(a_Value.get("ench", "").asString()); + } +} + + + + + +bool cItem::IsEnchantable(short item) +{ + if ((item >= 256) && (item <= 259)) + return true; + if ((item >= 267) && (item <= 279)) + return true; + if ((item >= 283) && (item <= 286)) + return true; + if ((item >= 290) && (item <= 294)) + return true; + if ((item >= 298) && (item <= 317)) + return true; + if ((item >= 290) && (item <= 294)) + return true; + + if ((item == 346) || (item == 359) || (item == 261)) + return true; + + return false; +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cItems: + +cItem * cItems::Get(int a_Idx) +{ + if ((a_Idx < 0) || (a_Idx >= (int)size())) + { + LOGWARNING("cItems: Attempt to get an out-of-bounds item at index %d; there are currently %d items. Returning a nil.", a_Idx, size()); + return NULL; + } + return &at(a_Idx); +} + + + + + +void cItems::Set(int a_Idx, const cItem & a_Item) +{ + if ((a_Idx < 0) || (a_Idx >= (int)size())) + { + LOGWARNING("cItems: Attempt to set an item at an out-of-bounds index %d; there are currently %d items. Not setting.", a_Idx, size()); + return; + } + at(a_Idx) = a_Item; +} + + + + + +void cItems::Delete(int a_Idx) +{ + if ((a_Idx < 0) || (a_Idx >= (int)size())) + { + LOGWARNING("cItems: Attempt to delete an item at an out-of-bounds index %d; there are currently %d items. Ignoring.", a_Idx, size()); + return; + } + erase(begin() + a_Idx); +} + + + + + +void cItems::Set(int a_Idx, ENUM_ITEM_ID a_ItemType, char a_ItemCount, short a_ItemDamage) +{ + if ((a_Idx < 0) || (a_Idx >= (int)size())) + { + LOGWARNING("cItems: Attempt to set an item at an out-of-bounds index %d; there are currently %d items. Not setting.", a_Idx, size()); + return; + } + at(a_Idx) = cItem(a_ItemType, a_ItemCount, a_ItemDamage); +} + + + + diff --git a/source/Item.h b/src/Item.h index c60d0542c..c60d0542c 100644 --- a/source/Item.h +++ b/src/Item.h diff --git a/source/ItemGrid.cpp b/src/ItemGrid.cpp index e9b86173e..e9b86173e 100644 --- a/source/ItemGrid.cpp +++ b/src/ItemGrid.cpp diff --git a/source/ItemGrid.h b/src/ItemGrid.h index a4af523cf..a4af523cf 100644 --- a/source/ItemGrid.h +++ b/src/ItemGrid.h diff --git a/source/Items/ItemBed.h b/src/Items/ItemBed.h index ab4182eea..ab4182eea 100644 --- a/source/Items/ItemBed.h +++ b/src/Items/ItemBed.h diff --git a/source/Items/ItemBoat.h b/src/Items/ItemBoat.h index 6e3395f1d..6e3395f1d 100644 --- a/source/Items/ItemBoat.h +++ b/src/Items/ItemBoat.h diff --git a/source/Items/ItemBow.h b/src/Items/ItemBow.h index d533c21fd..d533c21fd 100644 --- a/source/Items/ItemBow.h +++ b/src/Items/ItemBow.h diff --git a/source/Items/ItemBrewingStand.h b/src/Items/ItemBrewingStand.h index 4ff14d4b4..4ff14d4b4 100644 --- a/source/Items/ItemBrewingStand.h +++ b/src/Items/ItemBrewingStand.h diff --git a/source/Items/ItemBucket.h b/src/Items/ItemBucket.h index fa3d48da1..fa3d48da1 100644 --- a/source/Items/ItemBucket.h +++ b/src/Items/ItemBucket.h diff --git a/source/Items/ItemCauldron.h b/src/Items/ItemCauldron.h index 8b2ddc29f..8b2ddc29f 100644 --- a/source/Items/ItemCauldron.h +++ b/src/Items/ItemCauldron.h diff --git a/source/Items/ItemCloth.h b/src/Items/ItemCloth.h index aca27a299..aca27a299 100644 --- a/source/Items/ItemCloth.h +++ b/src/Items/ItemCloth.h diff --git a/source/Items/ItemComparator.h b/src/Items/ItemComparator.h index 3fbb7603d..3fbb7603d 100644 --- a/source/Items/ItemComparator.h +++ b/src/Items/ItemComparator.h diff --git a/source/Items/ItemDoor.h b/src/Items/ItemDoor.h index 72ea0beed..72ea0beed 100644 --- a/source/Items/ItemDoor.h +++ b/src/Items/ItemDoor.h diff --git a/source/Items/ItemDye.h b/src/Items/ItemDye.h index 99b8d2543..99b8d2543 100644 --- a/source/Items/ItemDye.h +++ b/src/Items/ItemDye.h diff --git a/source/Items/ItemFlowerPot.h b/src/Items/ItemFlowerPot.h index befa2ff21..befa2ff21 100644 --- a/source/Items/ItemFlowerPot.h +++ b/src/Items/ItemFlowerPot.h diff --git a/source/Items/ItemFood.h b/src/Items/ItemFood.h index 2ae572331..2ae572331 100644 --- a/source/Items/ItemFood.h +++ b/src/Items/ItemFood.h diff --git a/source/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index 92ba94999..92ba94999 100644 --- a/source/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp diff --git a/source/Items/ItemHandler.h b/src/Items/ItemHandler.h index e39bb054b..e39bb054b 100644 --- a/source/Items/ItemHandler.h +++ b/src/Items/ItemHandler.h diff --git a/source/Items/ItemHoe.h b/src/Items/ItemHoe.h index 7b6b3e6ac..7b6b3e6ac 100644 --- a/source/Items/ItemHoe.h +++ b/src/Items/ItemHoe.h diff --git a/source/Items/ItemLeaves.h b/src/Items/ItemLeaves.h index 60222eaa9..60222eaa9 100644 --- a/source/Items/ItemLeaves.h +++ b/src/Items/ItemLeaves.h diff --git a/source/Items/ItemLighter.h b/src/Items/ItemLighter.h index 4281a2d0c..4281a2d0c 100644 --- a/source/Items/ItemLighter.h +++ b/src/Items/ItemLighter.h diff --git a/source/Items/ItemMinecart.h b/src/Items/ItemMinecart.h index f8eb31a49..f8eb31a49 100644 --- a/source/Items/ItemMinecart.h +++ b/src/Items/ItemMinecart.h diff --git a/source/Items/ItemPickaxe.h b/src/Items/ItemPickaxe.h index bde7f0905..bde7f0905 100644 --- a/source/Items/ItemPickaxe.h +++ b/src/Items/ItemPickaxe.h diff --git a/source/Items/ItemRedstoneDust.h b/src/Items/ItemRedstoneDust.h index b7860b187..b7860b187 100644 --- a/source/Items/ItemRedstoneDust.h +++ b/src/Items/ItemRedstoneDust.h diff --git a/source/Items/ItemRedstoneRepeater.h b/src/Items/ItemRedstoneRepeater.h index f69f24eb8..f69f24eb8 100644 --- a/source/Items/ItemRedstoneRepeater.h +++ b/src/Items/ItemRedstoneRepeater.h diff --git a/source/Items/ItemSapling.h b/src/Items/ItemSapling.h index dc0810a45..dc0810a45 100644 --- a/source/Items/ItemSapling.h +++ b/src/Items/ItemSapling.h diff --git a/source/Items/ItemSeeds.h b/src/Items/ItemSeeds.h index 8ca86663f..8ca86663f 100644 --- a/source/Items/ItemSeeds.h +++ b/src/Items/ItemSeeds.h diff --git a/source/Items/ItemShears.h b/src/Items/ItemShears.h index 6a17607ee..6a17607ee 100644 --- a/source/Items/ItemShears.h +++ b/src/Items/ItemShears.h diff --git a/source/Items/ItemShovel.h b/src/Items/ItemShovel.h index d0625ef1c..d0625ef1c 100644 --- a/source/Items/ItemShovel.h +++ b/src/Items/ItemShovel.h diff --git a/source/Items/ItemSign.h b/src/Items/ItemSign.h index 5ccd79e29..5ccd79e29 100644 --- a/source/Items/ItemSign.h +++ b/src/Items/ItemSign.h diff --git a/source/Items/ItemSpawnEgg.h b/src/Items/ItemSpawnEgg.h index 26dd15b7d..26dd15b7d 100644 --- a/source/Items/ItemSpawnEgg.h +++ b/src/Items/ItemSpawnEgg.h diff --git a/source/Items/ItemSugarcane.h b/src/Items/ItemSugarcane.h index ce93aa3e5..ce93aa3e5 100644 --- a/source/Items/ItemSugarcane.h +++ b/src/Items/ItemSugarcane.h diff --git a/source/Items/ItemSword.h b/src/Items/ItemSword.h index a7c1d2432..a7c1d2432 100644 --- a/source/Items/ItemSword.h +++ b/src/Items/ItemSword.h diff --git a/source/Items/ItemThrowable.h b/src/Items/ItemThrowable.h index fc24e775a..fc24e775a 100644 --- a/source/Items/ItemThrowable.h +++ b/src/Items/ItemThrowable.h diff --git a/source/LeakFinder.cpp b/src/LeakFinder.cpp index 0f84adb2b..0f84adb2b 100644 --- a/source/LeakFinder.cpp +++ b/src/LeakFinder.cpp diff --git a/source/LeakFinder.h b/src/LeakFinder.h index e63b9ec5d..e63b9ec5d 100644 --- a/source/LeakFinder.h +++ b/src/LeakFinder.h diff --git a/source/LightingThread.cpp b/src/LightingThread.cpp index d7e60e458..d7e60e458 100644 --- a/source/LightingThread.cpp +++ b/src/LightingThread.cpp diff --git a/source/LightingThread.h b/src/LightingThread.h index 498755025..498755025 100644 --- a/source/LightingThread.h +++ b/src/LightingThread.h diff --git a/source/LineBlockTracer.cpp b/src/LineBlockTracer.cpp index 9fcbca915..9fcbca915 100644 --- a/source/LineBlockTracer.cpp +++ b/src/LineBlockTracer.cpp diff --git a/source/LineBlockTracer.h b/src/LineBlockTracer.h index ccbb70ea6..ccbb70ea6 100644 --- a/source/LineBlockTracer.h +++ b/src/LineBlockTracer.h diff --git a/source/LinearInterpolation.cpp b/src/LinearInterpolation.cpp index d4975418b..d4975418b 100644 --- a/source/LinearInterpolation.cpp +++ b/src/LinearInterpolation.cpp diff --git a/source/LinearInterpolation.h b/src/LinearInterpolation.h index 4b798d9bc..4b798d9bc 100644 --- a/source/LinearInterpolation.h +++ b/src/LinearInterpolation.h diff --git a/source/LinearUpscale.h b/src/LinearUpscale.h index b337b3219..b337b3219 100644 --- a/source/LinearUpscale.h +++ b/src/LinearUpscale.h diff --git a/source/Log.cpp b/src/Log.cpp index a0de4531b..a0de4531b 100644 --- a/source/Log.cpp +++ b/src/Log.cpp diff --git a/source/Log.h b/src/Log.h index d00022c6f..d00022c6f 100644 --- a/source/Log.h +++ b/src/Log.h diff --git a/source/LuaFunctions.h b/src/LuaFunctions.h index 0ad420881..0ad420881 100644 --- a/source/LuaFunctions.h +++ b/src/LuaFunctions.h diff --git a/src/LuaState.cpp b/src/LuaState.cpp new file mode 100644 index 000000000..6be1ee58c --- /dev/null +++ b/src/LuaState.cpp @@ -0,0 +1,1024 @@ + +// LuaState.cpp + +// Implements the cLuaState class representing the wrapper over lua_State *, provides associated helper functions + +#include "Globals.h" +#include "LuaState.h" + +extern "C" +{ + #include "lua/src/lualib.h" +} + +#include "tolua++.h" +#include "Bindings.h" +#include "ManualBindings.h" + +// fwd: SQLite/lsqlite3.c +extern "C" +{ + LUALIB_API int luaopen_lsqlite3(lua_State * L); +} + +// fwd: LuaExpat/lxplib.c: +extern "C" +{ + int luaopen_lxp(lua_State * L); +} + + + + + + +const cLuaState::cRet cLuaState::Return = {}; + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cLuaState: + +cLuaState::cLuaState(const AString & a_SubsystemName) : + m_LuaState(NULL), + m_IsOwned(false), + m_SubsystemName(a_SubsystemName), + m_NumCurrentFunctionArgs(-1) +{ +} + + + + + +cLuaState::cLuaState(lua_State * a_AttachState) : + m_LuaState(a_AttachState), + m_IsOwned(false), + m_SubsystemName("<attached>"), + m_NumCurrentFunctionArgs(-1) +{ +} + + + + + +cLuaState::~cLuaState() +{ + if (IsValid()) + { + if (m_IsOwned) + { + Close(); + } + else + { + Detach(); + } + } +} + + + + + +void cLuaState::Create(void) +{ + if (m_LuaState != NULL) + { + LOGWARNING("%s: Trying to create an already-existing LuaState, ignoring.", __FUNCTION__); + return; + } + m_LuaState = lua_open(); + luaL_openlibs(m_LuaState); + tolua_AllToLua_open(m_LuaState); + ManualBindings::Bind(m_LuaState); + luaopen_lsqlite3(m_LuaState); + luaopen_lxp(m_LuaState); + m_IsOwned = true; +} + + + + + +void cLuaState::Close(void) +{ + if (m_LuaState == NULL) + { + LOGWARNING("%s: Trying to close an invalid LuaState, ignoring.", __FUNCTION__); + return; + } + if (!m_IsOwned) + { + LOGWARNING( + "%s: Detected mis-use, calling Close() on an attached state (0x%p). Detaching instead.", + __FUNCTION__, m_LuaState + ); + Detach(); + return; + } + lua_close(m_LuaState); + m_LuaState = NULL; + m_IsOwned = false; +} + + + + + +void cLuaState::Attach(lua_State * a_State) +{ + if (m_LuaState != NULL) + { + LOGINFO("%s: Already contains a LuaState (0x%p), will be closed / detached.", __FUNCTION__, m_LuaState); + if (m_IsOwned) + { + Close(); + } + else + { + Detach(); + } + } + m_LuaState = a_State; + m_IsOwned = false; +} + + + + + +void cLuaState::Detach(void) +{ + if (m_LuaState == NULL) + { + return; + } + if (m_IsOwned) + { + LOGWARNING( + "%s: Detected a mis-use, calling Detach() when the state is owned. Closing the owned state (0x%p).", + __FUNCTION__, m_LuaState + ); + Close(); + return; + } + m_LuaState = NULL; +} + + + + + +bool cLuaState::LoadFile(const AString & a_FileName) +{ + ASSERT(IsValid()); + + // Load the file: + int s = luaL_loadfile(m_LuaState, a_FileName.c_str()); + if (ReportErrors(s)) + { + LOGWARNING("Can't load %s because of an error in file %s", m_SubsystemName.c_str(), a_FileName.c_str()); + return false; + } + + // Execute the globals: + s = lua_pcall(m_LuaState, 0, LUA_MULTRET, 0); + if (ReportErrors(s)) + { + LOGWARNING("Error in %s in file %s", m_SubsystemName.c_str(), a_FileName.c_str()); + return false; + } + + return true; +} + + + + + +bool cLuaState::HasFunction(const char * a_FunctionName) +{ + if (!IsValid()) + { + // This happens if cPlugin::Initialize() fails with an error + return false; + } + + lua_getglobal(m_LuaState, a_FunctionName); + bool res = (!lua_isnil(m_LuaState, -1) && lua_isfunction(m_LuaState, -1)); + lua_pop(m_LuaState, 1); + return res; +} + + + + + +bool cLuaState::PushFunction(const char * a_FunctionName) +{ + ASSERT(m_NumCurrentFunctionArgs == -1); // If not, there's already something pushed onto the stack + + if (!IsValid()) + { + // This happens if cPlugin::Initialize() fails with an error + return false; + } + + lua_getglobal(m_LuaState, a_FunctionName); + if (!lua_isfunction(m_LuaState, -1)) + { + LOGWARNING("Error in %s: Could not find function %s()", m_SubsystemName.c_str(), a_FunctionName); + lua_pop(m_LuaState, 1); + return false; + } + m_CurrentFunctionName.assign(a_FunctionName); + m_NumCurrentFunctionArgs = 0; + return true; +} + + + + + +bool cLuaState::PushFunction(int a_FnRef) +{ + ASSERT(IsValid()); + ASSERT(m_NumCurrentFunctionArgs == -1); // If not, there's already something pushed onto the stack + + lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, a_FnRef); // same as lua_getref() + if (!lua_isfunction(m_LuaState, -1)) + { + lua_pop(m_LuaState, 1); + return false; + } + m_CurrentFunctionName = "<callback>"; + m_NumCurrentFunctionArgs = 0; + return true; +} + + + + + +bool cLuaState::PushFunctionFromRefTable(cRef & a_TableRef, const char * a_FnName) +{ + ASSERT(IsValid()); + ASSERT(m_NumCurrentFunctionArgs == -1); // If not, there's already something pushed onto the stack + + lua_rawgeti(m_LuaState, LUA_REGISTRYINDEX, a_TableRef); // Get the table ref + if (!lua_istable(m_LuaState, -1)) + { + // Not a table, bail out + lua_pop(m_LuaState, 1); + return false; + } + lua_getfield(m_LuaState, -1, a_FnName); + if (lua_isnil(m_LuaState, -1) || !lua_isfunction(m_LuaState, -1)) + { + // Not a valid function, bail out + lua_pop(m_LuaState, 2); + return false; + } + lua_remove(m_LuaState, -2); // Remove the table ref from the stack + m_CurrentFunctionName = "<table_callback>"; + m_NumCurrentFunctionArgs = 0; + return true; +} + + + + + +void cLuaState::Push(const AString & a_String) +{ + ASSERT(IsValid()); + + tolua_pushcppstring(m_LuaState, a_String); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(const AStringVector & a_Vector) +{ + ASSERT(IsValid()); + + lua_createtable(m_LuaState, a_Vector.size(), 0); + int newTable = lua_gettop(m_LuaState); + int index = 1; + for (AStringVector::const_iterator itr = a_Vector.begin(), end = a_Vector.end(); itr != end; ++itr, ++index) + { + tolua_pushstring(m_LuaState, itr->c_str()); + lua_rawseti(m_LuaState, newTable, index); + } + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::PushUserType(void * a_Object, const char * a_Type) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Object, a_Type); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(int a_Value) +{ + ASSERT(IsValid()); + + tolua_pushnumber(m_LuaState, a_Value); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(double a_Value) +{ + ASSERT(IsValid()); + + tolua_pushnumber(m_LuaState, a_Value); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(const char * a_Value) +{ + ASSERT(IsValid()); + + tolua_pushstring(m_LuaState, a_Value); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(bool a_Value) +{ + ASSERT(IsValid()); + + tolua_pushboolean(m_LuaState, a_Value ? 1 : 0); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cWorld * a_World) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_World, "cWorld"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cPlayer * a_Player) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Player, "cPlayer"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(const cPlayer * a_Player) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, (void *)a_Player, "cPlayer"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cEntity * a_Entity) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Entity, "cEntity"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cMonster * a_Monster) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Monster, "cMonster"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cItem * a_Item) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Item, "cItem"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cItems * a_Items) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Items, "cItems"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cClientHandle * a_Client) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Client, "cClientHandle"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cPickup * a_Pickup) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Pickup, "cPickup"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cChunkDesc * a_ChunkDesc) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_ChunkDesc, "cChunkDesc"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(const cCraftingGrid * a_Grid) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, (void *)a_Grid, "cCraftingGrid"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(const cCraftingRecipe * a_Recipe) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, (void *)a_Recipe, "cCraftingRecipe"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(TakeDamageInfo * a_TDI) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_TDI, "TakeDamageInfo"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cWindow * a_Window) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Window, "cWindow"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cPluginLua * a_Plugin) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Plugin, "cPluginLua"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(const HTTPRequest * a_Request) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPRequest"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cWebAdmin * a_WebAdmin) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_WebAdmin, "cWebAdmin"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(const HTTPTemplateRequest * a_Request) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, (void *)a_Request, "HTTPTemplateRequest"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cTNTEntity * a_TNTEntity) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_TNTEntity, "cTNTEntity"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cCreeper * a_Creeper) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Creeper, "cCreeper"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(Vector3i * a_Vector) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Vector, "Vector3i"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(void * a_Ptr) +{ + ASSERT(IsValid()); + + lua_pushnil(m_LuaState); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cHopperEntity * a_Hopper) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_Hopper, "cHopperEntity"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::Push(cBlockEntity * a_BlockEntity) +{ + ASSERT(IsValid()); + + tolua_pushusertype(m_LuaState, a_BlockEntity, "cBlockEntity"); + m_NumCurrentFunctionArgs += 1; +} + + + + + +void cLuaState::GetReturn(int a_StackPos, bool & a_ReturnedVal) +{ + a_ReturnedVal = (tolua_toboolean(m_LuaState, a_StackPos, a_ReturnedVal ? 1 : 0) > 0); +} + + + + + +void cLuaState::GetReturn(int a_StackPos, AString & a_ReturnedVal) +{ + if (lua_isstring(m_LuaState, a_StackPos)) + { + a_ReturnedVal = tolua_tocppstring(m_LuaState, a_StackPos, a_ReturnedVal.c_str()); + } +} + + + + + +void cLuaState::GetReturn(int a_StackPos, int & a_ReturnedVal) +{ + if (lua_isnumber(m_LuaState, a_StackPos)) + { + a_ReturnedVal = (int)tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal); + } +} + + + + + +void cLuaState::GetReturn(int a_StackPos, double & a_ReturnedVal) +{ + if (lua_isnumber(m_LuaState, a_StackPos)) + { + a_ReturnedVal = tolua_tonumber(m_LuaState, a_StackPos, a_ReturnedVal); + } +} + + + + + +bool cLuaState::CallFunction(int a_NumResults) +{ + ASSERT (m_NumCurrentFunctionArgs >= 0); // A function must be pushed to stack first + ASSERT(lua_isfunction(m_LuaState, -m_NumCurrentFunctionArgs - 1)); + + int s = lua_pcall(m_LuaState, m_NumCurrentFunctionArgs, a_NumResults, 0); + if (ReportErrors(s)) + { + LOGWARNING("Error in %s calling function %s()", m_SubsystemName.c_str(), m_CurrentFunctionName.c_str()); + m_NumCurrentFunctionArgs = -1; + m_CurrentFunctionName.clear(); + return false; + } + m_NumCurrentFunctionArgs = -1; + m_CurrentFunctionName.clear(); + return true; +} + + + + + +bool cLuaState::CheckParamUserTable(int a_StartParam, const char * a_UserTable, int a_EndParam) +{ + ASSERT(IsValid()); + + if (a_EndParam < 0) + { + a_EndParam = a_StartParam; + } + + tolua_Error tolua_err; + for (int i = a_StartParam; i <= a_EndParam; i++) + { + if (tolua_isusertable(m_LuaState, i, a_UserTable, 0, &tolua_err)) + { + continue; + } + // Not the correct parameter + lua_Debug entry; + VERIFY(lua_getstack(m_LuaState, 0, &entry)); + VERIFY(lua_getinfo (m_LuaState, "n", &entry)); + AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?"); + tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); + return false; + } // for i - Param + + // All params checked ok + return true; +} + + + + + +bool cLuaState::CheckParamUserType(int a_StartParam, const char * a_UserType, int a_EndParam) +{ + ASSERT(IsValid()); + + if (a_EndParam < 0) + { + a_EndParam = a_StartParam; + } + + tolua_Error tolua_err; + for (int i = a_StartParam; i <= a_EndParam; i++) + { + if (tolua_isusertype(m_LuaState, i, a_UserType, 0, &tolua_err)) + { + continue; + } + // Not the correct parameter + lua_Debug entry; + VERIFY(lua_getstack(m_LuaState, 0, &entry)); + VERIFY(lua_getinfo (m_LuaState, "n", &entry)); + AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?"); + tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); + return false; + } // for i - Param + + // All params checked ok + return true; +} + + + + + +bool cLuaState::CheckParamTable(int a_StartParam, int a_EndParam) +{ + ASSERT(IsValid()); + + if (a_EndParam < 0) + { + a_EndParam = a_StartParam; + } + + tolua_Error tolua_err; + for (int i = a_StartParam; i <= a_EndParam; i++) + { + if (tolua_istable(m_LuaState, i, 0, &tolua_err)) + { + continue; + } + // Not the correct parameter + lua_Debug entry; + VERIFY(lua_getstack(m_LuaState, 0, &entry)); + VERIFY(lua_getinfo (m_LuaState, "n", &entry)); + AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?"); + tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); + return false; + } // for i - Param + + // All params checked ok + return true; +} + + + + + +bool cLuaState::CheckParamNumber(int a_StartParam, int a_EndParam) +{ + ASSERT(IsValid()); + + if (a_EndParam < 0) + { + a_EndParam = a_StartParam; + } + + tolua_Error tolua_err; + for (int i = a_StartParam; i <= a_EndParam; i++) + { + if (tolua_isnumber(m_LuaState, i, 0, &tolua_err)) + { + continue; + } + // Not the correct parameter + lua_Debug entry; + VERIFY(lua_getstack(m_LuaState, 0, &entry)); + VERIFY(lua_getinfo (m_LuaState, "n", &entry)); + AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?"); + tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); + return false; + } // for i - Param + + // All params checked ok + return true; +} + + + + + +bool cLuaState::CheckParamString(int a_StartParam, int a_EndParam) +{ + ASSERT(IsValid()); + + if (a_EndParam < 0) + { + a_EndParam = a_StartParam; + } + + tolua_Error tolua_err; + for (int i = a_StartParam; i <= a_EndParam; i++) + { + if (tolua_isstring(m_LuaState, i, 0, &tolua_err)) + { + continue; + } + // Not the correct parameter + lua_Debug entry; + VERIFY(lua_getstack(m_LuaState, 0, &entry)); + VERIFY(lua_getinfo (m_LuaState, "n", &entry)); + AString ErrMsg = Printf("#ferror in function '%s'.", (entry.name != NULL) ? entry.name : "?"); + tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); + return false; + } // for i - Param + + // All params checked ok + return true; +} + + + + + +bool cLuaState::CheckParamEnd(int a_Param) +{ + tolua_Error tolua_err; + if (tolua_isnoobj(m_LuaState, a_Param, &tolua_err)) + { + return true; + } + // Not the correct parameter + lua_Debug entry; + VERIFY(lua_getstack(m_LuaState, 0, &entry)); + VERIFY(lua_getinfo (m_LuaState, "n", &entry)); + AString ErrMsg = Printf("#ferror in function '%s': Too many arguments.", (entry.name != NULL) ? entry.name : "?"); + tolua_error(m_LuaState, ErrMsg.c_str(), &tolua_err); + return false; +} + + + + + +bool cLuaState::ReportErrors(int a_Status) +{ + return ReportErrors(m_LuaState, a_Status); +} + + + + + +bool cLuaState::ReportErrors(lua_State * a_LuaState, int a_Status) +{ + if (a_Status == 0) + { + // No error to report + return false; + } + + LOGWARNING("LUA: %d - %s", a_Status, lua_tostring(a_LuaState, -1)); + lua_pop(a_LuaState, 1); + return true; +} + + + + + +void cLuaState::LogStackTrace(void) +{ + LOGWARNING("Stack trace:"); + lua_Debug entry; + int depth = 0; + while (lua_getstack(m_LuaState, depth, &entry)) + { + int status = lua_getinfo(m_LuaState, "Sln", &entry); + assert(status); + + LOGWARNING(" %s(%d): %s", entry.short_src, entry.currentline, entry.name ? entry.name : "?"); + depth++; + } + LOGWARNING("Stack trace end"); +} + + + + + +AString cLuaState::GetTypeText(int a_StackPos) +{ + int Type = lua_type(m_LuaState, a_StackPos); + switch (Type) + { + case LUA_TNONE: return "TNONE"; + case LUA_TNIL: return "TNIL"; + case LUA_TBOOLEAN: return "TBOOLEAN"; + case LUA_TLIGHTUSERDATA: return "TLIGHTUSERDATA"; + case LUA_TNUMBER: return "TNUMBER"; + case LUA_TSTRING: return "TSTRING"; + case LUA_TTABLE: return "TTABLE"; + case LUA_TFUNCTION: return "TFUNCTION"; + case LUA_TUSERDATA: return "TUSERDATA"; + case LUA_TTHREAD: return "TTHREAD"; + } + return Printf("Unknown (%d)", Type); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cLuaState::cRef: + +cLuaState::cRef::cRef(cLuaState & a_LuaState, int a_StackPos) : + m_LuaState(a_LuaState) +{ + ASSERT(m_LuaState.IsValid()); + + lua_pushvalue(m_LuaState, a_StackPos); // Push a copy of the value at a_StackPos onto the stack + m_Ref = luaL_ref(m_LuaState, LUA_REGISTRYINDEX); +} + + + + + +cLuaState::cRef::~cRef() +{ + ASSERT(m_LuaState.IsValid()); + + if (IsValid()) + { + luaL_unref(m_LuaState, LUA_REGISTRYINDEX, m_Ref); + } +} + + + + diff --git a/src/LuaState.h b/src/LuaState.h new file mode 100644 index 000000000..5e7f3d180 --- /dev/null +++ b/src/LuaState.h @@ -0,0 +1,817 @@ + +// LuaState.h + +// Declares the cLuaState class representing the wrapper over lua_State *, provides associated helper functions + +/* +The contained lua_State can be either owned or attached. +Owned lua_State is created by calling Create() and the cLuaState automatically closes the state +Or, lua_State can be attached by calling Attach(), the cLuaState doesn't close such a state +Attaching a state will automatically close an owned state. + +Calling a Lua function is done by pushing the function, either by PushFunction() or PushFunctionFromRegistry(), +then pushing the arguments (PushString(), PushNumber(), PushUserData() etc.) and finally +executing CallFunction(). cLuaState automatically keeps track of the number of arguments and the name of the +function (for logging purposes), which makes the call less error-prone. + +Reference management is provided by the cLuaState::cRef class. This is used when you need to hold a reference to +any Lua object across several function calls; usually this is used for callbacks. The class is RAII-like, with +automatic resource management. +*/ + + + + +#pragma once + +extern "C" +{ + #include "lua/src/lauxlib.h" +} + + + + + +class cWorld; +class cPlayer; +class cEntity; +class cMonster; +class cItem; +class cItems; +class cClientHandle; +class cPickup; +class cChunkDesc; +class cCraftingGrid; +class cCraftingRecipe; +struct TakeDamageInfo; +class cWindow; +class cPluginLua; +struct HTTPRequest; +class cWebAdmin; +struct HTTPTemplateRequest; +class cTNTEntity; +class cCreeper; +class Vector3i; +class cHopperEntity; +class cBlockEntity; + + + + + +/// Encapsulates a Lua state and provides some syntactic sugar for common operations +class cLuaState +{ +public: + + /// Used for storing references to object in the global registry + class cRef + { + public: + /// Creates a reference in the specified LuaState for object at the specified StackPos + cRef(cLuaState & a_LuaState, int a_StackPos); + ~cRef(); + + /// Returns true if the reference is valid + bool IsValid(void) const {return (m_Ref != LUA_REFNIL); } + + /// Allows to use this class wherever an int (i. e. ref) is to be used + operator int(void) const { return m_Ref; } + + protected: + cLuaState & m_LuaState; + int m_Ref; + } ; + + + /// A dummy class that's used only to delimit function args from return values for cLuaState::Call() + class cRet + { + } ; + + static const cRet Return; // Use this constant to delimit function args from return values for cLuaState::Call() + + + /** Creates a new instance. The LuaState is not initialized. + a_SubsystemName is used for reporting problems in the console, it is "plugin %s" for plugins, + or "LuaScript" for the cLuaScript template + */ + cLuaState(const AString & a_SubsystemName); + + /** Creates a new instance. The a_AttachState is attached. + Subsystem name is set to "<attached>". + */ + explicit cLuaState(lua_State * a_AttachState); + + ~cLuaState(); + + /// Allows this object to be used in the same way as a lua_State *, for example in the LuaLib functions + operator lua_State * (void) { return m_LuaState; } + + /// Creates the m_LuaState, if not closed already. This state will be automatically closed in the destructor + void Create(void); + + /// Closes the m_LuaState, if not closed already + void Close(void); + + /// Attaches the specified state. Operations will be carried out on this state, but it will not be closed in the destructor + void Attach(lua_State * a_State); + + /// Detaches a previously attached state. + void Detach(void); + + /// Returns true if the m_LuaState is valid + bool IsValid(void) const { return (m_LuaState != NULL); } + + /** Loads the specified file + Returns false and logs a warning to the console if not successful (but the LuaState is kept open). + m_SubsystemName is displayed in the warning log message. + */ + bool LoadFile(const AString & a_FileName); + + /// Returns true if a_FunctionName is a valid Lua function that can be called + bool HasFunction(const char * a_FunctionName); + + /** Pushes the function of the specified name onto the stack. + Returns true if successful. Logs a warning on failure (incl. m_SubsystemName) + */ + bool PushFunction(const char * a_FunctionName); + + /** Pushes a function that has been saved into the global registry, identified by a_FnRef. + Returns true if successful. Logs a warning on failure + */ + bool PushFunction(int a_FnRef); + + /** Pushes a function that is stored in a table ref. + Returns true if successful, false on failure. Doesn't log failure. + */ + bool PushFunctionFromRefTable(cRef & a_TableRef, const char * a_FnName); + + /// Pushes a usertype of the specified class type onto the stack + void PushUserType(void * a_Object, const char * a_Type); + + // Push a value onto the stack + void Push(const AString & a_String); + void Push(const AStringVector & a_Vector); + void Push(int a_Value); + void Push(double a_Value); + void Push(const char * a_Value); + void Push(bool a_Value); + void Push(cWorld * a_World); + void Push(cPlayer * a_Player); + void Push(const cPlayer * a_Player); + void Push(cEntity * a_Entity); + void Push(cMonster * a_Monster); + void Push(cItem * a_Item); + void Push(cItems * a_Items); + void Push(cClientHandle * a_ClientHandle); + void Push(cPickup * a_Pickup); + void Push(cChunkDesc * a_ChunkDesc); + void Push(const cCraftingGrid * a_Grid); + void Push(const cCraftingRecipe * a_Recipe); + void Push(TakeDamageInfo * a_TDI); + void Push(cWindow * a_Window); + void Push(cPluginLua * a_Plugin); + void Push(const HTTPRequest * a_Request); + void Push(cWebAdmin * a_WebAdmin); + void Push(const HTTPTemplateRequest * a_Request); + void Push(cTNTEntity * a_TNTEntity); + void Push(cCreeper * a_Creeper); + void Push(Vector3i * a_Vector); + void Push(void * a_Ptr); + void Push(cHopperEntity * a_Hopper); + void Push(cBlockEntity * a_BlockEntity); + + /// Call any 0-param 0-return Lua function in a single line: + template <typename FnT> + bool Call(FnT a_FnName) + { + if (!PushFunction(a_FnName)) + { + return false; + } + return CallFunction(0); + } + + /// Call any 1-param 0-return Lua function in a single line: + template< + typename FnT, + typename ArgT1 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + return CallFunction(0); + } + + /// Call any 2-param 0-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + return CallFunction(0); + } + + /// Call any 1-param 1-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename RetT1 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, const cRet & a_Mark, RetT1 & a_Ret1) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + if (!CallFunction(1)) + { + return false; + } + GetReturn(-1, a_Ret1); + lua_pop(m_LuaState, 1); + return true; + } + + /// Call any 2-param 1-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename RetT1 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, const cRet & a_Mark, RetT1 & a_Ret1) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + if (!CallFunction(1)) + { + return false; + } + GetReturn(-1, a_Ret1); + lua_pop(m_LuaState, 1); + return true; + } + + /// Call any 3-param 1-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename RetT1 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, const cRet & a_Mark, RetT1 & a_Ret1) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + if (!CallFunction(1)) + { + return false; + } + GetReturn(-1, a_Ret1); + lua_pop(m_LuaState, 1); + return true; + } + + /// Call any 4-param 1-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename RetT1 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, const cRet & a_Mark, RetT1 & a_Ret1) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + if (!CallFunction(1)) + { + return false; + } + GetReturn(-1, a_Ret1); + lua_pop(m_LuaState, 1); + return true; + } + + /// Call any 5-param 1-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename RetT1 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, const cRet & a_Mark, RetT1 & a_Ret1) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + Push(a_Arg5); + if (!CallFunction(1)) + { + return false; + } + GetReturn(-1, a_Ret1); + lua_pop(m_LuaState, 1); + return true; + } + + /// Call any 6-param 1-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename ArgT6, + typename RetT1 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, const cRet & a_Mark, RetT1 & a_Ret1) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + Push(a_Arg5); + Push(a_Arg6); + if (!CallFunction(1)) + { + return false; + } + GetReturn(-1, a_Ret1); + lua_pop(m_LuaState, 1); + return true; + } + + /// Call any 7-param 1-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename ArgT6, + typename ArgT7, typename RetT1 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + Push(a_Arg5); + Push(a_Arg6); + Push(a_Arg7); + if (!CallFunction(1)) + { + return false; + } + GetReturn(-1, a_Ret1); + lua_pop(m_LuaState, 1); + return true; + } + + /// Call any 8-param 1-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename ArgT6, + typename ArgT7, typename ArgT8, typename RetT1 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, const cRet & a_Mark, RetT1 & a_Ret1) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + Push(a_Arg5); + Push(a_Arg6); + Push(a_Arg7); + Push(a_Arg8); + if (!CallFunction(1)) + { + return false; + } + GetReturn(-1, a_Ret1); + lua_pop(m_LuaState, 1); + return true; + } + + /// Call any 9-param 1-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename ArgT6, + typename ArgT7, typename ArgT8, typename ArgT9, typename RetT1 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, const cRet & a_Mark, RetT1 & a_Ret1) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + Push(a_Arg5); + Push(a_Arg6); + Push(a_Arg7); + Push(a_Arg8); + Push(a_Arg9); + if (!CallFunction(1)) + { + return false; + } + GetReturn(-1, a_Ret1); + lua_pop(m_LuaState, 1); + return true; + } + + /// Call any 10-param 1-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, typename ArgT6, + typename ArgT7, typename ArgT8, typename ArgT9, typename ArgT10, typename RetT1 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, ArgT10 a_Arg10, const cRet & a_Mark, RetT1 & a_Ret1) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + Push(a_Arg5); + Push(a_Arg6); + Push(a_Arg7); + Push(a_Arg8); + Push(a_Arg9); + Push(a_Arg10); + if (!CallFunction(1)) + { + return false; + } + GetReturn(-1, a_Ret1); + lua_pop(m_LuaState, 1); + return true; + } + + /// Call any 1-param 2-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename RetT1, typename RetT2 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + if (!CallFunction(2)) + { + return false; + } + GetReturn(-2, a_Ret1); + GetReturn(-1, a_Ret2); + lua_pop(m_LuaState, 2); + return true; + } + + /// Call any 2-param 2-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename RetT1, typename RetT2 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + if (!CallFunction(2)) + { + return false; + } + GetReturn(-2, a_Ret1); + GetReturn(-1, a_Ret2); + lua_pop(m_LuaState, 2); + return true; + } + + /// Call any 3-param 2-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, + typename RetT1, typename RetT2 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + if (!CallFunction(2)) + { + return false; + } + GetReturn(-2, a_Ret1); + GetReturn(-1, a_Ret2); + lua_pop(m_LuaState, 2); + return true; + } + + /// Call any 4-param 2-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, + typename RetT1, typename RetT2 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + if (!CallFunction(2)) + { + return false; + } + GetReturn(-2, a_Ret1); + GetReturn(-1, a_Ret2); + lua_pop(m_LuaState, 2); + return true; + } + + /// Call any 5-param 2-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, + typename RetT1, typename RetT2 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + Push(a_Arg5); + if (!CallFunction(2)) + { + return false; + } + GetReturn(-2, a_Ret1); + GetReturn(-1, a_Ret2); + lua_pop(m_LuaState, 2); + return true; + } + + /// Call any 6-param 2-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, + typename ArgT6, + typename RetT1, typename RetT2 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + Push(a_Arg5); + Push(a_Arg6); + if (!CallFunction(2)) + { + return false; + } + GetReturn(-2, a_Ret1); + GetReturn(-1, a_Ret2); + lua_pop(m_LuaState, 2); + return true; + } + + /// Call any 7-param 2-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, + typename ArgT6, typename ArgT7, + typename RetT1, typename RetT2 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + Push(a_Arg5); + Push(a_Arg6); + Push(a_Arg7); + if (!CallFunction(2)) + { + return false; + } + GetReturn(-2, a_Ret1); + GetReturn(-1, a_Ret2); + lua_pop(m_LuaState, 2); + return true; + } + + /// Call any 7-param 3-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, + typename ArgT6, typename ArgT7, + typename RetT1, typename RetT2, typename RetT3 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + Push(a_Arg5); + Push(a_Arg6); + Push(a_Arg7); + if (!CallFunction(3)) + { + return false; + } + GetReturn(-3, a_Ret1); + GetReturn(-2, a_Ret2); + GetReturn(-1, a_Ret3); + lua_pop(m_LuaState, 3); + return true; + } + + /// Call any 8-param 3-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, + typename ArgT6, typename ArgT7, typename ArgT8, + typename RetT1, typename RetT2, typename RetT3 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + Push(a_Arg5); + Push(a_Arg6); + Push(a_Arg7); + Push(a_Arg8); + if (!CallFunction(3)) + { + return false; + } + GetReturn(-3, a_Ret1); + GetReturn(-2, a_Ret2); + GetReturn(-1, a_Ret3); + lua_pop(m_LuaState, 3); + return true; + } + + /// Call any 9-param 5-return Lua function in a single line: + template< + typename FnT, typename ArgT1, typename ArgT2, typename ArgT3, typename ArgT4, typename ArgT5, + typename ArgT6, typename ArgT7, typename ArgT8, typename ArgT9, + typename RetT1, typename RetT2, typename RetT3, typename RetT4, typename RetT5 + > + bool Call(FnT a_FnName, ArgT1 a_Arg1, ArgT2 a_Arg2, ArgT3 a_Arg3, ArgT4 a_Arg4, ArgT5 a_Arg5, ArgT6 a_Arg6, ArgT7 a_Arg7, ArgT8 a_Arg8, ArgT9 a_Arg9, const cRet & a_Mark, RetT1 & a_Ret1, RetT2 & a_Ret2, RetT3 & a_Ret3, RetT4 & a_Ret4, RetT5 & a_Ret5) + { + if (!PushFunction(a_FnName)) + { + return false; + } + Push(a_Arg1); + Push(a_Arg2); + Push(a_Arg3); + Push(a_Arg4); + Push(a_Arg5); + Push(a_Arg6); + Push(a_Arg7); + Push(a_Arg8); + Push(a_Arg9); + if (!CallFunction(5)) + { + return false; + } + GetReturn(-5, a_Ret1); + GetReturn(-4, a_Ret2); + GetReturn(-3, a_Ret3); + GetReturn(-2, a_Ret4); + GetReturn(-1, a_Ret5); + lua_pop(m_LuaState, 5); + return true; + } + + + /// Retrieve value returned at a_StackPos, if it is a valid bool. If not, a_ReturnedVal is unchanged + void GetReturn(int a_StackPos, bool & a_ReturnedVal); + + /// Retrieve value returned at a_StackPos, if it is a valid string. If not, a_ReturnedVal is unchanged + void GetReturn(int a_StackPos, AString & a_ReturnedVal); + + /// Retrieve value returned at a_StackPos, if it is a valid number. If not, a_ReturnedVal is unchanged + void GetReturn(int a_StackPos, int & a_ReturnedVal); + + /// Retrieve value returned at a_StackPos, if it is a valid number. If not, a_ReturnedVal is unchanged + void GetReturn(int a_StackPos, double & a_ReturnedVal); + + /** + Calls the function that has been pushed onto the stack by PushFunction(), + with arguments pushed by PushXXX(). + Returns true if successful, logs a warning on failure. + */ + bool CallFunction(int a_NumReturnValues); + + /// Returns true if the specified parameters on the stack are of the specified usertable type; also logs warning if not. Used for static functions + bool CheckParamUserTable(int a_StartParam, const char * a_UserTable, int a_EndParam = -1); + + /// Returns true if the specified parameters on the stack are of the specified usertype; also logs warning if not. Used for regular functions + bool CheckParamUserType(int a_StartParam, const char * a_UserType, int a_EndParam = -1); + + /// Returns true if the specified parameters on the stack are tables; also logs warning if not + bool CheckParamTable(int a_StartParam, int a_EndParam = -1); + + /// Returns true if the specified parameters on the stack are numbers; also logs warning if not + bool CheckParamNumber(int a_StartParam, int a_EndParam = -1); + + /// Returns true if the specified parameters on the stack are strings; also logs warning if not + bool CheckParamString(int a_StartParam, int a_EndParam = -1); + + /// Returns true if the specified parameter on the stack is nil (indicating an end-of-parameters) + bool CheckParamEnd(int a_Param); + + /// If the status is nonzero, prints the text on the top of Lua stack and returns true + bool ReportErrors(int status); + + /// If the status is nonzero, prints the text on the top of Lua stack and returns true + static bool ReportErrors(lua_State * a_LuaState, int status); + + /// Logs all items in the current stack trace to the server console + void LogStackTrace(void); + + /// Returns the type of the item on the specified position in the stack + AString GetTypeText(int a_StackPos); + +protected: + lua_State * m_LuaState; + + /// If true, the state is owned by this object and will be auto-Closed. False => attached state + bool m_IsOwned; + + /** The subsystem name is used for reporting errors to the console, it is either "plugin %s" or "LuaScript" + whatever is given to the constructor + */ + AString m_SubsystemName; + + /// Name of the currently pushed function (for the Push / Call chain) + AString m_CurrentFunctionName; + + /// Number of arguments currently pushed (for the Push / Call chain) + int m_NumCurrentFunctionArgs; +} ; + + + + diff --git a/src/LuaWindow.cpp b/src/LuaWindow.cpp new file mode 100644 index 000000000..5f112f1e1 --- /dev/null +++ b/src/LuaWindow.cpp @@ -0,0 +1,185 @@ + +// LuaWindow.cpp + +// Implements the cLuaWindow class representing a virtual window that plugins may create and open for the player + +#include "Globals.h" +#include "LuaWindow.h" +#include "UI/SlotArea.h" +#include "PluginLua.h" +#include "Entities/Player.h" +#include "lua/src/lauxlib.h" // Needed for LUA_REFNIL + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cLuaWindow: + +cLuaWindow::cLuaWindow(cWindow::WindowType a_WindowType, int a_SlotsX, int a_SlotsY, const AString & a_Title) : + super(a_WindowType, a_Title), + m_Contents(a_SlotsX, a_SlotsY), + m_Plugin(NULL), + m_LuaRef(LUA_REFNIL), + m_OnClosingFnRef(LUA_REFNIL), + m_OnSlotChangedFnRef(LUA_REFNIL) +{ + m_Contents.AddListener(*this); + m_SlotAreas.push_back(new cSlotAreaItemGrid(m_Contents, *this)); + + // If appropriate, add an Armor slot area: + switch (a_WindowType) + { + case cWindow::wtInventory: + case cWindow::wtWorkbench: + { + m_SlotAreas.push_back(new cSlotAreaArmor(*this)); + break; + } + } + m_SlotAreas.push_back(new cSlotAreaInventory(*this)); + m_SlotAreas.push_back(new cSlotAreaHotBar(*this)); +} + + + + + +cLuaWindow::~cLuaWindow() +{ + m_Contents.RemoveListener(*this); + + // Must delete slot areas now, because they are referencing this->m_Contents and would try to access it in cWindow's + // destructor, when the member is already gone. + for (cSlotAreas::iterator itr = m_SlotAreas.begin(), end = m_SlotAreas.end(); itr != end; ++itr) + { + delete *itr; + } + m_SlotAreas.clear(); + + ASSERT(m_OpenedBy.empty()); +} + + + + + +void cLuaWindow::SetLuaRef(cPluginLua * a_Plugin, int a_LuaRef) +{ + // Either m_Plugin is not set or equal to the passed plugin; only one plugin can use one cLuaWindow object + ASSERT((m_Plugin == NULL) || (m_Plugin == a_Plugin)); + ASSERT(m_LuaRef == LUA_REFNIL); + m_Plugin = a_Plugin; + m_LuaRef = a_LuaRef; +} + + + + + +bool cLuaWindow::IsLuaReferenced(void) const +{ + return ((m_Plugin != NULL) && (m_LuaRef != LUA_REFNIL)); +} + + + + + +void cLuaWindow::SetOnClosing(cPluginLua * a_Plugin, int a_FnRef) +{ + // Either m_Plugin is not set or equal to the passed plugin; only one plugin can use one cLuaWindow object + ASSERT((m_Plugin == NULL) || (m_Plugin == a_Plugin)); + + // If there already was a function, unreference it first + if (m_OnClosingFnRef != LUA_REFNIL) + { + m_Plugin->Unreference(m_OnClosingFnRef); + } + + // Store the new reference + m_Plugin = a_Plugin; + m_OnClosingFnRef = a_FnRef; +} + + + + + +void cLuaWindow::SetOnSlotChanged(cPluginLua * a_Plugin, int a_FnRef) +{ + // Either m_Plugin is not set or equal to the passed plugin; only one plugin can use one cLuaWindow object + ASSERT((m_Plugin == NULL) || (m_Plugin == a_Plugin)); + + // If there already was a function, unreference it first + if (m_OnSlotChangedFnRef != LUA_REFNIL) + { + m_Plugin->Unreference(m_OnSlotChangedFnRef); + } + + // Store the new reference + m_Plugin = a_Plugin; + m_OnSlotChangedFnRef = a_FnRef; +} + + + + + +bool cLuaWindow::ClosedByPlayer(cPlayer & a_Player, bool a_CanRefuse) +{ + // First notify the plugin through the registered callback: + if (m_OnClosingFnRef != LUA_REFNIL) + { + ASSERT(m_Plugin != NULL); + if (m_Plugin->CallbackWindowClosing(m_OnClosingFnRef, *this, a_Player, a_CanRefuse)) + { + // The callback disagrees (the higher levels check the CanRefuse flag compliance) + return false; + } + } + + return super::ClosedByPlayer(a_Player, a_CanRefuse); +} + + + + + +void cLuaWindow::Destroy(void) +{ + super::Destroy(); + + if ((m_LuaRef != LUA_REFNIL) && (m_Plugin != NULL)) + { + // The object is referenced by Lua, un-reference it + m_Plugin->Unreference(m_LuaRef); + } + + // Lua will take care of this object, it will garbage-collect it, so we *must not* delete it! + m_IsDestroyed = false; +} + + + + + +void cLuaWindow::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum) +{ + if (a_ItemGrid != &m_Contents) + { + ASSERT(!"Invalid ItemGrid in callback"); + return; + } + + // If an OnSlotChanged callback has been registered, call it: + if (m_OnSlotChangedFnRef != LUA_REFNIL) + { + m_Plugin->CallbackWindowSlotChanged(m_OnSlotChangedFnRef, *this, a_SlotNum); + } +} + + + + diff --git a/source/LuaWindow.h b/src/LuaWindow.h index 4c32c263e..4c32c263e 100644 --- a/source/LuaWindow.h +++ b/src/LuaWindow.h diff --git a/source/MCLogger.cpp b/src/MCLogger.cpp index 4f3e5dc0f..4f3e5dc0f 100644 --- a/source/MCLogger.cpp +++ b/src/MCLogger.cpp diff --git a/source/MCLogger.h b/src/MCLogger.h index c949a4cdf..c949a4cdf 100644 --- a/source/MCLogger.h +++ b/src/MCLogger.h diff --git a/source/ManualBindings.cpp b/src/ManualBindings.cpp index 02b3347f6..02b3347f6 100644 --- a/source/ManualBindings.cpp +++ b/src/ManualBindings.cpp diff --git a/source/ManualBindings.h b/src/ManualBindings.h index e6594947e..e6594947e 100644 --- a/source/ManualBindings.h +++ b/src/ManualBindings.h diff --git a/source/Matrix4f.cpp b/src/Matrix4f.cpp index d0a407a99..d0a407a99 100644 --- a/source/Matrix4f.cpp +++ b/src/Matrix4f.cpp diff --git a/source/Matrix4f.h b/src/Matrix4f.h index 249c92f5f..249c92f5f 100644 --- a/source/Matrix4f.h +++ b/src/Matrix4f.h diff --git a/source/MemoryLeak.h b/src/MemoryLeak.h index e9c0c34e3..e9c0c34e3 100644 --- a/source/MemoryLeak.h +++ b/src/MemoryLeak.h diff --git a/source/MersenneTwister.h b/src/MersenneTwister.h index dc7134a93..dc7134a93 100644 --- a/source/MersenneTwister.h +++ b/src/MersenneTwister.h diff --git a/source/MobCensus.cpp b/src/MobCensus.cpp index 66b5932bc..66b5932bc 100644 --- a/source/MobCensus.cpp +++ b/src/MobCensus.cpp diff --git a/source/MobCensus.h b/src/MobCensus.h index e3892bec6..e3892bec6 100644 --- a/source/MobCensus.h +++ b/src/MobCensus.h diff --git a/source/MobFamilyCollecter.cpp b/src/MobFamilyCollecter.cpp index e9c69e078..e9c69e078 100644 --- a/source/MobFamilyCollecter.cpp +++ b/src/MobFamilyCollecter.cpp diff --git a/source/MobFamilyCollecter.h b/src/MobFamilyCollecter.h index 6cef133b5..6cef133b5 100644 --- a/source/MobFamilyCollecter.h +++ b/src/MobFamilyCollecter.h diff --git a/source/MobProximityCounter.cpp b/src/MobProximityCounter.cpp index 583a71579..583a71579 100644 --- a/source/MobProximityCounter.cpp +++ b/src/MobProximityCounter.cpp diff --git a/source/MobProximityCounter.h b/src/MobProximityCounter.h index 8a67139aa..8a67139aa 100644 --- a/source/MobProximityCounter.h +++ b/src/MobProximityCounter.h diff --git a/source/MobSpawner.cpp b/src/MobSpawner.cpp index 4d0b2777b..4d0b2777b 100644 --- a/source/MobSpawner.cpp +++ b/src/MobSpawner.cpp diff --git a/source/MobSpawner.h b/src/MobSpawner.h index ea6636310..ea6636310 100644 --- a/source/MobSpawner.h +++ b/src/MobSpawner.h diff --git a/source/Mobs/AggressiveMonster.cpp b/src/Mobs/AggressiveMonster.cpp index cc7e7da2b..cc7e7da2b 100644 --- a/source/Mobs/AggressiveMonster.cpp +++ b/src/Mobs/AggressiveMonster.cpp diff --git a/source/Mobs/AggressiveMonster.h b/src/Mobs/AggressiveMonster.h index 5a0d93f3d..5a0d93f3d 100644 --- a/source/Mobs/AggressiveMonster.h +++ b/src/Mobs/AggressiveMonster.h diff --git a/source/Mobs/Bat.cpp b/src/Mobs/Bat.cpp index b9c82996b..b9c82996b 100644 --- a/source/Mobs/Bat.cpp +++ b/src/Mobs/Bat.cpp diff --git a/source/Mobs/Bat.h b/src/Mobs/Bat.h index e878d0ee8..e878d0ee8 100644 --- a/source/Mobs/Bat.h +++ b/src/Mobs/Bat.h diff --git a/source/Mobs/Blaze.cpp b/src/Mobs/Blaze.cpp index f9c05b17a..f9c05b17a 100644 --- a/source/Mobs/Blaze.cpp +++ b/src/Mobs/Blaze.cpp diff --git a/source/Mobs/Blaze.h b/src/Mobs/Blaze.h index cdb3a1306..cdb3a1306 100644 --- a/source/Mobs/Blaze.h +++ b/src/Mobs/Blaze.h diff --git a/source/Mobs/Cavespider.cpp b/src/Mobs/Cavespider.cpp index aba1ff9f5..aba1ff9f5 100644 --- a/source/Mobs/Cavespider.cpp +++ b/src/Mobs/Cavespider.cpp diff --git a/source/Mobs/Cavespider.h b/src/Mobs/Cavespider.h index 10ea03f7b..10ea03f7b 100644 --- a/source/Mobs/Cavespider.h +++ b/src/Mobs/Cavespider.h diff --git a/source/Mobs/Chicken.cpp b/src/Mobs/Chicken.cpp index 087fd088a..087fd088a 100644 --- a/source/Mobs/Chicken.cpp +++ b/src/Mobs/Chicken.cpp diff --git a/source/Mobs/Chicken.h b/src/Mobs/Chicken.h index 979c4d8a0..979c4d8a0 100644 --- a/source/Mobs/Chicken.h +++ b/src/Mobs/Chicken.h diff --git a/source/Mobs/Cow.cpp b/src/Mobs/Cow.cpp index 9eb74dac2..9eb74dac2 100644 --- a/source/Mobs/Cow.cpp +++ b/src/Mobs/Cow.cpp diff --git a/source/Mobs/Cow.h b/src/Mobs/Cow.h index 0391d4a31..0391d4a31 100644 --- a/source/Mobs/Cow.h +++ b/src/Mobs/Cow.h diff --git a/source/Mobs/Creeper.cpp b/src/Mobs/Creeper.cpp index 4e11ae13e..4e11ae13e 100644 --- a/source/Mobs/Creeper.cpp +++ b/src/Mobs/Creeper.cpp diff --git a/source/Mobs/Creeper.h b/src/Mobs/Creeper.h index c3d4edeae..c3d4edeae 100644 --- a/source/Mobs/Creeper.h +++ b/src/Mobs/Creeper.h diff --git a/source/Mobs/EnderDragon.cpp b/src/Mobs/EnderDragon.cpp index acd81cde1..acd81cde1 100644 --- a/source/Mobs/EnderDragon.cpp +++ b/src/Mobs/EnderDragon.cpp diff --git a/source/Mobs/EnderDragon.h b/src/Mobs/EnderDragon.h index 77177edfe..77177edfe 100644 --- a/source/Mobs/EnderDragon.h +++ b/src/Mobs/EnderDragon.h diff --git a/source/Mobs/Enderman.cpp b/src/Mobs/Enderman.cpp index a784131e4..a784131e4 100644 --- a/source/Mobs/Enderman.cpp +++ b/src/Mobs/Enderman.cpp diff --git a/source/Mobs/Enderman.h b/src/Mobs/Enderman.h index 32e40e70b..32e40e70b 100644 --- a/source/Mobs/Enderman.h +++ b/src/Mobs/Enderman.h diff --git a/source/Mobs/Ghast.cpp b/src/Mobs/Ghast.cpp index 96a29b2d8..96a29b2d8 100644 --- a/source/Mobs/Ghast.cpp +++ b/src/Mobs/Ghast.cpp diff --git a/source/Mobs/Ghast.h b/src/Mobs/Ghast.h index 43e8bedb6..43e8bedb6 100644 --- a/source/Mobs/Ghast.h +++ b/src/Mobs/Ghast.h diff --git a/source/Mobs/Giant.cpp b/src/Mobs/Giant.cpp index bbcad46f0..bbcad46f0 100644 --- a/source/Mobs/Giant.cpp +++ b/src/Mobs/Giant.cpp diff --git a/source/Mobs/Giant.h b/src/Mobs/Giant.h index 356dd4352..356dd4352 100644 --- a/source/Mobs/Giant.h +++ b/src/Mobs/Giant.h diff --git a/source/Mobs/Horse.cpp b/src/Mobs/Horse.cpp index bb9a4e3f6..bb9a4e3f6 100644 --- a/source/Mobs/Horse.cpp +++ b/src/Mobs/Horse.cpp diff --git a/source/Mobs/Horse.h b/src/Mobs/Horse.h index be0c23f9b..be0c23f9b 100644 --- a/source/Mobs/Horse.h +++ b/src/Mobs/Horse.h diff --git a/source/Mobs/IncludeAllMonsters.h b/src/Mobs/IncludeAllMonsters.h index 1b436a11f..1b436a11f 100644 --- a/source/Mobs/IncludeAllMonsters.h +++ b/src/Mobs/IncludeAllMonsters.h diff --git a/source/Mobs/IronGolem.cpp b/src/Mobs/IronGolem.cpp index 47c961098..47c961098 100644 --- a/source/Mobs/IronGolem.cpp +++ b/src/Mobs/IronGolem.cpp diff --git a/source/Mobs/IronGolem.h b/src/Mobs/IronGolem.h index d49ff4cab..d49ff4cab 100644 --- a/source/Mobs/IronGolem.h +++ b/src/Mobs/IronGolem.h diff --git a/source/Mobs/Magmacube.cpp b/src/Mobs/Magmacube.cpp index 86447ff6b..86447ff6b 100644 --- a/source/Mobs/Magmacube.cpp +++ b/src/Mobs/Magmacube.cpp diff --git a/source/Mobs/Magmacube.h b/src/Mobs/Magmacube.h index 130952970..130952970 100644 --- a/source/Mobs/Magmacube.h +++ b/src/Mobs/Magmacube.h diff --git a/source/Mobs/Monster.cpp b/src/Mobs/Monster.cpp index 091623c8a..091623c8a 100644 --- a/source/Mobs/Monster.cpp +++ b/src/Mobs/Monster.cpp diff --git a/source/Mobs/Monster.h b/src/Mobs/Monster.h index 29a705d11..29a705d11 100644 --- a/source/Mobs/Monster.h +++ b/src/Mobs/Monster.h diff --git a/source/Mobs/Mooshroom.cpp b/src/Mobs/Mooshroom.cpp index 940e2db44..940e2db44 100644 --- a/source/Mobs/Mooshroom.cpp +++ b/src/Mobs/Mooshroom.cpp diff --git a/source/Mobs/Mooshroom.h b/src/Mobs/Mooshroom.h index 73f6348b6..73f6348b6 100644 --- a/source/Mobs/Mooshroom.h +++ b/src/Mobs/Mooshroom.h diff --git a/source/Mobs/Ocelot.h b/src/Mobs/Ocelot.h index adb7a1f75..adb7a1f75 100644 --- a/source/Mobs/Ocelot.h +++ b/src/Mobs/Ocelot.h diff --git a/source/Mobs/PassiveAggressiveMonster.cpp b/src/Mobs/PassiveAggressiveMonster.cpp index 28de65905..28de65905 100644 --- a/source/Mobs/PassiveAggressiveMonster.cpp +++ b/src/Mobs/PassiveAggressiveMonster.cpp diff --git a/source/Mobs/PassiveAggressiveMonster.h b/src/Mobs/PassiveAggressiveMonster.h index 2c5ef30b1..2c5ef30b1 100644 --- a/source/Mobs/PassiveAggressiveMonster.h +++ b/src/Mobs/PassiveAggressiveMonster.h diff --git a/source/Mobs/PassiveMonster.cpp b/src/Mobs/PassiveMonster.cpp index 91ceb5a53..91ceb5a53 100644 --- a/source/Mobs/PassiveMonster.cpp +++ b/src/Mobs/PassiveMonster.cpp diff --git a/source/Mobs/PassiveMonster.h b/src/Mobs/PassiveMonster.h index 14a6be6b1..14a6be6b1 100644 --- a/source/Mobs/PassiveMonster.h +++ b/src/Mobs/PassiveMonster.h diff --git a/source/Mobs/Pig.cpp b/src/Mobs/Pig.cpp index 0871a38a9..0871a38a9 100644 --- a/source/Mobs/Pig.cpp +++ b/src/Mobs/Pig.cpp diff --git a/source/Mobs/Pig.h b/src/Mobs/Pig.h index 4fd0d8db8..4fd0d8db8 100644 --- a/source/Mobs/Pig.h +++ b/src/Mobs/Pig.h diff --git a/source/Mobs/Sheep.cpp b/src/Mobs/Sheep.cpp index bda4ccff8..bda4ccff8 100644 --- a/source/Mobs/Sheep.cpp +++ b/src/Mobs/Sheep.cpp diff --git a/source/Mobs/Sheep.h b/src/Mobs/Sheep.h index 8293a2c05..8293a2c05 100644 --- a/source/Mobs/Sheep.h +++ b/src/Mobs/Sheep.h diff --git a/source/Mobs/Silverfish.h b/src/Mobs/Silverfish.h index a6e11c49d..a6e11c49d 100644 --- a/source/Mobs/Silverfish.h +++ b/src/Mobs/Silverfish.h diff --git a/source/Mobs/Skeleton.cpp b/src/Mobs/Skeleton.cpp index 509c2191e..509c2191e 100644 --- a/source/Mobs/Skeleton.cpp +++ b/src/Mobs/Skeleton.cpp diff --git a/source/Mobs/Skeleton.h b/src/Mobs/Skeleton.h index 8f31b42e1..8f31b42e1 100644 --- a/source/Mobs/Skeleton.h +++ b/src/Mobs/Skeleton.h diff --git a/source/Mobs/Slime.cpp b/src/Mobs/Slime.cpp index 19f376c21..19f376c21 100644 --- a/source/Mobs/Slime.cpp +++ b/src/Mobs/Slime.cpp diff --git a/source/Mobs/Slime.h b/src/Mobs/Slime.h index 782c3113f..782c3113f 100644 --- a/source/Mobs/Slime.h +++ b/src/Mobs/Slime.h diff --git a/source/Mobs/SnowGolem.cpp b/src/Mobs/SnowGolem.cpp index 9e199f87e..9e199f87e 100644 --- a/source/Mobs/SnowGolem.cpp +++ b/src/Mobs/SnowGolem.cpp diff --git a/source/Mobs/SnowGolem.h b/src/Mobs/SnowGolem.h index d1344adfd..d1344adfd 100644 --- a/source/Mobs/SnowGolem.h +++ b/src/Mobs/SnowGolem.h diff --git a/source/Mobs/Spider.cpp b/src/Mobs/Spider.cpp index b19a5dcef..b19a5dcef 100644 --- a/source/Mobs/Spider.cpp +++ b/src/Mobs/Spider.cpp diff --git a/source/Mobs/Spider.h b/src/Mobs/Spider.h index 51e65d028..51e65d028 100644 --- a/source/Mobs/Spider.h +++ b/src/Mobs/Spider.h diff --git a/source/Mobs/Squid.cpp b/src/Mobs/Squid.cpp index a311108ae..a311108ae 100644 --- a/source/Mobs/Squid.cpp +++ b/src/Mobs/Squid.cpp diff --git a/source/Mobs/Squid.h b/src/Mobs/Squid.h index ad299b95c..ad299b95c 100644 --- a/source/Mobs/Squid.h +++ b/src/Mobs/Squid.h diff --git a/source/Mobs/Villager.cpp b/src/Mobs/Villager.cpp index 7f89fb6cc..7f89fb6cc 100644 --- a/source/Mobs/Villager.cpp +++ b/src/Mobs/Villager.cpp diff --git a/source/Mobs/Villager.h b/src/Mobs/Villager.h index 4cd9aaa8e..4cd9aaa8e 100644 --- a/source/Mobs/Villager.h +++ b/src/Mobs/Villager.h diff --git a/source/Mobs/Witch.cpp b/src/Mobs/Witch.cpp index 25d27041f..25d27041f 100644 --- a/source/Mobs/Witch.cpp +++ b/src/Mobs/Witch.cpp diff --git a/source/Mobs/Witch.h b/src/Mobs/Witch.h index 4e637beea..4e637beea 100644 --- a/source/Mobs/Witch.h +++ b/src/Mobs/Witch.h diff --git a/source/Mobs/Wither.cpp b/src/Mobs/Wither.cpp index c46e0beab..c46e0beab 100644 --- a/source/Mobs/Wither.cpp +++ b/src/Mobs/Wither.cpp diff --git a/source/Mobs/Wither.h b/src/Mobs/Wither.h index 56effc6bb..56effc6bb 100644 --- a/source/Mobs/Wither.h +++ b/src/Mobs/Wither.h diff --git a/source/Mobs/Wolf.cpp b/src/Mobs/Wolf.cpp index c86250142..c86250142 100644 --- a/source/Mobs/Wolf.cpp +++ b/src/Mobs/Wolf.cpp diff --git a/source/Mobs/Wolf.h b/src/Mobs/Wolf.h index 040e2cf7a..040e2cf7a 100644 --- a/source/Mobs/Wolf.h +++ b/src/Mobs/Wolf.h diff --git a/source/Mobs/Zombie.cpp b/src/Mobs/Zombie.cpp index a485d2b55..a485d2b55 100644 --- a/source/Mobs/Zombie.cpp +++ b/src/Mobs/Zombie.cpp diff --git a/source/Mobs/Zombie.h b/src/Mobs/Zombie.h index 7e14fe42f..7e14fe42f 100644 --- a/source/Mobs/Zombie.h +++ b/src/Mobs/Zombie.h diff --git a/source/Mobs/Zombiepigman.cpp b/src/Mobs/Zombiepigman.cpp index 6ac89ed4c..6ac89ed4c 100644 --- a/source/Mobs/Zombiepigman.cpp +++ b/src/Mobs/Zombiepigman.cpp diff --git a/source/Mobs/Zombiepigman.h b/src/Mobs/Zombiepigman.h index 67991d56a..67991d56a 100644 --- a/source/Mobs/Zombiepigman.h +++ b/src/Mobs/Zombiepigman.h diff --git a/src/MonsterConfig.cpp b/src/MonsterConfig.cpp new file mode 100644 index 000000000..6165606f0 --- /dev/null +++ b/src/MonsterConfig.cpp @@ -0,0 +1,103 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "MonsterConfig.h" +#include "Mobs/Monster.h" +#include "inifile/iniFile.h" + + + + + +struct cMonsterConfig::sAttributesStruct +{ + AString m_Name; + double m_SightDistance; + double m_AttackDamage; + double m_AttackRange; + double m_AttackRate; + int m_MaxHealth; +}; + + + + + +struct cMonsterConfig::sMonsterConfigState +{ + AString MonsterTypes; + std::list< sAttributesStruct > AttributesList; +}; + + + + + +cMonsterConfig::cMonsterConfig(void) + : m_pState( new sMonsterConfigState ) +{ + Initialize(); +} + + + + + +cMonsterConfig::~cMonsterConfig() +{ + delete m_pState; +} + + + + + +void cMonsterConfig::Initialize() +{ + cIniFile MonstersIniFile; + + if (!MonstersIniFile.ReadFile("monsters.ini")) + { + LOGWARNING("%s: Cannot read monsters.ini file, monster attributes not available", __FUNCTION__); + return; + } + + for (int i = (int)MonstersIniFile.GetNumKeys(); i >= 0; i--) + { + sAttributesStruct Attributes; + AString Name = MonstersIniFile.GetKeyName(i); + Attributes.m_Name = Name; + Attributes.m_AttackDamage = MonstersIniFile.GetValueF(Name, "AttackDamage", 0); + Attributes.m_AttackRange = MonstersIniFile.GetValueF(Name, "AttackRange", 0); + Attributes.m_SightDistance = MonstersIniFile.GetValueF(Name, "SightDistance", 0); + Attributes.m_AttackRate = MonstersIniFile.GetValueF(Name, "AttackRate", 0); + Attributes.m_MaxHealth = MonstersIniFile.GetValueI(Name, "MaxHealth", 1); + m_pState->AttributesList.push_front(Attributes); + } // for i - SplitList[] +} + + + + + +void cMonsterConfig::AssignAttributes(cMonster * a_Monster, const AString & a_Name) +{ + std::list<sAttributesStruct>::const_iterator itr; + for (itr = m_pState->AttributesList.begin(); itr != m_pState->AttributesList.end(); ++itr) + { + if (itr->m_Name.compare(a_Name) == 0) + { + a_Monster->SetAttackDamage ((float)itr->m_AttackDamage); + a_Monster->SetAttackRange ((float)itr->m_AttackRange); + a_Monster->SetSightDistance((float)itr->m_SightDistance); + a_Monster->SetAttackRate ((int)itr->m_AttackRate); + a_Monster->SetMaxHealth (itr->m_MaxHealth); + return; + } + } // for itr - m_pState->AttributesList[] +} + + + + + diff --git a/source/MonsterConfig.h b/src/MonsterConfig.h index 371d324c2..371d324c2 100644 --- a/source/MonsterConfig.h +++ b/src/MonsterConfig.h diff --git a/source/Noise.cpp b/src/Noise.cpp index 729641961..729641961 100644 --- a/source/Noise.cpp +++ b/src/Noise.cpp diff --git a/source/Noise.h b/src/Noise.h index ea72c64e9..ea72c64e9 100644 --- a/source/Noise.h +++ b/src/Noise.h diff --git a/source/OSSupport/BlockingTCPLink.cpp b/src/OSSupport/BlockingTCPLink.cpp index 55454a4b5..55454a4b5 100644 --- a/source/OSSupport/BlockingTCPLink.cpp +++ b/src/OSSupport/BlockingTCPLink.cpp diff --git a/source/OSSupport/BlockingTCPLink.h b/src/OSSupport/BlockingTCPLink.h index cb5f9e3f4..cb5f9e3f4 100644 --- a/source/OSSupport/BlockingTCPLink.h +++ b/src/OSSupport/BlockingTCPLink.h diff --git a/source/OSSupport/CriticalSection.cpp b/src/OSSupport/CriticalSection.cpp index bda97e3a1..bda97e3a1 100644 --- a/source/OSSupport/CriticalSection.cpp +++ b/src/OSSupport/CriticalSection.cpp diff --git a/source/OSSupport/CriticalSection.h b/src/OSSupport/CriticalSection.h index 1bfe81439..1bfe81439 100644 --- a/source/OSSupport/CriticalSection.h +++ b/src/OSSupport/CriticalSection.h diff --git a/source/OSSupport/Event.cpp b/src/OSSupport/Event.cpp index cbacbba17..cbacbba17 100644 --- a/source/OSSupport/Event.cpp +++ b/src/OSSupport/Event.cpp diff --git a/source/OSSupport/Event.h b/src/OSSupport/Event.h index 71f418c0c..71f418c0c 100644 --- a/source/OSSupport/Event.h +++ b/src/OSSupport/Event.h diff --git a/source/OSSupport/File.cpp b/src/OSSupport/File.cpp index 9f7c0d439..9f7c0d439 100644 --- a/source/OSSupport/File.cpp +++ b/src/OSSupport/File.cpp diff --git a/source/OSSupport/File.h b/src/OSSupport/File.h index 01663a229..01663a229 100644 --- a/source/OSSupport/File.h +++ b/src/OSSupport/File.h diff --git a/source/OSSupport/GZipFile.cpp b/src/OSSupport/GZipFile.cpp index cbf6be6c4..cbf6be6c4 100644 --- a/source/OSSupport/GZipFile.cpp +++ b/src/OSSupport/GZipFile.cpp diff --git a/src/OSSupport/GZipFile.h b/src/OSSupport/GZipFile.h new file mode 100644 index 000000000..dfb4e8c31 --- /dev/null +++ b/src/OSSupport/GZipFile.h @@ -0,0 +1,52 @@ + +// GZipFile.h + +// Declares the cGZipFile class representing a RAII wrapper over zlib's GZip file routines + + + + + +#pragma once + +#include "zlib/zlib.h" + + + + + +class cGZipFile +{ +public: + enum eMode + { + fmRead, // Read-only. If the file doesn't exist, object will not be valid + fmWrite, // Write-only. If the file already exists, it will be overwritten + } ; + + cGZipFile(void); + ~cGZipFile(); + + /// Opens the file. Returns true if successful. Fails if a file has already been opened through this object. + bool Open(const AString & a_FileName, eMode a_Mode); + + /// Closes the file, flushing all buffers. This object may be then reused for a different file and / or mode + void Close(void); + + /// Reads the rest of the file and decompresses it into a_Contents. Returns the number of decompressed bytes, <0 for error + int ReadRestOfFile(AString & a_Contents); + + /// Writes a_Contents into file, compressing it along the way. Returns true if successful. Multiple writes are supported. + bool Write(const AString & a_Contents) { return Write(a_Contents.data(), (int)(a_Contents.size())); } + + bool Write(const char * a_Data, int a_Size); + +protected: + gzFile m_File; + eMode m_Mode; +} ; + + + + + diff --git a/source/OSSupport/IsThread.cpp b/src/OSSupport/IsThread.cpp index 4da9f9949..4da9f9949 100644 --- a/source/OSSupport/IsThread.cpp +++ b/src/OSSupport/IsThread.cpp diff --git a/source/OSSupport/IsThread.h b/src/OSSupport/IsThread.h index b8784ea33..b8784ea33 100644 --- a/source/OSSupport/IsThread.h +++ b/src/OSSupport/IsThread.h diff --git a/source/OSSupport/ListenThread.cpp b/src/OSSupport/ListenThread.cpp index ba3198764..ba3198764 100644 --- a/source/OSSupport/ListenThread.cpp +++ b/src/OSSupport/ListenThread.cpp diff --git a/source/OSSupport/ListenThread.h b/src/OSSupport/ListenThread.h index 4e337d814..4e337d814 100644 --- a/source/OSSupport/ListenThread.h +++ b/src/OSSupport/ListenThread.h diff --git a/source/OSSupport/Semaphore.cpp b/src/OSSupport/Semaphore.cpp index 468de6858..468de6858 100644 --- a/source/OSSupport/Semaphore.cpp +++ b/src/OSSupport/Semaphore.cpp diff --git a/source/OSSupport/Semaphore.h b/src/OSSupport/Semaphore.h index fbe8907f1..fbe8907f1 100644 --- a/source/OSSupport/Semaphore.h +++ b/src/OSSupport/Semaphore.h diff --git a/source/OSSupport/Sleep.cpp b/src/OSSupport/Sleep.cpp index 70fb06b40..70fb06b40 100644 --- a/source/OSSupport/Sleep.cpp +++ b/src/OSSupport/Sleep.cpp diff --git a/source/OSSupport/Sleep.h b/src/OSSupport/Sleep.h index 5298c15da..5298c15da 100644 --- a/source/OSSupport/Sleep.h +++ b/src/OSSupport/Sleep.h diff --git a/source/OSSupport/Socket.cpp b/src/OSSupport/Socket.cpp index f25f800c2..f25f800c2 100644 --- a/source/OSSupport/Socket.cpp +++ b/src/OSSupport/Socket.cpp diff --git a/source/OSSupport/Socket.h b/src/OSSupport/Socket.h index 81bfd28fc..81bfd28fc 100644 --- a/source/OSSupport/Socket.h +++ b/src/OSSupport/Socket.h diff --git a/source/OSSupport/SocketThreads.cpp b/src/OSSupport/SocketThreads.cpp index 3e505616c..3e505616c 100644 --- a/source/OSSupport/SocketThreads.cpp +++ b/src/OSSupport/SocketThreads.cpp diff --git a/source/OSSupport/SocketThreads.h b/src/OSSupport/SocketThreads.h index ecbac3aeb..ecbac3aeb 100644 --- a/source/OSSupport/SocketThreads.h +++ b/src/OSSupport/SocketThreads.h diff --git a/source/OSSupport/Thread.cpp b/src/OSSupport/Thread.cpp index 3df75f0e7..3df75f0e7 100644 --- a/source/OSSupport/Thread.cpp +++ b/src/OSSupport/Thread.cpp diff --git a/source/OSSupport/Thread.h b/src/OSSupport/Thread.h index 3c9316424..3c9316424 100644 --- a/source/OSSupport/Thread.h +++ b/src/OSSupport/Thread.h diff --git a/source/OSSupport/Timer.cpp b/src/OSSupport/Timer.cpp index ed16f9e3a..ed16f9e3a 100644 --- a/source/OSSupport/Timer.cpp +++ b/src/OSSupport/Timer.cpp diff --git a/source/OSSupport/Timer.h b/src/OSSupport/Timer.h index a059daa41..a059daa41 100644 --- a/source/OSSupport/Timer.h +++ b/src/OSSupport/Timer.h diff --git a/source/Piston.cpp b/src/Piston.cpp index 048cc355d..048cc355d 100644 --- a/source/Piston.cpp +++ b/src/Piston.cpp diff --git a/source/Piston.h b/src/Piston.h index 92ddf6938..92ddf6938 100644 --- a/source/Piston.h +++ b/src/Piston.h diff --git a/source/Plugin.cpp b/src/Plugin.cpp index 98ccfb88c..98ccfb88c 100644 --- a/source/Plugin.cpp +++ b/src/Plugin.cpp diff --git a/source/Plugin.h b/src/Plugin.h index 06e5819df..06e5819df 100644 --- a/source/Plugin.h +++ b/src/Plugin.h diff --git a/src/PluginLua.cpp b/src/PluginLua.cpp new file mode 100644 index 000000000..4ddf191ac --- /dev/null +++ b/src/PluginLua.cpp @@ -0,0 +1,1471 @@ + +// PluginLua.cpp + +// Implements the cPluginLua class representing a plugin written in Lua + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#define LUA_USE_POSIX +#include "PluginLua.h" +#include "CommandOutput.h" + +extern "C" +{ + #include "lua/src/lualib.h" +} + +#include "tolua++.h" + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cPluginLua: + +cPluginLua::cPluginLua(const AString & a_PluginDirectory) : + cPlugin(a_PluginDirectory), + m_LuaState(Printf("plugin %s", a_PluginDirectory.c_str())) +{ +} + + + + + +cPluginLua::~cPluginLua() +{ + cCSLock Lock(m_CriticalSection); + Close(); +} + + + + + +void cPluginLua::Close(void) +{ + if (m_LuaState.IsValid()) + { + // Release all the references in the hook map: + for (cHookMap::iterator itrH = m_HookMap.begin(), endH = m_HookMap.end(); itrH != endH; ++itrH) + { + for (cLuaRefs::iterator itrR = itrH->second.begin(), endR = itrH->second.end(); itrR != endR; ++itrR) + { + delete *itrR; + } // for itrR - itrH->second[] + } // for itrH - m_HookMap[] + m_HookMap.clear(); + + m_LuaState.Close(); + } + else + { + ASSERT(m_HookMap.empty()); + } +} + + + + + +bool cPluginLua::Initialize(void) +{ + cCSLock Lock(m_CriticalSection); + if (!m_LuaState.IsValid()) + { + m_LuaState.Create(); + + // Inject the identification global variables into the state: + lua_pushlightuserdata(m_LuaState, this); + lua_setglobal(m_LuaState, LUA_PLUGIN_INSTANCE_VAR_NAME); + lua_pushstring(m_LuaState, GetName().c_str()); + lua_setglobal(m_LuaState, LUA_PLUGIN_NAME_VAR_NAME); + + tolua_pushusertype(m_LuaState, this, "cPluginLua"); + lua_setglobal(m_LuaState, "g_Plugin"); + } + + std::string PluginPath = FILE_IO_PREFIX + GetLocalFolder() + "/"; + + // Load all files for this plugin, and execute them + AStringVector Files = cFile::GetFolderContents(PluginPath.c_str()); + for (AStringVector::const_iterator itr = Files.begin(); itr != Files.end(); ++itr) + { + if (itr->rfind(".lua") == AString::npos) + { + continue; + } + AString Path = PluginPath + *itr; + if (!m_LuaState.LoadFile(Path)) + { + Close(); + return false; + } + } // for itr - Files[] + + // Call intialize function + bool res = false; + if (!m_LuaState.Call("Initialize", this, cLuaState::Return, res)) + { + LOGWARNING("Error in plugin %s: Cannot call the Initialize() function. Plugin is temporarily disabled.", GetName().c_str()); + Close(); + return false; + } + + if (!res) + { + LOGINFO("Plugin %s: Initialize() call failed, plugin is temporarily disabled.", GetName().c_str()); + Close(); + return false; + } + + return true; +} + + + + + +void cPluginLua::OnDisable(void) +{ + cCSLock Lock(m_CriticalSection); + if (!m_LuaState.HasFunction("OnDisable")) + { + return; + } + m_LuaState.Call("OnDisable"); +} + + + + + +void cPluginLua::Tick(float a_Dt) +{ + cCSLock Lock(m_CriticalSection); + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_TICK]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_Dt); + } +} + + + + + +bool cPluginLua::OnBlockToPickups(cWorld * a_World, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cItems & a_Pickups) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_BLOCK_TO_PICKUPS]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_World, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, &a_Pickups, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnChat(cPlayer * a_Player, AString & a_Message) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CHAT]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_Player, a_Message, cLuaState::Return, res, a_Message); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnChunkAvailable(cWorld * a_World, int a_ChunkX, int a_ChunkZ) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CHUNK_AVAILABLE]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_World, a_ChunkX, a_ChunkZ, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnChunkGenerated(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CHUNK_GENERATED]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CHUNK_GENERATING]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnChunkUnloaded(cWorld * a_World, int a_ChunkX, int a_ChunkZ) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CHUNK_UNLOADED]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_World, a_ChunkX, a_ChunkZ, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnChunkUnloading(cWorld * a_World, int a_ChunkX, int a_ChunkZ) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CHUNK_UNLOADING]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_World, a_ChunkX, a_ChunkZ, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnCollectingPickup(cPlayer * a_Player, cPickup * a_Pickup) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_COLLECTING_PICKUP]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_Player, a_Pickup, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_CRAFTING_NO_RECIPE]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), (cPlayer *)a_Player, a_Grid, a_Recipe, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnDisconnect(cPlayer * a_Player, const AString & a_Reason) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_DISCONNECT]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_Player, a_Reason, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnExecuteCommand(cPlayer * a_Player, const AStringVector & a_Split) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_EXECUTE_COMMAND]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_Player, a_Split, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnExploded(cWorld & a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_EXPLODED]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + switch (a_Source) + { + case esOther: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break; + case esPrimedTNT: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (cTNTEntity *)a_SourceData, cLuaState::Return, res); break; + case esCreeper: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (cCreeper *)a_SourceData, cLuaState::Return, res); break; + case esBed: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (Vector3i *)a_SourceData, cLuaState::Return, res); break; + case esEnderCrystal: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (Vector3i *)a_SourceData, cLuaState::Return, res); break; + case esGhastFireball: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break; + case esWitherSkullBlack: + case esWitherSkullBlue: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break; + case esWitherBirth: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break; + case esPlugin: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res); break; + default: + { + ASSERT(!"Unhandled ExplosionSource"); + return false; + } + } + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnExploding(cWorld & a_World, double & a_ExplosionSize, bool & a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_EXPLODING]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + switch (a_Source) + { + case esOther: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; + case esPrimedTNT: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (cTNTEntity *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; + case esCreeper: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (cCreeper *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; + case esBed: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (Vector3i *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; + case esEnderCrystal: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, (Vector3i *)a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; + case esGhastFireball: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; + case esWitherSkullBlack: + case esWitherSkullBlue: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; + case esWitherBirth: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; + case esPlugin: m_LuaState.Call((int)(**itr), &a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData, cLuaState::Return, res, a_CanCauseFire, a_ExplosionSize); break; + default: + { + ASSERT(!"Unhandled ExplosionSource"); + return false; + } + } + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnHandshake(cClientHandle * a_Client, const AString & a_Username) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_HANDSHAKE]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_Client, a_Username, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnHopperPullingItem(cWorld & a_World, cHopperEntity & a_Hopper, int a_DstSlotNum, cBlockEntityWithItems & a_SrcEntity, int a_SrcSlotNum) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_HOPPER_PULLING_ITEM]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_World, &a_Hopper, a_DstSlotNum, &a_SrcEntity, a_SrcSlotNum, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnHopperPushingItem(cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_HOPPER_PUSHING_ITEM]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_World, &a_Hopper, a_SrcSlotNum, &a_DstEntity, a_DstSlotNum, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnKilling(cEntity & a_Victim, cEntity * a_Killer) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_KILLING]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Victim, a_Killer, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnLogin(cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_LOGIN]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_Client, a_ProtocolVersion, a_Username, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerAnimation(cPlayer & a_Player, int a_Animation) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_ANIMATION]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_Animation, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerBreakingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_BREAKING_BLOCK]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_BlockType, a_BlockMeta, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerBrokenBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_BROKEN_BLOCK]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_BlockType, a_BlockMeta, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerEating(cPlayer & a_Player) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_EATING]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerJoined(cPlayer & a_Player) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_JOINED]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerLeftClick(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_LEFT_CLICK]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerMoved(cPlayer & a_Player) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_MOVING]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerPlacedBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_PLACED_BLOCK]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerPlacingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_PLACING_BLOCK]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerRightClick(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_RIGHT_CLICK]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_RIGHT_CLICKING_ENTITY]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, &a_Entity, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerShooting(cPlayer & a_Player) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_SHOOTING]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerSpawned(cPlayer & a_Player) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_SPAWNED]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerTossingItem(cPlayer & a_Player) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_TOSSING_ITEM]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerUsedBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_USED_BLOCK]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerUsedItem(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_USED_ITEM]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerUsingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_USING_BLOCK]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPlayerUsingItem(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PLAYER_USING_ITEM]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPostCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_POST_CRAFTING]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_Player, a_Grid, a_Recipe, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_PRE_CRAFTING]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_Player, a_Grid, a_Recipe, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnSpawnedEntity(cWorld & a_World, cEntity & a_Entity) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_SPAWNED_ENTITY]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_World, &a_Entity, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnSpawnedMonster(cWorld & a_World, cMonster & a_Monster) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_SPAWNED_MONSTER]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_World, &a_Monster, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnSpawningEntity(cWorld & a_World, cEntity & a_Entity) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_SPAWNING_ENTITY]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_World, &a_Entity, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnSpawningMonster(cWorld & a_World, cMonster & a_Monster) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_SPAWNING_MONSTER]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_World, &a_Monster, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnTakeDamage(cEntity & a_Receiver, TakeDamageInfo & a_TDI) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_TAKE_DAMAGE]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_Receiver, &a_TDI, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnUpdatedSign( + cWorld * a_World, + int a_BlockX, int a_BlockY, int a_BlockZ, + const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, + cPlayer * a_Player +) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_UPDATED_SIGN]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, a_Player, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnUpdatingSign( + cWorld * a_World, + int a_BlockX, int a_BlockY, int a_BlockZ, + AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, + cPlayer * a_Player +) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_UPDATING_SIGN]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, a_Player, cLuaState::Return, res, a_Line1, a_Line2, a_Line3, a_Line4); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnWeatherChanged(cWorld & a_World) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_WEATHER_CHANGED]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_World, cLuaState::Return, res); + if (res) + { + return true; + } + } + return false; +} + + + + + +bool cPluginLua::OnWeatherChanging(cWorld & a_World, eWeather & a_NewWeather) +{ + cCSLock Lock(m_CriticalSection); + bool res = false; + int NewWeather = a_NewWeather; + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_WEATHER_CHANGING]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_World, NewWeather, cLuaState::Return, res, NewWeather); + if (res) + { + a_NewWeather = (eWeather)NewWeather; + return true; + } + } + a_NewWeather = (eWeather)NewWeather; + return false; +} + + + + + +bool cPluginLua::OnWorldTick(cWorld & a_World, float a_Dt) +{ + cCSLock Lock(m_CriticalSection); + cLuaRefs & Refs = m_HookMap[cPluginManager::HOOK_WORLD_TICK]; + for (cLuaRefs::iterator itr = Refs.begin(), end = Refs.end(); itr != end; ++itr) + { + m_LuaState.Call((int)(**itr), &a_World, a_Dt); + } + return false; +} + + + + + +bool cPluginLua::HandleCommand(const AStringVector & a_Split, cPlayer * a_Player) +{ + ASSERT(!a_Split.empty()); + CommandMap::iterator cmd = m_Commands.find(a_Split[0]); + if (cmd == m_Commands.end()) + { + LOGWARNING("Command handler is registered in cPluginManager but not in cPlugin, wtf? Command \"%s\".", a_Split[0].c_str()); + return false; + } + + cCSLock Lock(m_CriticalSection); + bool res = false; + m_LuaState.Call(cmd->second, a_Split, a_Player, cLuaState::Return, res); + return res; +} + + + + + +bool cPluginLua::HandleConsoleCommand(const AStringVector & a_Split, cCommandOutputCallback & a_Output) +{ + ASSERT(!a_Split.empty()); + CommandMap::iterator cmd = m_ConsoleCommands.find(a_Split[0]); + if (cmd == m_ConsoleCommands.end()) + { + LOGWARNING("Console command handler is registered in cPluginManager but not in cPlugin, wtf? Console command \"%s\", plugin \"%s\".", + a_Split[0].c_str(), GetName().c_str() + ); + return false; + } + + cCSLock Lock(m_CriticalSection); + bool res = false; + AString str; + m_LuaState.Call(cmd->second, a_Split, cLuaState::Return, res, str); + if (res && !str.empty()) + { + a_Output.Out(str); + } + return res; +} + + + + + +void cPluginLua::ClearCommands(void) +{ + cCSLock Lock(m_CriticalSection); + + // Unreference the bound functions so that Lua can GC them + if (m_LuaState != NULL) + { + for (CommandMap::iterator itr = m_Commands.begin(), end = m_Commands.end(); itr != end; ++itr) + { + luaL_unref(m_LuaState, LUA_REGISTRYINDEX, itr->second); + } + } + m_Commands.clear(); +} + + + + + +void cPluginLua::ClearConsoleCommands(void) +{ + cCSLock Lock(m_CriticalSection); + + // Unreference the bound functions so that Lua can GC them + if (m_LuaState != NULL) + { + for (CommandMap::iterator itr = m_ConsoleCommands.begin(), end = m_ConsoleCommands.end(); itr != end; ++itr) + { + luaL_unref(m_LuaState, LUA_REGISTRYINDEX, itr->second); + } + } + m_ConsoleCommands.clear(); +} + + + + + +bool cPluginLua::CanAddOldStyleHook(int a_HookType) +{ + const char * FnName = GetHookFnName(a_HookType); + if (FnName == NULL) + { + // Unknown hook ID + LOGWARNING("Plugin %s wants to add an unknown hook ID (%d). The plugin need not work properly.", + GetName().c_str(), a_HookType + ); + m_LuaState.LogStackTrace(); + return false; + } + + // Check if the function is available + if (m_LuaState.HasFunction(FnName)) + { + return true; + } + + LOGWARNING("Plugin %s wants to add a hook (%d), but it doesn't provide the callback function \"%s\" for it. The plugin need not work properly.", + GetName().c_str(), a_HookType, FnName + ); + m_LuaState.LogStackTrace(); + return false; +} + + + + + +const char * cPluginLua::GetHookFnName(int a_HookType) +{ + switch (a_HookType) + { + case cPluginManager::HOOK_BLOCK_TO_PICKUPS: return "OnBlockToPickups"; + case cPluginManager::HOOK_CHAT: return "OnChat"; + case cPluginManager::HOOK_CHUNK_AVAILABLE: return "OnChunkAvailable"; + case cPluginManager::HOOK_CHUNK_GENERATED: return "OnChunkGenerated"; + case cPluginManager::HOOK_CHUNK_GENERATING: return "OnChunkGenerating"; + case cPluginManager::HOOK_CHUNK_UNLOADED: return "OnChunkUnloaded"; + case cPluginManager::HOOK_CHUNK_UNLOADING: return "OnChunkUnloading"; + case cPluginManager::HOOK_COLLECTING_PICKUP: return "OnCollectingPickup"; + case cPluginManager::HOOK_CRAFTING_NO_RECIPE: return "OnCraftingNoRecipe"; + case cPluginManager::HOOK_DISCONNECT: return "OnDisconnect"; + case cPluginManager::HOOK_EXECUTE_COMMAND: return "OnExecuteCommand"; + case cPluginManager::HOOK_HANDSHAKE: return "OnHandshake"; + case cPluginManager::HOOK_KILLING: return "OnKilling"; + case cPluginManager::HOOK_LOGIN: return "OnLogin"; + case cPluginManager::HOOK_PLAYER_ANIMATION: return "OnPlayerAnimation"; + case cPluginManager::HOOK_PLAYER_BREAKING_BLOCK: return "OnPlayerBreakingBlock"; + case cPluginManager::HOOK_PLAYER_BROKEN_BLOCK: return "OnPlayerBrokenBlock"; + case cPluginManager::HOOK_PLAYER_EATING: return "OnPlayerEating"; + case cPluginManager::HOOK_PLAYER_JOINED: return "OnPlayerJoined"; + case cPluginManager::HOOK_PLAYER_LEFT_CLICK: return "OnPlayerLeftClick"; + case cPluginManager::HOOK_PLAYER_MOVING: return "OnPlayerMoving"; + case cPluginManager::HOOK_PLAYER_PLACED_BLOCK: return "OnPlayerPlacedBlock"; + case cPluginManager::HOOK_PLAYER_PLACING_BLOCK: return "OnPlayerPlacingBlock"; + case cPluginManager::HOOK_PLAYER_RIGHT_CLICK: return "OnPlayerRightClick"; + case cPluginManager::HOOK_PLAYER_RIGHT_CLICKING_ENTITY: return "OnPlayerRightClickingEntity"; + case cPluginManager::HOOK_PLAYER_SHOOTING: return "OnPlayerShooting"; + case cPluginManager::HOOK_PLAYER_SPAWNED: return "OnPlayerSpawned"; + case cPluginManager::HOOK_PLAYER_TOSSING_ITEM: return "OnPlayerTossingItem"; + case cPluginManager::HOOK_PLAYER_USED_BLOCK: return "OnPlayerUsedBlock"; + case cPluginManager::HOOK_PLAYER_USED_ITEM: return "OnPlayerUsedItem"; + case cPluginManager::HOOK_PLAYER_USING_BLOCK: return "OnPlayerUsingBlock"; + case cPluginManager::HOOK_PLAYER_USING_ITEM: return "OnPlayerUsingItem"; + case cPluginManager::HOOK_POST_CRAFTING: return "OnPostCrafting"; + case cPluginManager::HOOK_PRE_CRAFTING: return "OnPreCrafting"; + case cPluginManager::HOOK_SPAWNED_ENTITY: return "OnSpawnedEntity"; + case cPluginManager::HOOK_SPAWNED_MONSTER: return "OnSpawnedMonster"; + case cPluginManager::HOOK_SPAWNING_ENTITY: return "OnSpawningEntity"; + case cPluginManager::HOOK_SPAWNING_MONSTER: return "OnSpawningMonster"; + case cPluginManager::HOOK_TAKE_DAMAGE: return "OnTakeDamage"; + case cPluginManager::HOOK_TICK: return "OnTick"; + case cPluginManager::HOOK_UPDATED_SIGN: return "OnUpdatedSign"; + case cPluginManager::HOOK_UPDATING_SIGN: return "OnUpdatingSign"; + case cPluginManager::HOOK_WEATHER_CHANGED: return "OnWeatherChanged"; + case cPluginManager::HOOK_WEATHER_CHANGING: return "OnWeatherChanging"; + case cPluginManager::HOOK_WORLD_TICK: return "OnWorldTick"; + default: return NULL; + } // switch (a_Hook) +} + + + + + +bool cPluginLua::AddHookRef(int a_HookType, int a_FnRefIdx) +{ + ASSERT(m_CriticalSection.IsLockedByCurrentThread()); // It probably has to be, how else would we have a LuaState? + + // Check if the function reference is valid: + cLuaState::cRef * Ref = new cLuaState::cRef(m_LuaState, a_FnRefIdx); + if ((Ref == NULL) || !Ref->IsValid()) + { + LOGWARNING("Plugin %s tried to add a hook %d with bad handler function.", GetName().c_str(), a_HookType); + m_LuaState.LogStackTrace(); + delete Ref; + return false; + } + + m_HookMap[a_HookType].push_back(Ref); + return true; +} + + + + + +AString cPluginLua::HandleWebRequest(const HTTPRequest * a_Request ) +{ + cCSLock Lock(m_CriticalSection); + std::string RetVal = ""; + + std::pair< std::string, std::string > TabName = GetTabNameForRequest(a_Request); + std::string SafeTabName = TabName.second; + if (SafeTabName.empty()) + { + return ""; + } + + sWebPluginTab * Tab = 0; + for (TabList::iterator itr = GetTabs().begin(); itr != GetTabs().end(); ++itr) + { + if ((*itr)->SafeTitle.compare(SafeTabName) == 0) // This is the one! Rawr + { + Tab = *itr; + break; + } + } + + if (Tab != NULL) + { + AString Contents = Printf("WARNING: WebPlugin tab '%s' did not return a string!", Tab->Title.c_str()); + if (!m_LuaState.Call(Tab->UserData, a_Request, cLuaState::Return, Contents)) + { + return "Lua encountered error while processing the page request"; + } + + RetVal += Contents; + } + + return RetVal; +} + + + + + +bool cPluginLua::AddWebTab(const AString & a_Title, lua_State * a_LuaState, int a_FunctionReference) +{ + cCSLock Lock(m_CriticalSection); + if (a_LuaState != m_LuaState) + { + LOGERROR("Only allowed to add a tab to a WebPlugin of your own Plugin!"); + return false; + } + sWebPluginTab * Tab = new sWebPluginTab(); + Tab->Title = a_Title; + Tab->SafeTitle = SafeString(a_Title); + + Tab->UserData = a_FunctionReference; + + GetTabs().push_back(Tab); + return true; +} + + + + + +void cPluginLua::BindCommand(const AString & a_Command, int a_FnRef) +{ + ASSERT(m_Commands.find(a_Command) == m_Commands.end()); + m_Commands[a_Command] = a_FnRef; +} + + + + + +void cPluginLua::BindConsoleCommand(const AString & a_Command, int a_FnRef) +{ + ASSERT(m_ConsoleCommands.find(a_Command) == m_ConsoleCommands.end()); + m_ConsoleCommands[a_Command] = a_FnRef; +} + + + + + +void cPluginLua::Unreference(int a_LuaRef) +{ + cCSLock Lock(m_CriticalSection); + luaL_unref(m_LuaState, LUA_REGISTRYINDEX, a_LuaRef); +} + + + + + +bool cPluginLua::CallbackWindowClosing(int a_FnRef, cWindow & a_Window, cPlayer & a_Player, bool a_CanRefuse) +{ + ASSERT(a_FnRef != LUA_REFNIL); + + cCSLock Lock(m_CriticalSection); + bool res; + m_LuaState.Call(a_FnRef, &a_Window, &a_Player, a_CanRefuse, cLuaState::Return, res); + return res; +} + + + + + +void cPluginLua::CallbackWindowSlotChanged(int a_FnRef, cWindow & a_Window, int a_SlotNum) +{ + ASSERT(a_FnRef != LUA_REFNIL); + + cCSLock Lock(m_CriticalSection); + m_LuaState.Call(a_FnRef, &a_Window, a_SlotNum); +} + + + + diff --git a/source/PluginLua.h b/src/PluginLua.h index 908466966..908466966 100644 --- a/source/PluginLua.h +++ b/src/PluginLua.h diff --git a/src/PluginManager.cpp b/src/PluginManager.cpp new file mode 100644 index 000000000..bb6f2a24b --- /dev/null +++ b/src/PluginManager.cpp @@ -0,0 +1,1668 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "PluginManager.h" +#include "Plugin.h" +#include "PluginLua.h" +#include "WebAdmin.h" +#include "Item.h" +#include "Root.h" +#include "Server.h" +#include "CommandOutput.h" + +#include "inifile/iniFile.h" +#include "tolua++.h" +#include "Entities/Player.h" + + + + + +cPluginManager * cPluginManager::Get(void) +{ + return cRoot::Get()->GetPluginManager(); +} + + + + + +cPluginManager::cPluginManager(void) : + m_bReloadPlugins(false) +{ +} + + + + + +cPluginManager::~cPluginManager() +{ + UnloadPluginsNow(); +} + + + + + +void cPluginManager::ReloadPlugins(void) +{ + m_bReloadPlugins = true; +} + + + + + +void cPluginManager::FindPlugins(void) +{ + AString PluginsPath = FILE_IO_PREFIX + AString( "Plugins/" ); + + // First get a clean list of only the currently running plugins, we don't want to mess those up + for (PluginMap::iterator itr = m_Plugins.begin(); itr != m_Plugins.end();) + { + if (itr->second == NULL) + { + PluginMap::iterator thiz = itr; + ++thiz; + m_Plugins.erase( itr ); + itr = thiz; + continue; + } + ++itr; + } + + AStringVector Files = cFile::GetFolderContents(PluginsPath.c_str()); + for (AStringVector::const_iterator itr = Files.begin(); itr != Files.end(); ++itr) + { + if ((*itr == ".") || (*itr == "..") || (!cFile::IsFolder(PluginsPath + *itr))) + { + // We only want folders, and don't want "." or ".." + continue; + } + + // Add plugin name/directory to the list + if (m_Plugins.find(*itr) == m_Plugins.end()) + { + m_Plugins[*itr] = NULL; + } + } +} + + + + + +void cPluginManager::ReloadPluginsNow(void) +{ + cIniFile a_SettingsIni; + a_SettingsIni.ReadFile("settings.ini"); + ReloadPluginsNow(a_SettingsIni); +} + + + + + +void cPluginManager::ReloadPluginsNow(cIniFile & a_SettingsIni) +{ + LOG("-- Loading Plugins --"); + m_bReloadPlugins = false; + UnloadPluginsNow(); + + FindPlugins(); + + cServer::BindBuiltInConsoleCommands(); + + // Check if the Plugins section exists. + int KeyNum = a_SettingsIni.FindKey("Plugins"); + + // If it does, how many plugins are there? + unsigned int NumPlugins = ((KeyNum != -1) ? (a_SettingsIni.GetNumValues(KeyNum)) : 0); + + if (KeyNum == -1) + { + InsertDefaultPlugins(a_SettingsIni); + } + else if (NumPlugins > 0) + { + for(unsigned int i = 0; i < NumPlugins; i++) + { + AString ValueName = a_SettingsIni.GetValueName(KeyNum, i); + if (ValueName.compare("Plugin") == 0) + { + AString PluginFile = a_SettingsIni.GetValue(KeyNum, i); + if (!PluginFile.empty()) + { + if (m_Plugins.find(PluginFile) != m_Plugins.end()) + { + LoadPlugin( PluginFile ); + } + } + } + } + } + + if (GetNumPlugins() == 0) + { + LOG("-- No Plugins Loaded --"); + } + else if (GetNumPlugins() > 1) + { + LOG("-- Loaded %i Plugins --", GetNumPlugins()); + } + else + { + LOG("-- Loaded 1 Plugin --"); + } +} + + + + + +void cPluginManager::InsertDefaultPlugins(cIniFile & a_SettingsIni) +{ + a_SettingsIni.AddKeyName("Plugins"); + a_SettingsIni.AddKeyComment("Plugins", " Plugin=Debuggers"); + a_SettingsIni.AddKeyComment("Plugins", " Plugin=HookNotify"); + a_SettingsIni.AddKeyComment("Plugins", " Plugin=ChunkWorx"); + a_SettingsIni.AddKeyComment("Plugins", " Plugin=APIDump"); + a_SettingsIni.SetValue("Plugins", "Plugin", "Core"); + a_SettingsIni.SetValue("Plugins", "Plugin", "TransAPI"); + a_SettingsIni.SetValue("Plugins", "Plugin", "ChatLog"); +} + + + + + +void cPluginManager::Tick(float a_Dt) +{ + while (!m_DisablePluginList.empty()) + { + RemovePlugin(m_DisablePluginList.front()); + m_DisablePluginList.pop_front(); + } + + if (m_bReloadPlugins) + { + ReloadPluginsNow(); + } + + HookMap::iterator Plugins = m_Hooks.find(HOOK_TICK); + if (Plugins != m_Hooks.end()) + { + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + (*itr)->Tick(a_Dt); + } + } +} + + + + + +bool cPluginManager::CallHookBlockToPickups( + cWorld * a_World, cEntity * a_Digger, + int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, + cItems & a_Pickups +) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_BLOCK_TO_PICKUPS); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnBlockToPickups(a_World, a_Digger, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, a_Pickups)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookChat(cPlayer * a_Player, AString & a_Message) +{ + if (ExecuteCommand(a_Player, a_Message)) + { + return true; + } + + // Check if it was a standard command (starts with a slash) + if (!a_Message.empty() && (a_Message[0] == '/')) + { + AStringVector Split(StringSplit(a_Message, " ")); + ASSERT(!Split.empty()); // This should not happen - we know there's at least one char in the message so the split needs to be at least one item long + a_Player->SendMessage(Printf("Unknown Command: \"%s\"", Split[0].c_str())); + LOGINFO("Player \"%s\" issued an unknown command: \"%s\"", a_Player->GetName().c_str(), a_Message.c_str()); + return true; // Cancel sending + } + + HookMap::iterator Plugins = m_Hooks.find(HOOK_CHAT); + if (Plugins == m_Hooks.end()) + { + return false; + } + + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnChat(a_Player, a_Message)) + { + return true; + } + } + + return false; +} + + + + + +bool cPluginManager::CallHookChunkAvailable(cWorld * a_World, int a_ChunkX, int a_ChunkZ) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_AVAILABLE); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnChunkAvailable(a_World, a_ChunkX, a_ChunkZ)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookChunkGenerated(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_GENERATED); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnChunkGenerated(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookChunkGenerating(cWorld * a_World, int a_ChunkX, int a_ChunkZ, cChunkDesc * a_ChunkDesc) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_GENERATING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnChunkGenerating(a_World, a_ChunkX, a_ChunkZ, a_ChunkDesc)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookChunkUnloaded(cWorld * a_World, int a_ChunkX, int a_ChunkZ) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_UNLOADED); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnChunkUnloaded(a_World, a_ChunkX, a_ChunkZ)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookChunkUnloading(cWorld * a_World, int a_ChunkX, int a_ChunkZ) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_CHUNK_UNLOADING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnChunkUnloading(a_World, a_ChunkX, a_ChunkZ)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookCollectingPickup(cPlayer * a_Player, cPickup & a_Pickup) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_COLLECTING_PICKUP); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnCollectingPickup(a_Player, &a_Pickup)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookCraftingNoRecipe(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_CRAFTING_NO_RECIPE); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnCraftingNoRecipe(a_Player, a_Grid, a_Recipe)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookDisconnect(cPlayer * a_Player, const AString & a_Reason) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_DISCONNECT); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnDisconnect(a_Player, a_Reason)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookExecuteCommand(cPlayer * a_Player, const AStringVector & a_Split) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_EXECUTE_COMMAND); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnExecuteCommand(a_Player, a_Split)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookExploded(cWorld & a_World, double a_ExplosionSize, bool a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_EXPLODED); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnExploded(a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookExploding(cWorld & a_World, double & a_ExplosionSize, bool & a_CanCauseFire, double a_X, double a_Y, double a_Z, eExplosionSource a_Source, void * a_SourceData) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_EXPLODING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnExploding(a_World, a_ExplosionSize, a_CanCauseFire, a_X, a_Y, a_Z, a_Source, a_SourceData)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookHandshake(cClientHandle * a_ClientHandle, const AString & a_Username) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_HANDSHAKE); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnHandshake(a_ClientHandle, a_Username)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookHopperPullingItem(cWorld & a_World, cHopperEntity & a_Hopper, int a_DstSlotNum, cBlockEntityWithItems & a_SrcEntity, int a_SrcSlotNum) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_HOPPER_PULLING_ITEM); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnHopperPullingItem(a_World, a_Hopper, a_DstSlotNum, a_SrcEntity, a_SrcSlotNum)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookHopperPushingItem(cWorld & a_World, cHopperEntity & a_Hopper, int a_SrcSlotNum, cBlockEntityWithItems & a_DstEntity, int a_DstSlotNum) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_HOPPER_PUSHING_ITEM); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnHopperPushingItem(a_World, a_Hopper, a_SrcSlotNum, a_DstEntity, a_DstSlotNum)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookKilling(cEntity & a_Victim, cEntity * a_Killer) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_KILLING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnKilling(a_Victim, a_Killer)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookLogin(cClientHandle * a_Client, int a_ProtocolVersion, const AString & a_Username) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_LOGIN); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnLogin(a_Client, a_ProtocolVersion, a_Username)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerAnimation(cPlayer & a_Player, int a_Animation) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_ANIMATION); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerAnimation(a_Player, a_Animation)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerBreakingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_BREAKING_BLOCK); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerBreakingBlock(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_BlockType, a_BlockMeta)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerBrokenBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_BROKEN_BLOCK); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerBrokenBlock(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_BlockType, a_BlockMeta)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerEating(cPlayer & a_Player) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_EATING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerEating(a_Player)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerJoined(cPlayer & a_Player) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_JOINED); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerJoined(a_Player)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerLeftClick(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, char a_Status) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_LEFT_CLICK); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerLeftClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_Status)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerMoving(cPlayer & a_Player) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_MOVING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerMoved(a_Player)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerPlacedBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_PLACED_BLOCK); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerPlacedBlock(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerPlacingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_PLACING_BLOCK); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerPlacingBlock(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerRightClick(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_RIGHT_CLICK); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerRightClick(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerRightClickingEntity(cPlayer & a_Player, cEntity & a_Entity) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_RIGHT_CLICKING_ENTITY); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerRightClickingEntity(a_Player, a_Entity)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerShooting(cPlayer & a_Player) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_SHOOTING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerShooting(a_Player)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerSpawned(cPlayer & a_Player) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_SPAWNED); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerSpawned(a_Player)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerTossingItem(cPlayer & a_Player) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_TOSSING_ITEM); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerTossingItem(a_Player)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerUsedBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_USED_BLOCK); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerUsedBlock(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerUsedItem(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_USED_ITEM); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerUsedItem(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerUsingBlock(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_USING_BLOCK); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerUsingBlock(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ, a_BlockType, a_BlockMeta)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPlayerUsingItem(cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, char a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PLAYER_USING_ITEM); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPlayerUsingItem(a_Player, a_BlockX, a_BlockY, a_BlockZ, a_BlockFace, a_CursorX, a_CursorY, a_CursorZ)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPostCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_POST_CRAFTING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPostCrafting(a_Player, a_Grid, a_Recipe)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookPreCrafting(const cPlayer * a_Player, const cCraftingGrid * a_Grid, cCraftingRecipe * a_Recipe) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_PRE_CRAFTING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnPreCrafting(a_Player, a_Grid, a_Recipe)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookSpawnedEntity(cWorld & a_World, cEntity & a_Entity) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_SPAWNED_ENTITY); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnSpawnedEntity(a_World, a_Entity)) + { + return true; + } + } + return false; +} + + + + +bool cPluginManager::CallHookSpawnedMonster(cWorld & a_World, cMonster & a_Monster) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_SPAWNED_MONSTER); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnSpawnedMonster(a_World, a_Monster)) + { + return true; + } + } + return false; +} + + + + +bool cPluginManager::CallHookSpawningEntity(cWorld & a_World, cEntity & a_Entity) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_SPAWNING_ENTITY); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnSpawningEntity(a_World, a_Entity)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookSpawningMonster(cWorld & a_World, cMonster & a_Monster) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_SPAWNING_MONSTER); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnSpawningMonster(a_World, a_Monster)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookTakeDamage(cEntity & a_Receiver, TakeDamageInfo & a_TDI) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_TAKE_DAMAGE); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnTakeDamage(a_Receiver, a_TDI)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookUpdatingSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4, cPlayer * a_Player) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_UPDATING_SIGN); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnUpdatingSign(a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, a_Player)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookUpdatedSign(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_UPDATED_SIGN); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnUpdatedSign(a_World, a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, a_Player)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookWeatherChanged(cWorld & a_World) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_WEATHER_CHANGED); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnWeatherChanged(a_World)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookWeatherChanging(cWorld & a_World, eWeather & a_NewWeather) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_WEATHER_CHANGING); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnWeatherChanging(a_World, a_NewWeather)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::CallHookWorldTick(cWorld & a_World, float a_Dt) +{ + HookMap::iterator Plugins = m_Hooks.find(HOOK_WORLD_TICK); + if (Plugins == m_Hooks.end()) + { + return false; + } + for (PluginList::iterator itr = Plugins->second.begin(); itr != Plugins->second.end(); ++itr) + { + if ((*itr)->OnWorldTick(a_World, a_Dt)) + { + return true; + } + } + return false; +} + + + + + +bool cPluginManager::HandleCommand(cPlayer * a_Player, const AString & a_Command, bool a_ShouldCheckPermissions) +{ + ASSERT(a_Player != NULL); + + AStringVector Split(StringSplit(a_Command, " ")); + if (Split.empty()) + { + return false; + } + + CommandMap::iterator cmd = m_Commands.find(Split[0]); + if (cmd == m_Commands.end()) + { + // Command not found + return false; + } + + // Ask plugins first if a command is okay to execute the command: + if (CallHookExecuteCommand(a_Player, Split)) + { + LOGINFO("Player \"%s\" tried executing command \"%s\" that was stopped by the HOOK_EXECUTE_COMMAND hook", a_Player->GetName().c_str(), Split[0].c_str()); + return false; + } + + if ( + a_ShouldCheckPermissions && + !cmd->second.m_Permission.empty() && + !a_Player->HasPermission(cmd->second.m_Permission) + ) + { + LOGINFO("Player \"%s\" tried to execute forbidden command \"%s\".", a_Player->GetName().c_str(), Split[0].c_str()); + return false; + } + + ASSERT(cmd->second.m_Plugin != NULL); + + return cmd->second.m_Plugin->HandleCommand(Split, a_Player); +} + + + + + +cPlugin * cPluginManager::GetPlugin( const AString & a_Plugin ) const +{ + for( PluginMap::const_iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr ) + { + if (itr->second == NULL ) continue; + if (itr->second->GetName().compare(a_Plugin) == 0) + { + return itr->second; + } + } + return 0; +} + + + + + +const cPluginManager::PluginMap & cPluginManager::GetAllPlugins() const +{ + return m_Plugins; +} + + + + + +void cPluginManager::UnloadPluginsNow() +{ + m_Hooks.clear(); + + while (!m_Plugins.empty()) + { + RemovePlugin(m_Plugins.begin()->second); + } + + m_Commands.clear(); + m_ConsoleCommands.clear(); +} + + + + + +bool cPluginManager::DisablePlugin(const AString & a_PluginName) +{ + PluginMap::iterator itr = m_Plugins.find(a_PluginName); + if (itr == m_Plugins.end()) + { + return false; + } + + if (itr->first.compare(a_PluginName) == 0) // _X 2013_02_01: wtf? Isn't this supposed to be what find() does? + { + m_DisablePluginList.push_back(itr->second); + itr->second = NULL; // Get rid of this thing right away + return true; + } + return false; +} + + + + + +bool cPluginManager::LoadPlugin(const AString & a_PluginName) +{ + return AddPlugin(new cPluginLua(a_PluginName.c_str())); +} + + + + + +void cPluginManager::RemoveHooks(cPlugin * a_Plugin) +{ + for (HookMap::iterator itr = m_Hooks.begin(), end = m_Hooks.end(); itr != end; ++itr) + { + itr->second.remove(a_Plugin); + } +} + + + + + +void cPluginManager::RemovePlugin(cPlugin * a_Plugin) +{ + for (PluginMap::iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr) + { + if (itr->second == a_Plugin) + { + m_Plugins.erase(itr); + break; + } + } + + RemovePluginCommands(a_Plugin); + RemovePluginConsoleCommands(a_Plugin); + RemoveHooks(a_Plugin); + if (a_Plugin != NULL) + { + a_Plugin->OnDisable(); + } + delete a_Plugin; +} + + + + + +void cPluginManager::RemovePluginCommands(cPlugin * a_Plugin) +{ + if (a_Plugin != NULL) + { + a_Plugin->ClearCommands(); + } + + for (CommandMap::iterator itr = m_Commands.begin(); itr != m_Commands.end();) + { + if (itr->second.m_Plugin == a_Plugin) + { + CommandMap::iterator EraseMe = itr; // Stupid GCC doesn't have a std::map::erase() that would return the next iterator + ++itr; + m_Commands.erase(EraseMe); + } + else + { + ++itr; + } + } // for itr - m_Commands[] +} + + + + + +bool cPluginManager::BindCommand(const AString & a_Command, cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) +{ + CommandMap::iterator cmd = m_Commands.find(a_Command); + if (cmd != m_Commands.end()) + { + LOGWARNING("Command \"%s\" is already bound to plugin \"%s\".", a_Command.c_str(), cmd->second.m_Plugin->GetName().c_str()); + return false; + } + + m_Commands[a_Command].m_Plugin = a_Plugin; + m_Commands[a_Command].m_Permission = a_Permission; + m_Commands[a_Command].m_HelpString = a_HelpString; + return true; +} + + + + + +bool cPluginManager::ForEachCommand(cCommandEnumCallback & a_Callback) +{ + for (CommandMap::iterator itr = m_Commands.begin(), end = m_Commands.end(); itr != end; ++itr) + { + if (a_Callback.Command(itr->first, itr->second.m_Plugin, itr->second.m_Permission, itr->second.m_HelpString)) + { + return false; + } + } // for itr - m_Commands[] + return true; +} + + + + + +bool cPluginManager::IsCommandBound(const AString & a_Command) +{ + return (m_Commands.find(a_Command) != m_Commands.end()); +} + + + + + +AString cPluginManager::GetCommandPermission(const AString & a_Command) +{ + CommandMap::iterator cmd = m_Commands.find(a_Command); + return (cmd == m_Commands.end()) ? "" : cmd->second.m_Permission; +} + + + + + +bool cPluginManager::ExecuteCommand(cPlayer * a_Player, const AString & a_Command) +{ + return HandleCommand(a_Player, a_Command, true); +} + + + + + +bool cPluginManager::ForceExecuteCommand(cPlayer * a_Player, const AString & a_Command) +{ + return HandleCommand(a_Player, a_Command, false); +} + + + + + +void cPluginManager::RemovePluginConsoleCommands(cPlugin * a_Plugin) +{ + if (a_Plugin != NULL) + { + a_Plugin->ClearConsoleCommands(); + } + + for (CommandMap::iterator itr = m_ConsoleCommands.begin(); itr != m_ConsoleCommands.end();) + { + if (itr->second.m_Plugin == a_Plugin) + { + CommandMap::iterator EraseMe = itr; // Stupid GCC doesn't have a std::map::erase() that would return the next iterator + ++itr; + m_ConsoleCommands.erase(EraseMe); + } + else + { + ++itr; + } + } // for itr - m_Commands[] +} + + + + + +bool cPluginManager::BindConsoleCommand(const AString & a_Command, cPlugin * a_Plugin, const AString & a_HelpString) +{ + CommandMap::iterator cmd = m_ConsoleCommands.find(a_Command); + if (cmd != m_ConsoleCommands.end()) + { + if (cmd->second.m_Plugin == NULL) + { + LOGWARNING("Console command \"%s\" is already bound internally by MCServer, cannot bind in plugin \"%s\".", a_Command.c_str(), a_Plugin->GetName().c_str()); + } + else + { + LOGWARNING("Console command \"%s\" is already bound to plugin \"%s\", cannot bind in plugin \"%s\".", a_Command.c_str(), cmd->second.m_Plugin->GetName().c_str(), a_Plugin->GetName().c_str()); + } + return false; + } + + m_ConsoleCommands[a_Command].m_Plugin = a_Plugin; + m_ConsoleCommands[a_Command].m_Permission = ""; + m_ConsoleCommands[a_Command].m_HelpString = a_HelpString; + return true; +} + + + + + +bool cPluginManager::ForEachConsoleCommand(cCommandEnumCallback & a_Callback) +{ + for (CommandMap::iterator itr = m_ConsoleCommands.begin(), end = m_ConsoleCommands.end(); itr != end; ++itr) + { + if (a_Callback.Command(itr->first, itr->second.m_Plugin, "", itr->second.m_HelpString)) + { + return false; + } + } // for itr - m_Commands[] + return true; +} + + + + + +bool cPluginManager::IsConsoleCommandBound(const AString & a_Command) +{ + return (m_ConsoleCommands.find(a_Command) != m_ConsoleCommands.end()); +} + + + + + +bool cPluginManager::ExecuteConsoleCommand(const AStringVector & a_Split, cCommandOutputCallback & a_Output) +{ + if (a_Split.empty()) + { + return false; + } + + CommandMap::iterator cmd = m_ConsoleCommands.find(a_Split[0]); + if (cmd == m_ConsoleCommands.end()) + { + // Command not found + return false; + } + + if (cmd->second.m_Plugin == NULL) + { + // This is a built-in command + return false; + } + + // Ask plugins first if a command is okay to execute the console command: + if (CallHookExecuteCommand(NULL, a_Split)) + { + a_Output.Out("Command \"%s\" was stopped by the HOOK_EXECUTE_COMMAND hook", a_Split[0].c_str()); + return false; + } + + return cmd->second.m_Plugin->HandleConsoleCommand(a_Split, a_Output); +} + + + + + +void cPluginManager::TabCompleteCommand(const AString & a_Text, AStringVector & a_Results, cPlayer * a_Player) +{ + for (CommandMap::iterator itr = m_Commands.begin(), end = m_Commands.end(); itr != end; ++itr) + { + if (NoCaseCompare(itr->first.substr(0, a_Text.length()), a_Text) != 0) + { + // Command name doesn't match + continue; + } + if ((a_Player != NULL) && !a_Player->HasPermission(itr->second.m_Permission)) + { + // Player doesn't have permission for the command + continue; + } + a_Results.push_back(itr->first); + } +} + + + + + +bool cPluginManager::IsValidHookType(int a_HookType) +{ + return ((a_HookType >= 0) && (a_HookType <= HOOK_MAX)); +} + + + + + +bool cPluginManager::AddPlugin(cPlugin * a_Plugin) +{ + m_Plugins[a_Plugin->GetDirectory()] = a_Plugin; + if (a_Plugin->Initialize()) + { + // Initialization OK + return true; + } + + // Initialization failed + RemovePlugin(a_Plugin); // Also undoes any registrations that Initialize() might have made + return false; +} + + + + + +void cPluginManager::AddHook(cPlugin * a_Plugin, int a_Hook) +{ + if (!a_Plugin) + { + LOGWARN("Called cPluginManager::AddHook() with a_Plugin == NULL"); + return; + } + PluginList & Plugins = m_Hooks[a_Hook]; + Plugins.remove(a_Plugin); + Plugins.push_back(a_Plugin); +} + + + + + +unsigned int cPluginManager::GetNumPlugins() const +{ + return m_Plugins.size(); +} + + + + diff --git a/source/PluginManager.h b/src/PluginManager.h index 4140bffb5..4140bffb5 100644 --- a/source/PluginManager.h +++ b/src/PluginManager.h diff --git a/source/ProbabDistrib.cpp b/src/ProbabDistrib.cpp index 5fa17c276..5fa17c276 100644 --- a/source/ProbabDistrib.cpp +++ b/src/ProbabDistrib.cpp diff --git a/source/ProbabDistrib.h b/src/ProbabDistrib.h index ddaadd9b7..ddaadd9b7 100644 --- a/source/ProbabDistrib.h +++ b/src/ProbabDistrib.h diff --git a/src/Protocol/ChunkDataSerializer.cpp b/src/Protocol/ChunkDataSerializer.cpp new file mode 100644 index 000000000..78318a5ee --- /dev/null +++ b/src/Protocol/ChunkDataSerializer.cpp @@ -0,0 +1,176 @@ + +// ChunkDataSerializer.cpp + +// Implements the cChunkDataSerializer class representing the object that can: +// - serialize chunk data to different protocol versions +// - cache such serialized data for multiple clients + +#include "Globals.h" +#include "ChunkDataSerializer.h" +#include "zlib/zlib.h" + + + + +cChunkDataSerializer::cChunkDataSerializer( + const cChunkDef::BlockTypes & a_BlockTypes, + const cChunkDef::BlockNibbles & a_BlockMetas, + const cChunkDef::BlockNibbles & a_BlockLight, + const cChunkDef::BlockNibbles & a_BlockSkyLight, + const unsigned char * a_BiomeData +) : + m_BlockTypes(a_BlockTypes), + m_BlockMetas(a_BlockMetas), + m_BlockLight(a_BlockLight), + m_BlockSkyLight(a_BlockSkyLight), + m_BiomeData(a_BiomeData) +{ +} + + + + +const AString & cChunkDataSerializer::Serialize(int a_Version) +{ + Serializations::const_iterator itr = m_Serializations.find(a_Version); + if (itr != m_Serializations.end()) + { + return itr->second; + } + + AString data; + switch (a_Version) + { + case RELEASE_1_2_5: Serialize29(data); break; + case RELEASE_1_3_2: Serialize39(data); break; + // TODO: Other protocol versions may serialize the data differently; implement here + + default: + { + LOGERROR("cChunkDataSerializer::Serialize(): Unknown version: %d", a_Version); + ASSERT(!"Unknown chunk data serialization version"); + break; + } + } + m_Serializations[a_Version] = data; + return m_Serializations[a_Version]; +} + + + + + +void cChunkDataSerializer::Serialize29(AString & a_Data) +{ + // TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib *can* stream) + + const int BiomeDataSize = cChunkDef::Width * cChunkDef::Width; + const int MetadataOffset = sizeof(m_BlockTypes); + const int BlockLightOffset = MetadataOffset + sizeof(m_BlockMetas); + const int SkyLightOffset = BlockLightOffset + sizeof(m_BlockLight); + const int BiomeOffset = SkyLightOffset + sizeof(m_BlockSkyLight); + const int DataSize = BiomeOffset + BiomeDataSize; + + // Temporary buffer for the composed data: + char AllData [DataSize]; + + memcpy(AllData, m_BlockTypes, sizeof(m_BlockTypes)); + memcpy(AllData + MetadataOffset, m_BlockMetas, sizeof(m_BlockMetas)); + memcpy(AllData + BlockLightOffset, m_BlockLight, sizeof(m_BlockLight)); + memcpy(AllData + SkyLightOffset, m_BlockSkyLight, sizeof(m_BlockSkyLight)); + memcpy(AllData + BiomeOffset, m_BiomeData, BiomeDataSize); + + // Compress the data: + // In order not to use allocation, use a fixed-size buffer, with the size + // that uses the same calculation as compressBound(): + const uLongf CompressedMaxSize = DataSize + (DataSize >> 12) + (DataSize >> 14) + (DataSize >> 25) + 16; + char CompressedBlockData[CompressedMaxSize]; + + uLongf CompressedSize = compressBound(DataSize); + + // Run-time check that our compile-time guess about CompressedMaxSize was enough: + ASSERT(CompressedSize <= CompressedMaxSize); + + compress2((Bytef*)CompressedBlockData, &CompressedSize, (const Bytef*)AllData, sizeof(AllData), Z_DEFAULT_COMPRESSION); + + // Now put all those data into a_Data: + + // "Ground-up continuous", or rather, "biome data present" flag: + a_Data.push_back('\x01'); + + // Two bitmaps; we're aways sending the full chunk with no additional data, so the bitmaps are 0xffff and 0, respectively + // Also, no endian flipping is needed because of the const values + unsigned short BitMap1 = 0xffff; + unsigned short BitMap2 = 0; + a_Data.append((const char *)&BitMap1, sizeof(short)); + a_Data.append((const char *)&BitMap2, sizeof(short)); + + Int32 CompressedSizeBE = htonl(CompressedSize); + a_Data.append((const char *)&CompressedSizeBE, sizeof(CompressedSizeBE)); + + Int32 UnusedInt32 = 0; + a_Data.append((const char *)&UnusedInt32, sizeof(UnusedInt32)); + + a_Data.append(CompressedBlockData, CompressedSize); +} + + + + + +void cChunkDataSerializer::Serialize39(AString & a_Data) +{ + // TODO: Do not copy data and then compress it; rather, compress partial blocks of data (zlib *can* stream) + + const int BiomeDataSize = cChunkDef::Width * cChunkDef::Width; + const int MetadataOffset = sizeof(m_BlockTypes); + const int BlockLightOffset = MetadataOffset + sizeof(m_BlockMetas); + const int SkyLightOffset = BlockLightOffset + sizeof(m_BlockLight); + const int BiomeOffset = SkyLightOffset + sizeof(m_BlockSkyLight); + const int DataSize = BiomeOffset + BiomeDataSize; + + // Temporary buffer for the composed data: + char AllData [DataSize]; + + memcpy(AllData, m_BlockTypes, sizeof(m_BlockTypes)); + memcpy(AllData + MetadataOffset, m_BlockMetas, sizeof(m_BlockMetas)); + memcpy(AllData + BlockLightOffset, m_BlockLight, sizeof(m_BlockLight)); + memcpy(AllData + SkyLightOffset, m_BlockSkyLight, sizeof(m_BlockSkyLight)); + memcpy(AllData + BiomeOffset, m_BiomeData, BiomeDataSize); + + // Compress the data: + // In order not to use allocation, use a fixed-size buffer, with the size + // that uses the same calculation as compressBound(): + const uLongf CompressedMaxSize = DataSize + (DataSize >> 12) + (DataSize >> 14) + (DataSize >> 25) + 16; + char CompressedBlockData[CompressedMaxSize]; + + uLongf CompressedSize = compressBound(DataSize); + + // Run-time check that our compile-time guess about CompressedMaxSize was enough: + ASSERT(CompressedSize <= CompressedMaxSize); + + compress2((Bytef*)CompressedBlockData, &CompressedSize, (const Bytef*)AllData, sizeof(AllData), Z_DEFAULT_COMPRESSION); + + // Now put all those data into a_Data: + + // "Ground-up continuous", or rather, "biome data present" flag: + a_Data.push_back('\x01'); + + // Two bitmaps; we're aways sending the full chunk with no additional data, so the bitmaps are 0xffff and 0, respectively + // Also, no endian flipping is needed because of the const values + unsigned short BitMap1 = 0xffff; + unsigned short BitMap2 = 0; + a_Data.append((const char *)&BitMap1, sizeof(short)); + a_Data.append((const char *)&BitMap2, sizeof(short)); + + Int32 CompressedSizeBE = htonl(CompressedSize); + a_Data.append((const char *)&CompressedSizeBE, sizeof(CompressedSizeBE)); + + // Unlike 29, 39 doesn't have the "unused" int + + a_Data.append(CompressedBlockData, CompressedSize); +} + + + + diff --git a/source/Protocol/ChunkDataSerializer.h b/src/Protocol/ChunkDataSerializer.h index a42856356..a42856356 100644 --- a/source/Protocol/ChunkDataSerializer.h +++ b/src/Protocol/ChunkDataSerializer.h diff --git a/source/Protocol/Protocol.h b/src/Protocol/Protocol.h index 9d8183361..9d8183361 100644 --- a/source/Protocol/Protocol.h +++ b/src/Protocol/Protocol.h diff --git a/source/Protocol/Protocol125.cpp b/src/Protocol/Protocol125.cpp index b1dd17ea1..b1dd17ea1 100644 --- a/source/Protocol/Protocol125.cpp +++ b/src/Protocol/Protocol125.cpp diff --git a/source/Protocol/Protocol125.h b/src/Protocol/Protocol125.h index 5a9218f5b..5a9218f5b 100644 --- a/source/Protocol/Protocol125.h +++ b/src/Protocol/Protocol125.h diff --git a/src/Protocol/Protocol132.cpp b/src/Protocol/Protocol132.cpp new file mode 100644 index 000000000..d8f450588 --- /dev/null +++ b/src/Protocol/Protocol132.cpp @@ -0,0 +1,950 @@ + +// Protocol132.cpp + +// Implements the cProtocol132 class representing the release 1.3.2 protocol (#39) + +#include "Globals.h" +#include "ChunkDataSerializer.h" +#include "cryptopp/randpool.h" +#include "Protocol132.h" +#include "../Root.h" +#include "../Server.h" +#include "../World.h" +#include "../ClientHandle.h" +#include "../Item.h" +#include "../Entities/Player.h" +#include "../Mobs/Monster.h" +#include "../UI/Window.h" +#include "../Entities/Pickup.h" +#include "../WorldStorage/FastNBT.h" +#include "../StringCompression.h" + + + + + +#define HANDLE_PACKET_READ(Proc, Type, Var) \ + Type Var; \ + { \ + if (!m_ReceivedData.Proc(Var)) \ + { \ + m_ReceivedData.CheckValid(); \ + return PARSE_INCOMPLETE; \ + } \ + m_ReceivedData.CheckValid(); \ + } + + + + +typedef unsigned char Byte; + + + + + +using namespace CryptoPP; + + + + + +const int MAX_ENC_LEN = 512; // Maximum size of the encrypted message; should be 128, but who knows... + + + + + +enum +{ + PACKET_KEEP_ALIVE = 0x00, + PACKET_LOGIN = 0x01, + PACKET_ENTITY_EQUIPMENT = 0x05, + PACKET_COMPASS = 0x06, + PACKET_PLAYER_SPAWN = 0x14, + PACKET_COLLECT_PICKUP = 0x16, + PACKET_SPAWN_MOB = 0x18, + PACKET_DESTROY_ENTITIES = 0x1d, + PACKET_CHUNK_DATA = 0x33, + PACKET_BLOCK_CHANGE = 0x35, + PACKET_BLOCK_ACTION = 0x36, + PACKET_BLOCK_BREAK_ANIM = 0x37, + PACKET_SOUND_EFFECT = 0x3e, + PACKET_SOUND_PARTICLE_EFFECT = 0x3d, + PACKET_TAB_COMPLETION = 0xcb, + PACKET_LOCALE_VIEW_DISTANCE = 0xcc, + PACKET_CLIENT_STATUSES = 0xcd, + PACKET_ENCRYPTION_KEY_RESP = 0xfc, +} ; + + + + + +// Converts a raw 160-bit SHA1 digest into a Java Hex representation +// According to http://wiki.vg/wiki/index.php?title=Protocol_Encryption&oldid=2802 +static void DigestToJava(byte a_Digest[20], AString & a_Out) +{ + bool IsNegative = (a_Digest[0] >= 0x80); + if (IsNegative) + { + // Two's complement: + bool carry = true; // Add one to the whole number + for (int i = 19; i >= 0; i--) + { + a_Digest[i] = ~a_Digest[i]; + if (carry) + { + carry = (a_Digest[i] == 0xff); + a_Digest[i]++; + } + } + } + a_Out.clear(); + a_Out.reserve(40); + for (int i = 0; i < 20; i++) + { + AppendPrintf(a_Out, "%02x", a_Digest[i]); + } + while ((a_Out.length() > 0) && (a_Out[0] == '0')) + { + a_Out.erase(0, 1); + } + if (IsNegative) + { + a_Out.insert(0, "-"); + } +} + + + + + +/* +// Self-test the hash formatting for known values: +// sha1(Notch) : 4ed1f46bbe04bc756bcb17c0c7ce3e4632f06a48 +// sha1(jeb_) : -7c9d5b0044c130109a5d7b5fb5c317c02b4e28c1 +// sha1(simon) : 88e16a1019277b15d58faf0541e11910eb756f6 + +class Test +{ +public: + Test(void) + { + AString DigestNotch, DigestJeb, DigestSimon; + byte Digest[20]; + CryptoPP::SHA1 Checksum; + Checksum.Update((const byte *)"Notch", 5); + Checksum.Final(Digest); + DigestToJava(Digest, DigestNotch); + Checksum.Restart(); + Checksum.Update((const byte *)"jeb_", 4); + Checksum.Final(Digest); + DigestToJava(Digest, DigestJeb); + Checksum.Restart(); + Checksum.Update((const byte *)"simon", 5); + Checksum.Final(Digest); + DigestToJava(Digest, DigestSimon); + printf("Notch: \"%s\"", DigestNotch.c_str()); + printf("jeb_: \"%s\"", DigestJeb.c_str()); + printf("simon: \"%s\"", DigestSimon.c_str()); + } +} test; +*/ + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cProtocol132: + +cProtocol132::cProtocol132(cClientHandle * a_Client) : + super(a_Client), + m_IsEncrypted(false) +{ +} + + + + + +cProtocol132::~cProtocol132() +{ + if (!m_DataToSend.empty()) + { + LOGD("There are %d unsent bytes while deleting cProtocol132", m_DataToSend.size()); + } +} + + + + + +void cProtocol132::DataReceived(const char * a_Data, int a_Size) +{ + if (m_IsEncrypted) + { + byte Decrypted[512]; + while (a_Size > 0) + { + int NumBytes = (a_Size > sizeof(Decrypted)) ? sizeof(Decrypted) : a_Size; + m_Decryptor.ProcessData(Decrypted, (byte *)a_Data, NumBytes); + super::DataReceived((const char *)Decrypted, NumBytes); + a_Size -= NumBytes; + a_Data += NumBytes; + } + } + else + { + super::DataReceived(a_Data, a_Size); + } +} + + + + + +void cProtocol132::SendBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) +{ + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_BLOCK_ACTION); + WriteInt (a_BlockX); + WriteShort((short)a_BlockY); + WriteInt (a_BlockZ); + WriteByte (a_Byte1); + WriteByte (a_Byte2); + WriteShort(a_BlockType); + Flush(); +} + + + + + +void cProtocol132::SendBlockBreakAnim(int a_entityID, int a_BlockX, int a_BlockY, int a_BlockZ, char stage) +{ + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_BLOCK_BREAK_ANIM); + WriteInt (a_entityID); + WriteInt (a_BlockX); + WriteInt (a_BlockY); + WriteInt (a_BlockZ); + WriteByte (stage); + Flush(); +} + + + + + +void cProtocol132::SendBlockChange(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_BLOCK_CHANGE); + WriteInt (a_BlockX); + WriteByte ((unsigned char)a_BlockY); + WriteInt (a_BlockZ); + WriteShort(a_BlockType); + WriteByte (a_BlockMeta); + Flush(); +} + + + + + +void cProtocol132::SendChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) +{ + cCSLock Lock(m_CSPacket); + + // Pre-chunk not used in 1.3.2. Finally. + + // Send the chunk data: + AString Serialized = a_Serializer.Serialize(cChunkDataSerializer::RELEASE_1_3_2); + WriteByte(PACKET_CHUNK_DATA); + WriteInt (a_ChunkX); + WriteInt (a_ChunkZ); + SendData(Serialized.data(), Serialized.size()); + Flush(); +} + + + + + +void cProtocol132::SendCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player) +{ + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_COLLECT_PICKUP); + WriteInt (a_Pickup.GetUniqueID()); + WriteInt (a_Player.GetUniqueID()); + Flush(); + + // Also send the "pop" sound effect with a somewhat random pitch (fast-random using EntityID ;) + SendSoundEffect( + "random.pop", + (int)(a_Pickup.GetPosX() * 8), (int)(a_Pickup.GetPosY() * 8), (int)(a_Pickup.GetPosZ() * 8), + 0.5, (float)(0.75 + ((float)((a_Pickup.GetUniqueID() * 23) % 32)) / 64) + ); +} + + + + + +void cProtocol132::SendDestroyEntity(const cEntity & a_Entity) +{ + if (a_Entity.GetUniqueID() == m_Client->GetPlayer()->GetUniqueID()) + { + // Do not send "destroy self" to the client, the client would crash (FS #254) + return; + } + + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_DESTROY_ENTITIES); + WriteByte(1); // entity count + WriteInt (a_Entity.GetUniqueID()); + Flush(); +} + + + + + +void cProtocol132::SendEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) +{ + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_ENTITY_EQUIPMENT); + WriteInt (a_Entity.GetUniqueID()); + WriteShort(a_SlotNum); + WriteItem (a_Item); + Flush(); +} + + + + + +void cProtocol132::SendLogin(const cPlayer & a_Player, const cWorld & a_World) +{ + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_LOGIN); + WriteInt (a_Player.GetUniqueID()); // EntityID of the player + WriteString("default"); // Level type + WriteByte ((int)a_Player.GetGameMode()); + WriteByte ((Byte)(a_World.GetDimension())); + WriteByte (2); // TODO: Difficulty + WriteByte (0); // Unused, used to be world height + WriteByte (8); // Client list width or something + Flush(); + + SendCompass(a_World); +} + + + + + +void cProtocol132::SendPlayerSpawn(const cPlayer & a_Player) +{ + const cItem & HeldItem = a_Player.GetEquippedItem(); + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_PLAYER_SPAWN); + WriteInt (a_Player.GetUniqueID()); + WriteString(a_Player.GetName()); + WriteInt ((int)(a_Player.GetPosX() * 32)); + WriteInt ((int)(a_Player.GetPosY() * 32)); + WriteInt ((int)(a_Player.GetPosZ() * 32)); + WriteByte ((char)((a_Player.GetRot().x / 360.f) * 256)); + WriteByte ((char)((a_Player.GetRot().y / 360.f) * 256)); + WriteShort (HeldItem.IsEmpty() ? 0 : HeldItem.m_ItemType); + // Player metadata: just use a default metadata value, since the client doesn't like starting without any metadata: + WriteByte (0); // Index 0, byte (flags) + WriteByte (0); // Flags, empty + WriteByte (0x7f); // End of metadata + Flush(); +} + + + + + +void cProtocol132::SendSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) +{ + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_SOUND_EFFECT); + WriteString (a_SoundName); + WriteInt (a_SrcX); + WriteInt (a_SrcY); + WriteInt (a_SrcZ); + WriteFloat (a_Volume); + WriteByte ((char)(a_Pitch * 63.0f)); + Flush(); +} + + + + + +void cProtocol132::SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) +{ + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_SOUND_PARTICLE_EFFECT); + WriteInt (a_EffectID); + WriteInt (a_SrcX); + WriteByte(a_SrcY); + WriteInt (a_SrcZ); + WriteInt (a_Data); + Flush(); +} + + + + + +void cProtocol132::SendSpawnMob(const cMonster & a_Mob) +{ + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_SPAWN_MOB); + WriteInt (a_Mob.GetUniqueID()); + WriteByte (a_Mob.GetMobType()); + WriteVectorI((Vector3i)(a_Mob.GetPosition() * 32)); + WriteByte ((Byte)((a_Mob.GetRotation() / 360.f) * 256)); + WriteByte ((Byte)((a_Mob.GetPitch() / 360.f) * 256)); + WriteByte ((Byte)((a_Mob.GetHeadYaw() / 360.f) * 256)); + WriteShort ((short)(a_Mob.GetSpeedX() * 400)); + WriteShort ((short)(a_Mob.GetSpeedY() * 400)); + WriteShort ((short)(a_Mob.GetSpeedZ() * 400)); + + WriteCommonMetadata(a_Mob); + WriteMobMetadata(a_Mob); + WriteByte(0x7f); + + Flush(); +} + + + + + +void cProtocol132::SendTabCompletionResults(const AStringVector & a_Results) +{ + if (a_Results.empty()) + { + // No results to send + return; + } + + AString Serialized(a_Results[0]); + for (AStringVector::const_iterator itr = a_Results.begin() + 1, end = a_Results.end(); itr != end; ++itr) + { + Serialized.push_back(0); + Serialized.append(*itr); + } // for itr - a_Results[] + + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_TAB_COMPLETION); + WriteString(Serialized); + Flush(); +} + + + + + +void cProtocol132::SendUnloadChunk(int a_ChunkX, int a_ChunkZ) +{ + // Unloading the chunk is done by sending a "map chunk" packet + // with IncludeInitialize set to true and primary bitmap set to 0: + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_CHUNK_DATA); + WriteInt (a_ChunkX); + WriteInt (a_ChunkZ); + WriteBool(true); // IncludeInitialize + WriteShort(0); // Primary bitmap + WriteShort(0); // Add bitmap + WriteInt(0); + Flush(); +} + + + + + +void cProtocol132::SendWholeInventory(const cWindow & a_Window) +{ + // 1.3.2 requires player inventory slots to be sent as SetSlot packets, + // otherwise it sometimes fails to update the window + + // Send the entire window: + super::SendWholeInventory(a_Window); + + // Send the player inventory and hotbar: + const cInventory & Inventory = m_Client->GetPlayer()->GetInventory(); + int BaseOffset = a_Window.GetNumSlots() - (cInventory::invNumSlots - cInventory::invInventoryOffset); // Number of non-inventory slots + char WindowID = a_Window.GetWindowID(); + for (int i = 0; i < cInventory::invInventoryCount; i++) + { + SendInventorySlot(WindowID, BaseOffset + i, Inventory.GetInventorySlot(i)); + } // for i - Inventory[] + BaseOffset += cInventory::invInventoryCount; + for (int i = 0; i < cInventory::invHotbarCount; i++) + { + SendInventorySlot(WindowID, BaseOffset + i, Inventory.GetHotbarSlot(i)); + } // for i - Hotbar[] + + // Send even the item being dragged: + SendInventorySlot(-1, -1, m_Client->GetPlayer()->GetDraggingItem()); +} + + + + + +AString cProtocol132::GetAuthServerID(void) +{ + // http://wiki.vg/wiki/index.php?title=Session&oldid=2615 + // Server uses SHA1 to mix ServerID, Client secret and server public key together + // The mixing is done in StartEncryption, the result is in m_AuthServerID + + return m_AuthServerID; +} + + + + + +int cProtocol132::ParsePacket(unsigned char a_PacketType) +{ + switch (a_PacketType) + { + default: return super::ParsePacket(a_PacketType); // off-load previously known packets into cProtocol125 + case PACKET_CLIENT_STATUSES: return ParseClientStatuses(); + case PACKET_ENCRYPTION_KEY_RESP: return ParseEncryptionKeyResponse(); + case PACKET_LOCALE_VIEW_DISTANCE: return ParseLocaleViewDistance(); + case PACKET_TAB_COMPLETION: return ParseTabCompletion(); + } +} + + + + + +int cProtocol132::ParseBlockPlace(void) +{ + HANDLE_PACKET_READ(ReadBEInt, int, PosX); + HANDLE_PACKET_READ(ReadByte, Byte, PosY); + HANDLE_PACKET_READ(ReadBEInt, int, PosZ); + HANDLE_PACKET_READ(ReadChar, char, BlockFace); + + cItem HeldItem; + int res = ParseItem(HeldItem); + if (res < 0) + { + return res; + } + + HANDLE_PACKET_READ(ReadChar, char, CursorX); + HANDLE_PACKET_READ(ReadChar, char, CursorY); + HANDLE_PACKET_READ(ReadChar, char, CursorZ); + + m_Client->HandleRightClick(PosX, PosY, PosZ, BlockFace, CursorX, CursorY, CursorZ, HeldItem); + return PARSE_OK; +} + + + + + +int cProtocol132::ParseHandshake(void) +{ + HANDLE_PACKET_READ(ReadByte, Byte, ProtocolVersion); + HANDLE_PACKET_READ(ReadBEUTF16String16, AString, Username); + HANDLE_PACKET_READ(ReadBEUTF16String16, AString, ServerHost); + HANDLE_PACKET_READ(ReadBEInt, int, ServerPort); + m_Username = Username; + + if (!m_Client->HandleHandshake( m_Username )) + { + return PARSE_OK; // Player is not allowed into the server + } + + // Send a 0xFD Encryption Key Request http://wiki.vg/Protocol#0xFD + CryptoPP::StringSink sink(m_ServerPublicKey); // GCC won't allow inline instantiation in the following line, damned temporary refs + cRoot::Get()->GetServer()->GetPublicKey().Save(sink); + SendEncryptionKeyRequest(); + + return PARSE_OK; +} + + + + + +int cProtocol132::ParseClientStatuses(void) +{ + HANDLE_PACKET_READ(ReadByte, byte, Status); + if ((Status & 1) == 0) + { + m_Client->HandleLogin(39, m_Username); + } + else + { + m_Client->HandleRespawn(); + } + return PARSE_OK; +} + + + + + +int cProtocol132::ParseEncryptionKeyResponse(void) +{ + HANDLE_PACKET_READ(ReadBEShort, short, EncKeyLength); + AString EncKey; + if (!m_ReceivedData.ReadString(EncKey, EncKeyLength)) + { + return PARSE_INCOMPLETE; + } + HANDLE_PACKET_READ(ReadBEShort, short, EncNonceLength); + AString EncNonce; + if (!m_ReceivedData.ReadString(EncNonce, EncNonceLength)) + { + return PARSE_INCOMPLETE; + } + if ((EncKeyLength > MAX_ENC_LEN) || (EncNonceLength > MAX_ENC_LEN)) + { + LOGD("Too long encryption"); + m_Client->Kick("Hacked client"); + return PARSE_OK; + } + + HandleEncryptionKeyResponse(EncKey, EncNonce); + return PARSE_OK; +} + + + + + +int cProtocol132::ParseLocaleViewDistance(void) +{ + HANDLE_PACKET_READ(ReadBEUTF16String16, AString, Locale); + HANDLE_PACKET_READ(ReadChar, char, ViewDistance); + HANDLE_PACKET_READ(ReadChar, char, ChatFlags); + HANDLE_PACKET_READ(ReadChar, char, ClientDifficulty); + // TODO: m_Client->HandleLocale(Locale); + // TODO: m_Client->HandleViewDistance(ViewDistance); + // TODO: m_Client->HandleChatFlags(ChatFlags); + // Ignoring client difficulty + return PARSE_OK; +} + + + + + +int cProtocol132::ParseLogin(void) +{ + // Login packet not used in 1.3.2 + return PARSE_ERROR; +} + + + + + +int cProtocol132::ParsePlayerAbilities(void) +{ + HANDLE_PACKET_READ(ReadBool, bool, Flags); + HANDLE_PACKET_READ(ReadChar, char, FlyingSpeed); + HANDLE_PACKET_READ(ReadChar, char, WalkingSpeed); + // TODO: m_Client->HandlePlayerAbilities(...); + return PARSE_OK; +} + + + + + +int cProtocol132::ParseTabCompletion(void) +{ + HANDLE_PACKET_READ(ReadBEUTF16String16, AString, Text); + m_Client->HandleTabCompletion(Text); + return PARSE_OK; +} + + + + + +void cProtocol132::SendData(const char * a_Data, int a_Size) +{ + m_DataToSend.append(a_Data, a_Size); +} + + + + + +void cProtocol132::Flush(void) +{ + ASSERT(m_CSPacket.IsLockedByCurrentThread()); // Did all packets lock the CS properly? + + if (m_DataToSend.empty()) + { + LOGD("Flushing empty"); + return; + } + const char * a_Data = m_DataToSend.data(); + int a_Size = m_DataToSend.size(); + if (m_IsEncrypted) + { + byte Encrypted[8192]; // Larger buffer, we may be sending lots of data (chunks) + while (a_Size > 0) + { + int NumBytes = (a_Size > sizeof(Encrypted)) ? sizeof(Encrypted) : a_Size; + m_Encryptor.ProcessData(Encrypted, (byte *)a_Data, NumBytes); + super::SendData((const char *)Encrypted, NumBytes); + a_Size -= NumBytes; + a_Data += NumBytes; + } + } + else + { + super::SendData(a_Data, a_Size); + } + m_DataToSend.clear(); +} + + + + + +void cProtocol132::WriteItem(const cItem & a_Item) +{ + short ItemType = a_Item.m_ItemType; + ASSERT(ItemType >= -1); // Check validity of packets in debug runtime + if (ItemType <= 0) + { + // Fix, to make sure no invalid values are sent. + ItemType = -1; + } + + if (a_Item.IsEmpty()) + { + WriteShort(-1); + return; + } + + WriteShort(ItemType); + WriteByte (a_Item.m_ItemCount); + WriteShort(a_Item.m_ItemDamage); + + if (a_Item.m_Enchantments.IsEmpty()) + { + WriteShort(-1); + return; + } + + // Send the enchantments: + cFastNBTWriter Writer; + const char * TagName = (a_Item.m_ItemType == E_ITEM_BOOK) ? "StoredEnchantments" : "ench"; + a_Item.m_Enchantments.WriteToNBTCompound(Writer, TagName); + Writer.Finish(); + AString Compressed; + CompressStringGZIP(Writer.GetResult().data(), Writer.GetResult().size(), Compressed); + WriteShort(Compressed.size()); + SendData(Compressed.data(), Compressed.size()); +} + + + + + +int cProtocol132::ParseItem(cItem & a_Item) +{ + HANDLE_PACKET_READ(ReadBEShort, short, ItemType); + + if (ItemType <= -1) + { + a_Item.Empty(); + return PARSE_OK; + } + a_Item.m_ItemType = ItemType; + + HANDLE_PACKET_READ(ReadChar, char, ItemCount); + HANDLE_PACKET_READ(ReadBEShort, short, ItemDamage); + a_Item.m_ItemCount = ItemCount; + a_Item.m_ItemDamage = ItemDamage; + if (ItemCount <= 0) + { + a_Item.Empty(); + } + + HANDLE_PACKET_READ(ReadBEShort, short, MetadataLength); + if (MetadataLength <= 0) + { + return PARSE_OK; + } + + // Read the metadata + AString Metadata; + Metadata.resize(MetadataLength); + if (!m_ReceivedData.ReadBuf((void *)Metadata.data(), MetadataLength)) + { + return PARSE_INCOMPLETE; + } + + return ParseItemMetadata(a_Item, Metadata); +} + + + + + +int cProtocol132::ParseItemMetadata(cItem & a_Item, const AString & a_Metadata) +{ + // Uncompress the GZIPped data: + AString Uncompressed; + if (UncompressStringGZIP(a_Metadata.data(), a_Metadata.size(), Uncompressed) != Z_OK) + { + AString HexDump; + CreateHexDump(HexDump, a_Metadata.data(), a_Metadata.size(), 16); + LOG("Cannot unGZIP item metadata:\n%s", HexDump.c_str()); + return PARSE_ERROR; + } + + // Parse into NBT: + cParsedNBT NBT(Uncompressed.data(), Uncompressed.size()); + if (!NBT.IsValid()) + { + AString HexDump; + CreateHexDump(HexDump, Uncompressed.data(), Uncompressed.size(), 16); + LOG("Cannot parse NBT item metadata:\n%s", HexDump.c_str()); + return PARSE_ERROR; + } + + // Load enchantments from the NBT: + for (int tag = NBT.GetFirstChild(NBT.GetRoot()); tag >= 0; tag = NBT.GetNextSibling(tag)) + { + if ( + (NBT.GetType(tag) == TAG_List) && + ( + (NBT.GetName(tag) == "ench") || + (NBT.GetName(tag) == "StoredEnchantments") + ) + ) + { + a_Item.m_Enchantments.ParseFromNBT(NBT, tag); + } + } + + return PARSE_OK; +} + + + + + +void cProtocol132::SendCompass(const cWorld & a_World) +{ + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_COMPASS); + WriteInt((int)(a_World.GetSpawnX())); + WriteInt((int)(a_World.GetSpawnY())); + WriteInt((int)(a_World.GetSpawnZ())); + Flush(); +} + + + + + +void cProtocol132::SendEncryptionKeyRequest(void) +{ + cCSLock Lock(m_CSPacket); + WriteByte((char)0xfd); + WriteString(cRoot::Get()->GetServer()->GetServerID()); + WriteShort((short)m_ServerPublicKey.size()); + SendData(m_ServerPublicKey.data(), m_ServerPublicKey.size()); + WriteShort(4); + WriteInt((int)(intptr_t)this); // Using 'this' as the cryptographic nonce, so that we don't have to generate one each time :) + Flush(); +} + + + + + +void cProtocol132::HandleEncryptionKeyResponse(const AString & a_EncKey, const AString & a_EncNonce) +{ + // Decrypt EncNonce using privkey + RSAES<PKCS1v15>::Decryptor rsaDecryptor(cRoot::Get()->GetServer()->GetPrivateKey()); + time_t CurTime = time(NULL); + CryptoPP::RandomPool rng; + rng.Put((const byte *)&CurTime, sizeof(CurTime)); + byte DecryptedNonce[MAX_ENC_LEN]; + DecodingResult res = rsaDecryptor.Decrypt(rng, (const byte *)a_EncNonce.data(), a_EncNonce.size(), DecryptedNonce); + if (!res.isValidCoding || (res.messageLength != 4)) + { + LOGD("Bad nonce length"); + m_Client->Kick("Hacked client"); + return; + } + if (ntohl(*((int *)DecryptedNonce)) != (unsigned)(uintptr_t)this) + { + LOGD("Bad nonce value"); + m_Client->Kick("Hacked client"); + return; + } + + // Decrypt the symmetric encryption key using privkey: + byte DecryptedKey[MAX_ENC_LEN]; + res = rsaDecryptor.Decrypt(rng, (const byte *)a_EncKey.data(), a_EncKey.size(), DecryptedKey); + if (!res.isValidCoding || (res.messageLength != 16)) + { + LOGD("Bad key length"); + m_Client->Kick("Hacked client"); + return; + } + + { + // Send encryption key response: + cCSLock Lock(m_CSPacket); + WriteByte((char)0xfc); + WriteShort(0); + WriteShort(0); + Flush(); + } + + StartEncryption(DecryptedKey); + return; +} + + + + + +void cProtocol132::StartEncryption(const byte * a_Key) +{ + m_Encryptor.SetKey(a_Key, 16, MakeParameters(Name::IV(), ConstByteArrayParameter(a_Key, 16))(Name::FeedbackSize(), 1)); + m_Decryptor.SetKey(a_Key, 16, MakeParameters(Name::IV(), ConstByteArrayParameter(a_Key, 16))(Name::FeedbackSize(), 1)); + m_IsEncrypted = true; + + // Prepare the m_AuthServerID: + CryptoPP::SHA1 Checksum; + AString ServerID = cRoot::Get()->GetServer()->GetServerID(); + Checksum.Update((const byte *)ServerID.c_str(), ServerID.length()); + Checksum.Update(a_Key, 16); + Checksum.Update((const byte *)m_ServerPublicKey.c_str(), m_ServerPublicKey.length()); + byte Digest[20]; + Checksum.Final(Digest); + DigestToJava(Digest, m_AuthServerID); +} + + + + diff --git a/src/Protocol/Protocol132.h b/src/Protocol/Protocol132.h new file mode 100644 index 000000000..f76272b8d --- /dev/null +++ b/src/Protocol/Protocol132.h @@ -0,0 +1,102 @@ + +// Protocol132.h + +// Interfaces to the cProtocol132 class representing the release 1.3.2 protocol (#39) + + + + + +#pragma once + +#include "Protocol125.h" +#include "cryptopp/modes.h" +#include "cryptopp/aes.h" + + + + + +class cProtocol132 : + public cProtocol125 +{ + typedef cProtocol125 super; +public: + + cProtocol132(cClientHandle * a_Client); + virtual ~cProtocol132(); + + /// Called when client sends some data: + virtual void DataReceived(const char * a_Data, int a_Size) override; + + // Sending commands (alphabetically sorted): + virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override; + virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override; + virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; + virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; + virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override; + virtual void SendDestroyEntity (const cEntity & a_Entity) override; + virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; + virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; + virtual void SendPlayerSpawn (const cPlayer & a_Player) override; + virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8 + virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; + virtual void SendSpawnMob (const cMonster & a_Mob) override; + virtual void SendTabCompletionResults(const AStringVector & a_Results) override; + virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override; + virtual void SendWholeInventory (const cWindow & a_Window) override; + + virtual AString GetAuthServerID(void) override; + + /// Handling of the additional packets: + virtual int ParsePacket(unsigned char a_PacketType) override; + + // Modified packets: + virtual int ParseBlockPlace (void) override; + virtual int ParseHandshake (void) override; + virtual int ParseLogin (void) override; + virtual int ParsePlayerAbilities(void) override; + + // New packets: + virtual int ParseClientStatuses (void); + virtual int ParseEncryptionKeyResponse(void); + virtual int ParseLocaleViewDistance (void); + virtual int ParseTabCompletion (void); + +protected: + bool m_IsEncrypted; + CryptoPP::CFB_Mode<CryptoPP::AES>::Decryption m_Decryptor; + CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption m_Encryptor; + AString m_DataToSend; + + /// The ServerID used for session authentication; set in StartEncryption(), used in GetAuthServerID() + AString m_AuthServerID; + + /// The server's public key, as used by SendEncryptionKeyRequest() and StartEncryption() + AString m_ServerPublicKey; + + virtual void SendData(const char * a_Data, int a_Size) override; + + // DEBUG: + virtual void Flush(void) override; + + // Items in slots are sent differently + virtual void WriteItem(const cItem & a_Item) override; + virtual int ParseItem(cItem & a_Item) override; + + /// Parses the metadata that may come with the item. + int ParseItemMetadata(cItem & a_Item, const AString & a_Metadata); + + virtual void SendCompass(const cWorld & a_World); + virtual void SendEncryptionKeyRequest(void); + + /// Decrypts the key and nonce, checks nonce, starts the symmetric encryption + void HandleEncryptionKeyResponse(const AString & a_EncKey, const AString & a_EncNonce); + + /// Starts the symmetric encryption with the specified key; also sets m_AuthServerID + void StartEncryption(const byte * a_Key); +} ; + + + + diff --git a/src/Protocol/Protocol14x.cpp b/src/Protocol/Protocol14x.cpp new file mode 100644 index 000000000..28122034c --- /dev/null +++ b/src/Protocol/Protocol14x.cpp @@ -0,0 +1,256 @@ + +// Protocol14x.cpp + +/* +Implements the 1.4.x protocol classes representing these protocols: +- cProtocol142: + - release 1.4.2 protocol (#47) + - release 1.4.4 protocol (#49) - the same protocol class is used, because the only difference is in a packet that MCServer doesn't implement yet (ITEM_DATA) + - release 1.4.5 protocol (same as 1.4.4) +- cProtocol146: + - release 1.4.6 protocol (#51) +*/ + +#include "Globals.h" +#include "Protocol14x.h" +#include "../Root.h" +#include "../Server.h" +#include "../ClientHandle.h" +#include "cryptopp/randpool.h" +#include "../Item.h" +#include "ChunkDataSerializer.h" +#include "../Entities/Player.h" +#include "../Mobs/Monster.h" +#include "../UI/Window.h" +#include "../Entities/Pickup.h" +#include "../Entities/FallingBlock.h" + + + + + +#define HANDLE_PACKET_READ(Proc, Type, Var) \ + Type Var; \ + { \ + if (!m_ReceivedData.Proc(Var)) \ + { \ + m_ReceivedData.CheckValid(); \ + return PARSE_INCOMPLETE; \ + } \ + m_ReceivedData.CheckValid(); \ + } + + + + + +enum +{ + PACKET_UPDATE_TIME = 0x04, + PACKET_PICKUP_SPAWN = 0x15, + PACKET_SPAWN_OBJECT = 0x17, + PACKET_ENTITY_METADATA = 0x28, + PACKET_SOUND_PARTICLE_EFFECT = 0x3d +} ; + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cProtocol142: + +cProtocol142::cProtocol142(cClientHandle * a_Client) : + super(a_Client) +{ +} + + + + + +int cProtocol142::ParseLocaleViewDistance(void) +{ + HANDLE_PACKET_READ(ReadBEUTF16String16, AString, Locale); + HANDLE_PACKET_READ(ReadChar, char, ViewDistance); + HANDLE_PACKET_READ(ReadChar, char, ChatFlags); + HANDLE_PACKET_READ(ReadChar, char, ClientDifficulty); + HANDLE_PACKET_READ(ReadChar, char, ShouldShowCape); // <-- new in 1.4.2 + // TODO: m_Client->HandleLocale(Locale); + // TODO: m_Client->HandleViewDistance(ViewDistance); + // TODO: m_Client->HandleChatFlags(ChatFlags); + // Ignoring client difficulty + return PARSE_OK; +} + + + + + +void cProtocol142::SendPickupSpawn(const cPickup & a_Pickup) +{ + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_PICKUP_SPAWN); + WriteInt (a_Pickup.GetUniqueID()); + WriteItem (a_Pickup.GetItem()); + WriteVectorI((Vector3i)(a_Pickup.GetPosition() * 32)); + WriteByte ((char)(a_Pickup.GetSpeed().x * 8)); + WriteByte ((char)(a_Pickup.GetSpeed().y * 8)); + WriteByte ((char)(a_Pickup.GetSpeed().z * 8)); + Flush(); +} + + + + + +void cProtocol142::SendSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) +{ + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_SOUND_PARTICLE_EFFECT); + WriteInt (a_EffectID); + WriteInt (a_SrcX); + WriteByte(a_SrcY); + WriteInt (a_SrcZ); + WriteInt (a_Data); + WriteBool(0); + Flush(); +} + + + + + +void cProtocol142::SendTimeUpdate(Int64 a_WorldAge, Int64 a_TimeOfDay) +{ + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_UPDATE_TIME); + WriteInt64(a_WorldAge); + WriteInt64(a_TimeOfDay); + Flush(); +} + + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cProtocol146: + +cProtocol146::cProtocol146(cClientHandle * a_Client) : + super(a_Client) +{ +} + + + + + +void cProtocol146::SendPickupSpawn(const cPickup & a_Pickup) +{ + ASSERT(!a_Pickup.GetItem().IsEmpty()); + + cCSLock Lock(m_CSPacket); + + // Send a SPAWN_OBJECT packet for the base entity: + WriteByte(PACKET_SPAWN_OBJECT); + WriteInt (a_Pickup.GetUniqueID()); + WriteByte(0x02); + WriteInt ((int)(a_Pickup.GetPosX() * 32)); + WriteInt ((int)(a_Pickup.GetPosY() * 32)); + WriteInt ((int)(a_Pickup.GetPosZ() * 32)); + WriteInt (1); + WriteShort((short)(a_Pickup.GetSpeed().x * 32)); + WriteShort((short)(a_Pickup.GetSpeed().y * 32)); + WriteShort((short)(a_Pickup.GetSpeed().z * 32)); + WriteByte(0); + WriteByte(0); + + // Send a ENTITY_METADATA packet with the slot info: + WriteByte(PACKET_ENTITY_METADATA); + WriteInt(a_Pickup.GetUniqueID()); + WriteByte(0xaa); // a slot value at index 10 + WriteItem(a_Pickup.GetItem()); + WriteByte(0x7f); // End of metadata + Flush(); +} + + + + + +void cProtocol146::SendSpawnFallingBlock(const cFallingBlock & a_FallingBlock) +{ + // Send a spawn object / vehicle packet + cCSLock Lock(m_CSPacket); + + WriteByte(PACKET_SPAWN_OBJECT); + WriteInt (a_FallingBlock.GetUniqueID()); + WriteByte(70); + WriteInt ((int)(a_FallingBlock.GetPosX() * 32)); + WriteInt ((int)(a_FallingBlock.GetPosY() * 32)); + WriteInt ((int)(a_FallingBlock.GetPosZ() * 32)); + WriteByte (0); // Pitch + WriteByte (0); // Yaw + WriteInt (a_FallingBlock.GetBlockType()); // data indicator = blocktype + WriteShort((short)(a_FallingBlock.GetSpeedX() * 400)); + WriteShort((short)(a_FallingBlock.GetSpeedY() * 400)); + WriteShort((short)(a_FallingBlock.GetSpeedZ() * 400)); + Flush(); +} + + + + + +void cProtocol146::SendSpawnObject(const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) +{ + cCSLock Lock(m_CSPacket); + WriteByte(PACKET_SPAWN_OBJECT); + WriteInt (a_Entity.GetUniqueID()); + WriteByte(a_ObjectType); + WriteInt ((int)(a_Entity.GetPosX() * 32)); + WriteInt ((int)(a_Entity.GetPosY() * 32)); + WriteInt ((int)(a_Entity.GetPosZ() * 32)); + WriteByte(a_Pitch); + WriteByte(a_Yaw); + WriteInt (a_ObjectData); + if (a_ObjectData != 0) + { + WriteShort((short)(a_Entity.GetSpeedX() * 400)); + WriteShort((short)(a_Entity.GetSpeedY() * 400)); + WriteShort((short)(a_Entity.GetSpeedZ() * 400)); + } + Flush(); +} + + + + + +void cProtocol146::SendSpawnVehicle(const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) +{ + cCSLock Lock(m_CSPacket); + WriteByte (PACKET_SPAWN_OBJECT); + WriteInt (a_Vehicle.GetUniqueID()); + WriteByte (a_VehicleType); + WriteInt ((int)(a_Vehicle.GetPosX() * 32)); + WriteInt ((int)(a_Vehicle.GetPosY() * 32)); + WriteInt ((int)(a_Vehicle.GetPosZ() * 32)); + WriteByte ((Byte)((a_Vehicle.GetPitch() / 360.f) * 256)); + WriteByte ((Byte)((a_Vehicle.GetRotation() / 360.f) * 256)); + WriteInt (a_VehicleSubType); + if (a_VehicleSubType != 0) + { + WriteShort((short)(a_Vehicle.GetSpeedX() * 400)); + WriteShort((short)(a_Vehicle.GetSpeedY() * 400)); + WriteShort((short)(a_Vehicle.GetSpeedZ() * 400)); + } + Flush(); +} + + + + + diff --git a/source/Protocol/Protocol14x.h b/src/Protocol/Protocol14x.h index ca497bbc1..ca497bbc1 100644 --- a/source/Protocol/Protocol14x.h +++ b/src/Protocol/Protocol14x.h diff --git a/source/Protocol/Protocol15x.cpp b/src/Protocol/Protocol15x.cpp index c337d26e7..c337d26e7 100644 --- a/source/Protocol/Protocol15x.cpp +++ b/src/Protocol/Protocol15x.cpp diff --git a/source/Protocol/Protocol15x.h b/src/Protocol/Protocol15x.h index e554fe130..e554fe130 100644 --- a/source/Protocol/Protocol15x.h +++ b/src/Protocol/Protocol15x.h diff --git a/source/Protocol/Protocol16x.cpp b/src/Protocol/Protocol16x.cpp index cfa27b3c4..cfa27b3c4 100644 --- a/source/Protocol/Protocol16x.cpp +++ b/src/Protocol/Protocol16x.cpp diff --git a/source/Protocol/Protocol16x.h b/src/Protocol/Protocol16x.h index 325e41c5a..325e41c5a 100644 --- a/source/Protocol/Protocol16x.h +++ b/src/Protocol/Protocol16x.h diff --git a/source/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 746e1c127..746e1c127 100644 --- a/source/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp diff --git a/src/Protocol/Protocol17x.h b/src/Protocol/Protocol17x.h new file mode 100644 index 000000000..9c1eaa99a --- /dev/null +++ b/src/Protocol/Protocol17x.h @@ -0,0 +1,260 @@ + +// Protocol17x.h + +/* +Declares the 1.7.x protocol classes: + - cProtocol172 + - release 1.7.2 protocol (#4) +(others may be added later in the future for the 1.7 release series) +*/ + + + + + +#pragma once + +#include "Protocol.h" +#include "../ByteBuffer.h" +#include "cryptopp/modes.h" +#include "cryptopp/aes.h" + + + + + +class cProtocol172 : + public cProtocol // TODO +{ + typedef cProtocol super; // TODO + +public: + + cProtocol172(cClientHandle * a_Client, const AString & a_ServerAddress, UInt16 a_ServerPort, UInt32 a_State); + + /// Called when client sends some data: + virtual void DataReceived(const char * a_Data, int a_Size) override; + + /// Sending stuff to clients (alphabetically sorted): + virtual void SendAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle) override; + virtual void SendBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType) override; + virtual void SendBlockBreakAnim (int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage) override; + virtual void SendBlockChange (int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override; + virtual void SendBlockChanges (int a_ChunkX, int a_ChunkZ, const sSetBlockVector & a_Changes) override; + virtual void SendChat (const AString & a_Message) override; + virtual void SendChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer) override; + virtual void SendCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player) override; + virtual void SendDestroyEntity (const cEntity & a_Entity) override; + virtual void SendDisconnect (const AString & a_Reason) override; + virtual void SendEditSign (int a_BlockX, int a_BlockY, int a_BlockZ) override; ///< Request the client to open up the sign editor for the sign (1.6+) + virtual void SendEntityEquipment (const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item) override; + virtual void SendEntityHeadLook (const cEntity & a_Entity) override; + virtual void SendEntityLook (const cEntity & a_Entity) override; + virtual void SendEntityMetadata (const cEntity & a_Entity) override; + virtual void SendEntityProperties (const cEntity & a_Entity) override; + virtual void SendEntityRelMove (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override; + virtual void SendEntityRelMoveLook (const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ) override; + virtual void SendEntityStatus (const cEntity & a_Entity, char a_Status) override; + virtual void SendEntityVelocity (const cEntity & a_Entity) override; + virtual void SendExplosion (double a_BlockX, double a_BlockY, double a_BlockZ, float a_Radius, const cVector3iArray & a_BlocksAffected, const Vector3d & a_PlayerMotion) override; + virtual void SendGameMode (eGameMode a_GameMode) override; + virtual void SendHealth (void) override; + virtual void SendInventorySlot (char a_WindowID, short a_SlotNum, const cItem & a_Item) override; + virtual void SendKeepAlive (int a_PingID) override; + virtual void SendLogin (const cPlayer & a_Player, const cWorld & a_World) override; + virtual void SendPickupSpawn (const cPickup & a_Pickup) override; + virtual void SendPlayerAbilities (void) override; + virtual void SendPlayerAnimation (const cPlayer & a_Player, char a_Animation) override; + virtual void SendPlayerListItem (const cPlayer & a_Player, bool a_IsOnline) override; + virtual void SendPlayerMaxSpeed (void) override; + virtual void SendPlayerMoveLook (void) override; + virtual void SendPlayerPosition (void) override; + virtual void SendPlayerSpawn (const cPlayer & a_Player) override; + virtual void SendRespawn (void) override; + virtual void SendSoundEffect (const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch) override; // a_Src coords are Block * 8 + virtual void SendExperience (void) override; + virtual void SendExperienceOrb (const cExpOrb & a_ExpOrb) override; + virtual void SendSoundParticleEffect (int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data) override; + virtual void SendSpawnFallingBlock (const cFallingBlock & a_FallingBlock) override; + virtual void SendSpawnMob (const cMonster & a_Mob) override; + virtual void SendSpawnObject (const cEntity & a_Entity, char a_ObjectType, int a_ObjectData, Byte a_Yaw, Byte a_Pitch) override; + virtual void SendSpawnVehicle (const cEntity & a_Vehicle, char a_VehicleType, char a_VehicleSubType) override; + virtual void SendTabCompletionResults(const AStringVector & a_Results) override; + virtual void SendTeleportEntity (const cEntity & a_Entity) override; + virtual void SendThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) override; + virtual void SendTimeUpdate (Int64 a_WorldAge, Int64 a_TimeOfDay) override; + virtual void SendUnloadChunk (int a_ChunkX, int a_ChunkZ) override; + virtual void SendUpdateSign (int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4) override; + virtual void SendUseBed (const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ ) override; + virtual void SendWeather (eWeather a_Weather) override; + virtual void SendWholeInventory (const cWindow & a_Window) override; + virtual void SendWindowClose (const cWindow & a_Window) override; + virtual void SendWindowOpen (const cWindow & a_Window) override; + virtual void SendWindowProperty (const cWindow & a_Window, short a_Property, short a_Value) override; + + virtual AString GetAuthServerID(void) override { return m_AuthServerID; } + +protected: + + /// Composes individual packets in the protocol's m_OutPacketBuffer; sends them upon being destructed + class cPacketizer + { + public: + cPacketizer(cProtocol172 & a_Protocol, UInt32 a_PacketType) : + m_Protocol(a_Protocol), + m_Out(a_Protocol.m_OutPacketBuffer), + m_Lock(a_Protocol.m_CSPacket) + { + m_Out.WriteVarInt(a_PacketType); + } + + ~cPacketizer(); + + void WriteBool(bool a_Value) + { + m_Out.WriteBool(a_Value); + } + + void WriteByte(Byte a_Value) + { + m_Out.WriteByte(a_Value); + } + + void WriteChar(char a_Value) + { + m_Out.WriteChar(a_Value); + } + + void WriteShort(short a_Value) + { + m_Out.WriteBEShort(a_Value); + } + + void WriteInt(int a_Value) + { + m_Out.WriteBEInt(a_Value); + } + + void WriteInt64(Int64 a_Value) + { + m_Out.WriteBEInt64(a_Value); + } + + void WriteFloat(float a_Value) + { + m_Out.WriteBEFloat(a_Value); + } + + void WriteDouble(double a_Value) + { + m_Out.WriteBEDouble(a_Value); + } + + void WriteVarInt(UInt32 a_Value) + { + m_Out.WriteVarInt(a_Value); + } + + void WriteString(const AString & a_Value) + { + m_Out.WriteVarUTF8String(a_Value); + } + + void WriteBuf(const char * a_Data, int a_Size) + { + m_Out.Write(a_Data, a_Size); + } + + void WriteItem(const cItem & a_Item); + void WriteByteAngle(double a_Angle); // Writes the specified angle using a single byte + void WriteFPInt(double a_Value); // Writes the double value as a 27:5 fixed-point integer + void WriteEntityMetadata(const cEntity & a_Entity); // Writes the metadata for the specified entity, not including the terminating 0x7f + void WriteMobMetadata(const cMonster & a_Mob); // Writes the mob-specific metadata for the specified mob + void WriteEntityProperties(const cEntity & a_Entity); // Writes the entity properties for the specified entity, including the Count field + + protected: + cProtocol172 & m_Protocol; + cByteBuffer & m_Out; + cCSLock m_Lock; + } ; + + AString m_ServerAddress; + + UInt16 m_ServerPort; + + AString m_AuthServerID; + + /// State of the protocol. 1 = status, 2 = login, 3 = game + UInt32 m_State; + + /// Buffer for the received data + cByteBuffer m_ReceivedData; + + /// Buffer for composing the outgoing packets, through cPacketizer + cByteBuffer m_OutPacketBuffer; + + /// Buffer for composing packet length (so that each cPacketizer instance doesn't allocate a new cPacketBuffer) + cByteBuffer m_OutPacketLenBuffer; + + bool m_IsEncrypted; + CryptoPP::CFB_Mode<CryptoPP::AES>::Decryption m_Decryptor; + CryptoPP::CFB_Mode<CryptoPP::AES>::Encryption m_Encryptor; + + + /// Adds the received (unencrypted) data to m_ReceivedData, parses complete packets + void AddReceivedData(const char * a_Data, int a_Size); + + /// Reads and handles the packet. The packet length and type have already been read. + void HandlePacket(UInt32 a_PacketType, UInt32 a_RemainingBytes); + + // Packet handlers while in the Status state (m_State == 1): + void HandlePacketStatusPing (UInt32 a_RemainingBytes); + void HandlePacketStatusRequest(UInt32 a_RemainingBytes); + + // Packet handlers while in the Login state (m_State == 2): + void HandlePacketLoginEncryptionResponse(UInt32 a_RemainingBytes); + void HandlePacketLoginStart (UInt32 a_RemainingBytes); + + // Packet handlers while in the Game state (m_State == 3): + void HandlePacketAnimation (UInt32 a_RemainingBytes); + void HandlePacketBlockDig (UInt32 a_RemainingBytes); + void HandlePacketBlockPlace (UInt32 a_RemainingBytes); + void HandlePacketChatMessage (UInt32 a_RemainingBytes); + void HandlePacketClientSettings (UInt32 a_RemainingBytes); + void HandlePacketClientStatus (UInt32 a_RemainingBytes); + void HandlePacketCreativeInventoryAction(UInt32 a_RemainingBytes); + void HandlePacketEntityAction (UInt32 a_RemainingBytes); + void HandlePacketKeepAlive (UInt32 a_RemainingBytes); + void HandlePacketPlayer (UInt32 a_RemainingBytes); + void HandlePacketPlayerAbilities (UInt32 a_RemainingBytes); + void HandlePacketPlayerLook (UInt32 a_RemainingBytes); + void HandlePacketPlayerPos (UInt32 a_RemainingBytes); + void HandlePacketPlayerPosLook (UInt32 a_RemainingBytes); + void HandlePacketPluginMessage (UInt32 a_RemainingBytes); + void HandlePacketSlotSelect (UInt32 a_RemainingBytes); + void HandlePacketSteerVehicle (UInt32 a_RemainingBytes); + void HandlePacketTabComplete (UInt32 a_RemainingBytes); + void HandlePacketUpdateSign (UInt32 a_RemainingBytes); + void HandlePacketUseEntity (UInt32 a_RemainingBytes); + void HandlePacketWindowClick (UInt32 a_RemainingBytes); + void HandlePacketWindowClose (UInt32 a_RemainingBytes); + + + /// Writes an entire packet into the output stream. a_Packet is expected to start with the packet type; data length is prepended here. + void WritePacket(cByteBuffer & a_Packet); + + /// Sends the data to the client, encrypting them if needed. + virtual void SendData(const char * a_Data, int a_Size) override; + + void SendCompass(const cWorld & a_World); + + /// Reads an item out of the received data, sets a_Item to the values read. Returns false if not enough received data + bool ReadItem(cItem & a_Item); + + /// Parses item metadata as read by ReadItem(), into the item enchantments. + void ParseItemMetadata(cItem & a_Item, const AString & a_Metadata); +} ; + + + + diff --git a/source/Protocol/ProtocolRecognizer.cpp b/src/Protocol/ProtocolRecognizer.cpp index 489149d74..489149d74 100644 --- a/source/Protocol/ProtocolRecognizer.cpp +++ b/src/Protocol/ProtocolRecognizer.cpp diff --git a/source/Protocol/ProtocolRecognizer.h b/src/Protocol/ProtocolRecognizer.h index 9ca0c1c88..9ca0c1c88 100644 --- a/source/Protocol/ProtocolRecognizer.h +++ b/src/Protocol/ProtocolRecognizer.h diff --git a/src/RCONServer.cpp b/src/RCONServer.cpp new file mode 100644 index 000000000..72f2d9ba9 --- /dev/null +++ b/src/RCONServer.cpp @@ -0,0 +1,333 @@ + +// RCONServer.cpp + +// Implements the cRCONServer class representing the RCON server + +#include "Globals.h" +#include "inifile/iniFile.h" +#include "RCONServer.h" +#include "Server.h" +#include "Root.h" +#include "CommandOutput.h" + + + + + +// Disable MSVC warnings: +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable:4355) // 'this' : used in base member initializer list +#endif + + + + + +enum +{ + // Client -> Server: + RCON_PACKET_COMMAND = 2, + RCON_PACKET_LOGIN = 3, + + // Server -> Client: + RCON_PACKET_RESPONSE = 2, +} ; + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cRCONCommandOutput: + +class cRCONCommandOutput : + public cCommandOutputCallback +{ +public: + cRCONCommandOutput(cRCONServer::cConnection & a_Connection, int a_RequestID) : + m_Connection(a_Connection), + m_RequestID(a_RequestID) + { + } + + // cCommandOutputCallback overrides: + virtual void Out(const AString & a_Text) override + { + m_Buffer.append(a_Text); + } + + virtual void Finished(void) override + { + m_Connection.SendResponse(m_RequestID, RCON_PACKET_RESPONSE, m_Buffer.size(), m_Buffer.c_str()); + delete this; + } + +protected: + cRCONServer::cConnection & m_Connection; + int m_RequestID; + AString m_Buffer; +} ; + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cRCONServer: + +cRCONServer::cRCONServer(cServer & a_Server) : + m_Server(a_Server), + m_ListenThread4(*this, cSocket::IPv4, "RCON IPv4"), + m_ListenThread6(*this, cSocket::IPv6, "RCON IPv6") +{ +} + + + + + +cRCONServer::~cRCONServer() +{ + m_ListenThread4.Stop(); + m_ListenThread6.Stop(); +} + + + + + +void cRCONServer::Initialize(cIniFile & a_IniFile) +{ + if (!a_IniFile.GetValueSetB("RCON", "Enabled", false)) + { + return; + } + + // Read the password, don't allow an empty one: + m_Password = a_IniFile.GetValueSet("RCON", "Password", ""); + if (m_Password.empty()) + { + LOGWARNING("RCON is requested, but the password is not set. RCON is now disabled."); + return; + } + + // Read and initialize both IPv4 and IPv6 ports for RCON + bool HasAnyPorts = false; + AString Ports4 = a_IniFile.GetValueSet("RCON", "PortsIPv4", "25575"); + if (m_ListenThread4.Initialize(Ports4)) + { + HasAnyPorts = true; + m_ListenThread4.Start(); + } + AString Ports6 = a_IniFile.GetValueSet("RCON", "PortsIPv6", "25575"); + if (m_ListenThread6.Initialize(Ports6)) + { + HasAnyPorts = true; + m_ListenThread6.Start(); + } + if (!HasAnyPorts) + { + LOGWARNING("RCON is requested, but no ports are specified. Specify at least one port in PortsIPv4 or PortsIPv6. RCON is now disabled."); + return; + } +} + + + + + +void cRCONServer::OnConnectionAccepted(cSocket & a_Socket) +{ + if (!a_Socket.IsValid()) + { + return; + } + + LOG("RCON Client \"%s\" connected!", a_Socket.GetIPString().c_str()); + + // Create a new cConnection object, it will be deleted when the connection is closed + m_SocketThreads.AddClient(a_Socket, new cConnection(*this, a_Socket)); +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cRCONServer::cConnection: + +cRCONServer::cConnection::cConnection(cRCONServer & a_RCONServer, cSocket & a_Socket) : + m_IsAuthenticated(false), + m_RCONServer(a_RCONServer), + m_Socket(a_Socket), + m_IPAddress(a_Socket.GetIPString()) +{ +} + + + + + +void cRCONServer::cConnection::DataReceived(const char * a_Data, int a_Size) +{ + // Append data to the buffer: + m_Buffer.append(a_Data, a_Size); + + // Process the packets in the buffer: + while (m_Buffer.size() >= 14) + { + int Length = IntFromBuffer(m_Buffer.data()); + if (Length > 1500) + { + // Too long, drop the connection + LOGWARNING("Received an invalid RCON packet length (%d), dropping RCON connection to %s.", + Length, m_IPAddress.c_str() + ); + m_RCONServer.m_SocketThreads.RemoveClient(this); + m_Socket.CloseSocket(); + delete this; + return; + } + if (Length > (int)(m_Buffer.size() + 4)) + { + // Incomplete packet yet, wait for more data to come + return; + } + + int RequestID = IntFromBuffer(m_Buffer.data() + 4); + int PacketType = IntFromBuffer(m_Buffer.data() + 8); + if (!ProcessPacket(RequestID, PacketType, Length - 10, m_Buffer.data() + 12)) + { + m_RCONServer.m_SocketThreads.RemoveClient(this); + m_Socket.CloseSocket(); + delete this; + return; + } + m_Buffer.erase(0, Length + 4); + } // while (m_Buffer.size() >= 14) +} + + + + + +void cRCONServer::cConnection::GetOutgoingData(AString & a_Data) +{ + a_Data.assign(m_Outgoing); + m_Outgoing.clear(); +} + + + + + +void cRCONServer::cConnection::SocketClosed(void) +{ + m_RCONServer.m_SocketThreads.RemoveClient(this); + delete this; +} + + + + + +bool cRCONServer::cConnection::ProcessPacket(int a_RequestID, int a_PacketType, int a_PayloadLength, const char * a_Payload) +{ + switch (a_PacketType) + { + case RCON_PACKET_LOGIN: + { + if (strncmp(a_Payload, m_RCONServer.m_Password.c_str(), a_PayloadLength) != 0) + { + LOGINFO("RCON: Invalid password from client %s, dropping connection.", m_IPAddress.c_str()); + SendResponse(-1, RCON_PACKET_RESPONSE, 0, NULL); + return false; + } + m_IsAuthenticated = true; + + LOGD("RCON: Client at %s has successfully authenticated", m_IPAddress.c_str()); + + // Send OK response: + SendResponse(a_RequestID, RCON_PACKET_RESPONSE, 0, NULL); + return true; + } + + case RCON_PACKET_COMMAND: + { + if (!m_IsAuthenticated) + { + char AuthNeeded[] = "You need to authenticate first!"; + SendResponse(a_RequestID, RCON_PACKET_RESPONSE, sizeof(AuthNeeded), AuthNeeded); + return false; + } + + AString cmd(a_Payload, a_PayloadLength); + LOGD("RCON command from %s: \"%s\"", m_IPAddress.c_str(), cmd.c_str()); + cRoot::Get()->ExecuteConsoleCommand(cmd, *(new cRCONCommandOutput(*this, a_RequestID))); + + // Send an empty response: + SendResponse(a_RequestID, RCON_PACKET_RESPONSE, 0, NULL); + return true; + } + } + + // Unknown packet type, drop the connection: + LOGWARNING("RCON: Client at %s has sent an unknown packet type %d, dropping connection.", + m_IPAddress.c_str(), a_PacketType + ); + return false; +} + + + + + +/// Reads 4 bytes from a_Buffer and returns the int they represent +int cRCONServer::cConnection::IntFromBuffer(const char * a_Buffer) +{ + return ((unsigned char)a_Buffer[3] << 24) | ((unsigned char)a_Buffer[2] << 16) | ((unsigned char)a_Buffer[1] << 8) | (unsigned char)a_Buffer[0]; +} + + + + + +/// Puts 4 bytes representing the int into the buffer +void cRCONServer::cConnection::IntToBuffer(int a_Value, char * a_Buffer) +{ + a_Buffer[0] = a_Value & 0xff; + a_Buffer[1] = (a_Value >> 8) & 0xff; + a_Buffer[2] = (a_Value >> 16) & 0xff; + a_Buffer[3] = (a_Value >> 24) & 0xff; +} + + + + + +/// Sends a RCON packet back to the client +void cRCONServer::cConnection::SendResponse(int a_RequestID, int a_PacketType, int a_PayloadLength, const char * a_Payload) +{ + ASSERT((a_PayloadLength == 0) || (a_Payload != NULL)); // Either zero data to send, or a valid payload ptr + + char Buffer[4]; + int Length = a_PayloadLength + 10; + IntToBuffer(Length, Buffer); + m_Outgoing.append(Buffer, 4); + IntToBuffer(a_RequestID, Buffer); + m_Outgoing.append(Buffer, 4); + IntToBuffer(a_PacketType, Buffer); + m_Outgoing.append(Buffer, 4); + if (a_PayloadLength > 0) + { + m_Outgoing.append(a_Payload, a_PayloadLength); + } + m_Outgoing.push_back(0); + m_Outgoing.push_back(0); + m_RCONServer.m_SocketThreads.NotifyWrite(this); +} + + + + diff --git a/source/RCONServer.h b/src/RCONServer.h index 0e89800a2..0e89800a2 100644 --- a/source/RCONServer.h +++ b/src/RCONServer.h diff --git a/source/ReferenceManager.cpp b/src/ReferenceManager.cpp index 6a9ed0e43..6a9ed0e43 100644 --- a/source/ReferenceManager.cpp +++ b/src/ReferenceManager.cpp diff --git a/source/ReferenceManager.h b/src/ReferenceManager.h index bcd451f72..bcd451f72 100644 --- a/source/ReferenceManager.h +++ b/src/ReferenceManager.h diff --git a/src/Root.cpp b/src/Root.cpp new file mode 100644 index 000000000..4a6abaf37 --- /dev/null +++ b/src/Root.cpp @@ -0,0 +1,754 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Root.h" +#include "Server.h" +#include "World.h" +#include "WebAdmin.h" +#include "FurnaceRecipe.h" +#include "GroupManager.h" +#include "CraftingRecipes.h" +#include "PluginManager.h" +#include "MonsterConfig.h" +#include "Entities/Player.h" +#include "Blocks/BlockHandler.h" +#include "Items/ItemHandler.h" +#include "Chunk.h" +#include "Protocol/ProtocolRecognizer.h" // for protocol version constants +#include "CommandOutput.h" +#include "DeadlockDetect.h" +#include "OSSupport/Timer.h" + +#include "inifile/iniFile.h" + +#ifdef _WIN32 + #include <psapi.h> +#elif defined(__linux__) + #include <fstream> +#elif defined(__APPLE__) + #include <mach/mach.h> +#endif + + + + + +cRoot* cRoot::s_Root = NULL; + + + + + +cRoot::cRoot() + : m_Server( NULL ) + , m_MonsterConfig( NULL ) + , m_GroupManager( NULL ) + , m_CraftingRecipes(NULL) + , m_FurnaceRecipe( NULL ) + , m_WebAdmin( NULL ) + , m_PluginManager( NULL ) + , m_Log( NULL ) + , m_bStop( false ) + , m_bRestart( false ) + , m_InputThread( NULL ) + , m_pDefaultWorld( NULL ) +{ + s_Root = this; +} + + + + + +cRoot::~cRoot() +{ + s_Root = 0; +} + + + + + +void cRoot::InputThread(void * a_Params) +{ + cRoot & self = *(cRoot*)a_Params; + + cLogCommandOutputCallback Output; + + while (!(self.m_bStop || self.m_bRestart) && std::cin.good()) + { + std::string Command; + std::getline(std::cin, Command); + if (!Command.empty()) + { + self.ExecuteConsoleCommand(Command, Output); + } + } + + if (!(self.m_bStop || self.m_bRestart)) + { + // We have come here because the std::cin has received an EOF and the server is still running; stop the server: + self.m_bStop = true; + } +} + + + + + +void cRoot::Start(void) +{ + cDeadlockDetect dd; + delete m_Log; + m_Log = new cMCLogger(); + + m_bStop = false; + while (!m_bStop) + { + cTimer Time; + long long mseconds = Time.GetNowTime(); + + m_bRestart = false; + + LoadGlobalSettings(); + + LOG("Creating new server instance..."); + m_Server = new cServer(); + + LOG("Reading server config..."); + cIniFile IniFile; + if (!IniFile.ReadFile("settings.ini")) + { + LOGWARN("Regenerating settings.ini, all settings will be reset"); + IniFile.AddHeaderComment(" This is the main server configuration"); + IniFile.AddHeaderComment(" Most of the settings here can be configured using the webadmin interface, if enabled in webadmin.ini"); + IniFile.AddHeaderComment(" See: http://www.mc-server.org/wiki/doku.php?id=configure:settings.ini for further configuration help"); + } + + m_PrimaryServerVersion = IniFile.GetValueI("Server", "PrimaryServerVersion", 0); + if (m_PrimaryServerVersion == 0) + { + m_PrimaryServerVersion = cProtocolRecognizer::PROTO_VERSION_LATEST; + } + else + { + // Make a note in the log that the primary server version is explicitly set in the ini file + LOGINFO("Primary server version set explicitly to %d.", m_PrimaryServerVersion); + } + + LOG("Starting server..."); + if (!m_Server->InitServer(IniFile)) + { + LOGERROR("Failure starting server, aborting..."); + return; + } + + m_WebAdmin = new cWebAdmin(); + m_WebAdmin->Init(); + + LOGD("Loading settings..."); + m_GroupManager = new cGroupManager(); + m_CraftingRecipes = new cCraftingRecipes; + m_FurnaceRecipe = new cFurnaceRecipe(); + + LOGD("Loading worlds..."); + LoadWorlds(IniFile); + + LOGD("Loading plugin manager..."); + m_PluginManager = new cPluginManager(); + m_PluginManager->ReloadPluginsNow(IniFile); + + LOGD("Loading MonsterConfig..."); + m_MonsterConfig = new cMonsterConfig; + + // This sets stuff in motion + LOGD("Starting Authenticator..."); + m_Authenticator.Start(IniFile); + + IniFile.WriteFile("settings.ini"); + + LOGD("Starting worlds..."); + StartWorlds(); + + LOGD("Starting deadlock detector..."); + dd.Start(); + + LOGD("Finalising startup..."); + m_Server->Start(); + + m_WebAdmin->Start(); + + #if !defined(ANDROID_NDK) + LOGD("Starting InputThread..."); + m_InputThread = new cThread( InputThread, this, "cRoot::InputThread" ); + m_InputThread->Start( false ); // We should NOT wait? Otherwise we can´t stop the server from other threads than the input thread + #endif + + long long finishmseconds = Time.GetNowTime(); + finishmseconds -= mseconds; + + LOG("Startup complete, took %i ms!", finishmseconds); + + while (!m_bStop && !m_bRestart) // These are modified by external threads + { + cSleep::MilliSleep(1000); + } + + #if !defined(ANDROID_NDK) + delete m_InputThread; m_InputThread = NULL; + #endif + + // Deallocate stuffs + LOG("Shutting down server..."); + m_Server->Shutdown(); + + LOGD("Shutting down deadlock detector..."); + dd.Stop(); + + LOGD("Stopping world threads..."); + StopWorlds(); + + LOGD("Stopping authenticator..."); + m_Authenticator.Stop(); + + LOGD("Freeing MonsterConfig..."); + delete m_MonsterConfig; m_MonsterConfig = NULL; + delete m_WebAdmin; m_WebAdmin = NULL; + LOGD("Unloading recipes..."); + delete m_FurnaceRecipe; m_FurnaceRecipe = NULL; + delete m_CraftingRecipes; m_CraftingRecipes = NULL; + LOGD("Forgetting groups..."); + delete m_GroupManager; m_GroupManager = 0; + LOGD("Unloading worlds..."); + UnloadWorlds(); + + LOGD("Stopping plugin manager..."); + delete m_PluginManager; m_PluginManager = NULL; + + cItemHandler::Deinit(); + cBlockHandler::Deinit(); + + LOG("Cleaning up..."); + //delete HeartBeat; HeartBeat = 0; + delete m_Server; m_Server = 0; + LOG("Shutdown successful!"); + } + + delete m_Log; m_Log = 0; +} + + + + + +void cRoot::LoadGlobalSettings() +{ + // Nothing needed yet +} + + + + + +void cRoot::LoadWorlds(cIniFile & IniFile) +{ + // First get the default world + AString DefaultWorldName = IniFile.GetValueSet("Worlds", "DefaultWorld", "world"); + m_pDefaultWorld = new cWorld( DefaultWorldName.c_str() ); + m_WorldsByName[ DefaultWorldName ] = m_pDefaultWorld; + + // Then load the other worlds + unsigned int KeyNum = IniFile.FindKey("Worlds"); + unsigned int NumWorlds = IniFile.GetNumValues( KeyNum ); + if (NumWorlds <= 0) + { + return; + } + + bool FoundAdditionalWorlds = false; + for (unsigned int i = 0; i < NumWorlds; i++) + { + AString ValueName = IniFile.GetValueName(KeyNum, i ); + if (ValueName.compare("World") != 0) + { + continue; + } + AString WorldName = IniFile.GetValue(KeyNum, i ); + if (WorldName.empty()) + { + continue; + } + FoundAdditionalWorlds = true; + cWorld* NewWorld = new cWorld( WorldName.c_str() ); + m_WorldsByName[ WorldName ] = NewWorld; + } // for i - Worlds + + if (!FoundAdditionalWorlds) + { + if (IniFile.GetKeyComment("Worlds", 0) != " World=secondworld") + { + IniFile.AddKeyComment("Worlds", " World=secondworld"); + } + } +} + + + + + +void cRoot::StartWorlds(void) +{ + for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr) + { + itr->second->Start(); + itr->second->InitializeSpawn(); + } +} + + + + + +void cRoot::StopWorlds(void) +{ + for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr) + { + itr->second->Stop(); + } +} + + + + + +void cRoot::UnloadWorlds(void) +{ + m_pDefaultWorld = NULL; + for( WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr ) + { + delete itr->second; + } + m_WorldsByName.clear(); +} + + + + + +cWorld* cRoot::GetDefaultWorld() +{ + return m_pDefaultWorld; +} + + + + + +cWorld* cRoot::GetWorld( const AString & a_WorldName ) +{ + WorldMap::iterator itr = m_WorldsByName.find( a_WorldName ); + if( itr != m_WorldsByName.end() ) + return itr->second; + return 0; +} + + + + + +bool cRoot::ForEachWorld(cWorldListCallback & a_Callback) +{ + for (WorldMap::iterator itr = m_WorldsByName.begin(), itr2 = itr; itr != m_WorldsByName.end(); itr = itr2) + { + ++itr2; + if (a_Callback.Item(itr->second)) + { + return false; + } + } + return true; +} + + + + + +void cRoot::TickCommands(void) +{ + // Execute any pending commands: + cCommandQueue PendingCommands; + { + cCSLock Lock(m_CSPendingCommands); + std::swap(PendingCommands, m_PendingCommands); + } + for (cCommandQueue::iterator itr = PendingCommands.begin(), end = PendingCommands.end(); itr != end; ++itr) + { + ExecuteConsoleCommand(itr->m_Command, *(itr->m_Output)); + } +} + + + + + +void cRoot::QueueExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output) +{ + // Some commands are built-in: + if (a_Cmd == "stop") + { + m_bStop = true; + } + else if (a_Cmd == "restart") + { + m_bRestart = true; + } + + // Put the command into a queue (Alleviates FS #363): + cCSLock Lock(m_CSPendingCommands); + m_PendingCommands.push_back(cCommand(a_Cmd, &a_Output)); +} + + + + + +void cRoot::QueueExecuteConsoleCommand(const AString & a_Cmd) +{ + // Some commands are built-in: + if (a_Cmd == "stop") + { + m_bStop = true; + } + else if (a_Cmd == "restart") + { + m_bRestart = true; + } + + // Put the command into a queue (Alleviates FS #363): + cCSLock Lock(m_CSPendingCommands); + m_PendingCommands.push_back(cCommand(a_Cmd, new cLogCommandDeleteSelfOutputCallback)); +} + + + + + +void cRoot::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output) +{ + // Some commands are built-in: + if (a_Cmd == "stop") + { + m_bStop = true; + } + else if (a_Cmd == "restart") + { + m_bRestart = true; + } + + LOG("Executing console command: \"%s\"", a_Cmd.c_str()); + m_Server->ExecuteConsoleCommand(a_Cmd, a_Output); +} + + + + + +void cRoot::KickUser(int a_ClientID, const AString & a_Reason) +{ + m_Server->KickUser(a_ClientID, a_Reason); +} + + + + + +void cRoot::AuthenticateUser(int a_ClientID) +{ + m_Server->AuthenticateUser(a_ClientID); +} + + + + + +int cRoot::GetTotalChunkCount(void) +{ + int res = 0; + for ( WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr ) + { + res += itr->second->GetNumChunks(); + } + return res; +} + + + + + +void cRoot::SaveAllChunks(void) +{ + for (WorldMap::iterator itr = m_WorldsByName.begin(); itr != m_WorldsByName.end(); ++itr) + { + itr->second->QueueSaveAllChunks(); + } +} + + + + + +void cRoot::BroadcastChat(const AString & a_Message) +{ + for (WorldMap::iterator itr = m_WorldsByName.begin(), end = m_WorldsByName.end(); itr != end; ++itr) + { + itr->second->BroadcastChat(a_Message); + } // for itr - m_WorldsByName[] +} + + + + + +bool cRoot::ForEachPlayer(cPlayerListCallback & a_Callback) +{ + for (WorldMap::iterator itr = m_WorldsByName.begin(), itr2 = itr; itr != m_WorldsByName.end(); itr = itr2) + { + ++itr2; + if (!itr->second->ForEachPlayer(a_Callback)) + { + return false; + } + } + return true; +} + + + + + +bool cRoot::FindAndDoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback) +{ + class cCallback : public cPlayerListCallback + { + unsigned int BestRating; + unsigned int NameLength; + const AString PlayerName; + + cPlayerListCallback & m_Callback; + virtual bool Item (cPlayer * a_pPlayer) + { + unsigned int Rating = RateCompareString (PlayerName, a_pPlayer->GetName()); + if (Rating > 0 && Rating >= BestRating) + { + BestMatch = a_pPlayer; + if( Rating > BestRating ) NumMatches = 0; + BestRating = Rating; + ++NumMatches; + } + if (Rating == NameLength) // Perfect match + { + return true; + } + return false; + } + + public: + cCallback (const AString & a_PlayerName, cPlayerListCallback & a_Callback) + : m_Callback( a_Callback ) + , BestMatch( NULL ) + , BestRating( 0 ) + , NumMatches( 0 ) + , NameLength( a_PlayerName.length() ) + , PlayerName( a_PlayerName ) + {} + + cPlayer * BestMatch; + unsigned int NumMatches; + } Callback (a_PlayerName, a_Callback); + ForEachPlayer( Callback ); + + if (Callback.NumMatches == 1) + { + return a_Callback.Item (Callback.BestMatch); + } + return false; +} + + + + + +AString cRoot::GetProtocolVersionTextFromInt(int a_ProtocolVersion) +{ + return cProtocolRecognizer::GetVersionTextFromInt(a_ProtocolVersion); +} + + + + + +int cRoot::GetVirtualRAMUsage(void) +{ + #ifdef _WIN32 + PROCESS_MEMORY_COUNTERS_EX pmc; + if (GetProcessMemoryInfo(GetCurrentProcess(), (PROCESS_MEMORY_COUNTERS *)&pmc, sizeof(pmc))) + { + return (int)(pmc.PrivateUsage / 1024); + } + return -1; + #elif defined(__linux__) + // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process + std::ifstream StatFile("/proc/self/status"); + if (!StatFile.good()) + { + return -1; + } + while (StatFile.good()) + { + AString Line; + std::getline(StatFile, Line); + if (strncmp(Line.c_str(), "VmSize:", 7) == 0) + { + int res = atoi(Line.c_str() + 8); + return (res == 0) ? -1 : res; // If parsing failed, return -1 + } + } + return -1; + #elif defined (__APPLE__) + // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process + struct task_basic_info t_info; + mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT; + + if (KERN_SUCCESS == task_info( + mach_task_self(), + TASK_BASIC_INFO, + (task_info_t)&t_info, + &t_info_count + )) + { + return (int)(t_info.virtual_size / 1024); + } + return -1; + #else + LOGINFO("%s: Unknown platform, cannot query memory usage", __FUNCTION__); + return -1; + #endif +} + + + + + +int cRoot::GetPhysicalRAMUsage(void) +{ + #ifdef _WIN32 + PROCESS_MEMORY_COUNTERS pmc; + if (GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof(pmc))) + { + return (int)(pmc.WorkingSetSize / 1024); + } + return -1; + #elif defined(__linux__) + // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process + std::ifstream StatFile("/proc/self/status"); + if (!StatFile.good()) + { + return -1; + } + while (StatFile.good()) + { + AString Line; + std::getline(StatFile, Line); + if (strncmp(Line.c_str(), "VmRSS:", 7) == 0) + { + int res = atoi(Line.c_str() + 8); + return (res == 0) ? -1 : res; // If parsing failed, return -1 + } + } + return -1; + #elif defined (__APPLE__) + // Code adapted from http://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process + struct task_basic_info t_info; + mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT; + + if (KERN_SUCCESS == task_info( + mach_task_self(), + TASK_BASIC_INFO, + (task_info_t)&t_info, + &t_info_count + )) + { + return (int)(t_info.resident_size / 1024); + } + return -1; + #else + LOGINFO("%s: Unknown platform, cannot query memory usage", __FUNCTION__); + return -1; + #endif +} + + + + + +void cRoot::LogChunkStats(cCommandOutputCallback & a_Output) +{ + int SumNumValid = 0; + int SumNumDirty = 0; + int SumNumInLighting = 0; + int SumNumInGenerator = 0; + int SumMem = 0; + for (WorldMap::iterator itr = m_WorldsByName.begin(), end = m_WorldsByName.end(); itr != end; ++itr) + { + cWorld * World = itr->second; + int NumInGenerator = World->GetGeneratorQueueLength(); + int NumInSaveQueue = World->GetStorageSaveQueueLength(); + int NumInLoadQueue = World->GetStorageLoadQueueLength(); + int NumValid = 0; + int NumDirty = 0; + int NumInLighting = 0; + World->GetChunkStats(NumValid, NumDirty, NumInLighting); + a_Output.Out("World %s:", World->GetName().c_str()); + a_Output.Out(" Num loaded chunks: %d", NumValid); + a_Output.Out(" Num dirty chunks: %d", NumDirty); + a_Output.Out(" Num chunks in lighting queue: %d", NumInLighting); + a_Output.Out(" Num chunks in generator queue: %d", NumInGenerator); + a_Output.Out(" Num chunks in storage load queue: %d", NumInLoadQueue); + a_Output.Out(" Num chunks in storage save queue: %d", NumInSaveQueue); + int Mem = NumValid * sizeof(cChunk); + a_Output.Out(" Memory used by chunks: %d KiB (%d MiB)", (Mem + 1023) / 1024, (Mem + 1024 * 1024 - 1) / (1024 * 1024)); + a_Output.Out(" Per-chunk memory size breakdown:"); + a_Output.Out(" block types: %6d bytes (%3d KiB)", sizeof(cChunkDef::BlockTypes), (sizeof(cChunkDef::BlockTypes) + 1023) / 1024); + a_Output.Out(" block metadata: %6d bytes (%3d KiB)", sizeof(cChunkDef::BlockNibbles), (sizeof(cChunkDef::BlockNibbles) + 1023) / 1024); + a_Output.Out(" block lighting: %6d bytes (%3d KiB)", 2 * sizeof(cChunkDef::BlockNibbles), (2 * sizeof(cChunkDef::BlockNibbles) + 1023) / 1024); + a_Output.Out(" heightmap: %6d bytes (%3d KiB)", sizeof(cChunkDef::HeightMap), (sizeof(cChunkDef::HeightMap) + 1023) / 1024); + a_Output.Out(" biomemap: %6d bytes (%3d KiB)", sizeof(cChunkDef::BiomeMap), (sizeof(cChunkDef::BiomeMap) + 1023) / 1024); + int Rest = sizeof(cChunk) - sizeof(cChunkDef::BlockTypes) - 3 * sizeof(cChunkDef::BlockNibbles) - sizeof(cChunkDef::HeightMap) - sizeof(cChunkDef::BiomeMap); + a_Output.Out(" other: %6d bytes (%3d KiB)", Rest, (Rest + 1023) / 1024); + SumNumValid += NumValid; + SumNumDirty += NumDirty; + SumNumInLighting += NumInLighting; + SumNumInGenerator += NumInGenerator; + SumMem += Mem; + } + a_Output.Out("Totals:"); + a_Output.Out(" Num loaded chunks: %d", SumNumValid); + a_Output.Out(" Num dirty chunks: %d", SumNumDirty); + a_Output.Out(" Num chunks in lighting queue: %d", SumNumInLighting); + a_Output.Out(" Num chunks in generator queue: %d", SumNumInGenerator); + a_Output.Out(" Memory used by chunks: %d KiB (%d MiB)", (SumMem + 1023) / 1024, (SumMem + 1024 * 1024 - 1) / (1024 * 1024)); +} + + + + + +int cRoot::GetFurnaceFuelBurnTime(const cItem & a_Fuel) +{ + cFurnaceRecipe * FR = Get()->GetFurnaceRecipe(); + return FR->GetBurnTime(a_Fuel); +} + + + + diff --git a/source/Root.h b/src/Root.h index 4e38dd17f..4e38dd17f 100644 --- a/source/Root.h +++ b/src/Root.h diff --git a/src/Server.cpp b/src/Server.cpp new file mode 100644 index 000000000..5951dc5b5 --- /dev/null +++ b/src/Server.cpp @@ -0,0 +1,707 @@ +// ReDucTor is an awesome guy who helped me a lot + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "Server.h" +#include "ClientHandle.h" +#include "OSSupport/Timer.h" +#include "Mobs/Monster.h" +#include "OSSupport/Socket.h" +#include "Root.h" +#include "World.h" +#include "ChunkDef.h" +#include "PluginManager.h" +#include "GroupManager.h" +#include "ChatColor.h" +#include "Entities/Player.h" +#include "Inventory.h" +#include "Item.h" +#include "FurnaceRecipe.h" +#include "WebAdmin.h" +#include "Protocol/ProtocolRecognizer.h" +#include "CommandOutput.h" + +#include "MersenneTwister.h" + +#include "inifile/iniFile.h" +#include "Vector3f.h" + +#include <fstream> +#include <sstream> +#include <iostream> + +extern "C" { + #include "zlib/zlib.h" +} + + + + +// For the "dumpmem" server command: +/// Synchronize this with main.cpp - the leak finder needs initialization before it can be used to dump memory +#define ENABLE_LEAK_FINDER + +#if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER) + #pragma warning(push) + #pragma warning(disable:4100) + #include "LeakFinder.h" + #pragma warning(pop) +#endif + + + + + +typedef std::list< cClientHandle* > ClientList; + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cServer::cTickThread: + +cServer::cTickThread::cTickThread(cServer & a_Server) : + super("ServerTickThread"), + m_Server(a_Server) +{ +} + + + + + +void cServer::cTickThread::Execute(void) +{ + cTimer Timer; + + long long msPerTick = 50; + long long LastTime = Timer.GetNowTime(); + + while (!m_ShouldTerminate) + { + long long NowTime = Timer.GetNowTime(); + float DeltaTime = (float)(NowTime-LastTime); + m_ShouldTerminate = !m_Server.Tick(DeltaTime); + long long TickTime = Timer.GetNowTime() - NowTime; + + if (TickTime < msPerTick) + { + // Stretch tick time until it's at least msPerTick + cSleep::MilliSleep((unsigned int)(msPerTick - TickTime)); + } + + LastTime = NowTime; + } +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cServer: + +cServer::cServer(void) : + m_ListenThreadIPv4(*this, cSocket::IPv4, "Client IPv4"), + m_ListenThreadIPv6(*this, cSocket::IPv6, "Client IPv6"), + m_bIsConnected(false), + m_bRestarting(false), + m_RCONServer(*this), + m_TickThread(*this) +{ +} + + + + + +void cServer::ClientDestroying(const cClientHandle * a_Client) +{ + m_SocketThreads.StopReading(a_Client); +} + + + + + +void cServer::NotifyClientWrite(const cClientHandle * a_Client) +{ + m_NotifyWriteThread.NotifyClientWrite(a_Client); +} + + + + + +void cServer::WriteToClient(const cClientHandle * a_Client, const AString & a_Data) +{ + m_SocketThreads.Write(a_Client, a_Data); +} + + + + + +void cServer::QueueClientClose(const cClientHandle * a_Client) +{ + m_SocketThreads.QueueClose(a_Client); +} + + + + + +void cServer::RemoveClient(const cClientHandle * a_Client) +{ + m_SocketThreads.RemoveClient(a_Client); +} + + + + + +void cServer::ClientMovedToWorld(const cClientHandle * a_Client) +{ + cCSLock Lock(m_CSClients); + m_ClientsToRemove.push_back(const_cast<cClientHandle *>(a_Client)); +} + + + + + +void cServer::PlayerCreated(const cPlayer * a_Player) +{ + // To avoid deadlocks, the player count is not handled directly, but rather posted onto the tick thread + cCSLock Lock(m_CSPlayerCountDiff); + m_PlayerCountDiff += 1; +} + + + + + +void cServer::PlayerDestroying(const cPlayer * a_Player) +{ + // To avoid deadlocks, the player count is not handled directly, but rather posted onto the tick thread + cCSLock Lock(m_CSPlayerCountDiff); + m_PlayerCountDiff -= 1; +} + + + + + +bool cServer::InitServer(cIniFile & a_SettingsIni) +{ + m_Description = a_SettingsIni.GetValueSet("Server", "Description", "MCServer - in C++!").c_str(); + m_MaxPlayers = a_SettingsIni.GetValueSetI("Server", "MaxPlayers", 100); + m_bIsHardcore = a_SettingsIni.GetValueSetB("Server", "HardcoreEnabled", false); + m_PlayerCount = 0; + m_PlayerCountDiff = 0; + + if (m_bIsConnected) + { + LOGERROR("ERROR: Trying to initialize server while server is already running!"); + return false; + } + + LOGINFO("Compatible clients: %s", MCS_CLIENT_VERSIONS); + LOGINFO("Compatible protocol versions %s", MCS_PROTOCOL_VERSIONS); + + if (cSocket::WSAStartup() != 0) // Only does anything on Windows, but whatever + { + LOGERROR("WSAStartup() != 0"); + return false; + } + + bool HasAnyPorts = false; + AString Ports = a_SettingsIni.GetValueSet("Server", "Port", "25565"); + m_ListenThreadIPv4.SetReuseAddr(true); + if (m_ListenThreadIPv4.Initialize(Ports)) + { + HasAnyPorts = true; + } + + Ports = a_SettingsIni.GetValueSet("Server", "PortsIPv6", "25565"); + m_ListenThreadIPv6.SetReuseAddr(true); + if (m_ListenThreadIPv6.Initialize(Ports)) + { + HasAnyPorts = true; + } + + if (!HasAnyPorts) + { + LOGERROR("Couldn't open any ports. Aborting the server"); + return false; + } + + m_RCONServer.Initialize(a_SettingsIni); + + m_bIsConnected = true; + + m_ServerID = "-"; + if (a_SettingsIni.GetValueSetB("Authentication", "Authenticate", true)) + { + MTRand mtrand1; + unsigned int r1 = (mtrand1.randInt() % 1147483647) + 1000000000; + unsigned int r2 = (mtrand1.randInt() % 1147483647) + 1000000000; + std::ostringstream sid; + sid << std::hex << r1; + sid << std::hex << r2; + m_ServerID = sid.str(); + m_ServerID.resize(16, '0'); + } + + m_ClientViewDistance = a_SettingsIni.GetValueSetI("Server", "DefaultViewDistance", cClientHandle::DEFAULT_VIEW_DISTANCE); + if (m_ClientViewDistance < cClientHandle::MIN_VIEW_DISTANCE) + { + m_ClientViewDistance = cClientHandle::MIN_VIEW_DISTANCE; + LOGINFO("Setting default viewdistance to the minimum of %d", m_ClientViewDistance); + } + if (m_ClientViewDistance > cClientHandle::MAX_VIEW_DISTANCE) + { + m_ClientViewDistance = cClientHandle::MAX_VIEW_DISTANCE; + LOGINFO("Setting default viewdistance to the maximum of %d", m_ClientViewDistance); + } + + m_NotifyWriteThread.Start(this); + + PrepareKeys(); + + return true; +} + + + + + +int cServer::GetNumPlayers(void) +{ + cCSLock Lock(m_CSPlayerCount); + return m_PlayerCount; +} + + + + + +void cServer::PrepareKeys(void) +{ + // TODO: Save and load key for persistence across sessions + // But generating the key takes only a moment, do we even need that? + + LOGD("Generating protocol encryption keypair..."); + + time_t CurTime = time(NULL); + CryptoPP::RandomPool rng; + rng.Put((const byte *)&CurTime, sizeof(CurTime)); + m_PrivateKey.GenerateRandomWithKeySize(rng, 1024); + CryptoPP::RSA::PublicKey pk(m_PrivateKey); + m_PublicKey = pk; +} + + + + + +void cServer::OnConnectionAccepted(cSocket & a_Socket) +{ + if (!a_Socket.IsValid()) + { + return; + } + + const AString & ClientIP = a_Socket.GetIPString(); + if (ClientIP.empty()) + { + LOGWARN("cServer: A client connected, but didn't present its IP, disconnecting."); + a_Socket.CloseSocket(); + return; + } + + LOGD("Client \"%s\" connected!", ClientIP.c_str()); + + cClientHandle * NewHandle = new cClientHandle(&a_Socket, m_ClientViewDistance); + if (!m_SocketThreads.AddClient(a_Socket, NewHandle)) + { + // For some reason SocketThreads have rejected the handle, clean it up + LOGERROR("Client \"%s\" cannot be handled, server probably unstable", ClientIP.c_str()); + a_Socket.CloseSocket(); + delete NewHandle; + return; + } + + cCSLock Lock(m_CSClients); + m_Clients.push_back(NewHandle); +} + + + + + +bool cServer::Tick(float a_Dt) +{ + // Apply the queued playercount adjustments (postponed to avoid deadlocks) + int PlayerCountDiff = 0; + { + cCSLock Lock(m_CSPlayerCountDiff); + std::swap(PlayerCountDiff, m_PlayerCountDiff); + } + { + cCSLock Lock(m_CSPlayerCount); + m_PlayerCount += PlayerCountDiff; + } + + // Send the tick to the plugins, as well as let the plugin manager reload, if asked to (issue #102): + cPluginManager::Get()->Tick(a_Dt); + + // Let the Root process all the queued commands: + cRoot::Get()->TickCommands(); + + // Tick all clients not yet assigned to a world: + TickClients(a_Dt); + + if (!m_bRestarting) + { + return true; + } + else + { + m_bRestarting = false; + m_RestartEvent.Set(); + return false; + } +} + + + + + +void cServer::TickClients(float a_Dt) +{ + cClientHandleList RemoveClients; + { + cCSLock Lock(m_CSClients); + + // Remove clients that have moved to a world (the world will be ticking them from now on) + for (cClientHandleList::const_iterator itr = m_ClientsToRemove.begin(), end = m_ClientsToRemove.end(); itr != end; ++itr) + { + m_Clients.remove(*itr); + } // for itr - m_ClientsToRemove[] + m_ClientsToRemove.clear(); + + // Tick the remaining clients, take out those that have been destroyed into RemoveClients + for (cClientHandleList::iterator itr = m_Clients.begin(); itr != m_Clients.end();) + { + if ((*itr)->IsDestroyed()) + { + // Remove the client later, when CS is not held, to avoid deadlock ( http://forum.mc-server.org/showthread.php?tid=374 ) + RemoveClients.push_back(*itr); + itr = m_Clients.erase(itr); + continue; + } + (*itr)->Tick(a_Dt); + ++itr; + } // for itr - m_Clients[] + } + + // Delete the clients that have been destroyed + for (cClientHandleList::iterator itr = RemoveClients.begin(); itr != RemoveClients.end(); ++itr) + { + delete *itr; + } // for itr - RemoveClients[] +} + + + + + +bool cServer::Start(void) +{ + if (!m_ListenThreadIPv4.Start()) + { + return false; + } + if (!m_ListenThreadIPv6.Start()) + { + return false; + } + if (!m_TickThread.Start()) + { + return false; + } + return true; +} + + + + + +bool cServer::Command(cClientHandle & a_Client, AString & a_Cmd) +{ + return cRoot::Get()->GetPluginManager()->CallHookChat(a_Client.GetPlayer(), a_Cmd); +} + + + + + +void cServer::ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output) +{ + AStringVector split = StringSplit(a_Cmd, " "); + if (split.empty()) + { + return; + } + + // Special handling: "stop" and "restart" are built in + if ((split[0].compare("stop") == 0) || (split[0].compare("restart") == 0)) + { + return; + } + + // "help" and "reload" are to be handled by MCS, so that they work no matter what + if (split[0] == "help") + { + PrintHelp(split, a_Output); + return; + } + if (split[0] == "reload") + { + cPluginManager::Get()->ReloadPlugins(); + return; + } + + // There is currently no way a plugin can do these (and probably won't ever be): + if (split[0].compare("chunkstats") == 0) + { + cRoot::Get()->LogChunkStats(a_Output); + a_Output.Finished(); + return; + } + #if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER) + if (split[0].compare("dumpmem") == 0) + { + LeakFinderXmlOutput Output("memdump.xml"); + DumpUsedMemory(&Output); + return; + } + + if (split[0].compare("killmem") == 0) + { + while (true) + { + new char[100 * 1024 * 1024]; // Allocate and leak 100 MiB in a loop -> fill memory and kill MCS + } + } + #endif + + if (cPluginManager::Get()->ExecuteConsoleCommand(split, a_Output)) + { + a_Output.Finished(); + return; + } + + a_Output.Out("Unknown command, type 'help' for all commands."); + a_Output.Finished(); +} + + + + + +void cServer::PrintHelp(const AStringVector & a_Split, cCommandOutputCallback & a_Output) +{ + typedef std::pair<AString, AString> AStringPair; + typedef std::vector<AStringPair> AStringPairs; + + class cCallback : + public cPluginManager::cCommandEnumCallback + { + public: + cCallback(void) : m_MaxLen(0) {} + + virtual bool Command(const AString & a_Command, const cPlugin * a_Plugin, const AString & a_Permission, const AString & a_HelpString) override + { + if (!a_HelpString.empty()) + { + m_Commands.push_back(AStringPair(a_Command, a_HelpString)); + if (m_MaxLen < a_Command.length()) + { + m_MaxLen = a_Command.length(); + } + } + return false; + } + + AStringPairs m_Commands; + size_t m_MaxLen; + } Callback; + cPluginManager::Get()->ForEachConsoleCommand(Callback); + std::sort(Callback.m_Commands.begin(), Callback.m_Commands.end()); + for (AStringPairs::const_iterator itr = Callback.m_Commands.begin(), end = Callback.m_Commands.end(); itr != end; ++itr) + { + const AStringPair & cmd = *itr; + a_Output.Out(Printf("%-*s%s\n", Callback.m_MaxLen, cmd.first.c_str(), cmd.second.c_str())); + } // for itr - Callback.m_Commands[] + a_Output.Finished(); +} + + + + + +void cServer::BindBuiltInConsoleCommands(void) +{ + cPluginManager * PlgMgr = cPluginManager::Get(); + PlgMgr->BindConsoleCommand("help", NULL, " - Shows the available commands"); + PlgMgr->BindConsoleCommand("reload", NULL, " - Reloads all plugins"); + PlgMgr->BindConsoleCommand("restart", NULL, " - Restarts the server cleanly"); + PlgMgr->BindConsoleCommand("stop", NULL, " - Stops the server cleanly"); + PlgMgr->BindConsoleCommand("chunkstats", NULL, " - Displays detailed chunk memory statistics"); + #if defined(_MSC_VER) && defined(_DEBUG) && defined(ENABLE_LEAK_FINDER) + PlgMgr->BindConsoleCommand("dumpmem", NULL, " - Dumps all used memory blocks together with their callstacks into memdump.xml"); + #endif +} + + + + + +void cServer::Shutdown(void) +{ + m_ListenThreadIPv4.Stop(); + m_ListenThreadIPv6.Stop(); + + m_bRestarting = true; + m_RestartEvent.Wait(); + + cRoot::Get()->SaveAllChunks(); + + cCSLock Lock(m_CSClients); + for( ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr ) + { + (*itr)->Destroy(); + delete *itr; + } + m_Clients.clear(); +} + + + + + +void cServer::KickUser(int a_ClientID, const AString & a_Reason) +{ + cCSLock Lock(m_CSClients); + for (ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr) + { + if ((*itr)->GetUniqueID() == a_ClientID) + { + (*itr)->Kick(a_Reason); + } + } // for itr - m_Clients[] +} + + + + + +void cServer::AuthenticateUser(int a_ClientID) +{ + cCSLock Lock(m_CSClients); + for (ClientList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr) + { + if ((*itr)->GetUniqueID() == a_ClientID) + { + (*itr)->Authenticate(); + return; + } + } // for itr - m_Clients[] +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cServer::cNotifyWriteThread: + +cServer::cNotifyWriteThread::cNotifyWriteThread(void) : + super("ClientPacketThread"), + m_Server(NULL) +{ +} + + + + + +cServer::cNotifyWriteThread::~cNotifyWriteThread() +{ + m_ShouldTerminate = true; + m_Event.Set(); + Wait(); +} + + + + + +bool cServer::cNotifyWriteThread::Start(cServer * a_Server) +{ + m_Server = a_Server; + return super::Start(); +} + + + + + +void cServer::cNotifyWriteThread::Execute(void) +{ + cClientHandleList Clients; + while (!m_ShouldTerminate) + { + cCSLock Lock(m_CS); + while (m_Clients.size() == 0) + { + cCSUnlock Unlock(Lock); + m_Event.Wait(); + if (m_ShouldTerminate) + { + return; + } + } + + // Copy the clients to notify and unlock the CS: + Clients.splice(Clients.begin(), m_Clients); + Lock.Unlock(); + + for (cClientHandleList::iterator itr = Clients.begin(); itr != Clients.end(); ++itr) + { + m_Server->m_SocketThreads.NotifyWrite(*itr); + } // for itr - Clients[] + Clients.clear(); + } // while (!mShouldTerminate) +} + + + + + +void cServer::cNotifyWriteThread::NotifyClientWrite(const cClientHandle * a_Client) +{ + { + cCSLock Lock(m_CS); + m_Clients.remove(const_cast<cClientHandle *>(a_Client)); // Put it there only once + m_Clients.push_back(const_cast<cClientHandle *>(a_Client)); + } + m_Event.Set(); +} + + + + diff --git a/src/Server.h b/src/Server.h new file mode 100644 index 000000000..0d93469a5 --- /dev/null +++ b/src/Server.h @@ -0,0 +1,195 @@ + +// cServer.h + +// Interfaces to the cServer object representing the network server + + + + + +#pragma once + +#include "OSSupport/SocketThreads.h" +#include "OSSupport/ListenThread.h" +#include "cryptopp/rsa.h" +#include "cryptopp/randpool.h" +#include "RCONServer.h" + + + + + +// fwd: +class cPlayer; +class cClientHandle; +class cIniFile; +class cCommandOutputCallback ; + +typedef std::list<cClientHandle *> cClientHandleList; + + + + + +class cServer // tolua_export + : public cListenThread::cCallback +{ // tolua_export +public: // tolua_export + bool InitServer(cIniFile & a_SettingsIni); + + // tolua_begin + + const AString & GetDescription(void) const {return m_Description; } + + // Player counts: + int GetMaxPlayers(void) const {return m_MaxPlayers; } + int GetNumPlayers(void); + void SetMaxPlayers(int a_MaxPlayers) { m_MaxPlayers = a_MaxPlayers; } + + // Hardcore mode or not: + bool IsHardcore(void) const {return m_bIsHardcore; } + + // tolua_end + + bool Start(void); + + bool Command(cClientHandle & a_Client, AString & a_Cmd); + + /// Executes the console command, sends output through the specified callback + void ExecuteConsoleCommand(const AString & a_Cmd, cCommandOutputCallback & a_Output); + + /// Lists all available console commands and their helpstrings + void PrintHelp(const AStringVector & a_Split, cCommandOutputCallback & a_Output); + + /// Binds the built-in console commands with the plugin manager + static void BindBuiltInConsoleCommands(void); + + void Shutdown(void); + + void KickUser(int a_ClientID, const AString & a_Reason); + void AuthenticateUser(int a_ClientID); // Called by cAuthenticator to auth the specified user + + const AString & GetServerID(void) const { return m_ServerID; } // tolua_export + + void ClientDestroying(const cClientHandle * a_Client); // Called by cClientHandle::Destroy(); stop m_SocketThreads from calling back into a_Client + + void NotifyClientWrite(const cClientHandle * a_Client); // Notifies m_SocketThreads that client has something to be written + + void WriteToClient(const cClientHandle * a_Client, const AString & a_Data); // Queues outgoing data for the client through m_SocketThreads + + void QueueClientClose(const cClientHandle * a_Client); // Queues the clienthandle to close when all its outgoing data is sent + + void RemoveClient(const cClientHandle * a_Client); // Removes the clienthandle from m_SocketThreads + + /// Don't tick a_Client anymore, it will be ticked from its cPlayer instead + void ClientMovedToWorld(const cClientHandle * a_Client); + + /// Notifies the server that a player was created; the server uses this to adjust the number of players + void PlayerCreated(const cPlayer * a_Player); + + /// Notifies the server that a player is being destroyed; the server uses this to adjust the number of players + void PlayerDestroying(const cPlayer * a_Player); + + CryptoPP::RSA::PrivateKey & GetPrivateKey(void) { return m_PrivateKey; } + CryptoPP::RSA::PublicKey & GetPublicKey (void) { return m_PublicKey; } + +private: + + friend class cRoot; // so cRoot can create and destroy cServer + + /// When NotifyClientWrite() is called, it is queued for this thread to process (to avoid deadlocks between cSocketThreads, cClientHandle and cChunkMap) + class cNotifyWriteThread : + public cIsThread + { + typedef cIsThread super; + + cEvent m_Event; // Set when m_Clients gets appended + cServer * m_Server; + + cCriticalSection m_CS; + cClientHandleList m_Clients; + + virtual void Execute(void); + + public: + + cNotifyWriteThread(void); + ~cNotifyWriteThread(); + + bool Start(cServer * a_Server); + + void NotifyClientWrite(const cClientHandle * a_Client); + } ; + + /// The server tick thread takes care of the players who aren't yet spawned in a world + class cTickThread : + public cIsThread + { + typedef cIsThread super; + + public: + cTickThread(cServer & a_Server); + + protected: + cServer & m_Server; + + // cIsThread overrides: + virtual void Execute(void) override; + } ; + + + cNotifyWriteThread m_NotifyWriteThread; + + cListenThread m_ListenThreadIPv4; + cListenThread m_ListenThreadIPv6; + + cCriticalSection m_CSClients; ///< Locks client lists + cClientHandleList m_Clients; ///< Clients that are connected to the server and not yet assigned to a cWorld + cClientHandleList m_ClientsToRemove; ///< Clients that have just been moved into a world and are to be removed from m_Clients in the next Tick() + + cCriticalSection m_CSPlayerCount; ///< Locks the m_PlayerCount + int m_PlayerCount; ///< Number of players currently playing in the server + cCriticalSection m_CSPlayerCountDiff; ///< Locks the m_PlayerCountDiff + int m_PlayerCountDiff; ///< Adjustment to m_PlayerCount to be applied in the Tick thread + + cSocketThreads m_SocketThreads; + + int m_ClientViewDistance; // The default view distance for clients; settable in Settings.ini + + bool m_bIsConnected; // true - connected false - not connected + + bool m_bRestarting; + + CryptoPP::RSA::PrivateKey m_PrivateKey; + CryptoPP::RSA::PublicKey m_PublicKey; + + cRCONServer m_RCONServer; + + AString m_Description; + int m_MaxPlayers; + bool m_bIsHardcore; + + cTickThread m_TickThread; + cEvent m_RestartEvent; + + /// The server ID used for client authentication + AString m_ServerID; + + + cServer(void); + + /// Loads, or generates, if missing, RSA keys for protocol encryption + void PrepareKeys(void); + + bool Tick(float a_Dt); + + /// Ticks the clients in m_Clients, manages the list in respect to removing clients + void TickClients(float a_Dt); + + // cListenThread::cCallback overrides: + virtual void OnConnectionAccepted(cSocket & a_Socket) override; +}; // tolua_export + + + + diff --git a/source/Simulator/DelayedFluidSimulator.cpp b/src/Simulator/DelayedFluidSimulator.cpp index a4645ca09..a4645ca09 100644 --- a/source/Simulator/DelayedFluidSimulator.cpp +++ b/src/Simulator/DelayedFluidSimulator.cpp diff --git a/source/Simulator/DelayedFluidSimulator.h b/src/Simulator/DelayedFluidSimulator.h index c81500741..c81500741 100644 --- a/source/Simulator/DelayedFluidSimulator.h +++ b/src/Simulator/DelayedFluidSimulator.h diff --git a/source/Simulator/FireSimulator.cpp b/src/Simulator/FireSimulator.cpp index ac3fb9695..ac3fb9695 100644 --- a/source/Simulator/FireSimulator.cpp +++ b/src/Simulator/FireSimulator.cpp diff --git a/source/Simulator/FireSimulator.h b/src/Simulator/FireSimulator.h index 0d8a548ef..0d8a548ef 100644 --- a/source/Simulator/FireSimulator.h +++ b/src/Simulator/FireSimulator.h diff --git a/source/Simulator/FloodyFluidSimulator.cpp b/src/Simulator/FloodyFluidSimulator.cpp index d204a1f8b..d204a1f8b 100644 --- a/source/Simulator/FloodyFluidSimulator.cpp +++ b/src/Simulator/FloodyFluidSimulator.cpp diff --git a/source/Simulator/FloodyFluidSimulator.h b/src/Simulator/FloodyFluidSimulator.h index c4af2e246..c4af2e246 100644 --- a/source/Simulator/FloodyFluidSimulator.h +++ b/src/Simulator/FloodyFluidSimulator.h diff --git a/source/Simulator/FluidSimulator.cpp b/src/Simulator/FluidSimulator.cpp index dac666484..dac666484 100644 --- a/source/Simulator/FluidSimulator.cpp +++ b/src/Simulator/FluidSimulator.cpp diff --git a/source/Simulator/FluidSimulator.h b/src/Simulator/FluidSimulator.h index 672b740a2..672b740a2 100644 --- a/source/Simulator/FluidSimulator.h +++ b/src/Simulator/FluidSimulator.h diff --git a/source/Simulator/NoopFluidSimulator.h b/src/Simulator/NoopFluidSimulator.h index 8f894433f..8f894433f 100644 --- a/source/Simulator/NoopFluidSimulator.h +++ b/src/Simulator/NoopFluidSimulator.h diff --git a/source/Simulator/RedstoneSimulator.cpp b/src/Simulator/RedstoneSimulator.cpp index 906961490..906961490 100644 --- a/source/Simulator/RedstoneSimulator.cpp +++ b/src/Simulator/RedstoneSimulator.cpp diff --git a/source/Simulator/RedstoneSimulator.h b/src/Simulator/RedstoneSimulator.h index d68c6daeb..d68c6daeb 100644 --- a/source/Simulator/RedstoneSimulator.h +++ b/src/Simulator/RedstoneSimulator.h diff --git a/source/Simulator/SandSimulator.cpp b/src/Simulator/SandSimulator.cpp index 87fb83357..87fb83357 100644 --- a/source/Simulator/SandSimulator.cpp +++ b/src/Simulator/SandSimulator.cpp diff --git a/source/Simulator/SandSimulator.h b/src/Simulator/SandSimulator.h index 6e9ea15ac..6e9ea15ac 100644 --- a/source/Simulator/SandSimulator.h +++ b/src/Simulator/SandSimulator.h diff --git a/source/Simulator/Simulator.cpp b/src/Simulator/Simulator.cpp index 06fd0f858..06fd0f858 100644 --- a/source/Simulator/Simulator.cpp +++ b/src/Simulator/Simulator.cpp diff --git a/src/Simulator/Simulator.h b/src/Simulator/Simulator.h new file mode 100644 index 000000000..5cd0e8657 --- /dev/null +++ b/src/Simulator/Simulator.h @@ -0,0 +1,46 @@ + +#pragma once + +#include "../Vector3i.h" +#include "inifile/iniFile.h" + + + + + +class cWorld; +class cChunk; + + + + + +class cSimulator +{ +public: + cSimulator(cWorld & a_World); + virtual ~cSimulator(); + + /// Called in each tick, a_Dt is the time passed since the last tick, in msec + virtual void Simulate(float a_Dt) = 0; + + /// Called in each tick for each chunk, a_Dt is the time passed since the last tick, in msec; direct access to chunk data available + virtual void SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk) {}; + + /// Called when a block changes + virtual void WakeUp(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk); + + virtual bool IsAllowedBlock(BLOCKTYPE a_BlockType) = 0; + +protected: + friend class cChunk; // Calls AddBlock() in its WakeUpSimulators() function, to speed things up + + /// Called to simulate a new block + virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) = 0; + + cWorld & m_World; +} ; + + + + diff --git a/source/Simulator/SimulatorManager.cpp b/src/Simulator/SimulatorManager.cpp index 2bc483cbd..2bc483cbd 100644 --- a/source/Simulator/SimulatorManager.cpp +++ b/src/Simulator/SimulatorManager.cpp diff --git a/source/Simulator/SimulatorManager.h b/src/Simulator/SimulatorManager.h index 31a709316..31a709316 100644 --- a/source/Simulator/SimulatorManager.h +++ b/src/Simulator/SimulatorManager.h diff --git a/source/Simulator/VaporizeFluidSimulator.cpp b/src/Simulator/VaporizeFluidSimulator.cpp index 4206c64d1..4206c64d1 100644 --- a/source/Simulator/VaporizeFluidSimulator.cpp +++ b/src/Simulator/VaporizeFluidSimulator.cpp diff --git a/source/Simulator/VaporizeFluidSimulator.h b/src/Simulator/VaporizeFluidSimulator.h index c8eb7802b..c8eb7802b 100644 --- a/source/Simulator/VaporizeFluidSimulator.h +++ b/src/Simulator/VaporizeFluidSimulator.h diff --git a/source/StackWalker.cpp b/src/StackWalker.cpp index bf18b9fc9..bf18b9fc9 100644 --- a/source/StackWalker.cpp +++ b/src/StackWalker.cpp diff --git a/source/StackWalker.h b/src/StackWalker.h index bf47d3726..bf47d3726 100644 --- a/source/StackWalker.h +++ b/src/StackWalker.h diff --git a/source/StringCompression.cpp b/src/StringCompression.cpp index 36946b282..36946b282 100644 --- a/source/StringCompression.cpp +++ b/src/StringCompression.cpp diff --git a/src/StringCompression.h b/src/StringCompression.h new file mode 100644 index 000000000..459e8f568 --- /dev/null +++ b/src/StringCompression.h @@ -0,0 +1,25 @@ + +// StringCompression.h + +// Interfaces to the wrapping functions for compression and decompression using AString as their data + +#include "zlib/zlib.h" // Needed for the Z_XXX return values + + + + + +/// Compresses a_Data into a_Compressed using ZLIB; returns Z_XXX error constants same as zlib's compress2() +extern int CompressString(const char * a_Data, int a_Length, AString & a_Compressed); + +/// Uncompresses a_Data into a_Uncompressed; returns Z_XXX error constants same as zlib's decompress() +extern int UncompressString(const char * a_Data, int a_Length, AString & a_Uncompressed, int a_UncompressedSize); + +/// Compresses a_Data into a_Compressed using GZIP; returns Z_OK for success or Z_XXX error constants same as zlib +extern int CompressStringGZIP(const char * a_Data, int a_Length, AString & a_Compressed); + +/// Uncompresses a_Data into a_Uncompressed using GZIP; returns Z_OK for success or Z_XXX error constants same as zlib +extern int UncompressStringGZIP(const char * a_Data, int a_Length, AString & a_Uncompressed); + + + diff --git a/source/StringUtils.cpp b/src/StringUtils.cpp index f7aeeed26..f7aeeed26 100644 --- a/source/StringUtils.cpp +++ b/src/StringUtils.cpp diff --git a/source/StringUtils.h b/src/StringUtils.h index 3917cc4ec..3917cc4ec 100644 --- a/source/StringUtils.h +++ b/src/StringUtils.h diff --git a/source/Tracer.cpp b/src/Tracer.cpp index ef136302f..ef136302f 100644 --- a/source/Tracer.cpp +++ b/src/Tracer.cpp diff --git a/source/Tracer.h b/src/Tracer.h index 6c2ab6792..6c2ab6792 100644 --- a/source/Tracer.h +++ b/src/Tracer.h diff --git a/source/UI/SlotArea.cpp b/src/UI/SlotArea.cpp index 7fd7cd996..7fd7cd996 100644 --- a/source/UI/SlotArea.cpp +++ b/src/UI/SlotArea.cpp diff --git a/source/UI/SlotArea.h b/src/UI/SlotArea.h index b1944d901..b1944d901 100644 --- a/source/UI/SlotArea.h +++ b/src/UI/SlotArea.h diff --git a/source/UI/Window.cpp b/src/UI/Window.cpp index f5c62692f..f5c62692f 100644 --- a/source/UI/Window.cpp +++ b/src/UI/Window.cpp diff --git a/source/UI/Window.h b/src/UI/Window.h index c44b900d7..c44b900d7 100644 --- a/source/UI/Window.h +++ b/src/UI/Window.h diff --git a/source/UI/WindowOwner.h b/src/UI/WindowOwner.h index d41abf66d..d41abf66d 100644 --- a/source/UI/WindowOwner.h +++ b/src/UI/WindowOwner.h diff --git a/source/Vector3d.cpp b/src/Vector3d.cpp index 96ebebab5..96ebebab5 100644 --- a/source/Vector3d.cpp +++ b/src/Vector3d.cpp diff --git a/source/Vector3d.h b/src/Vector3d.h index a06a17c09..a06a17c09 100644 --- a/source/Vector3d.h +++ b/src/Vector3d.h diff --git a/source/Vector3f.cpp b/src/Vector3f.cpp index 59d71d371..59d71d371 100644 --- a/source/Vector3f.cpp +++ b/src/Vector3f.cpp diff --git a/source/Vector3f.h b/src/Vector3f.h index adb154ad7..adb154ad7 100644 --- a/source/Vector3f.h +++ b/src/Vector3f.h diff --git a/source/Vector3i.cpp b/src/Vector3i.cpp index 4ce1e2cf3..4ce1e2cf3 100644 --- a/source/Vector3i.cpp +++ b/src/Vector3i.cpp diff --git a/source/Vector3i.h b/src/Vector3i.h index 7d726a7b3..7d726a7b3 100644 --- a/source/Vector3i.h +++ b/src/Vector3i.h diff --git a/source/WebAdmin.cpp b/src/WebAdmin.cpp index ecc131d21..ecc131d21 100644 --- a/source/WebAdmin.cpp +++ b/src/WebAdmin.cpp diff --git a/src/WebAdmin.h b/src/WebAdmin.h new file mode 100644 index 000000000..a775acec2 --- /dev/null +++ b/src/WebAdmin.h @@ -0,0 +1,215 @@ + +// WebAdmin.h + +// Declares the cWebAdmin class representing the admin interface over http protocol, and related services (API) + +#pragma once + +#include "OSSupport/Socket.h" +#include "LuaState.h" +#include "inifile/iniFile.h" +#include "HTTPServer/HTTPServer.h" +#include "HTTPServer/HTTPFormParser.h" + + + + + +// Disable MSVC warnings: +#if defined(_MSC_VER) + #pragma warning(push) + #pragma warning(disable:4355) // 'this' : used in base member initializer list +#endif + + + + + +// fwd: +class cEvent; +class cWebPlugin; + + + + + +// tolua_begin +struct HTTPFormData +{ + std::string Name; + std::string Value; + std::string Type; +} ; +// tolua_end + + + + +// tolua_begin +struct HTTPRequest +{ + typedef std::map< std::string, std::string > StringStringMap; + typedef std::map< std::string, HTTPFormData > FormDataMap; + + AString Method; + AString Path; + AString Username; + // tolua_end + + /// Parameters given in the URL, after the questionmark + StringStringMap Params; // >> EXPORTED IN MANUALBINDINGS << + + /// Parameters posted as a part of a form - either in the URL (GET method) or in the body (POST method) + StringStringMap PostParams; // >> EXPORTED IN MANUALBINDINGS << + + /// Same as PostParams + FormDataMap FormData; // >> EXPORTED IN MANUALBINDINGS << +} ; // tolua_export + + + + + +// tolua_begin +struct HTTPTemplateRequest +{ + HTTPRequest Request; +} ; +// tolua_end + + + + + +// tolua_begin +struct sWebAdminPage +{ + AString Content; + AString PluginName; + AString TabName; +}; +// tolua_end + + + + + +// tolua_begin +class cWebAdmin : + public cHTTPServer::cCallbacks +{ +public: + // tolua_end + + typedef std::list< cWebPlugin* > PluginList; + + + cWebAdmin(void); + ~cWebAdmin(); + + /// Initializes the object. Returns true if successfully initialized and ready to start + bool Init(void); + + /// Starts the HTTP server taking care of the admin. Returns true if successful + bool Start(void); + + void AddPlugin( cWebPlugin* a_Plugin ); + void RemovePlugin( cWebPlugin* a_Plugin ); + + // TODO: Convert this to the auto-locking callback mechanism used for looping players in worlds and such + PluginList GetPlugins() const { return m_Plugins; } // >> EXPORTED IN MANUALBINDINGS << + + // tolua_begin + + sWebAdminPage GetPage(const HTTPRequest & a_Request); + + /// Returns the contents of the default page - the list of plugins and players + AString GetDefaultPage(void); + + /// Returns the prefix needed for making a link point to the webadmin root from the given URL ("../../../webadmin"-style) + AString GetBaseURL(const AString & a_URL); + + /// Escapes text passed into it, so it can be embedded into html. + static AString GetHTMLEscapedString(const AString & a_Input); + + // tolua_end + + /// Returns the prefix needed for making a link point to the webadmin root from the given URL ("../../../webadmin"-style) + AString GetBaseURL(const AStringVector& a_URLSplit); + +protected: + /// Common base class for request body data handlers + class cRequestData + { + public: + virtual ~cRequestData() {} // Force a virtual destructor in all descendants + + /// Called when a new chunk of body data is received + virtual void OnBody(const char * a_Data, int a_Size) = 0; + } ; + + /// The body handler for requests in the "/webadmin" and "/~webadmin" paths + class cWebadminRequestData : + public cRequestData, + public cHTTPFormParser::cCallbacks + { + public: + cHTTPFormParser m_Form; + + + cWebadminRequestData(cHTTPRequest & a_Request) : + m_Form(a_Request, *this) + { + } + + // cRequestData overrides: + virtual void OnBody(const char * a_Data, int a_Size) override; + + // cHTTPFormParser::cCallbacks overrides. Files are ignored: + virtual void OnFileStart(cHTTPFormParser & a_Parser, const AString & a_FileName) override {} + virtual void OnFileData(cHTTPFormParser & a_Parser, const char * a_Data, int a_Size) override {} + virtual void OnFileEnd(cHTTPFormParser & a_Parser) override {} + } ; + + + /// Set to true if Init() succeeds and the webadmin isn't to be disabled + bool m_IsInitialized; + + /// The webadmin.ini file, used for the settings and allowed logins + cIniFile m_IniFile; + + PluginList m_Plugins; + + /// The Lua template script to provide templates: + cLuaState m_TemplateScript; + + /// The HTTP server which provides the underlying HTTP parsing, serialization and events + cHTTPServer m_HTTPServer; + + + AString GetTemplate(void); + + /// Handles requests coming to the "/webadmin" or "/~webadmin" URLs + void HandleWebadminRequest(cHTTPConnection & a_Connection, cHTTPRequest & a_Request); + + /// Handles requests for the root page + void HandleRootRequest(cHTTPConnection & a_Connection, cHTTPRequest & a_Request); + + // cHTTPServer::cCallbacks overrides: + virtual void OnRequestBegun (cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override; + virtual void OnRequestBody (cHTTPConnection & a_Connection, cHTTPRequest & a_Request, const char * a_Data, int a_Size) override; + virtual void OnRequestFinished(cHTTPConnection & a_Connection, cHTTPRequest & a_Request) override; +} ; // tolua_export + + + + + +// Revert MSVC warnings back to orignal state: +#if defined(_MSC_VER) + #pragma warning(pop) +#endif + + + + diff --git a/source/WebPlugin.cpp b/src/WebPlugin.cpp index 48ddb2076..48ddb2076 100644 --- a/source/WebPlugin.cpp +++ b/src/WebPlugin.cpp diff --git a/source/WebPlugin.h b/src/WebPlugin.h index 22587b892..22587b892 100644 --- a/source/WebPlugin.h +++ b/src/WebPlugin.h diff --git a/src/World.cpp b/src/World.cpp new file mode 100644 index 000000000..fb8ee0cb3 --- /dev/null +++ b/src/World.cpp @@ -0,0 +1,2745 @@ + +#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules + +#include "BlockID.h" +#include "World.h" +#include "ChunkDef.h" +#include "ClientHandle.h" +#include "Server.h" +#include "Item.h" +#include "Root.h" +#include "inifile/iniFile.h" +#include "ChunkMap.h" +#include "OSSupport/Timer.h" + +// Entities (except mobs): +#include "Entities/ExpOrb.h" +#include "Entities/Pickup.h" +#include "Entities/Player.h" +#include "Entities/TNTEntity.h" + +// Simulators: +#include "Simulator/SimulatorManager.h" +#include "Simulator/FloodyFluidSimulator.h" +#include "Simulator/FluidSimulator.h" +#include "Simulator/FireSimulator.h" +#include "Simulator/NoopFluidSimulator.h" +#include "Simulator/SandSimulator.h" +#include "Simulator/RedstoneSimulator.h" +#include "Simulator/VaporizeFluidSimulator.h" + +// Mobs: +#include "Mobs/IncludeAllMonsters.h" +#include "MobCensus.h" +#include "MobSpawner.h" + +#include "MersenneTwister.h" +#include "Generating/Trees.h" +#include "PluginManager.h" +#include "Blocks/BlockHandler.h" +#include "Vector3d.h" + +#include "Tracer.h" +#include "tolua++.h" + +// DEBUG: Test out the cLineBlockTracer class by tracing a few lines: +#include "LineBlockTracer.h" + +#ifndef _WIN32 + #include <stdlib.h> +#endif + + + + + +/// Up to this many m_SpreadQueue elements are handled each world tick +const int MAX_LIGHTING_SPREAD_PER_TICK = 10; + +const int TIME_SUNSET = 12000; +const int TIME_NIGHT_START = 13187; +const int TIME_NIGHT_END = 22812; +const int TIME_SUNRISE = 23999; +const int TIME_SPAWN_DIVISOR = 148; + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cWorldLoadProgress: + +/// A simple thread that displays the progress of world loading / saving in cWorld::InitializeSpawn() +class cWorldLoadProgress : + public cIsThread +{ +public: + cWorldLoadProgress(cWorld * a_World) : + cIsThread("cWorldLoadProgress"), + m_World(a_World) + { + Start(); + } + + void Stop(void) + { + m_ShouldTerminate = true; + Wait(); + } + +protected: + + cWorld * m_World; + + virtual void Execute(void) override + { + for (;;) + { + LOG("%d chunks to load, %d chunks to generate", + m_World->GetStorage().GetLoadQueueLength(), + m_World->GetGenerator().GetQueueLength() + ); + + // Wait for 2 sec, but be "reasonably wakeable" when the thread is to finish + for (int i = 0; i < 20; i++) + { + cSleep::MilliSleep(100); + if (m_ShouldTerminate) + { + return; + } + } + } // for (-ever) + } + +} ; + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cWorldLightingProgress: + +/// A simple thread that displays the progress of world lighting in cWorld::InitializeSpawn() +class cWorldLightingProgress : + public cIsThread +{ +public: + cWorldLightingProgress(cLightingThread * a_Lighting) : + cIsThread("cWorldLightingProgress"), + m_Lighting(a_Lighting) + { + Start(); + } + + void Stop(void) + { + m_ShouldTerminate = true; + Wait(); + } + +protected: + + cLightingThread * m_Lighting; + + virtual void Execute(void) override + { + for (;;) + { + LOG("%d chunks remaining to light", m_Lighting->GetQueueLength() + ); + + // Wait for 2 sec, but be "reasonably wakeable" when the thread is to finish + for (int i = 0; i < 20; i++) + { + cSleep::MilliSleep(100); + if (m_ShouldTerminate) + { + return; + } + } + } // for (-ever) + } + +} ; + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cWorld::cLock: + +cWorld::cLock::cLock(cWorld & a_World) : + super(&(a_World.m_ChunkMap->GetCS())) +{ +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cWorld::cTickThread: + +cWorld::cTickThread::cTickThread(cWorld & a_World) : + super(Printf("WorldTickThread: %s", a_World.GetName().c_str())), + m_World(a_World) +{ +} + + + + + +void cWorld::cTickThread::Execute(void) +{ + cTimer Timer; + + long long msPerTick = 50; + long long LastTime = Timer.GetNowTime(); + + while (!m_ShouldTerminate) + { + long long NowTime = Timer.GetNowTime(); + float DeltaTime = (float)(NowTime - LastTime); + m_World.Tick(DeltaTime); + long long TickTime = Timer.GetNowTime() - NowTime; + + if (TickTime < msPerTick) + { + // Stretch tick time until it's at least msPerTick + cSleep::MilliSleep((unsigned int)(msPerTick - TickTime)); + } + + LastTime = NowTime; + } +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cWorld: + +cWorld::cWorld(const AString & a_WorldName) : + m_WorldName(a_WorldName), + m_IniFileName(m_WorldName + "/world.ini"), + m_StorageSchema("Default"), + m_WorldAgeSecs(0), + m_TimeOfDaySecs(0), + m_WorldAge(0), + m_TimeOfDay(0), + m_LastTimeUpdate(0), + m_RSList(0), + m_Weather(eWeather_Sunny), + m_WeatherInterval(24000), // Guaranteed 1 day of sunshine at server start :) + m_TickThread(*this), + m_SkyDarkness(0) +{ + LOGD("cWorld::cWorld(\"%s\")", a_WorldName.c_str()); + + cFile::CreateFolder(FILE_IO_PREFIX + m_WorldName); +} + + + + + +cWorld::~cWorld() +{ + delete m_SimulatorManager; + delete m_SandSimulator; + delete m_WaterSimulator; + delete m_LavaSimulator; + delete m_FireSimulator; + delete m_RedstoneSimulator; + + UnloadUnusedChunks(); + + m_Storage.WaitForFinish(); + + delete m_ChunkMap; +} + + + + + +void cWorld::CastThunderbolt (int a_BlockX, int a_BlockY, int a_BlockZ) +{ + BroadcastThunderbolt(a_BlockX, a_BlockY, a_BlockZ); +} + + + + + +void cWorld::SetWeather(eWeather a_NewWeather) +{ + // Do the plugins agree? Do they want a different weather? + cRoot::Get()->GetPluginManager()->CallHookWeatherChanging(*this, a_NewWeather); + + // Set new period for the selected weather: + switch (a_NewWeather) + { + case eWeather_Sunny: m_WeatherInterval = 14400 + (m_TickRand.randInt() % 4800); break; // 12 - 16 minutes + case eWeather_Rain: m_WeatherInterval = 9600 + (m_TickRand.randInt() % 7200); break; // 8 - 14 minutes + case eWeather_ThunderStorm: m_WeatherInterval = 2400 + (m_TickRand.randInt() % 4800); break; // 2 - 6 minutes + default: + { + LOGWARNING("Requested unknown weather %d, setting sunny for a minute instead.", a_NewWeather); + a_NewWeather = eWeather_Sunny; + m_WeatherInterval = 1200; + break; + } + } // switch (NewWeather) + m_Weather = a_NewWeather; + BroadcastWeather(m_Weather); + + // Let the plugins know about the change: + cPluginManager::Get()->CallHookWeatherChanged(*this); +} + + + + + +void cWorld::ChangeWeather(void) +{ + // In the next tick the weather will be changed + m_WeatherInterval = 0; +} + + + + + +void cWorld::SetNextBlockTick(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + return m_ChunkMap->SetNextBlockTick(a_BlockX, a_BlockY, a_BlockZ); +} + + + + + +void cWorld::InitializeSpawn(void) +{ + int ChunkX = 0, ChunkY = 0, ChunkZ = 0; + BlockToChunk((int)m_SpawnX, (int)m_SpawnY, (int)m_SpawnZ, ChunkX, ChunkY, ChunkZ); + + // For the debugging builds, don't make the server build too much world upon start: + #if defined(_DEBUG) || defined(ANDROID_NDK) + int ViewDist = 9; + #else + int ViewDist = 20; // Always prepare an area 20 chunks across, no matter what the actual cClientHandle::VIEWDISTANCE is + #endif // _DEBUG + + LOG("Preparing spawn area in world \"%s\"...", m_WorldName.c_str()); + for (int x = 0; x < ViewDist; x++) + { + for (int z = 0; z < ViewDist; z++) + { + m_ChunkMap->TouchChunk(x + ChunkX-(ViewDist - 1) / 2, ZERO_CHUNK_Y, z + ChunkZ-(ViewDist - 1) / 2); // Queue the chunk in the generator / loader + } + } + + { + // Display progress during this process: + cWorldLoadProgress Progress(this); + + // Wait for the loader to finish loading + m_Storage.WaitForQueuesEmpty(); + + // Wait for the generator to finish generating + m_Generator.WaitForQueueEmpty(); + + Progress.Stop(); + } + + // Light all chunks that have been newly generated: + LOG("Lighting spawn area in world \"%s\"...", m_WorldName.c_str()); + + for (int x = 0; x < ViewDist; x++) + { + int ChX = x + ChunkX-(ViewDist - 1) / 2; + for (int z = 0; z < ViewDist; z++) + { + int ChZ = z + ChunkZ-(ViewDist - 1) / 2; + if (!m_ChunkMap->IsChunkLighted(ChX, ChZ)) + { + m_Lighting.QueueChunk(ChX, ChZ); // Queue the chunk in the lighting thread + } + } // for z + } // for x + + { + cWorldLightingProgress Progress(&m_Lighting); + m_Lighting.WaitForQueueEmpty(); + Progress.Stop(); + } + + // TODO: Better spawn detection - move spawn out of the water if it isn't set in the INI already + m_SpawnY = (double)GetHeight((int)m_SpawnX, (int)m_SpawnZ) + 1.6f; // +1.6f eye height + + + #ifdef TEST_LINEBLOCKTRACER + // DEBUG: Test out the cLineBlockTracer class by tracing a few lines: + class cTracerCallbacks : + public cBlockTracer::cCallbacks + { + virtual bool OnNextBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) override + { + LOGD("Block {%d, %d, %d}: %d:%d (%s)", + a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, + ItemToString(cItem(a_BlockType, 1, a_BlockMeta)).c_str() + ); + return false; + } + + virtual bool OnNextBlockNoData(int a_BlockX, int a_BlockY, int a_BlockZ) override + { + LOGD("Block {%d, %d, %d}: no data available", + a_BlockX, a_BlockY, a_BlockZ + ); + return false; + } + + virtual bool OnOutOfWorld(double a_BlockX, double a_BlockY, double a_BlockZ) override + { + LOGD("Out of world at {%f, %f, %f}", a_BlockX, a_BlockY, a_BlockZ); + return false; + } + + virtual bool OnIntoWorld(double a_BlockX, double a_BlockY, double a_BlockZ) override + { + LOGD("Into world at {%f, %f, %f}", a_BlockX, a_BlockY, a_BlockZ); + return false; + } + + virtual void OnNoMoreHits(void) override + { + LOGD("No more hits"); + } + } Callbacks; + LOGD("Spawn is at {%f, %f, %f}", m_SpawnX, m_SpawnY, m_SpawnZ); + LOGD("Tracing a line along +X:"); + cLineBlockTracer::Trace(*this, Callbacks, m_SpawnX - 10, m_SpawnY, m_SpawnZ, m_SpawnX + 10, m_SpawnY, m_SpawnZ); + LOGD("Tracing a line along -Z:"); + cLineBlockTracer::Trace(*this, Callbacks, m_SpawnX, m_SpawnY, m_SpawnZ + 10, m_SpawnX, m_SpawnY, m_SpawnZ - 10); + LOGD("Tracing a line along -Y, out of world:"); + cLineBlockTracer::Trace(*this, Callbacks, m_SpawnX, 260, m_SpawnZ, m_SpawnX, -5, m_SpawnZ); + LOGD("Tracing a line along XY:"); + cLineBlockTracer::Trace(*this, Callbacks, m_SpawnX - 10, m_SpawnY - 10, m_SpawnZ, m_SpawnX + 10, m_SpawnY + 10, m_SpawnZ); + LOGD("Tracing a line in generic direction:"); + cLineBlockTracer::Trace(*this, Callbacks, m_SpawnX - 15, m_SpawnY - 5, m_SpawnZ + 7.5, m_SpawnX + 13, m_SpawnY - 10, m_SpawnZ + 8.5); + LOGD("Tracing tests done"); + #endif // TEST_LINEBLOCKTRACER +} + + + + + +void cWorld::Start(void) +{ + // TODO: Find a proper spawn location, based on the biomes (not in ocean) + m_SpawnX = (double)((m_TickRand.randInt() % 1000) - 500); + m_SpawnY = cChunkDef::Height; + m_SpawnZ = (double)((m_TickRand.randInt() % 1000) - 500); + m_GameMode = eGameMode_Creative; + + cIniFile IniFile; + if (!IniFile.ReadFile(m_IniFileName)) + { + LOGWARNING("Cannot read world settings from \"%s\", defaults will be used.", m_IniFileName.c_str()); + } + AString Dimension = IniFile.GetValueSet("General", "Dimension", "Overworld"); + m_Dimension = StringToDimension(Dimension); + switch (m_Dimension) + { + case dimNether: + case dimOverworld: + case dimEnd: + { + break; + } + default: + { + LOGWARNING("Unknown dimension: \"%s\". Setting to Overworld", Dimension.c_str()); + m_Dimension = dimOverworld; + break; + } + } // switch (m_Dimension) + m_SpawnX = IniFile.GetValueSetF("SpawnPosition", "X", m_SpawnX); + m_SpawnY = IniFile.GetValueSetF("SpawnPosition", "Y", m_SpawnY); + m_SpawnZ = IniFile.GetValueSetF("SpawnPosition", "Z", m_SpawnZ); + m_StorageSchema = IniFile.GetValueSet ("Storage", "Schema", m_StorageSchema); + m_MaxCactusHeight = IniFile.GetValueSetI("Plants", "MaxCactusHeight", 3); + m_MaxSugarcaneHeight = IniFile.GetValueSetI("Plants", "MaxSugarcaneHeight", 3); + m_IsCactusBonemealable = IniFile.GetValueSetB("Plants", "IsCactusBonemealable", false); + m_IsCarrotsBonemealable = IniFile.GetValueSetB("Plants", "IsCarrotsBonemealable", true); + m_IsCropsBonemealable = IniFile.GetValueSetB("Plants", "IsCropsBonemealable", true); + m_IsGrassBonemealable = IniFile.GetValueSetB("Plants", "IsGrassBonemealable", true); + m_IsMelonStemBonemealable = IniFile.GetValueSetB("Plants", "IsMelonStemBonemealable", true); + m_IsMelonBonemealable = IniFile.GetValueSetB("Plants", "IsMelonBonemealable", false); + m_IsPotatoesBonemealable = IniFile.GetValueSetB("Plants", "IsPotatoesBonemealable", true); + m_IsPumpkinStemBonemealable = IniFile.GetValueSetB("Plants", "IsPumpkinStemBonemealable", true); + m_IsPumpkinBonemealable = IniFile.GetValueSetB("Plants", "IsPumpkinBonemealable", false); + m_IsSaplingBonemealable = IniFile.GetValueSetB("Plants", "IsSaplingBonemealable", true); + m_IsSugarcaneBonemealable = IniFile.GetValueSetB("Plants", "IsSugarcaneBonemealable", false); + m_bEnabledPVP = IniFile.GetValueSetB("PVP", "Enabled", true); + m_IsDeepSnowEnabled = IniFile.GetValueSetB("Physics", "DeepSnow", false); + + m_GameMode = (eGameMode)IniFile.GetValueSetI("GameMode", "GameMode", m_GameMode); + + // Load allowed mobs: + const char * DefaultMonsters = ""; + switch (m_Dimension) + { + case dimOverworld: DefaultMonsters = "bat, cavespider, chicken, cow, creeper, enderman, horse, mooshroom, ocelot, pig, sheep, silverfish, skeleton, slime, spider, squid, wolf, zombie"; break; + case dimNether: DefaultMonsters = "blaze, ghast, magmacube, skeleton, zombie, zombiepigman"; break; + case dimEnd: DefaultMonsters = "enderman"; break; + default: + { + ASSERT(!"Unhandled world dimension"); + DefaultMonsters = "wither"; + break; + } + } + m_bAnimals = IniFile.GetValueSetB("Monsters", "AnimalsOn", true); + AString AllMonsters = IniFile.GetValueSet("Monsters", "Types", DefaultMonsters); + AStringVector SplitList = StringSplitAndTrim(AllMonsters, ","); + for (AStringVector::const_iterator itr = SplitList.begin(), end = SplitList.end(); itr != end; ++itr) + { + cMonster::eType ToAdd = cMonster::StringToMobType(*itr); + if (ToAdd != cMonster::mtInvalidType) + { + m_AllowedMobs.insert(ToAdd); + LOGD("Allowed mob: %s", itr->c_str()); + } + else + { + LOG("World \"%s\": Unknown mob type: %s", m_WorldName.c_str(), itr->c_str()); + } + } + + m_ChunkMap = new cChunkMap(this); + + m_LastSave = 0; + m_LastUnload = 0; + + // preallocate some memory for ticking blocks so we don't need to allocate that often + m_BlockTickQueue.reserve(1000); + m_BlockTickQueueCopy.reserve(1000); + + // Simulators: + m_SimulatorManager = new cSimulatorManager(*this); + m_WaterSimulator = InitializeFluidSimulator(IniFile, "Water", E_BLOCK_WATER, E_BLOCK_STATIONARY_WATER); + m_LavaSimulator = InitializeFluidSimulator(IniFile, "Lava", E_BLOCK_LAVA, E_BLOCK_STATIONARY_LAVA); + m_SandSimulator = new cSandSimulator(*this, IniFile); + m_FireSimulator = new cFireSimulator(*this, IniFile); + m_RedstoneSimulator = new cRedstoneSimulator(*this); + + // Water and Lava simulators get registered in InitializeFluidSimulator() + m_SimulatorManager->RegisterSimulator(m_SandSimulator, 1); + m_SimulatorManager->RegisterSimulator(m_FireSimulator, 1); + m_SimulatorManager->RegisterSimulator(m_RedstoneSimulator, 1); + + m_Lighting.Start(this); + m_Storage.Start(this, m_StorageSchema); + m_Generator.Start(this, IniFile); + m_ChunkSender.Start(this); + m_TickThread.Start(); + + // Init of the spawn monster time (as they are supposed to have different spawn rate) + m_LastSpawnMonster.insert(std::map<cMonster::eFamily, Int64>::value_type(cMonster::mfHostile, 0)); + m_LastSpawnMonster.insert(std::map<cMonster::eFamily, Int64>::value_type(cMonster::mfPassive, 0)); + m_LastSpawnMonster.insert(std::map<cMonster::eFamily, Int64>::value_type(cMonster::mfAmbient, 0)); + m_LastSpawnMonster.insert(std::map<cMonster::eFamily, Int64>::value_type(cMonster::mfWater, 0)); + + + // Save any changes that the defaults may have done to the ini file: + if (!IniFile.WriteFile(m_IniFileName)) + { + LOGWARNING("Could not write world config to %s", m_IniFileName.c_str()); + } + +} + + + + + +void cWorld::Stop(void) +{ + // Delete the clients that have been in this world: + { + cCSLock Lock(m_CSClients); + for (cClientHandleList::iterator itr = m_Clients.begin(); itr != m_Clients.end(); ++itr) + { + (*itr)->Destroy(); + delete *itr; + } // for itr - m_Clients[] + m_Clients.clear(); + } + + m_TickThread.Stop(); + m_Lighting.Stop(); + m_Generator.Stop(); + m_ChunkSender.Stop(); + m_Storage.Stop(); +} + + + + + +void cWorld::Tick(float a_Dt) +{ + // Call the plugins + cPluginManager::Get()->CallHookWorldTick(*this, a_Dt); + + // We need sub-tick precision here, that's why we store the time in seconds and calculate ticks off of it + m_WorldAgeSecs += (double)a_Dt / 1000.0; + m_TimeOfDaySecs += (double)a_Dt / 1000.0; + + // Wrap time of day each 20 minutes (1200 seconds) + if (m_TimeOfDaySecs > 1200.0) + { + m_TimeOfDaySecs -= 1200.0; + } + + m_WorldAge = (Int64)(m_WorldAgeSecs * 20.0); + m_TimeOfDay = (Int64)(m_TimeOfDaySecs * 20.0); + + // Updates the sky darkness based on current time of day + UpdateSkyDarkness(); + + // Broadcast time update every 40 ticks (2 seconds) + if (m_LastTimeUpdate < m_WorldAge - 40) + { + BroadcastTimeUpdate(); + m_LastTimeUpdate = m_WorldAge; + } + + m_ChunkMap->Tick(a_Dt); + + TickClients(a_Dt); + TickQueuedBlocks(); + TickQueuedTasks(); + + GetSimulatorManager()->Simulate(a_Dt); + + TickWeather(a_Dt); + + // Asynchronously set blocks: + sSetBlockList FastSetBlockQueueCopy; + { + cCSLock Lock(m_CSFastSetBlock); + std::swap(FastSetBlockQueueCopy, m_FastSetBlockQueue); + } + m_ChunkMap->FastSetBlocks(FastSetBlockQueueCopy); + if (!FastSetBlockQueueCopy.empty()) + { + // Some blocks failed, store them for next tick: + cCSLock Lock(m_CSFastSetBlock); + m_FastSetBlockQueue.splice(m_FastSetBlockQueue.end(), FastSetBlockQueueCopy); + } + + if (m_WorldAge - m_LastSave > 60 * 5 * 20) // Save each 5 minutes + { + SaveAllChunks(); + } + + if (m_WorldAge - m_LastUnload > 10 * 20) // Unload every 10 seconds + { + UnloadUnusedChunks(); + } + + TickMobs(a_Dt); + + std::vector<int> m_RSList_copy(m_RSList); + + m_RSList.clear(); + + std::vector<int>::const_iterator cii; // FIXME - Please rename this variable, WTF is cii??? Use human readable variable names or common abbreviations (i, idx, itr, iter) + for (cii = m_RSList_copy.begin(); cii != m_RSList_copy.end();) + { + int tempX = *cii; cii++; + int tempY = *cii; cii++; + int tempZ = *cii; cii++; + int state = *cii; cii++; + + if ((state == 11111) && ((int)GetBlock(tempX, tempY, tempZ) == E_BLOCK_REDSTONE_TORCH_OFF)) + { + FastSetBlock(tempX, tempY, tempZ, E_BLOCK_REDSTONE_TORCH_ON, (int)GetBlockMeta(tempX, tempY, tempZ)); + } + else if ((state == 00000) && ((int)GetBlock(tempX, tempY, tempZ) == E_BLOCK_REDSTONE_TORCH_ON)) + { + FastSetBlock(tempX, tempY, tempZ, E_BLOCK_REDSTONE_TORCH_OFF, (int)GetBlockMeta(tempX, tempY, tempZ)); + } + } + m_RSList_copy.erase(m_RSList_copy.begin(),m_RSList_copy.end()); +} + + + + + +void cWorld::TickWeather(float a_Dt) +{ + // There are no weather changes anywhere but in the Overworld: + if (GetDimension() != dimOverworld) + { + return; + } + + if (m_WeatherInterval > 0) + { + // Not yet, wait for the weather period to end + m_WeatherInterval--; + } + else + { + // Change weather: + + // Pick a new weather. Only reasonable transitions allowed: + eWeather NewWeather = m_Weather; + switch (m_Weather) + { + case eWeather_Sunny: NewWeather = eWeather_Rain; break; + case eWeather_ThunderStorm: NewWeather = eWeather_Rain; break; + case eWeather_Rain: + { + // 1/8 chance of turning into a thunderstorm + NewWeather = ((m_TickRand.randInt() % 256) < 32) ? eWeather_ThunderStorm : eWeather_Sunny; + break; + } + + default: + { + LOGWARNING("Unknown current weather: %d. Setting sunny.", m_Weather); + ASSERT(!"Unknown weather"); + NewWeather = eWeather_Sunny; + } + } + + SetWeather(NewWeather); + } // else (m_WeatherInterval > 0) + + if (m_Weather == eWeather_ThunderStorm) + { + // 0.5% chance per tick of thunderbolt + if (m_TickRand.randInt() % 199 == 0) + { + CastThunderbolt(0, 0, 0); // TODO: find random possitions near players to cast thunderbolts. + } + } +} + + + + + +void cWorld::TickMobs(float a_Dt) +{ + // _X 2013_10_22: This is a quick fix for #283 - the world needs to be locked while ticking mobs + cWorld::cLock Lock(*this); + + // before every Mob action, we have to count them depending on the distance to players, on their family ... + cMobCensus MobCensus; + m_ChunkMap->CollectMobCensus(MobCensus); + if (m_bAnimals) + { + // Spawning is enabled, spawn now: + static const cMonster::eFamily AllFamilies[] = + { + cMonster::mfHostile, + cMonster::mfPassive, + cMonster::mfAmbient, + cMonster::mfWater, + } ; + for (int i = 0; i < ARRAYCOUNT(AllFamilies); i++) + { + cMonster::eFamily Family = AllFamilies[i]; + int SpawnDelay = cMonster::GetSpawnDelay(Family); + if ( + (m_LastSpawnMonster[Family] > m_WorldAge - SpawnDelay) || // Not reached the needed ticks before the next round + MobCensus.IsCapped(Family) + ) + { + continue; + } + m_LastSpawnMonster[Family] = m_WorldAge; + cMobSpawner Spawner(Family, m_AllowedMobs); + if (Spawner.CanSpawnAnything()) + { + m_ChunkMap->SpawnMobs(Spawner); + // do the spawn + for (cMobSpawner::tSpawnedContainer::const_iterator itr2 = Spawner.getSpawned().begin(); itr2 != Spawner.getSpawned().end(); itr2++) + { + SpawnMobFinalize(*itr2); + } + } + } // for i - AllFamilies[] + } // if (Spawning enabled) + + // move close mobs + cMobProximityCounter::sIterablePair allCloseEnoughToMoveMobs = MobCensus.GetProximityCounter().getMobWithinThosesDistances(-1, 64 * 16);// MG TODO : deal with this magic number (the 16 is the size of a block) + for(cMobProximityCounter::tDistanceToMonster::const_iterator itr = allCloseEnoughToMoveMobs.m_Begin; itr != allCloseEnoughToMoveMobs.m_End; itr++) + { + itr->second.m_Monster.Tick(a_Dt, itr->second.m_Chunk); + } + + // remove too far mobs + cMobProximityCounter::sIterablePair allTooFarMobs = MobCensus.GetProximityCounter().getMobWithinThosesDistances(128 * 16, -1);// MG TODO : deal with this magic number (the 16 is the size of a block) + for(cMobProximityCounter::tDistanceToMonster::const_iterator itr = allTooFarMobs.m_Begin; itr != allTooFarMobs.m_End; itr++) + { + itr->second.m_Monster.Destroy(true); + } +} + + + + + +void cWorld::TickQueuedTasks(void) +{ + // Make a copy of the tasks to avoid deadlocks on accessing m_Tasks + cTasks Tasks; + { + cCSLock Lock(m_CSTasks); + std::swap(Tasks, m_Tasks); + } + + // Execute and delete each task: + for (cTasks::iterator itr = Tasks.begin(), end = Tasks.end(); itr != end; ++itr) + { + (*itr)->Run(*this); + delete *itr; + } // for itr - m_Tasks[] +} + + + + + +void cWorld::TickClients(float a_Dt) +{ + cClientHandleList RemoveClients; + { + cCSLock Lock(m_CSClients); + + // Remove clients scheduled for removal: + for (cClientHandleList::iterator itr = m_ClientsToRemove.begin(), end = m_ClientsToRemove.end(); itr != end; ++itr) + { + m_Clients.remove(*itr); + } // for itr - m_ClientsToRemove[] + m_ClientsToRemove.clear(); + + // Add clients scheduled for adding: + for (cClientHandleList::iterator itr = m_ClientsToAdd.begin(), end = m_ClientsToAdd.end(); itr != end; ++itr) + { + if (std::find(m_Clients.begin(), m_Clients.end(), *itr) != m_Clients.end()) + { + ASSERT(!"Adding a client that is already in the clientlist"); + continue; + } + m_Clients.push_back(*itr); + } // for itr - m_ClientsToRemove[] + m_ClientsToAdd.clear(); + + // Tick the clients, take out those that have been destroyed into RemoveClients + for (cClientHandleList::iterator itr = m_Clients.begin(); itr != m_Clients.end();) + { + if ((*itr)->IsDestroyed()) + { + // Remove the client later, when CS is not held, to avoid deadlock + RemoveClients.push_back(*itr); + itr = m_Clients.erase(itr); + continue; + } + (*itr)->Tick(a_Dt); + ++itr; + } // for itr - m_Clients[] + } + + // Delete the clients that have been destroyed + for (cClientHandleList::iterator itr = RemoveClients.begin(); itr != RemoveClients.end(); ++itr) + { + delete *itr; + } // for itr - RemoveClients[] +} + + + + + +void cWorld::UpdateSkyDarkness(void) +{ + int TempTime = (int)m_TimeOfDay; + if (TempTime <= TIME_SUNSET) + { + m_SkyDarkness = 0; + } + else if (TempTime <= TIME_NIGHT_START) + { + m_SkyDarkness = (TIME_NIGHT_START - TempTime) / TIME_SPAWN_DIVISOR; + } + else if (TempTime <= TIME_NIGHT_END) + { + m_SkyDarkness = 8; + } + else + { + m_SkyDarkness = (TIME_SUNRISE - TempTime) / TIME_SPAWN_DIVISOR; + } +} + + + + + +void cWorld::WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + return m_ChunkMap->WakeUpSimulators(a_BlockX, a_BlockY, a_BlockZ); +} + + + + + +/// Wakes up the simulators for the specified area of blocks +void cWorld::WakeUpSimulatorsInArea(int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ) +{ + return m_ChunkMap->WakeUpSimulatorsInArea(a_MinBlockX, a_MaxBlockX, a_MinBlockY, a_MaxBlockY, a_MinBlockZ, a_MaxBlockZ); +} + + + + + +bool cWorld::ForEachBlockEntityInChunk(int a_ChunkX, int a_ChunkZ, cBlockEntityCallback & a_Callback) +{ + return m_ChunkMap->ForEachBlockEntityInChunk(a_ChunkX, a_ChunkZ, a_Callback); +} + + + + + +bool cWorld::ForEachChestInChunk(int a_ChunkX, int a_ChunkZ, cChestCallback & a_Callback) +{ + return m_ChunkMap->ForEachChestInChunk(a_ChunkX, a_ChunkZ, a_Callback); +} + + + + + +bool cWorld::ForEachDispenserInChunk(int a_ChunkX, int a_ChunkZ, cDispenserCallback & a_Callback) +{ + return m_ChunkMap->ForEachDispenserInChunk(a_ChunkX, a_ChunkZ, a_Callback); +} + + + + + +bool cWorld::ForEachDropperInChunk(int a_ChunkX, int a_ChunkZ, cDropperCallback & a_Callback) +{ + return m_ChunkMap->ForEachDropperInChunk(a_ChunkX, a_ChunkZ, a_Callback); +} + + + + + +bool cWorld::ForEachDropSpenserInChunk(int a_ChunkX, int a_ChunkZ, cDropSpenserCallback & a_Callback) +{ + return m_ChunkMap->ForEachDropSpenserInChunk(a_ChunkX, a_ChunkZ, a_Callback); +} + + + + + +bool cWorld::ForEachFurnaceInChunk(int a_ChunkX, int a_ChunkZ, cFurnaceCallback & a_Callback) +{ + return m_ChunkMap->ForEachFurnaceInChunk(a_ChunkX, a_ChunkZ, a_Callback); +} + + + + + +void cWorld::DoExplosionAt(double a_ExplosionSize, double a_BlockX, double a_BlockY, double a_BlockZ, bool a_CanCauseFire, eExplosionSource a_Source, void * a_SourceData) +{ + if (cPluginManager::Get()->CallHookExploding(*this, a_ExplosionSize, a_CanCauseFire, a_BlockX, a_BlockY, a_BlockZ, a_Source, a_SourceData) || (a_ExplosionSize <= 0)) + { + return; + } + + // TODO: Add damage to entities, add support for pickups, and implement block hardiness + Vector3d explosion_pos = Vector3d(a_BlockX, a_BlockY, a_BlockZ); + cVector3iArray BlocksAffected; + m_ChunkMap->DoExplosionAt(a_ExplosionSize, a_BlockX, a_BlockY, a_BlockZ, BlocksAffected); + BroadcastSoundEffect("random.explode", (int)floor(a_BlockX * 8), (int)floor(a_BlockY * 8), (int)floor(a_BlockZ * 8), 1.0f, 0.6f); + { + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + Vector3d distance_explosion = (*itr)->GetPosition() - explosion_pos; + if (distance_explosion.SqrLength() < 4096.0) + { + double real_distance = std::max(0.004, sqrt(distance_explosion.SqrLength())); + double power = a_ExplosionSize / real_distance; + if (power <= 1) + { + power = 0; + } + distance_explosion.Normalize(); + distance_explosion *= power; + ch->SendExplosion(a_BlockX, a_BlockY, a_BlockZ, (float)a_ExplosionSize, BlocksAffected, distance_explosion); + } + } + } + cPluginManager::Get()->CallHookExploded(*this, a_ExplosionSize, a_CanCauseFire, a_BlockX, a_BlockY, a_BlockZ, a_Source, a_SourceData); +} + + + + + +bool cWorld::DoWithBlockEntityAt(int a_BlockX, int a_BlockY, int a_BlockZ, cBlockEntityCallback & a_Callback) +{ + return m_ChunkMap->DoWithBlockEntityAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + +bool cWorld::DoWithChestAt(int a_BlockX, int a_BlockY, int a_BlockZ, cChestCallback & a_Callback) +{ + return m_ChunkMap->DoWithChestAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + +bool cWorld::DoWithDispenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDispenserCallback & a_Callback) +{ + return m_ChunkMap->DoWithDispenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + +bool cWorld::DoWithDropperAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropperCallback & a_Callback) +{ + return m_ChunkMap->DoWithDropperAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + +bool cWorld::DoWithDropSpenserAt(int a_BlockX, int a_BlockY, int a_BlockZ, cDropSpenserCallback & a_Callback) +{ + return m_ChunkMap->DoWithDropSpenserAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + +bool cWorld::DoWithFurnaceAt(int a_BlockX, int a_BlockY, int a_BlockZ, cFurnaceCallback & a_Callback) +{ + return m_ChunkMap->DoWithFurnaceAt(a_BlockX, a_BlockY, a_BlockZ, a_Callback); +} + + + + + +bool cWorld::GetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, AString & a_Line1, AString & a_Line2, AString & a_Line3, AString & a_Line4) +{ + return m_ChunkMap->GetSignLines(a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4); +} + + + + + +bool cWorld::DoWithChunk(int a_ChunkX, int a_ChunkZ, cChunkCallback & a_Callback) +{ + return m_ChunkMap->DoWithChunk(a_ChunkX, a_ChunkZ, a_Callback); +} + + + + + +void cWorld::GrowTree(int a_X, int a_Y, int a_Z) +{ + if (GetBlock(a_X, a_Y, a_Z) == E_BLOCK_SAPLING) + { + // There is a sapling here, grow a tree according to its type: + GrowTreeFromSapling(a_X, a_Y, a_Z, GetBlockMeta(a_X, a_Y, a_Z)); + } + else + { + // There is nothing here, grow a tree based on the current biome here: + GrowTreeByBiome(a_X, a_Y, a_Z); + } +} + + + + + +void cWorld::GrowTreeFromSapling(int a_X, int a_Y, int a_Z, NIBBLETYPE a_SaplingMeta) +{ + cNoise Noise(m_Generator.GetSeed()); + sSetBlockVector Logs, Other; + switch (a_SaplingMeta & 0x07) + { + case E_META_SAPLING_APPLE: GetAppleTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break; + case E_META_SAPLING_BIRCH: GetBirchTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break; + case E_META_SAPLING_CONIFER: GetConiferTreeImage(a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break; + case E_META_SAPLING_JUNGLE: GetJungleTreeImage (a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), Logs, Other); break; + } + Other.insert(Other.begin(), Logs.begin(), Logs.end()); + Logs.clear(); + GrowTreeImage(Other); +} + + + + + +void cWorld::GrowTreeByBiome(int a_X, int a_Y, int a_Z) +{ + cNoise Noise(m_Generator.GetSeed()); + sSetBlockVector Logs, Other; + GetTreeImageByBiome(a_X, a_Y, a_Z, Noise, (int)(m_WorldAge & 0xffffffff), (EMCSBiome)GetBiomeAt(a_X, a_Z), Logs, Other); + Other.insert(Other.begin(), Logs.begin(), Logs.end()); + Logs.clear(); + GrowTreeImage(Other); +} + + + + + +void cWorld::GrowTreeImage(const sSetBlockVector & a_Blocks) +{ + // Check that the tree has place to grow + + // Make a copy of the log blocks: + sSetBlockVector b2; + for (sSetBlockVector::const_iterator itr = a_Blocks.begin(); itr != a_Blocks.end(); ++itr) + { + if (itr->BlockType == E_BLOCK_LOG) + { + b2.push_back(*itr); + } + } // for itr - a_Blocks[] + + // Query blocktypes and metas at those log blocks: + if (!GetBlocks(b2, false)) + { + return; + } + + // Check that at each log's coord there's an block allowed to be overwritten: + for (sSetBlockVector::const_iterator itr = b2.begin(); itr != b2.end(); ++itr) + { + switch (itr->BlockType) + { + CASE_TREE_ALLOWED_BLOCKS: + { + break; + } + default: + { + return; + } + } + } // for itr - b2[] + + // All ok, replace blocks with the tree image: + m_ChunkMap->ReplaceTreeBlocks(a_Blocks); +} + + + + + +bool cWorld::GrowRipePlant(int a_BlockX, int a_BlockY, int a_BlockZ, bool a_IsByBonemeal) +{ + BLOCKTYPE BlockType; + NIBBLETYPE BlockMeta; + GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, BlockType, BlockMeta); + switch (BlockType) + { + case E_BLOCK_CARROTS: + { + if (a_IsByBonemeal && !m_IsCarrotsBonemealable) + { + return false; + } + if (BlockMeta < 7) + { + FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); + } + return true; + } + + case E_BLOCK_CROPS: + { + if (a_IsByBonemeal && !m_IsCropsBonemealable) + { + return false; + } + if (BlockMeta < 7) + { + FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); + } + return true; + } + + case E_BLOCK_MELON_STEM: + { + if (BlockMeta < 7) + { + if (a_IsByBonemeal && !m_IsMelonStemBonemealable) + { + return false; + } + FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); + } + else + { + if (a_IsByBonemeal && !m_IsMelonBonemealable) + { + return false; + } + GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, BlockType); + } + return true; + } + + case E_BLOCK_POTATOES: + { + if (a_IsByBonemeal && !m_IsPotatoesBonemealable) + { + return false; + } + if (BlockMeta < 7) + { + FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); + } + return true; + } + + case E_BLOCK_PUMPKIN_STEM: + { + if (BlockMeta < 7) + { + if (a_IsByBonemeal && !m_IsPumpkinStemBonemealable) + { + return false; + } + FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, BlockType, 7); + } + else + { + if (a_IsByBonemeal && !m_IsPumpkinBonemealable) + { + return false; + } + GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, BlockType); + } + return true; + } + + case E_BLOCK_SAPLING: + { + if (a_IsByBonemeal && !m_IsSaplingBonemealable) + { + return false; + } + GrowTreeFromSapling(a_BlockX, a_BlockY, a_BlockZ, BlockMeta); + return true; + } + + case E_BLOCK_GRASS: + { + if (a_IsByBonemeal && !m_IsGrassBonemealable) + { + return false; + } + MTRand r1; + for (int i = 0; i < 60; i++) + { + int OfsX = (r1.randInt(3) + r1.randInt(3) + r1.randInt(3) + r1.randInt(3)) / 2 - 3; + int OfsY = r1.randInt(3) + r1.randInt(3) - 3; + int OfsZ = (r1.randInt(3) + r1.randInt(3) + r1.randInt(3) + r1.randInt(3)) / 2 - 3; + BLOCKTYPE Ground = GetBlock(a_BlockX + OfsX, a_BlockY + OfsY, a_BlockZ + OfsZ); + if (Ground != E_BLOCK_GRASS) + { + continue; + } + BLOCKTYPE Above = GetBlock(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ); + if (Above != E_BLOCK_AIR) + { + continue; + } + BLOCKTYPE SpawnType; + NIBBLETYPE SpawnMeta = 0; + switch (r1.randInt(10)) + { + case 0: SpawnType = E_BLOCK_YELLOW_FLOWER; break; + case 1: SpawnType = E_BLOCK_RED_ROSE; break; + default: + { + SpawnType = E_BLOCK_TALL_GRASS; + SpawnMeta = E_META_TALL_GRASS_GRASS; + break; + } + } // switch (random spawn block type) + FastSetBlock(a_BlockX + OfsX, a_BlockY + OfsY + 1, a_BlockZ + OfsZ, SpawnType, SpawnMeta); + } // for i - 50 times + return true; + } + + case E_BLOCK_SUGARCANE: + { + if (a_IsByBonemeal && !m_IsSugarcaneBonemealable) + { + return false; + } + m_ChunkMap->GrowSugarcane(a_BlockX, a_BlockY, a_BlockZ, m_MaxSugarcaneHeight); + return true; + } + + case E_BLOCK_CACTUS: + { + if (a_IsByBonemeal && !m_IsCactusBonemealable) + { + return false; + } + m_ChunkMap->GrowCactus(a_BlockX, a_BlockY, a_BlockZ, m_MaxCactusHeight); + return true; + } + } // switch (BlockType) + return false; +} + + + + + +void cWorld::GrowCactus(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow) +{ + m_ChunkMap->GrowCactus(a_BlockX, a_BlockY, a_BlockZ, a_NumBlocksToGrow); +} + + + + + +void cWorld::GrowMelonPumpkin(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType) +{ + MTRand Rand; + m_ChunkMap->GrowMelonPumpkin(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, Rand); +} + + + + + +void cWorld::GrowSugarcane(int a_BlockX, int a_BlockY, int a_BlockZ, int a_NumBlocksToGrow) +{ + m_ChunkMap->GrowSugarcane(a_BlockX, a_BlockY, a_BlockZ, a_NumBlocksToGrow); +} + + + + + +int cWorld::GetBiomeAt (int a_BlockX, int a_BlockZ) +{ + return m_ChunkMap->GetBiomeAt(a_BlockX, a_BlockZ); +} + + + + + +void cWorld::SetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + if (a_BlockType == E_BLOCK_AIR) + { + BlockHandler(GetBlock(a_BlockX, a_BlockY, a_BlockZ))->OnDestroyed(this, a_BlockX, a_BlockY, a_BlockZ); + } + m_ChunkMap->SetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); + + BlockHandler(a_BlockType)->OnPlaced(this, a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta); +} + + + + + +void cWorld::FastSetBlock(int a_X, int a_Y, int a_Z, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta) +{ + cCSLock Lock(m_CSFastSetBlock); + m_FastSetBlockQueue.push_back(sSetBlock(a_X, a_Y, a_Z, a_BlockType, a_BlockMeta)); +} + + + + + +void cWorld::QueueSetBlock(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_TickDelay) +{ + m_ChunkMap->QueueSetBlock(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_BlockMeta, GetWorldAge() + a_TickDelay); +} + + + + + +BLOCKTYPE cWorld::GetBlock(int a_X, int a_Y, int a_Z) +{ + // First check if it isn't queued in the m_FastSetBlockQueue: + { + int X = a_X, Y = a_Y, Z = a_Z; + int ChunkX, ChunkY, ChunkZ; + AbsoluteToRelative(X, Y, Z, ChunkX, ChunkY, ChunkZ); + + cCSLock Lock(m_CSFastSetBlock); + for (sSetBlockList::iterator itr = m_FastSetBlockQueue.begin(); itr != m_FastSetBlockQueue.end(); ++itr) + { + if ((itr->x == X) && (itr->y == Y) && (itr->z == Z) && (itr->ChunkX == ChunkX) && (itr->ChunkZ == ChunkZ)) + { + return itr->BlockType; + } + } // for itr - m_FastSetBlockQueue[] + } + + return m_ChunkMap->GetBlock(a_X, a_Y, a_Z); +} + + + + + +NIBBLETYPE cWorld::GetBlockMeta(int a_X, int a_Y, int a_Z) +{ + // First check if it isn't queued in the m_FastSetBlockQueue: + { + cCSLock Lock(m_CSFastSetBlock); + for (sSetBlockList::iterator itr = m_FastSetBlockQueue.begin(); itr != m_FastSetBlockQueue.end(); ++itr) + { + if ((itr->x == a_X) && (itr->y == a_Y) && (itr->y == a_Y)) + { + return itr->BlockMeta; + } + } // for itr - m_FastSetBlockQueue[] + } + + return m_ChunkMap->GetBlockMeta(a_X, a_Y, a_Z); +} + + + + + +void cWorld::SetBlockMeta(int a_X, int a_Y, int a_Z, NIBBLETYPE a_MetaData) +{ + m_ChunkMap->SetBlockMeta(a_X, a_Y, a_Z, a_MetaData); +} + + + + + +NIBBLETYPE cWorld::GetBlockSkyLight(int a_X, int a_Y, int a_Z) +{ + return m_ChunkMap->GetBlockSkyLight(a_X, a_Y, a_Z); +} + + + + + +NIBBLETYPE cWorld::GetBlockBlockLight(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + return m_ChunkMap->GetBlockBlockLight(a_BlockX, a_BlockY, a_BlockZ); +} + + + + + +bool cWorld::GetBlockTypeMeta(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta) +{ + return m_ChunkMap->GetBlockTypeMeta(a_BlockX, a_BlockY, a_BlockZ, (BLOCKTYPE &)a_BlockType, (NIBBLETYPE &)a_BlockMeta); +} + + + + + +bool cWorld::GetBlockInfo(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE & a_BlockType, NIBBLETYPE & a_Meta, NIBBLETYPE & a_SkyLight, NIBBLETYPE & a_BlockLight) +{ + return m_ChunkMap->GetBlockInfo(a_BlockX, a_BlockY, a_BlockZ, a_BlockType, a_Meta, a_SkyLight, a_BlockLight); +} + + + + + +bool cWorld::WriteBlockArea(cBlockArea & a_Area, int a_MinBlockX, int a_MinBlockY, int a_MinBlockZ, int a_DataTypes) +{ + return m_ChunkMap->WriteBlockArea(a_Area, a_MinBlockX, a_MinBlockY, a_MinBlockZ, a_DataTypes); +} + + + + + +void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_FlyAwaySpeed, bool IsPlayerCreated) +{ + MTRand r1; + a_FlyAwaySpeed /= 1000; // Pre-divide, so that we don't have to divide each time inside the loop + for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr) + { + float SpeedX = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500)); + float SpeedY = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500)); + float SpeedZ = (float)(a_FlyAwaySpeed * (r1.randInt(1000) - 500)); + + cPickup * Pickup = new cPickup( + a_BlockX, a_BlockY, a_BlockZ, + *itr, IsPlayerCreated, SpeedX, SpeedY, SpeedZ + ); + Pickup->Initialize(this); + } +} + + + + + +void cWorld::SpawnItemPickups(const cItems & a_Pickups, double a_BlockX, double a_BlockY, double a_BlockZ, double a_SpeedX, double a_SpeedY, double a_SpeedZ, bool IsPlayerCreated) +{ + for (cItems::const_iterator itr = a_Pickups.begin(); itr != a_Pickups.end(); ++itr) + { + cPickup * Pickup = new cPickup( + a_BlockX, a_BlockY, a_BlockZ, + *itr, IsPlayerCreated, (float)a_SpeedX, (float)a_SpeedY, (float)a_SpeedZ + ); + Pickup->Initialize(this); + } +} + + + + + +int cWorld::SpawnExperienceOrb(double a_X, double a_Y, double a_Z, int a_Reward) +{ + cExpOrb * ExpOrb = new cExpOrb(a_X, a_Y, a_Z, a_Reward); + ExpOrb->Initialize(this); + return ExpOrb->GetUniqueID(); +} + + + + + +void cWorld::SpawnPrimedTNT(double a_X, double a_Y, double a_Z, double a_FuseTimeInSec, double a_InitialVelocityCoeff) +{ + cTNTEntity * TNT = new cTNTEntity(a_X, a_Y, a_Z, a_FuseTimeInSec); + TNT->Initialize(this); + // TODO: Add a bit of speed in horiz and vert axes, based on the a_InitialVelocityCoeff +} + + + + + +void cWorld::ReplaceBlocks(const sSetBlockVector & a_Blocks, BLOCKTYPE a_FilterBlockType) +{ + m_ChunkMap->ReplaceBlocks(a_Blocks, a_FilterBlockType); +} + + + + + +bool cWorld::GetBlocks(sSetBlockVector & a_Blocks, bool a_ContinueOnFailure) +{ + return m_ChunkMap->GetBlocks(a_Blocks, a_ContinueOnFailure); +} + + + + + +bool cWorld::DigBlock(int a_X, int a_Y, int a_Z) +{ + cBlockHandler *Handler = cBlockHandler::GetBlockHandler(GetBlock(a_X, a_Y, a_Z)); + Handler->OnDestroyed(this, a_X, a_Y, a_Z); + return m_ChunkMap->DigBlock(a_X, a_Y, a_Z); +} + + + + + +void cWorld::SendBlockTo(int a_X, int a_Y, int a_Z, cPlayer * a_Player) +{ + m_ChunkMap->SendBlockTo(a_X, a_Y, a_Z, a_Player); +} + + + + + +int cWorld::GetHeight(int a_X, int a_Z) +{ + return m_ChunkMap->GetHeight(a_X, a_Z); +} + + + + + +bool cWorld::TryGetHeight(int a_BlockX, int a_BlockZ, int & a_Height) +{ + return m_ChunkMap->TryGetHeight(a_BlockX, a_BlockZ, a_Height); +} + + + + + +void cWorld::BroadcastAttachEntity(const cEntity & a_Entity, const cEntity * a_Vehicle) +{ + return m_ChunkMap->BroadcastAttachEntity(a_Entity, a_Vehicle); +} + + + + + +void cWorld::BroadcastBlockAction(int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastBlockAction(a_BlockX, a_BlockY, a_BlockZ, a_Byte1, a_Byte2, a_BlockType, a_Exclude); +} + + + + + +void cWorld::BroadcastBlockBreakAnimation(int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastBlockBreakAnimation(a_EntityID, a_BlockX, a_BlockY, a_BlockZ, a_Stage, a_Exclude); +} + + + + + +void cWorld::BroadcastBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Exclude); +} + + + + + +void cWorld::BroadcastChat(const AString & a_Message, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendChat(a_Message); + } +} + + + + + +void cWorld::BroadcastChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastChunkData(a_ChunkX, a_ChunkZ, a_Serializer, a_Exclude); +} + + + + + +void cWorld::BroadcastCollectPickup(const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastCollectPickup(a_Pickup, a_Player, a_Exclude); +} + + + + + +void cWorld::BroadcastDestroyEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastDestroyEntity(a_Entity, a_Exclude); +} + + + + + +void cWorld::BroadcastEntityEquipment(const cEntity & a_Entity, short a_SlotNum, const cItem & a_Item, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastEntityEquipment(a_Entity, a_SlotNum, a_Item, a_Exclude); +} + + + + + +void cWorld::BroadcastEntityHeadLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastEntityHeadLook(a_Entity, a_Exclude); +} + + + + + +void cWorld::BroadcastEntityLook(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastEntityLook(a_Entity, a_Exclude); +} + + + + + +void cWorld::BroadcastEntityMetadata(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastEntityMetadata(a_Entity, a_Exclude); +} + + + + + +void cWorld::BroadcastEntityRelMove(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastEntityRelMove(a_Entity, a_RelX, a_RelY, a_RelZ, a_Exclude); +} + + + + + +void cWorld::BroadcastEntityRelMoveLook(const cEntity & a_Entity, char a_RelX, char a_RelY, char a_RelZ, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastEntityRelMoveLook(a_Entity, a_RelX, a_RelY, a_RelZ, a_Exclude); +} + + + + + +void cWorld::BroadcastEntityStatus(const cEntity & a_Entity, char a_Status, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastEntityStatus(a_Entity, a_Status, a_Exclude); +} + + + + + +void cWorld::BroadcastEntityVelocity(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastEntityVelocity(a_Entity, a_Exclude); +} + + + + +void cWorld::BroadcastPlayerAnimation(const cPlayer & a_Player, char a_Animation, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastPlayerAnimation(a_Player, a_Animation, a_Exclude); +} + + + + + +void cWorld::BroadcastPlayerListItem (const cPlayer & a_Player, bool a_IsOnline, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendPlayerListItem(a_Player, a_IsOnline); + } +} + + + + + +void cWorld::BroadcastSoundEffect(const AString & a_SoundName, int a_SrcX, int a_SrcY, int a_SrcZ, float a_Volume, float a_Pitch, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastSoundEffect(a_SoundName, a_SrcX, a_SrcY, a_SrcZ, a_Volume, a_Pitch, a_Exclude); +} + + + + + +void cWorld::BroadcastSoundParticleEffect(int a_EffectID, int a_SrcX, int a_SrcY, int a_SrcZ, int a_Data, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastSoundParticleEffect(a_EffectID, a_SrcX, a_SrcY, a_SrcZ, a_Data, a_Exclude); +} + + + + + +void cWorld::BroadcastSpawnEntity(cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastSpawnEntity(a_Entity, a_Exclude); +} + + + + + +void cWorld::BroadcastTeleportEntity(const cEntity & a_Entity, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendTeleportEntity(a_Entity); + } +} + + + + + +void cWorld::BroadcastThunderbolt(int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude) +{ + m_ChunkMap->BroadcastThunderbolt(a_BlockX, a_BlockY, a_BlockZ, a_Exclude); +} + + + + + +void cWorld::BroadcastTimeUpdate(const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendTimeUpdate(m_WorldAge, m_TimeOfDay); + } +} + + + + + +void cWorld::BroadcastUseBed(const cEntity & a_Entity, int a_BlockX, int a_BlockY, int a_BlockZ) +{ + m_ChunkMap->BroadcastUseBed(a_Entity, a_BlockX, a_BlockY, a_BlockZ); +} + + + + + +void cWorld::BroadcastWeather(eWeather a_Weather, const cClientHandle * a_Exclude) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch == a_Exclude) || (ch == NULL) || !ch->IsLoggedIn() || ch->IsDestroyed()) + { + continue; + } + ch->SendWeather(a_Weather); + } +} + + + + + +void cWorld::SendBlockEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cClientHandle & a_Client) +{ + m_ChunkMap->SendBlockEntity(a_BlockX, a_BlockY, a_BlockZ, a_Client); +} + + + + + +void cWorld::MarkChunkDirty (int a_ChunkX, int a_ChunkZ) +{ + m_ChunkMap->MarkChunkDirty (a_ChunkX, a_ChunkZ); +} + + + + + +void cWorld::MarkChunkSaving(int a_ChunkX, int a_ChunkZ) +{ + m_ChunkMap->MarkChunkSaving(a_ChunkX, a_ChunkZ); +} + + + + + +void cWorld::MarkChunkSaved (int a_ChunkX, int a_ChunkZ) +{ + m_ChunkMap->MarkChunkSaved (a_ChunkX, a_ChunkZ); +} + + + + + +void cWorld::SetChunkData( + int a_ChunkX, int a_ChunkZ, + const BLOCKTYPE * a_BlockTypes, + const NIBBLETYPE * a_BlockMeta, + const NIBBLETYPE * a_BlockLight, + const NIBBLETYPE * a_BlockSkyLight, + const cChunkDef::HeightMap * a_HeightMap, + const cChunkDef::BiomeMap * a_BiomeMap, + cEntityList & a_Entities, + cBlockEntityList & a_BlockEntities, + bool a_MarkDirty +) +{ + // Validate biomes, if needed: + cChunkDef::BiomeMap BiomeMap; + const cChunkDef::BiomeMap * Biomes = a_BiomeMap; + if (a_BiomeMap == NULL) + { + // The biomes are not assigned, get them from the generator: + Biomes = &BiomeMap; + m_Generator.GenerateBiomes(a_ChunkX, a_ChunkZ, BiomeMap); + } + + m_ChunkMap->SetChunkData( + a_ChunkX, a_ChunkZ, + a_BlockTypes, a_BlockMeta, a_BlockLight, a_BlockSkyLight, + a_HeightMap, *Biomes, + a_BlockEntities, + a_MarkDirty + ); + + // Initialize the entities (outside the m_ChunkMap's CS, to fix FS #347): + for (cEntityList::iterator itr = a_Entities.begin(), end = a_Entities.end(); itr != end; ++itr) + { + (*itr)->Initialize(this); + } + + // If a client is requesting this chunk, send it to them: + if (m_ChunkMap->HasChunkAnyClients(a_ChunkX, a_ChunkZ)) + { + m_ChunkSender.ChunkReady(a_ChunkX, a_ChunkZ); + } + + // Notify the lighting thread that the chunk has become valid (in case it is a neighbor of a postponed chunk): + m_Lighting.ChunkReady(a_ChunkX, a_ChunkZ); +} + + + + + +void cWorld::ChunkLighted( + int a_ChunkX, int a_ChunkZ, + const cChunkDef::BlockNibbles & a_BlockLight, + const cChunkDef::BlockNibbles & a_SkyLight +) +{ + m_ChunkMap->ChunkLighted(a_ChunkX, a_ChunkZ, a_BlockLight, a_SkyLight); +} + + + + + +bool cWorld::GetChunkData(int a_ChunkX, int a_ChunkZ, cChunkDataCallback & a_Callback) +{ + return m_ChunkMap->GetChunkData(a_ChunkX, a_ChunkZ, a_Callback); +} + + + + + +bool cWorld::GetChunkBlockTypes(int a_ChunkX, int a_ChunkZ, BLOCKTYPE * a_BlockTypes) +{ + return m_ChunkMap->GetChunkBlockTypes(a_ChunkX, a_ChunkZ, a_BlockTypes); +} + + + + + +bool cWorld::IsChunkValid(int a_ChunkX, int a_ChunkZ) const +{ + return m_ChunkMap->IsChunkValid(a_ChunkX, a_ChunkZ); +} + + + + + +bool cWorld::HasChunkAnyClients(int a_ChunkX, int a_ChunkZ) const +{ + return m_ChunkMap->HasChunkAnyClients(a_ChunkX, a_ChunkZ); +} + + + + + +void cWorld::UnloadUnusedChunks(void) +{ + m_LastUnload = m_WorldAge; + m_ChunkMap->UnloadUnusedChunks(); +} + + + + + +void cWorld::CollectPickupsByPlayer(cPlayer * a_Player) +{ + m_ChunkMap->CollectPickupsByPlayer(a_Player); +} + + + + + +void cWorld::AddPlayer(cPlayer * a_Player) +{ + { + cCSLock Lock(m_CSPlayers); + + ASSERT(std::find(m_Players.begin(), m_Players.end(), a_Player) == m_Players.end()); // Is it already in the list? HOW? + + m_Players.remove(a_Player); // Make sure the player is registered only once + m_Players.push_back(a_Player); + } + + // Add the player's client to the list of clients to be ticked: + if (a_Player->GetClientHandle() != NULL) + { + cCSLock Lock(m_CSClients); + m_ClientsToAdd.push_back(a_Player->GetClientHandle()); + } + + // The player has already been added to the chunkmap as the entity, do NOT add again! +} + + + + + +void cWorld::RemovePlayer(cPlayer * a_Player) +{ + m_ChunkMap->RemoveEntity(a_Player); + { + cCSLock Lock(m_CSPlayers); + m_Players.remove(a_Player); + } + + // Remove the player's client from the list of clients to be ticked: + if (a_Player->GetClientHandle() != NULL) + { + cCSLock Lock(m_CSClients); + m_ClientsToRemove.push_back(a_Player->GetClientHandle()); + } +} + + + + + +bool cWorld::ForEachPlayer(cPlayerListCallback & a_Callback) +{ + // Calls the callback for each player in the list + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(), itr2 = itr; itr != m_Players.end(); itr = itr2) + { + ++itr2; + if (a_Callback.Item(*itr)) + { + return false; + } + } // for itr - m_Players[] + return true; +} + + + + + +bool cWorld::DoWithPlayer(const AString & a_PlayerName, cPlayerListCallback & a_Callback) +{ + // Calls the callback for each player in the list + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + if (NoCaseCompare((*itr)->GetName(), a_PlayerName) == 0) + { + a_Callback.Item(*itr); + return true; + } + } // for itr - m_Players[] + return false; +} + + + + + +bool cWorld::FindAndDoWithPlayer(const AString & a_PlayerNameHint, cPlayerListCallback & a_Callback) +{ + cPlayer * BestMatch = NULL; + unsigned int BestRating = 0; + unsigned int NameLength = a_PlayerNameHint.length(); + + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + unsigned int Rating = RateCompareString (a_PlayerNameHint, (*itr)->GetName()); + if (Rating >= BestRating) + { + BestMatch = *itr; + BestRating = Rating; + } + if (Rating == NameLength) // Perfect match + { + break; + } + } // for itr - m_Players[] + + if (BestMatch != NULL) + { + LOG("Compared %s and %s with rating %i", a_PlayerNameHint.c_str(), BestMatch->GetName().c_str(), BestRating); + return a_Callback.Item (BestMatch); + } + return false; +} + + + + + +// TODO: This interface is dangerous! +cPlayer * cWorld::FindClosestPlayer(const Vector3f & a_Pos, float a_SightLimit) +{ + cTracer LineOfSight(this); + + float ClosestDistance = a_SightLimit; + cPlayer* ClosestPlayer = NULL; + + cCSLock Lock(m_CSPlayers); + for (cPlayerList::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + Vector3f Pos = (*itr)->GetPosition(); + float Distance = (Pos - a_Pos).Length(); + + if (Distance < ClosestDistance) + { + if (!LineOfSight.Trace(a_Pos,(Pos - a_Pos),(int)(Pos - a_Pos).Length())) + { + ClosestDistance = Distance; + ClosestPlayer = *itr; + } + } + } + return ClosestPlayer; +} + + + + + +void cWorld::SendPlayerList(cPlayer * a_DestPlayer) +{ + // Sends the playerlist to a_DestPlayer + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) + { + cClientHandle * ch = (*itr)->GetClientHandle(); + if ((ch != NULL) && !ch->IsDestroyed()) + { + a_DestPlayer->GetClientHandle()->SendPlayerListItem(*(*itr), true); + } + } +} + + + + + +bool cWorld::ForEachEntity(cEntityCallback & a_Callback) +{ + return m_ChunkMap->ForEachEntity(a_Callback); +} + + + + + +bool cWorld::ForEachEntityInChunk(int a_ChunkX, int a_ChunkZ, cEntityCallback & a_Callback) +{ + return m_ChunkMap->ForEachEntityInChunk(a_ChunkX, a_ChunkZ, a_Callback); +} + + + + + +bool cWorld::DoWithEntityByID(int a_UniqueID, cEntityCallback & a_Callback) +{ + return m_ChunkMap->DoWithEntityByID(a_UniqueID, a_Callback); +} + + + + + +void cWorld::CompareChunkClients(int a_ChunkX1, int a_ChunkZ1, int a_ChunkX2, int a_ChunkZ2, cClientDiffCallback & a_Callback) +{ + m_ChunkMap->CompareChunkClients(a_ChunkX1, a_ChunkZ1, a_ChunkX2, a_ChunkZ2, a_Callback); +} + + + + + +bool cWorld::AddChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) +{ + return m_ChunkMap->AddChunkClient(a_ChunkX, a_ChunkZ, a_Client); +} + + + + + +void cWorld::RemoveChunkClient(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) +{ + m_ChunkMap->RemoveChunkClient(a_ChunkX, a_ChunkZ, a_Client); +} + + + + + +void cWorld::RemoveClientFromChunks(cClientHandle * a_Client) +{ + m_ChunkMap->RemoveClientFromChunks(a_Client); +} + + + + + +void cWorld::SendChunkTo(int a_ChunkX, int a_ChunkZ, cClientHandle * a_Client) +{ + m_ChunkSender.QueueSendChunkTo(a_ChunkX, a_ChunkZ, a_Client); +} + + + + + +void cWorld::RemoveClientFromChunkSender(cClientHandle * a_Client) +{ + m_ChunkSender.RemoveClient(a_Client); +} + + + + + +void cWorld::TouchChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +{ + m_ChunkMap->TouchChunk(a_ChunkX, a_ChunkY, a_ChunkZ); +} + + + + + +bool cWorld::LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +{ + return m_ChunkMap->LoadChunk(a_ChunkX, a_ChunkY, a_ChunkZ); +} + + + + + +void cWorld::LoadChunks(const cChunkCoordsList & a_Chunks) +{ + m_ChunkMap->LoadChunks(a_Chunks); +} + + + + + +void cWorld::ChunkLoadFailed(int a_ChunkX, int a_ChunkY, int a_ChunkZ) +{ + m_ChunkMap->ChunkLoadFailed(a_ChunkX, a_ChunkY, a_ChunkZ); +} + + + + + +bool cWorld::SetSignLines(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) +{ + AString Line1(a_Line1); + AString Line2(a_Line2); + AString Line3(a_Line3); + AString Line4(a_Line4); + if (cRoot::Get()->GetPluginManager()->CallHookUpdatingSign(this, a_BlockX, a_BlockY, a_BlockZ, Line1, Line2, Line3, Line4, a_Player)) + { + return false; + } + if (m_ChunkMap->SetSignLines(a_BlockX, a_BlockY, a_BlockZ, Line1, Line2, Line3, Line4)) + { + cRoot::Get()->GetPluginManager()->CallHookUpdatedSign(this, a_BlockX, a_BlockY, a_BlockZ, Line1, Line2, Line3, Line4, a_Player); + return true; + } + return false; +} + + + + + +bool cWorld::UpdateSign(int a_BlockX, int a_BlockY, int a_BlockZ, const AString & a_Line1, const AString & a_Line2, const AString & a_Line3, const AString & a_Line4, cPlayer * a_Player) +{ + return SetSignLines(a_BlockX, a_BlockY, a_BlockZ, a_Line1, a_Line2, a_Line3, a_Line4, a_Player); +} + + + + + +void cWorld::ChunksStay(const cChunkCoordsList & a_Chunks, bool a_Stay) +{ + m_ChunkMap->ChunksStay(a_Chunks, a_Stay); +} + + + + + +void cWorld::RegenerateChunk(int a_ChunkX, int a_ChunkZ) +{ + m_ChunkMap->MarkChunkRegenerating(a_ChunkX, a_ChunkZ); + + // Trick: use Y=1 to force the chunk generation even though the chunk data is already present + m_Generator.QueueGenerateChunk(a_ChunkX, 1, a_ChunkZ); +} + + + + + +void cWorld::GenerateChunk(int a_ChunkX, int a_ChunkZ) +{ + m_Generator.QueueGenerateChunk(a_ChunkX, ZERO_CHUNK_Y, a_ChunkZ); +} + + + + + +void cWorld::QueueLightChunk(int a_ChunkX, int a_ChunkZ, cChunkCoordCallback * a_Callback) +{ + m_Lighting.QueueChunk(a_ChunkX, a_ChunkZ, a_Callback); +} + + + + + +bool cWorld::IsChunkLighted(int a_ChunkX, int a_ChunkZ) +{ + return m_ChunkMap->IsChunkLighted(a_ChunkX, a_ChunkZ); +} + + + + + +bool cWorld::ForEachChunkInRect(int a_MinChunkX, int a_MaxChunkX, int a_MinChunkZ, int a_MaxChunkZ, cChunkDataCallback & a_Callback) +{ + return m_ChunkMap->ForEachChunkInRect(a_MinChunkX, a_MaxChunkX, a_MinChunkZ, a_MaxChunkZ, a_Callback); +} + + + + + +void cWorld::SaveAllChunks(void) +{ + LOGINFO("Saving all chunks..."); + m_LastSave = m_WorldAge; + m_ChunkMap->SaveAllChunks(); + m_Storage.QueueSavedMessage(); +} + + + + + +void cWorld::QueueSaveAllChunks(void) +{ + QueueTask(new cWorld::cTaskSaveAllChunks); +} + + + + + +void cWorld::QueueTask(cTask * a_Task) +{ + cCSLock Lock(m_CSTasks); + m_Tasks.push_back(a_Task); +} + + + + + +void cWorld::AddEntity(cEntity * a_Entity) +{ + m_ChunkMap->AddEntity(a_Entity); +} + + + + + +bool cWorld::HasEntity(int a_UniqueID) +{ + return m_ChunkMap->HasEntity(a_UniqueID); +} + + + + + +void cWorld::RemoveEntity(cEntity * a_Entity) +{ + m_ChunkMap->RemoveEntity(a_Entity); +} + + + + + +/* +unsigned int cWorld::GetNumPlayers(void) +{ + cCSLock Lock(m_CSPlayers); + return m_Players.size(); +} +*/ + + + + + +int cWorld::GetNumChunks(void) const +{ + return m_ChunkMap->GetNumChunks(); +} + + + + + +void cWorld::GetChunkStats(int & a_NumValid, int & a_NumDirty, int & a_NumInLightingQueue) +{ + m_ChunkMap->GetChunkStats(a_NumValid, a_NumDirty); + a_NumInLightingQueue = (int) m_Lighting.GetQueueLength(); +} + + + + + +void cWorld::TickQueuedBlocks(void) +{ + if (m_BlockTickQueue.empty()) + { + return; + } + m_BlockTickQueueCopy.clear(); + m_BlockTickQueue.swap(m_BlockTickQueueCopy); + + for (std::vector<BlockTickQueueItem *>::iterator itr = m_BlockTickQueueCopy.begin(); itr != m_BlockTickQueueCopy.end(); itr++) + { + BlockTickQueueItem *Block = (*itr); + Block->TicksToWait -= 1; + if (Block->TicksToWait <= 0) + { + // TODO: Handle the case when the chunk is already unloaded + BlockHandler(GetBlock(Block->X, Block->Y, Block->Z))->OnUpdate(this, Block->X, Block->Y, Block->Z); + delete Block; // We don't have to remove it from the vector, this will happen automatically on the next tick + } + else + { + m_BlockTickQueue.push_back(Block); // Keep the block in the queue + } + } // for itr - m_BlockTickQueueCopy[] +} + + + + + +void cWorld::QueueBlockForTick(int a_BlockX, int a_BlockY, int a_BlockZ, int a_TicksToWait) +{ + BlockTickQueueItem * Block = new BlockTickQueueItem; + Block->X = a_BlockX; + Block->Y = a_BlockY; + Block->Z = a_BlockZ; + Block->TicksToWait = a_TicksToWait; + + m_BlockTickQueue.push_back(Block); +} + + + + + +bool cWorld::IsBlockDirectlyWatered(int a_BlockX, int a_BlockY, int a_BlockZ) +{ + return ( + IsBlockWater(GetBlock(a_BlockX - 1, a_BlockY, a_BlockZ)) || + IsBlockWater(GetBlock(a_BlockX + 1, a_BlockY, a_BlockZ)) || + IsBlockWater(GetBlock(a_BlockX, a_BlockY, a_BlockZ - 1)) || + IsBlockWater(GetBlock(a_BlockX, a_BlockY, a_BlockZ + 1)) + ); +} + + + + + +int cWorld::SpawnMob(double a_PosX, double a_PosY, double a_PosZ, cMonster::eType a_MonsterType) +{ + cMonster * Monster = NULL; + + Monster = cMonster::NewMonsterFromType(a_MonsterType); + if (Monster != NULL) + { + Monster->SetPosition(a_PosX, a_PosY, a_PosZ); + } + + // Because it's logical that ALL mob spawns need spawn effects, not just spawners + BroadcastSoundParticleEffect(2004, (int)a_PosX, (int)a_PosY, (int)a_PosZ, 0); + + return SpawnMobFinalize(Monster); +} + + + + +int cWorld::SpawnMobFinalize(cMonster * a_Monster) +{ + if (!a_Monster) + return -1; + a_Monster->SetHealth(a_Monster->GetMaxHealth()); + if (cPluginManager::Get()->CallHookSpawningMonster(*this, *a_Monster)) + { + delete a_Monster; + return -1; + } + if (!a_Monster->Initialize(this)) + { + delete a_Monster; + return -1; + } + BroadcastSpawnEntity(*a_Monster); + cPluginManager::Get()->CallHookSpawnedMonster(*this, *a_Monster); + + return a_Monster->GetUniqueID(); +} + + + + + +int cWorld::CreateProjectile(double a_PosX, double a_PosY, double a_PosZ, cProjectileEntity::eKind a_Kind, cEntity * a_Creator, const Vector3d * a_Speed) +{ + cProjectileEntity * Projectile = cProjectileEntity::Create(a_Kind, a_Creator, a_PosX, a_PosY, a_PosZ, a_Speed); + if (Projectile == NULL) + { + return -1; + } + if (!Projectile->Initialize(this)) + { + delete Projectile; + return -1; + } + BroadcastSpawnEntity(*Projectile); + return Projectile->GetUniqueID(); +} + + + + + +void cWorld::TabCompleteUserName(const AString & a_Text, AStringVector & a_Results) +{ + cCSLock Lock(m_CSPlayers); + for (cPlayerList::iterator itr = m_Players.begin(), end = m_Players.end(); itr != end; ++itr) + { + size_t LastSpace = a_Text.find_last_of(" "); //Find the position of the last space + + std::string LastWord = a_Text.substr(LastSpace + 1, a_Text.length()); //Find the last word + std::string PlayerName ((*itr)->GetName()); + std::size_t Found = PlayerName.find(LastWord); //Try to find last word in playername + + if (Found!=0) + { + continue; //No match + } + + a_Results.push_back((*itr)->GetName()); //Match! + } +} + + + + + +cFluidSimulator * cWorld::InitializeFluidSimulator(cIniFile & a_IniFile, const char * a_FluidName, BLOCKTYPE a_SimulateBlock, BLOCKTYPE a_StationaryBlock) +{ + AString SimulatorNameKey; + Printf(SimulatorNameKey, "%sSimulator", a_FluidName); + AString SimulatorSectionName; + Printf(SimulatorSectionName, "%sSimulator", a_FluidName); + AString SimulatorName = a_IniFile.GetValueSet("Physics", SimulatorNameKey, ""); + if (SimulatorName.empty()) + { + LOGWARNING("[Physics] %s not present or empty in %s, using the default of \"Floody\".", SimulatorNameKey.c_str(), GetIniFileName().c_str()); + SimulatorName = "Floody"; + } + + cFluidSimulator * res = NULL; + bool IsWater = (strcmp(a_FluidName, "Water") == 0); // Used for defaults + int Rate = 1; + if ( + (NoCaseCompare(SimulatorName, "vaporize") == 0) || + (NoCaseCompare(SimulatorName, "vaporise") == 0) + ) + { + res = new cVaporizeFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock); + } + else if ( + (NoCaseCompare(SimulatorName, "noop") == 0) || + (NoCaseCompare(SimulatorName, "nop") == 0) || + (NoCaseCompare(SimulatorName, "null") == 0) || + (NoCaseCompare(SimulatorName, "nil") == 0) + ) + { + res = new cNoopFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock); + } + else + { + if (NoCaseCompare(SimulatorName, "floody") != 0) + { + // The simulator name doesn't match anything we have, issue a warning: + LOGWARNING("%s [Physics]:%s specifies an unknown simulator, using the default \"Floody\".", GetIniFileName().c_str(), SimulatorNameKey.c_str()); + } + int Falloff = a_IniFile.GetValueSetI(SimulatorSectionName, "Falloff", IsWater ? 1 : 2); + int TickDelay = a_IniFile.GetValueSetI(SimulatorSectionName, "TickDelay", IsWater ? 5 : 30); + int NumNeighborsForSource = a_IniFile.GetValueSetI(SimulatorSectionName, "NumNeighborsForSource", IsWater ? 2 : -1); + res = new cFloodyFluidSimulator(*this, a_SimulateBlock, a_StationaryBlock, Falloff, TickDelay, NumNeighborsForSource); + } + + m_SimulatorManager->RegisterSimulator(res, Rate); + + return res; +} + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cWorld::cTaskSaveAllChunks: + +void cWorld::cTaskSaveAllChunks::Run(cWorld & a_World) +{ + a_World.SaveAllChunks(); +} + + + + + diff --git a/source/World.h b/src/World.h index 284e96bbb..284e96bbb 100644 --- a/source/World.h +++ b/src/World.h diff --git a/source/WorldStorage/FastNBT.cpp b/src/WorldStorage/FastNBT.cpp index e55011069..e55011069 100644 --- a/source/WorldStorage/FastNBT.cpp +++ b/src/WorldStorage/FastNBT.cpp diff --git a/source/WorldStorage/FastNBT.h b/src/WorldStorage/FastNBT.h index 7323c29cb..7323c29cb 100644 --- a/source/WorldStorage/FastNBT.h +++ b/src/WorldStorage/FastNBT.h diff --git a/source/WorldStorage/NBTChunkSerializer.cpp b/src/WorldStorage/NBTChunkSerializer.cpp index c9013b1b3..c9013b1b3 100644 --- a/source/WorldStorage/NBTChunkSerializer.cpp +++ b/src/WorldStorage/NBTChunkSerializer.cpp diff --git a/source/WorldStorage/NBTChunkSerializer.h b/src/WorldStorage/NBTChunkSerializer.h index 9d4ac208c..9d4ac208c 100644 --- a/source/WorldStorage/NBTChunkSerializer.h +++ b/src/WorldStorage/NBTChunkSerializer.h diff --git a/src/WorldStorage/WSSAnvil.cpp b/src/WorldStorage/WSSAnvil.cpp new file mode 100644 index 000000000..79be4dfa2 --- /dev/null +++ b/src/WorldStorage/WSSAnvil.cpp @@ -0,0 +1,1555 @@ + +// WSSAnvil.cpp + +// Implements the cWSSAnvil class representing the Anvil world storage scheme + +#include "Globals.h" +#include "WSSAnvil.h" +#include "NBTChunkSerializer.h" +#include "../World.h" +#include "zlib/zlib.h" +#include "../BlockID.h" +#include "../BlockEntities/ChestEntity.h" +#include "../BlockEntities/DispenserEntity.h" +#include "../BlockEntities/DropperEntity.h" +#include "../BlockEntities/FurnaceEntity.h" +#include "../BlockEntities/HopperEntity.h" +#include "../BlockEntities/JukeboxEntity.h" +#include "../BlockEntities/NoteEntity.h" +#include "../BlockEntities/SignEntity.h" +#include "../Item.h" +#include "../ItemGrid.h" +#include "../StringCompression.h" +#include "FastNBT.h" +#include "../Mobs/Monster.h" +#include "../Entities/Boat.h" +#include "../Entities/FallingBlock.h" +#include "../Entities/Minecart.h" +#include "../Entities/Pickup.h" +#include "../Entities/ProjectileEntity.h" + + + + + +/** If defined, the BlockSkyLight values will be copied over to BlockLight upon chunk saving, +thus making skylight visible in Minutor's Lighting mode +*/ +// #define DEBUG_SKYLIGHT + +/** Maximum number of MCA files that are cached in memory. +Since only the header is actually in the memory, this number can be high, but still, each file means an OS FS handle. +*/ +#define MAX_MCA_FILES 32 + +/// The maximum size of an inflated chunk; raw chunk data is 192 KiB, allow 64 KiB more of entities +#define CHUNK_INFLATE_MAX 256 KiB + + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cWSSAnvil: + +cWSSAnvil::cWSSAnvil(cWorld * a_World) : + super(a_World) +{ + // Create a level.dat file for mapping tools, if it doesn't already exist: + AString fnam; + Printf(fnam, "%s/level.dat", a_World->GetName().c_str()); + if (!cFile::Exists(fnam)) + { + cFastNBTWriter Writer; + Writer.BeginCompound(""); + Writer.AddInt("SpawnX", (int)(a_World->GetSpawnX())); + Writer.AddInt("SpawnY", (int)(a_World->GetSpawnY())); + Writer.AddInt("SpawnZ", (int)(a_World->GetSpawnZ())); + Writer.EndCompound(); + Writer.Finish(); + + #ifdef _DEBUG + cParsedNBT TestParse(Writer.GetResult().data(), Writer.GetResult().size()); + ASSERT(TestParse.IsValid()); + #endif // _DEBUG + + gzFile gz = gzopen((FILE_IO_PREFIX + fnam).c_str(), "wb"); + if (gz != NULL) + { + gzwrite(gz, Writer.GetResult().data(), Writer.GetResult().size()); + } + gzclose(gz); + } +} + + + + + +cWSSAnvil::~cWSSAnvil() +{ + cCSLock Lock(m_CS); + for (cMCAFiles::iterator itr = m_Files.begin(); itr != m_Files.end(); ++itr) + { + delete *itr; + } // for itr - m_Files[] +} + + + + + +bool cWSSAnvil::LoadChunk(const cChunkCoords & a_Chunk) +{ + AString ChunkData; + if (!GetChunkData(a_Chunk, ChunkData)) + { + // The reason for failure is already printed in GetChunkData() + return false; + } + + return LoadChunkFromData(a_Chunk, ChunkData); +} + + + + + +bool cWSSAnvil::SaveChunk(const cChunkCoords & a_Chunk) +{ + AString ChunkData; + if (!SaveChunkToData(a_Chunk, ChunkData)) + { + LOGWARNING("Cannot serialize chunk [%d, %d] into data", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ); + return false; + } + if (!SetChunkData(a_Chunk, ChunkData)) + { + LOGWARNING("Cannot store chunk [%d, %d] data", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ); + return false; + } + + // Everything successful + return true; +} + + + + + +bool cWSSAnvil::GetChunkData(const cChunkCoords & a_Chunk, AString & a_Data) +{ + cCSLock Lock(m_CS); + cMCAFile * File = LoadMCAFile(a_Chunk); + if (File == NULL) + { + return false; + } + return File->GetChunkData(a_Chunk, a_Data); +} + + + + + +bool cWSSAnvil::SetChunkData(const cChunkCoords & a_Chunk, const AString & a_Data) +{ + cCSLock Lock(m_CS); + cMCAFile * File = LoadMCAFile(a_Chunk); + if (File == NULL) + { + return false; + } + return File->SetChunkData(a_Chunk, a_Data); +} + + + + + +cWSSAnvil::cMCAFile * cWSSAnvil::LoadMCAFile(const cChunkCoords & a_Chunk) +{ + // ASSUME m_CS is locked + ASSERT(m_CS.IsLocked()); + + const int RegionX = FAST_FLOOR_DIV(a_Chunk.m_ChunkX, 32); + const int RegionZ = FAST_FLOOR_DIV(a_Chunk.m_ChunkZ, 32); + ASSERT(a_Chunk.m_ChunkX - RegionX * 32 >= 0); + ASSERT(a_Chunk.m_ChunkZ - RegionZ * 32 >= 0); + ASSERT(a_Chunk.m_ChunkX - RegionX * 32 < 32); + ASSERT(a_Chunk.m_ChunkZ - RegionZ * 32 < 32); + + // Is it already cached? + for (cMCAFiles::iterator itr = m_Files.begin(); itr != m_Files.end(); ++itr) + { + if (((*itr) != NULL) && ((*itr)->GetRegionX() == RegionX) && ((*itr)->GetRegionZ() == RegionZ)) + { + // Move the file to front and return it: + cMCAFile * f = *itr; + if (itr != m_Files.begin()) + { + m_Files.erase(itr); + m_Files.push_front(f); + } + return f; + } + } + + // Load it anew: + AString FileName; + Printf(FileName, "%s/region", m_World->GetName().c_str()); + cFile::CreateFolder(FILE_IO_PREFIX + FileName); + AppendPrintf(FileName, "/r.%d.%d.mca", RegionX, RegionZ); + cMCAFile * f = new cMCAFile(FileName, RegionX, RegionZ); + if (f == NULL) + { + return NULL; + } + m_Files.push_front(f); + + // If there are too many MCA files cached, delete the last one used: + if (m_Files.size() > MAX_MCA_FILES) + { + delete m_Files.back(); + m_Files.pop_back(); + } + return f; +} + + + + + +bool cWSSAnvil::LoadChunkFromData(const cChunkCoords & a_Chunk, const AString & a_Data) +{ + // Decompress the data: + char Uncompressed[CHUNK_INFLATE_MAX]; + z_stream strm; + strm.zalloc = (alloc_func)NULL; + strm.zfree = (free_func)NULL; + strm.opaque = NULL; + inflateInit(&strm); + strm.next_out = (Bytef *)Uncompressed; + strm.avail_out = sizeof(Uncompressed); + strm.next_in = (Bytef *)a_Data.data(); + strm.avail_in = a_Data.size(); + int res = inflate(&strm, Z_FINISH); + inflateEnd(&strm); + if (res != Z_STREAM_END) + { + return false; + } + + // Parse the NBT data: + cParsedNBT NBT(Uncompressed, strm.total_out); + if (!NBT.IsValid()) + { + // NBT Parsing failed + return false; + } + + // Load the data from NBT: + return LoadChunkFromNBT(a_Chunk, NBT); +} + + + + + +bool cWSSAnvil::SaveChunkToData(const cChunkCoords & a_Chunk, AString & a_Data) +{ + cFastNBTWriter Writer; + if (!SaveChunkToNBT(a_Chunk, Writer)) + { + LOGWARNING("Cannot save chunk [%d, %d] to NBT", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ); + return false; + } + Writer.Finish(); + + CompressString(Writer.GetResult().data(), Writer.GetResult().size(), a_Data); + return true; +} + + + + + +bool cWSSAnvil::LoadChunkFromNBT(const cChunkCoords & a_Chunk, const cParsedNBT & a_NBT) +{ + // The data arrays, in MCA-native y/z/x ordering (will be reordered for the final chunk data) + cChunkDef::BlockTypes BlockTypes; + cChunkDef::BlockNibbles MetaData; + cChunkDef::BlockNibbles BlockLight; + cChunkDef::BlockNibbles SkyLight; + + memset(BlockTypes, E_BLOCK_AIR, sizeof(BlockTypes)); + memset(MetaData, 0, sizeof(MetaData)); + memset(SkyLight, 0xff, sizeof(SkyLight)); // By default, data not present in the NBT means air, which means full skylight + memset(BlockLight, 0x00, sizeof(BlockLight)); + + // Load the blockdata, blocklight and skylight: + int Level = a_NBT.FindChildByName(0, "Level"); + if (Level < 0) + { + return false; + } + int Sections = a_NBT.FindChildByName(Level, "Sections"); + if ((Sections < 0) || (a_NBT.GetType(Sections) != TAG_List) || (a_NBT.GetChildrenType(Sections) != TAG_Compound)) + { + return false; + } + for (int Child = a_NBT.GetFirstChild(Sections); Child >= 0; Child = a_NBT.GetNextSibling(Child)) + { + int y = 0; + int SectionY = a_NBT.FindChildByName(Child, "Y"); + if ((SectionY < 0) || (a_NBT.GetType(SectionY) != TAG_Byte)) + { + continue; + } + y = a_NBT.GetByte(SectionY); + if ((y < 0) || (y > 15)) + { + continue; + } + CopyNBTData(a_NBT, Child, "Blocks", (char *)&(BlockTypes[y * 4096]), 4096); + CopyNBTData(a_NBT, Child, "Data", (char *)&(MetaData[y * 2048]), 2048); + CopyNBTData(a_NBT, Child, "SkyLight", (char *)&(SkyLight[y * 2048]), 2048); + CopyNBTData(a_NBT, Child, "BlockLight", (char *)&(BlockLight[y * 2048]), 2048); + } // for itr - LevelSections[] + + // Load the biomes from NBT, if present and valid. First try MCS-style, then Vanilla-style: + cChunkDef::BiomeMap BiomeMap; + cChunkDef::BiomeMap * Biomes = LoadBiomeMapFromNBT(&BiomeMap, a_NBT, a_NBT.FindChildByName(Level, "MCSBiomes")); + if (Biomes == NULL) + { + // MCS-style biomes not available, load vanilla-style: + Biomes = LoadVanillaBiomeMapFromNBT(&BiomeMap, a_NBT, a_NBT.FindChildByName(Level, "Biomes")); + } + + // Load the entities from NBT: + cEntityList Entities; + cBlockEntityList BlockEntities; + LoadEntitiesFromNBT (Entities, a_NBT, a_NBT.FindChildByName(Level, "Entities")); + LoadBlockEntitiesFromNBT(BlockEntities, a_NBT, a_NBT.FindChildByName(Level, "TileEntities"), BlockTypes, MetaData); + + bool IsLightValid = (a_NBT.FindChildByName(Level, "MCSIsLightValid") > 0); + + /* + // Uncomment this block for really cool stuff :) + // DEBUG magic: Invert the underground, so that we can see the MC generator in action :) + bool ShouldInvert[cChunkDef::Width * cChunkDef::Width]; + memset(ShouldInvert, 0, sizeof(ShouldInvert)); + for (int y = cChunkDef::Height - 1; y >= 0; y--) + { + for (int x = 0; x < cChunkDef::Width; x++) for (int z = 0; z < cChunkDef::Width; z++) + { + int Index = cChunkDef::MakeIndexNoCheck(x, y, z); + if (ShouldInvert[x + cChunkDef::Width * z]) + { + BlockTypes[Index] = (BlockTypes[Index] == E_BLOCK_AIR) ? E_BLOCK_STONE : E_BLOCK_AIR; + } + else + { + switch (BlockTypes[Index]) + { + case E_BLOCK_AIR: + case E_BLOCK_LEAVES: + { + // nothing needed + break; + } + default: + { + ShouldInvert[x + cChunkDef::Width * z] = true; + } + } + BlockTypes[Index] = E_BLOCK_AIR; + } + } + } // for y + //*/ + + m_World->SetChunkData( + a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, + BlockTypes, MetaData, + IsLightValid ? BlockLight : NULL, + IsLightValid ? SkyLight : NULL, + NULL, Biomes, + Entities, BlockEntities, + false + ); + return true; +} + + + + +void cWSSAnvil::CopyNBTData(const cParsedNBT & a_NBT, int a_Tag, const AString & a_ChildName, char * a_Destination, int a_Length) +{ + int Child = a_NBT.FindChildByName(a_Tag, a_ChildName); + if ((Child >= 0) && (a_NBT.GetType(Child) == TAG_ByteArray) && (a_NBT.GetDataLength(Child) == a_Length)) + { + memcpy(a_Destination, a_NBT.GetData(Child), a_Length); + } +} + + + + + +bool cWSSAnvil::SaveChunkToNBT(const cChunkCoords & a_Chunk, cFastNBTWriter & a_Writer) +{ + a_Writer.BeginCompound("Level"); + a_Writer.AddInt("xPos", a_Chunk.m_ChunkX); + a_Writer.AddInt("zPos", a_Chunk.m_ChunkZ); + cNBTChunkSerializer Serializer(a_Writer); + if (!m_World->GetChunkData(a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, Serializer)) + { + LOGWARNING("Cannot get chunk [%d, %d] data for NBT saving", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ); + return false; + } + Serializer.Finish(); // Close NBT tags + + // Save biomes, both MCS (IntArray) and MC-vanilla (ByteArray): + if (Serializer.m_BiomesAreValid) + { + a_Writer.AddByteArray("Biomes", (const char *)(Serializer.m_VanillaBiomes), ARRAYCOUNT(Serializer.m_VanillaBiomes)); + a_Writer.AddIntArray ("MCSBiomes", (const int *)(Serializer.m_Biomes), ARRAYCOUNT(Serializer.m_Biomes)); + } + + // Save blockdata: + a_Writer.BeginList("Sections", TAG_Compound); + int SliceSizeBlock = cChunkDef::Width * cChunkDef::Width * 16; + int SliceSizeNibble = SliceSizeBlock / 2; + const char * BlockTypes = (const char *)(Serializer.m_BlockTypes); + const char * BlockMetas = (const char *)(Serializer.m_BlockMetas); + #ifdef DEBUG_SKYLIGHT + const char * BlockLight = (const char *)(Serializer.m_BlockSkyLight); + #else + const char * BlockLight = (const char *)(Serializer.m_BlockLight); + #endif + const char * BlockSkyLight = (const char *)(Serializer.m_BlockSkyLight); + for (int Y = 0; Y < 16; Y++) + { + a_Writer.BeginCompound(""); + a_Writer.AddByteArray("Blocks", BlockTypes + Y * SliceSizeBlock, SliceSizeBlock); + a_Writer.AddByteArray("Data", BlockMetas + Y * SliceSizeNibble, SliceSizeNibble); + a_Writer.AddByteArray("SkyLight", BlockSkyLight + Y * SliceSizeNibble, SliceSizeNibble); + a_Writer.AddByteArray("BlockLight", BlockLight + Y * SliceSizeNibble, SliceSizeNibble); + a_Writer.AddByte("Y", (unsigned char)Y); + a_Writer.EndCompound(); + } + a_Writer.EndList(); // "Sections" + + // Store the information that the lighting is valid. + // For compatibility reason, the default is "invalid" (missing) - this means older data is re-lighted upon loading. + if (Serializer.IsLightValid()) + { + a_Writer.AddByte("MCSIsLightValid", 1); + } + + a_Writer.EndCompound(); // "Level" + return true; +} + + + + + +cChunkDef::BiomeMap * cWSSAnvil::LoadVanillaBiomeMapFromNBT(cChunkDef::BiomeMap * a_BiomeMap, const cParsedNBT & a_NBT, int a_TagIdx) +{ + if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_ByteArray)) + { + return NULL; + } + if (a_NBT.GetDataLength(a_TagIdx) != 16 * 16) + { + // The biomes stored don't match in size + return NULL; + } + const unsigned char * VanillaBiomeData = (const unsigned char *)(a_NBT.GetData(a_TagIdx)); + for (int i = 0; i < ARRAYCOUNT(*a_BiomeMap); i++) + { + if ((VanillaBiomeData)[i] == 0xff) + { + // Unassigned biomes + return NULL; + } + (*a_BiomeMap)[i] = (EMCSBiome)(VanillaBiomeData[i]); + } + return a_BiomeMap; +} + + + + + +cChunkDef::BiomeMap * cWSSAnvil::LoadBiomeMapFromNBT(cChunkDef::BiomeMap * a_BiomeMap, const cParsedNBT & a_NBT, int a_TagIdx) +{ + if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_IntArray)) + { + return NULL; + } + if (a_NBT.GetDataLength(a_TagIdx) != sizeof(*a_BiomeMap)) + { + // The biomes stored don't match in size + return NULL; + } + const int * BiomeData = (const int *)(a_NBT.GetData(a_TagIdx)); + for (int i = 0; i < ARRAYCOUNT(*a_BiomeMap); i++) + { + (*a_BiomeMap)[i] = (EMCSBiome)(ntohl(BiomeData[i])); + if ((*a_BiomeMap)[i] == 0xff) + { + // Unassigned biomes + return NULL; + } + } + return a_BiomeMap; +} + + + + + +void cWSSAnvil::LoadEntitiesFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_List)) + { + return; + } + + for (int Child = a_NBT.GetFirstChild(a_TagIdx); Child != -1; Child = a_NBT.GetNextSibling(Child)) + { + if (a_NBT.GetType(Child) != TAG_Compound) + { + continue; + } + int sID = a_NBT.FindChildByName(Child, "id"); + if (sID < 0) + { + continue; + } + LoadEntityFromNBT(a_Entities, a_NBT, Child, a_NBT.GetData(sID), a_NBT.GetDataLength(sID)); + } // for Child - a_NBT[] +} + + + + + +void cWSSAnvil::LoadBlockEntitiesFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE * a_BlockTypes, NIBBLETYPE * a_BlockMetas) +{ + if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_List)) + { + return; + } + + for (int Child = a_NBT.GetFirstChild(a_TagIdx); Child != -1; Child = a_NBT.GetNextSibling(Child)) + { + if (a_NBT.GetType(Child) != TAG_Compound) + { + continue; + } + int sID = a_NBT.FindChildByName(Child, "id"); + if (sID < 0) + { + continue; + } + if (strncmp(a_NBT.GetData(sID), "Chest", a_NBT.GetDataLength(sID)) == 0) + { + LoadChestFromNBT(a_BlockEntities, a_NBT, Child); + } + else if (strncmp(a_NBT.GetData(sID), "Dropper", a_NBT.GetDataLength(sID)) == 0) + { + LoadDropperFromNBT(a_BlockEntities, a_NBT, Child); + } + else if (strncmp(a_NBT.GetData(sID), "Furnace", a_NBT.GetDataLength(sID)) == 0) + { + LoadFurnaceFromNBT(a_BlockEntities, a_NBT, Child, a_BlockTypes, a_BlockMetas); + } + else if (strncmp(a_NBT.GetData(sID), "Hopper", a_NBT.GetDataLength(sID)) == 0) + { + LoadHopperFromNBT(a_BlockEntities, a_NBT, Child); + } + else if (strncmp(a_NBT.GetData(sID), "Music", a_NBT.GetDataLength(sID)) == 0) + { + LoadNoteFromNBT(a_BlockEntities, a_NBT, Child); + } + else if (strncmp(a_NBT.GetData(sID), "RecordPlayer", a_NBT.GetDataLength(sID)) == 0) + { + LoadJukeboxFromNBT(a_BlockEntities, a_NBT, Child); + } + else if (strncmp(a_NBT.GetData(sID), "Sign", a_NBT.GetDataLength(sID)) == 0) + { + LoadSignFromNBT(a_BlockEntities, a_NBT, Child); + } + else if (strncmp(a_NBT.GetData(sID), "Trap", a_NBT.GetDataLength(sID)) == 0) + { + LoadDispenserFromNBT(a_BlockEntities, a_NBT, Child); + } + // TODO: Other block entities + } // for Child - tag children +} + + + + + +bool cWSSAnvil::LoadItemFromNBT(cItem & a_Item, const cParsedNBT & a_NBT, int a_TagIdx) +{ + int ID = a_NBT.FindChildByName(a_TagIdx, "id"); + if ((ID < 0) || (a_NBT.GetType(ID) != TAG_Short)) + { + return false; + } + a_Item.m_ItemType = (ENUM_ITEM_ID)(a_NBT.GetShort(ID)); + + int Damage = a_NBT.FindChildByName(a_TagIdx, "Damage"); + if ((Damage < 0) || (a_NBT.GetType(Damage) != TAG_Short)) + { + return false; + } + a_Item.m_ItemDamage = a_NBT.GetShort(Damage); + + int Count = a_NBT.FindChildByName(a_TagIdx, "Count"); + if ((Count < 0) || (a_NBT.GetType(Count) != TAG_Byte)) + { + return false; + } + a_Item.m_ItemCount = a_NBT.GetByte(Count); + + // Find the "tag" tag, used for enchantments and other extra data + int TagTag = a_NBT.FindChildByName(a_TagIdx, "tag"); + if (TagTag <= 0) + { + // No extra data + return true; + } + + // Load enchantments: + const char * EnchName = (a_Item.m_ItemType == E_ITEM_BOOK) ? "StoredEnchantments" : "ench"; + int EnchTag = a_NBT.FindChildByName(TagTag, EnchName); + if (EnchTag > 0) + { + a_Item.m_Enchantments.ParseFromNBT(a_NBT, EnchTag); + } + + return true; +} + + + + + +void cWSSAnvil::LoadItemGridFromNBT(cItemGrid & a_ItemGrid, const cParsedNBT & a_NBT, int a_ItemsTagIdx, int a_SlotOffset) +{ + int NumSlots = a_ItemGrid.GetNumSlots(); + for (int Child = a_NBT.GetFirstChild(a_ItemsTagIdx); Child != -1; Child = a_NBT.GetNextSibling(Child)) + { + int SlotTag = a_NBT.FindChildByName(Child, "Slot"); + if ((SlotTag < 0) || (a_NBT.GetType(SlotTag) != TAG_Byte)) + { + continue; + } + int SlotNum = (int)(a_NBT.GetByte(SlotTag)) - a_SlotOffset; + if ((SlotNum < 0) || (SlotNum >= NumSlots)) + { + // SlotNum outside of the range + continue; + } + cItem Item; + if (LoadItemFromNBT(Item, a_NBT, Child)) + { + a_ItemGrid.SetSlot(SlotNum, Item); + } + } // for itr - ItemDefs[] +} + + + + + +void cWSSAnvil::LoadChestFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); + int x, y, z; + if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) + { + return; + } + int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); + if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) + { + return; // Make it an empty chest - the chunk loader will provide an empty cChestEntity for this + } + std::auto_ptr<cChestEntity> Chest(new cChestEntity(x, y, z, m_World)); + LoadItemGridFromNBT(Chest->GetContents(), a_NBT, Items); + a_BlockEntities.push_back(Chest.release()); +} + + + + + +void cWSSAnvil::LoadDispenserFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); + int x, y, z; + if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) + { + return; + } + int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); + if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) + { + return; // Make it an empty dispenser - the chunk loader will provide an empty cDispenserEntity for this + } + std::auto_ptr<cDispenserEntity> Dispenser(new cDispenserEntity(x, y, z, m_World)); + LoadItemGridFromNBT(Dispenser->GetContents(), a_NBT, Items); + a_BlockEntities.push_back(Dispenser.release()); +} + + + + + +void cWSSAnvil::LoadDropperFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); + int x, y, z; + if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) + { + return; + } + int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); + if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) + { + return; // Make it an empty dropper - the chunk loader will provide an empty cDropperEntity for this + } + std::auto_ptr<cDropperEntity> Dropper(new cDropperEntity(x, y, z, m_World)); + LoadItemGridFromNBT(Dropper->GetContents(), a_NBT, Items); + a_BlockEntities.push_back(Dropper.release()); +} + + + + + +void cWSSAnvil::LoadFurnaceFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx, BLOCKTYPE * a_BlockTypes, NIBBLETYPE * a_BlockMetas) +{ + ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); + int x, y, z; + if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) + { + return; + } + int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); + if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) + { + return; // Make it an empty furnace - the chunk loader will provide an empty cFurnaceEntity for this + } + + // Convert coords to relative: + int RelX = x; + int RelZ = z; + int ChunkX, ChunkZ; + cChunkDef::AbsoluteToRelative(RelX, y, RelZ, ChunkX, ChunkZ); + + // Create the furnace entity, with proper BlockType and BlockMeta info: + BLOCKTYPE BlockType = cChunkDef::GetBlock(a_BlockTypes, RelX, y, RelZ); + NIBBLETYPE BlockMeta = cChunkDef::GetNibble(a_BlockMetas, RelX, y, RelZ); + std::auto_ptr<cFurnaceEntity> Furnace(new cFurnaceEntity(x, y, z, BlockType, BlockMeta, m_World)); + + // Load slots: + for (int Child = a_NBT.GetFirstChild(Items); Child != -1; Child = a_NBT.GetNextSibling(Child)) + { + int Slot = a_NBT.FindChildByName(Child, "Slot"); + if ((Slot < 0) || (a_NBT.GetType(Slot) != TAG_Byte)) + { + continue; + } + cItem Item; + if (LoadItemFromNBT(Item, a_NBT, Child)) + { + Furnace->SetSlot(a_NBT.GetByte(Slot), Item); + } + } // for itr - ItemDefs[] + + // Load burn time: + int BurnTime = a_NBT.FindChildByName(a_TagIdx, "BurnTime"); + if (BurnTime >= 0) + { + Int16 bt = a_NBT.GetShort(BurnTime); + // Anvil doesn't store the time that the fuel can burn. We simply "reset" the current value to be the 100% + Furnace->SetBurnTimes(bt, 0); + } + + // Load cook time: + int CookTime = a_NBT.FindChildByName(a_TagIdx, "CookTime"); + if (CookTime >= 0) + { + Int16 ct = a_NBT.GetShort(CookTime); + // Anvil doesn't store the time that an item takes to cook. We simply use the default - 10 seconds (200 ticks) + Furnace->SetCookTimes(200, ct); + } + + // Restart cooking: + Furnace->ContinueCooking(); + a_BlockEntities.push_back(Furnace.release()); +} + + + + + +void cWSSAnvil::LoadHopperFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); + int x, y, z; + if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) + { + return; + } + int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); + if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) + { + return; // Make it an empty hopper - the chunk loader will provide an empty cHopperEntity for this + } + std::auto_ptr<cHopperEntity> Hopper(new cHopperEntity(x, y, z, m_World)); + LoadItemGridFromNBT(Hopper->GetContents(), a_NBT, Items); + a_BlockEntities.push_back(Hopper.release()); +} + + + + + +void cWSSAnvil::LoadJukeboxFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); + int x, y, z; + if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) + { + return; + } + std::auto_ptr<cJukeboxEntity> Jukebox(new cJukeboxEntity(x, y, z, m_World)); + int Record = a_NBT.FindChildByName(a_TagIdx, "Record"); + if (Record >= 0) + { + Jukebox->SetRecord(a_NBT.GetInt(Record)); + } + a_BlockEntities.push_back(Jukebox.release()); +} + + + + + +void cWSSAnvil::LoadNoteFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); + int x, y, z; + if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) + { + return; + } + std::auto_ptr<cNoteEntity> Note(new cNoteEntity(x, y, z, m_World)); + int note = a_NBT.FindChildByName(a_TagIdx, "note"); + if (note >= 0) + { + Note->SetPitch(a_NBT.GetByte(note)); + } + a_BlockEntities.push_back(Note.release()); +} + + + + + +void cWSSAnvil::LoadSignFromNBT(cBlockEntityList & a_BlockEntities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + ASSERT(a_NBT.GetType(a_TagIdx) == TAG_Compound); + int x, y, z; + if (!GetBlockEntityNBTPos(a_NBT, a_TagIdx, x, y, z)) + { + return; + } + std::auto_ptr<cSignEntity> Sign(new cSignEntity(E_BLOCK_SIGN_POST, x, y, z, m_World)); + + int currentLine = a_NBT.FindChildByName(a_TagIdx, "Text1"); + if (currentLine >= 0) + { + Sign->SetLine(0, a_NBT.GetString(currentLine)); + } + + currentLine = a_NBT.FindChildByName(a_TagIdx, "Text2"); + if (currentLine >= 0) + { + Sign->SetLine(1, a_NBT.GetString(currentLine)); + } + + currentLine = a_NBT.FindChildByName(a_TagIdx, "Text3"); + if (currentLine >= 0) + { + Sign->SetLine(2, a_NBT.GetString(currentLine)); + } + + currentLine = a_NBT.FindChildByName(a_TagIdx, "Text4"); + if (currentLine >= 0) + { + Sign->SetLine(3, a_NBT.GetString(currentLine)); + } + + a_BlockEntities.push_back(Sign.release()); +} + + + + + +void cWSSAnvil::LoadEntityFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_EntityTagIdx, const char * a_IDTag, int a_IDTagLength) +{ + if (strncmp(a_IDTag, "Boat", a_IDTagLength) == 0) + { + LoadBoatFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "FallingBlock", a_IDTagLength) == 0) + { + LoadFallingBlockFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "Minecart", a_IDTagLength) == 0) + { + // It is a minecart, old style, find out the type: + int TypeTag = a_NBT.FindChildByName(a_EntityTagIdx, "Type"); + if ((TypeTag < 0) || (a_NBT.GetType(TypeTag) != TAG_Int)) + { + return; + } + switch (a_NBT.GetInt(TypeTag)) + { + case 0: LoadMinecartRFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Rideable minecart + case 1: LoadMinecartCFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Minecart with chest + case 2: LoadMinecartFFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Minecart with furnace + case 3: LoadMinecartTFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Minecart with TNT + case 4: LoadMinecartHFromNBT(a_Entities, a_NBT, a_EntityTagIdx); break; // Minecart with Hopper + } + } + else if (strncmp(a_IDTag, "MinecartRideable", a_IDTagLength) == 0) + { + LoadMinecartRFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "MinecartChest", a_IDTagLength) == 0) + { + LoadMinecartCFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "MinecartFurnace", a_IDTagLength) == 0) + { + LoadMinecartFFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "MinecartTNT", a_IDTagLength) == 0) + { + LoadMinecartTFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "MinecartHopper", a_IDTagLength) == 0) + { + LoadMinecartHFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "Item", a_IDTagLength) == 0) + { + LoadPickupFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "Arrow", a_IDTagLength) == 0) + { + LoadArrowFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "Snowball", a_IDTagLength) == 0) + { + LoadSnowballFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "Egg", a_IDTagLength) == 0) + { + LoadEggFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "Fireball", a_IDTagLength) == 0) + { + LoadFireballFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "SmallFireball", a_IDTagLength) == 0) + { + LoadFireChargeFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + else if (strncmp(a_IDTag, "ThrownEnderpearl", a_IDTagLength) == 0) + { + LoadThrownEnderpearlFromNBT(a_Entities, a_NBT, a_EntityTagIdx); + } + // TODO: other entities +} + + + + + +void cWSSAnvil::LoadBoatFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + std::auto_ptr<cBoat> Boat(new cBoat(0, 0, 0)); + if (!LoadEntityBaseFromNBT(*Boat.get(), a_NBT, a_TagIdx)) + { + return; + } + a_Entities.push_back(Boat.release()); +} + + + + + +void cWSSAnvil::LoadFallingBlockFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + // TODO +} + + + + + +void cWSSAnvil::LoadMinecartRFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + std::auto_ptr<cEmptyMinecart> Minecart(new cEmptyMinecart(0, 0, 0)); + if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx)) + { + return; + } + a_Entities.push_back(Minecart.release()); +} + + + + + +void cWSSAnvil::LoadMinecartCFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + int Items = a_NBT.FindChildByName(a_TagIdx, "Items"); + if ((Items < 0) || (a_NBT.GetType(Items) != TAG_List)) + { + return; // Make it an empty chest - the chunk loader will provide an empty cChestEntity for this + } + std::auto_ptr<cMinecartWithChest> Minecart(new cMinecartWithChest(0, 0, 0)); + if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx)) + { + return; + } + for (int Child = a_NBT.GetFirstChild(Items); Child != -1; Child = a_NBT.GetNextSibling(Child)) + { + int Slot = a_NBT.FindChildByName(Child, "Slot"); + if ((Slot < 0) || (a_NBT.GetType(Slot) != TAG_Byte)) + { + continue; + } + cItem Item; + if (LoadItemFromNBT(Item, a_NBT, Child)) + { + Minecart->SetSlot(a_NBT.GetByte(Slot), Item); + } + } // for itr - ItemDefs[] + a_Entities.push_back(Minecart.release()); +} + + + + + +void cWSSAnvil::LoadMinecartFFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + std::auto_ptr<cMinecartWithFurnace> Minecart(new cMinecartWithFurnace(0, 0, 0)); + if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx)) + { + return; + } + + // TODO: Load the Push and Fuel tags + + a_Entities.push_back(Minecart.release()); +} + + + + + +void cWSSAnvil::LoadMinecartTFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + std::auto_ptr<cMinecartWithTNT> Minecart(new cMinecartWithTNT(0, 0, 0)); + if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx)) + { + return; + } + + // TODO: Everything to do with TNT carts + + a_Entities.push_back(Minecart.release()); +} + + + + + +void cWSSAnvil::LoadMinecartHFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + std::auto_ptr<cMinecartWithHopper> Minecart(new cMinecartWithHopper(0, 0, 0)); + if (!LoadEntityBaseFromNBT(*Minecart.get(), a_NBT, a_TagIdx)) + { + return; + } + + // TODO: Everything to do with hopper carts + + a_Entities.push_back(Minecart.release()); +} + + + + + +void cWSSAnvil::LoadPickupFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + int ItemTag = a_NBT.FindChildByName(a_TagIdx, "Item"); + if ((ItemTag < 0) || (a_NBT.GetType(ItemTag) != TAG_Compound)) + { + return; + } + cItem Item; + if (!LoadItemFromNBT(Item, a_NBT, ItemTag)) + { + return; + } + std::auto_ptr<cPickup> Pickup(new cPickup(0, 0, 0, Item, false)); // Pickup delay doesn't matter, just say false + if (!LoadEntityBaseFromNBT(*Pickup.get(), a_NBT, a_TagIdx)) + { + return; + } + a_Entities.push_back(Pickup.release()); +} + + + + + +void cWSSAnvil::LoadArrowFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + std::auto_ptr<cArrowEntity> Arrow(new cArrowEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0))); + if (!LoadProjectileBaseFromNBT(*Arrow.get(), a_NBT, a_TagIdx)) + { + return; + } + + // Load pickup state: + int PickupIdx = a_NBT.FindChildByName(a_TagIdx, "pickup"); + if (PickupIdx > 0) + { + Arrow->SetPickupState((cArrowEntity::ePickupState)a_NBT.GetByte(PickupIdx)); + } + else + { + // Try the older "player" tag: + int PlayerIdx = a_NBT.FindChildByName(a_TagIdx, "player"); + if (PlayerIdx > 0) + { + Arrow->SetPickupState((a_NBT.GetByte(PlayerIdx) == 0) ? cArrowEntity::psNoPickup : cArrowEntity::psInSurvivalOrCreative); + } + } + + // Load damage: + int DamageIdx = a_NBT.FindChildByName(a_TagIdx, "damage"); + if (DamageIdx > 0) + { + Arrow->SetDamageCoeff(a_NBT.GetDouble(DamageIdx)); + } + + // Store the new arrow in the entities list: + a_Entities.push_back(Arrow.release()); +} + + + + + +void cWSSAnvil::LoadSnowballFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + std::auto_ptr<cThrownSnowballEntity> Snowball(new cThrownSnowballEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0))); + if (!LoadProjectileBaseFromNBT(*Snowball.get(), a_NBT, a_TagIdx)) + { + return; + } + + // Store the new snowball in the entities list: + a_Entities.push_back(Snowball.release()); +} + + + + + +void cWSSAnvil::LoadEggFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + std::auto_ptr<cThrownEggEntity> Egg(new cThrownEggEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0))); + if (!LoadProjectileBaseFromNBT(*Egg.get(), a_NBT, a_TagIdx)) + { + return; + } + + // Store the new egg in the entities list: + a_Entities.push_back(Egg.release()); +} + + + + + +void cWSSAnvil::LoadFireballFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + std::auto_ptr<cGhastFireballEntity> Fireball(new cGhastFireballEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0))); + if (!LoadProjectileBaseFromNBT(*Fireball.get(), a_NBT, a_TagIdx)) + { + return; + } + + // Store the new fireball in the entities list: + a_Entities.push_back(Fireball.release()); +} + + + + + +void cWSSAnvil::LoadFireChargeFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + std::auto_ptr<cFireChargeEntity> FireCharge(new cFireChargeEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0))); + if (!LoadProjectileBaseFromNBT(*FireCharge.get(), a_NBT, a_TagIdx)) + { + return; + } + + // Store the new FireCharge in the entities list: + a_Entities.push_back(FireCharge.release()); +} + + + + + +void cWSSAnvil::LoadThrownEnderpearlFromNBT(cEntityList & a_Entities, const cParsedNBT & a_NBT, int a_TagIdx) +{ + std::auto_ptr<cThrownEnderPearlEntity> Enderpearl(new cThrownEnderPearlEntity(NULL, 0, 0, 0, Vector3d(0, 0, 0))); + if (!LoadProjectileBaseFromNBT(*Enderpearl.get(), a_NBT, a_TagIdx)) + { + return; + } + + // Store the new enderpearl in the entities list: + a_Entities.push_back(Enderpearl.release()); +} + + + + + +bool cWSSAnvil::LoadEntityBaseFromNBT(cEntity & a_Entity, const cParsedNBT & a_NBT, int a_TagIdx) +{ + double Pos[3]; + if (!LoadDoublesListFromNBT(Pos, 3, a_NBT, a_NBT.FindChildByName(a_TagIdx, "Pos"))) + { + return false; + } + a_Entity.SetPosition(Pos[0], Pos[1], Pos[2]); + + double Speed[3]; + if (!LoadDoublesListFromNBT(Speed, 3, a_NBT, a_NBT.FindChildByName(a_TagIdx, "Motion"))) + { + return false; + } + a_Entity.SetSpeed(Speed[0], Speed[1], Speed[2]); + + double Rotation[3]; + if (!LoadDoublesListFromNBT(Rotation, 2, a_NBT, a_NBT.FindChildByName(a_TagIdx, "Rotation"))) + { + return false; + } + a_Entity.SetRotation(Rotation[0]); + a_Entity.SetRoll (Rotation[1]); + + return true; +} + + + + + +bool cWSSAnvil::LoadProjectileBaseFromNBT(cProjectileEntity & a_Entity, const cParsedNBT & a_NBT, int a_TagIdx) +{ + if (!LoadEntityBaseFromNBT(a_Entity, a_NBT, a_TagIdx)) + { + return false; + } + + bool IsInGround = false; + int InGroundIdx = a_NBT.FindChildByName(a_TagIdx, "inGround"); + if (InGroundIdx > 0) + { + IsInGround = (a_NBT.GetByte(InGroundIdx) != 0); + } + a_Entity.SetIsInGround(IsInGround); + + // TODO: Load inTile, TileCoords + + return true; +} + + + + + +bool cWSSAnvil::LoadDoublesListFromNBT(double * a_Doubles, int a_NumDoubles, const cParsedNBT & a_NBT, int a_TagIdx) +{ + if ((a_TagIdx < 0) || (a_NBT.GetType(a_TagIdx) != TAG_List) || (a_NBT.GetChildrenType(a_TagIdx) != TAG_Double)) + { + return false; + } + int idx = 0; + for (int Tag = a_NBT.GetFirstChild(a_TagIdx); (Tag > 0) && (idx < a_NumDoubles); Tag = a_NBT.GetNextSibling(Tag), ++idx) + { + a_Doubles[idx] = a_NBT.GetDouble(Tag); + } // for Tag - PosTag[] + return (idx == a_NumDoubles); // Did we read enough doubles? +} + + + + + +bool cWSSAnvil::GetBlockEntityNBTPos(const cParsedNBT & a_NBT, int a_TagIdx, int & a_X, int & a_Y, int & a_Z) +{ + int x = a_NBT.FindChildByName(a_TagIdx, "x"); + if ((x < 0) || (a_NBT.GetType(x) != TAG_Int)) + { + return false; + } + int y = a_NBT.FindChildByName(a_TagIdx, "y"); + if ((y < 0) || (a_NBT.GetType(y) != TAG_Int)) + { + return false; + } + int z = a_NBT.FindChildByName(a_TagIdx, "z"); + if ((z < 0) || (a_NBT.GetType(z) != TAG_Int)) + { + return false; + } + a_X = a_NBT.GetInt(x); + a_Y = a_NBT.GetInt(y); + a_Z = a_NBT.GetInt(z); + return true; +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cWSSAnvil::cMCAFile: + +cWSSAnvil::cMCAFile::cMCAFile(const AString & a_FileName, int a_RegionX, int a_RegionZ) : + m_RegionX(a_RegionX), + m_RegionZ(a_RegionZ), + m_FileName(a_FileName) +{ +} + + + + + +bool cWSSAnvil::cMCAFile::OpenFile(bool a_IsForReading) +{ + if (m_File.IsOpen()) + { + // Already open + return true; + } + + if (a_IsForReading) + { + if (!cFile::Exists(m_FileName)) + { + // We want to read and the file doesn't exist. Fail. + return false; + } + } + + if (!m_File.Open(m_FileName, cFile::fmReadWrite)) + { + // The file failed to open + return false; + } + + // Load the header: + if (m_File.Read(m_Header, sizeof(m_Header)) != sizeof(m_Header)) + { + // Cannot read the header - perhaps the file has just been created? + // Try writing a NULL header (both chunk offsets and timestamps): + memset(m_Header, 0, sizeof(m_Header)); + if ( + (m_File.Write(m_Header, sizeof(m_Header)) != sizeof(m_Header)) || // Real header - chunk offsets + (m_File.Write(m_Header, sizeof(m_Header)) != sizeof(m_Header)) // Bogus data for the chunk timestamps + ) + { + LOGWARNING("Cannot process MCA header in file \"%s\", chunks in that file will be lost", m_FileName.c_str()); + m_File.Close(); + return false; + } + } + return true; +} + + + + + +bool cWSSAnvil::cMCAFile::GetChunkData(const cChunkCoords & a_Chunk, AString & a_Data) +{ + if (!OpenFile(true)) + { + return false; + } + + int LocalX = a_Chunk.m_ChunkX % 32; + if (LocalX < 0) + { + LocalX = 32 + LocalX; + } + int LocalZ = a_Chunk.m_ChunkZ % 32; + if (LocalZ < 0) + { + LocalZ = 32 + LocalZ; + } + unsigned ChunkLocation = ntohl(m_Header[LocalX + 32 * LocalZ]); + unsigned ChunkOffset = ChunkLocation >> 8; + + m_File.Seek(ChunkOffset * 4096); + + int ChunkSize = 0; + if (m_File.Read(&ChunkSize, 4) != 4) + { + return false; + } + ChunkSize = ntohl(ChunkSize); + char CompressionType = 0; + if (m_File.Read(&CompressionType, 1) != 1) + { + return false; + } + if (CompressionType != 2) + { + // Chunk is in an unknown compression + return false; + } + ChunkSize--; + + // HACK: This depends on the internal knowledge that AString's data() function returns the internal buffer directly + a_Data.assign(ChunkSize, '\0'); + return (m_File.Read((void *)a_Data.data(), ChunkSize) == ChunkSize); +} + + + + + +bool cWSSAnvil::cMCAFile::SetChunkData(const cChunkCoords & a_Chunk, const AString & a_Data) +{ + if (!OpenFile(false)) + { + LOGWARNING("Cannot save chunk [%d, %d], opening file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); + return false; + } + + int LocalX = a_Chunk.m_ChunkX % 32; + if (LocalX < 0) + { + LocalX = 32 + LocalX; + } + int LocalZ = a_Chunk.m_ChunkZ % 32; + if (LocalZ < 0) + { + LocalZ = 32 + LocalZ; + } + + unsigned ChunkSector = FindFreeLocation(LocalX, LocalZ, a_Data); + + // Store the chunk data: + m_File.Seek(ChunkSector * 4096); + unsigned ChunkSize = htonl(a_Data.size() + 1); + if (m_File.Write(&ChunkSize, 4) != 4) + { + LOGWARNING("Cannot save chunk [%d, %d], writing(1) data to file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); + return false; + } + char CompressionType = 2; + if (m_File.Write(&CompressionType, 1) != 1) + { + LOGWARNING("Cannot save chunk [%d, %d], writing(2) data to file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); + return false; + } + if (m_File.Write(a_Data.data(), a_Data.size()) != (int)(a_Data.size())) + { + LOGWARNING("Cannot save chunk [%d, %d], writing(3) data to file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); + return false; + } + + // Store the header: + ChunkSize = (a_Data.size() + MCA_CHUNK_HEADER_LENGTH + 4095) / 4096; // Round data size *up* to nearest 4KB sector, make it a sector number + ASSERT(ChunkSize < 256); + m_Header[LocalX + 32 * LocalZ] = htonl((ChunkSector << 8) | ChunkSize); + if (m_File.Seek(0) < 0) + { + LOGWARNING("Cannot save chunk [%d, %d], seeking in file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); + return false; + } + if (m_File.Write(m_Header, sizeof(m_Header)) != sizeof(m_Header)) + { + LOGWARNING("Cannot save chunk [%d, %d], writing header to file \"%s\" failed", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, GetFileName().c_str()); + return false; + } + + return true; +} + + + + + +unsigned cWSSAnvil::cMCAFile::FindFreeLocation(int a_LocalX, int a_LocalZ, const AString & a_Data) +{ + // See if it fits the current location: + unsigned ChunkLocation = ntohl(m_Header[a_LocalX + 32 * a_LocalZ]); + unsigned ChunkLen = ChunkLocation & 0xff; + if (a_Data.size() + MCA_CHUNK_HEADER_LENGTH <= (ChunkLen * 4096)) + { + return ChunkLocation >> 8; + } + + // Doesn't fit, append to the end of file (we're wasting a lot of space, TODO: fix this later) + unsigned MaxLocation = 2 << 8; // Minimum sector is #2 - after the headers + for (int i = 0; i < ARRAYCOUNT(m_Header); i++) + { + ChunkLocation = ntohl(m_Header[i]); + ChunkLocation = ChunkLocation + ((ChunkLocation & 0xff) << 8); // Add the number of sectors used; don't care about the 4th byte + if (MaxLocation < ChunkLocation) + { + MaxLocation = ChunkLocation; + } + } // for i - m_Header[] + return MaxLocation >> 8; +} + + + + diff --git a/source/WorldStorage/WSSAnvil.h b/src/WorldStorage/WSSAnvil.h index 7685d2236..7685d2236 100644 --- a/source/WorldStorage/WSSAnvil.h +++ b/src/WorldStorage/WSSAnvil.h diff --git a/src/WorldStorage/WSSCompact.cpp b/src/WorldStorage/WSSCompact.cpp new file mode 100644 index 000000000..287938b24 --- /dev/null +++ b/src/WorldStorage/WSSCompact.cpp @@ -0,0 +1,1009 @@ + +// WSSCompact.cpp + +// Interfaces to the cWSSCompact class representing the "compact" storage schema (PAK-files) + +#include "Globals.h" +#include "WSSCompact.h" +#include "../World.h" +#include "zlib/zlib.h" +#include "json/json.h" +#include "../StringCompression.h" +#include "../BlockEntities/ChestEntity.h" +#include "../BlockEntities/DispenserEntity.h" +#include "../BlockEntities/FurnaceEntity.h" +#include "../BlockEntities/JukeboxEntity.h" +#include "../BlockEntities/NoteEntity.h" +#include "../BlockEntities/SignEntity.h" + + + + + +#pragma pack(push, 1) +/// The chunk header, as stored in the file: +struct cWSSCompact::sChunkHeader +{ + int m_ChunkX; + int m_ChunkZ; + int m_CompressedSize; + int m_UncompressedSize; +} ; +#pragma pack(pop) + + + + + +/// The maximum number of PAK files that are cached +const int MAX_PAK_FILES = 16; + +/// The maximum number of unsaved chunks before the cPAKFile saves them to disk +const int MAX_DIRTY_CHUNKS = 16; + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cJsonChunkSerializer: + +cJsonChunkSerializer::cJsonChunkSerializer(void) : + m_HasJsonData(false) +{ +} + + + + + +void cJsonChunkSerializer::Entity(cEntity * a_Entity) +{ + // TODO: a_Entity->SaveToJson(m_Root); +} + + + + + +void cJsonChunkSerializer::BlockEntity(cBlockEntity * a_BlockEntity) +{ + const char * SaveInto = NULL; + switch (a_BlockEntity->GetBlockType()) + { + case E_BLOCK_CHEST: SaveInto = "Chests"; break; + case E_BLOCK_DISPENSER: SaveInto = "Dispensers"; break; + case E_BLOCK_DROPPER: SaveInto = "Droppers"; break; + case E_BLOCK_FURNACE: SaveInto = "Furnaces"; break; + case E_BLOCK_SIGN_POST: SaveInto = "Signs"; break; + case E_BLOCK_WALLSIGN: SaveInto = "Signs"; break; + case E_BLOCK_NOTE_BLOCK: SaveInto = "Notes"; break; + case E_BLOCK_JUKEBOX: SaveInto = "Jukeboxes"; break; + + default: + { + ASSERT(!"Unhandled blocktype in BlockEntities list while saving to JSON"); + break; + } + } // switch (BlockEntity->GetBlockType()) + if (SaveInto == NULL) + { + return; + } + + Json::Value val; + a_BlockEntity->SaveToJson(val); + m_Root[SaveInto].append(val); + m_HasJsonData = true; +} + + + + + +bool cJsonChunkSerializer::LightIsValid(bool a_IsLightValid) +{ + if (!a_IsLightValid) + { + return false; + } + m_Root["IsLightValid"] = true; + m_HasJsonData = true; + return true; +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cWSSCompact: + +cWSSCompact::~cWSSCompact() +{ + for (cPAKFiles::iterator itr = m_PAKFiles.begin(); itr != m_PAKFiles.end(); ++itr) + { + delete *itr; + } +} + + + + + +bool cWSSCompact::LoadChunk(const cChunkCoords & a_Chunk) +{ + AString ChunkData; + int UncompressedSize = 0; + if (!GetChunkData(a_Chunk, UncompressedSize, ChunkData)) + { + // The reason for failure is already printed in GetChunkData() + return false; + } + + return LoadChunkFromData(a_Chunk, UncompressedSize, ChunkData, m_World); +} + + + + + +bool cWSSCompact::SaveChunk(const cChunkCoords & a_Chunk) +{ + cCSLock Lock(m_CS); + + cPAKFile * f = LoadPAKFile(a_Chunk); + if (f == NULL) + { + // For some reason we couldn't locate the file + LOG("Cannot locate a proper PAK file for chunk [%d, %d]", a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ); + return false; + } + return f->SaveChunk(a_Chunk, m_World); +} + + + + + +cWSSCompact::cPAKFile * cWSSCompact::LoadPAKFile(const cChunkCoords & a_Chunk) +{ + // ASSUMES that m_CS has been locked + + // We need to retain this weird conversion code, because some edge chunks are in the wrong PAK file + const int LayerX = FAST_FLOOR_DIV(a_Chunk.m_ChunkX, 32); + const int LayerZ = FAST_FLOOR_DIV(a_Chunk.m_ChunkZ, 32); + + // Is it already cached? + for (cPAKFiles::iterator itr = m_PAKFiles.begin(); itr != m_PAKFiles.end(); ++itr) + { + if (((*itr) != NULL) && ((*itr)->GetLayerX() == LayerX) && ((*itr)->GetLayerZ() == LayerZ)) + { + // Move the file to front and return it: + cPAKFile * f = *itr; + if (itr != m_PAKFiles.begin()) + { + m_PAKFiles.erase(itr); + m_PAKFiles.push_front(f); + } + return f; + } + } + + // Load it anew: + AString FileName; + Printf(FileName, "%s/X%i_Z%i.pak", m_World->GetName().c_str(), LayerX, LayerZ ); + cPAKFile * f = new cPAKFile(FileName, LayerX, LayerZ); + if (f == NULL) + { + return NULL; + } + m_PAKFiles.push_front(f); + + // If there are too many PAK files cached, delete the last one used: + if (m_PAKFiles.size() > MAX_PAK_FILES) + { + delete m_PAKFiles.back(); + m_PAKFiles.pop_back(); + } + return f; +} + + + + + +bool cWSSCompact::GetChunkData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, AString & a_Data) +{ + cCSLock Lock(m_CS); + cPAKFile * f = LoadPAKFile(a_Chunk); + if (f == NULL) + { + return false; + } + return f->GetChunkData(a_Chunk, a_UncompressedSize, a_Data); +} + + + + + +/* +// TODO: Rewrite saving to use the same principles as loading +bool cWSSCompact::SetChunkData(const cChunkCoords & a_Chunk, int a_UncompressedSize, const AString & a_Data) +{ + cCSLock Lock(m_CS); + cPAKFile * f = LoadPAKFile(a_Chunk); + if (f == NULL) + { + return false; + } + return f->SetChunkData(a_Chunk, a_UncompressedSize, a_Data); +} +*/ + + + + + +bool cWSSCompact::EraseChunkData(const cChunkCoords & a_Chunk) +{ + cCSLock Lock(m_CS); + cPAKFile * f = LoadPAKFile(a_Chunk); + if (f == NULL) + { + return false; + } + return f->EraseChunkData(a_Chunk); +} + + + + + +void cWSSCompact::LoadEntitiesFromJson(Json::Value & a_Value, cEntityList & a_Entities, cBlockEntityList & a_BlockEntities, cWorld * a_World) +{ + // Load chests + Json::Value AllChests = a_Value.get("Chests", Json::nullValue); + if (!AllChests.empty()) + { + for (Json::Value::iterator itr = AllChests.begin(); itr != AllChests.end(); ++itr ) + { + Json::Value & Chest = *itr; + cChestEntity * ChestEntity = new cChestEntity(0,0,0, a_World); + if (!ChestEntity->LoadFromJson( Chest ) ) + { + LOGERROR("ERROR READING CHEST FROM JSON!" ); + delete ChestEntity; + } + else + { + a_BlockEntities.push_back( ChestEntity ); + } + } // for itr - AllChests[] + } + + // Load dispensers + Json::Value AllDispensers = a_Value.get("Dispensers", Json::nullValue); + if( !AllDispensers.empty() ) + { + for( Json::Value::iterator itr = AllDispensers.begin(); itr != AllDispensers.end(); ++itr ) + { + Json::Value & Dispenser = *itr; + cDispenserEntity * DispenserEntity = new cDispenserEntity(0,0,0, a_World); + if( !DispenserEntity->LoadFromJson( Dispenser ) ) + { + LOGERROR("ERROR READING DISPENSER FROM JSON!" ); + delete DispenserEntity; + } + else + { + a_BlockEntities.push_back( DispenserEntity ); + } + } // for itr - AllDispensers[] + } + + // Load furnaces + Json::Value AllFurnaces = a_Value.get("Furnaces", Json::nullValue); + if( !AllFurnaces.empty() ) + { + for( Json::Value::iterator itr = AllFurnaces.begin(); itr != AllFurnaces.end(); ++itr ) + { + Json::Value & Furnace = *itr; + // TODO: The block type and meta aren't correct, there's no way to get them here + cFurnaceEntity * FurnaceEntity = new cFurnaceEntity(0, 0, 0, E_BLOCK_FURNACE, 0, a_World); + if (!FurnaceEntity->LoadFromJson(Furnace)) + { + LOGERROR("ERROR READING FURNACE FROM JSON!" ); + delete FurnaceEntity; + } + else + { + a_BlockEntities.push_back(FurnaceEntity); + } + } // for itr - AllFurnaces[] + } + + // Load signs + Json::Value AllSigns = a_Value.get("Signs", Json::nullValue); + if( !AllSigns.empty() ) + { + for( Json::Value::iterator itr = AllSigns.begin(); itr != AllSigns.end(); ++itr ) + { + Json::Value & Sign = *itr; + cSignEntity * SignEntity = new cSignEntity( E_BLOCK_SIGN_POST, 0,0,0, a_World); + if ( !SignEntity->LoadFromJson( Sign ) ) + { + LOGERROR("ERROR READING SIGN FROM JSON!" ); + delete SignEntity; + } + else + { + a_BlockEntities.push_back( SignEntity ); + } + } // for itr - AllSigns[] + } + + // Load note blocks + Json::Value AllNotes = a_Value.get("Notes", Json::nullValue); + if( !AllNotes.empty() ) + { + for( Json::Value::iterator itr = AllNotes.begin(); itr != AllNotes.end(); ++itr ) + { + Json::Value & Note = *itr; + cNoteEntity * NoteEntity = new cNoteEntity(0, 0, 0, a_World); + if ( !NoteEntity->LoadFromJson( Note ) ) + { + LOGERROR("ERROR READING NOTE BLOCK FROM JSON!" ); + delete NoteEntity; + } + else + { + a_BlockEntities.push_back( NoteEntity ); + } + } // for itr - AllNotes[] + } + + // Load jukeboxes + Json::Value AllJukeboxes = a_Value.get("Jukeboxes", Json::nullValue); + if( !AllJukeboxes.empty() ) + { + for( Json::Value::iterator itr = AllJukeboxes.begin(); itr != AllJukeboxes.end(); ++itr ) + { + Json::Value & Jukebox = *itr; + cJukeboxEntity * JukeboxEntity = new cJukeboxEntity(0, 0, 0, a_World); + if ( !JukeboxEntity->LoadFromJson( Jukebox ) ) + { + LOGERROR("ERROR READING JUKEBOX FROM JSON!" ); + delete JukeboxEntity; + } + else + { + a_BlockEntities.push_back( JukeboxEntity ); + } + } // for itr - AllJukeboxes[] + } +} + + + + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// cWSSCompact::cPAKFile + +#define READ(Var) \ + if (f.Read(&Var, sizeof(Var)) != sizeof(Var)) \ + { \ + LOGERROR("ERROR READING %s FROM FILE %s (line %d); file offset %d", #Var, m_FileName.c_str(), __LINE__, f.Tell()); \ + return; \ + } + +cWSSCompact::cPAKFile::cPAKFile(const AString & a_FileName, int a_LayerX, int a_LayerZ) : + m_FileName(a_FileName), + m_LayerX(a_LayerX), + m_LayerZ(a_LayerZ), + m_NumDirty(0), + m_ChunkVersion( CHUNK_VERSION ), // Init with latest version + m_PakVersion( PAK_VERSION ) +{ + cFile f; + if (!f.Open(m_FileName, cFile::fmRead)) + { + return; + } + + // Read headers: + READ(m_PakVersion); + if (m_PakVersion != 1) + { + LOGERROR("File \"%s\" is in an unknown pak format (%d)", m_FileName.c_str(), m_PakVersion); + return; + } + + READ(m_ChunkVersion); + switch( m_ChunkVersion ) + { + case 1: + m_ChunkSize.Set(16, 128, 16); + break; + case 2: + case 3: + m_ChunkSize.Set(16, 256, 16); + break; + default: + LOGERROR("File \"%s\" is in an unknown chunk format (%d)", m_FileName.c_str(), m_ChunkVersion); + return; + }; + + short NumChunks = 0; + READ(NumChunks); + + // Read chunk headers: + for (int i = 0; i < NumChunks; i++) + { + sChunkHeader * Header = new sChunkHeader; + READ(*Header); + m_ChunkHeaders.push_back(Header); + } // for i - chunk headers + + // Read chunk data: + if (f.ReadRestOfFile(m_DataContents) == -1) + { + LOGERROR("Cannot read file \"%s\" contents", m_FileName.c_str()); + return; + } + + if( m_ChunkVersion == 1 ) // Convert chunks to version 2 + { + UpdateChunk1To2(); + } +#if AXIS_ORDER == AXIS_ORDER_XZY + if( m_ChunkVersion == 2 ) // Convert chunks to version 3 + { + UpdateChunk2To3(); + } +#endif +} + + + + + +cWSSCompact::cPAKFile::~cPAKFile() +{ + if (m_NumDirty > 0) + { + SynchronizeFile(); + } + for (sChunkHeaders::iterator itr = m_ChunkHeaders.begin(); itr != m_ChunkHeaders.end(); ++itr) + { + delete *itr; + } +} + + + + + +bool cWSSCompact::cPAKFile::GetChunkData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, AString & a_Data) +{ + int ChunkX = a_Chunk.m_ChunkX; + int ChunkZ = a_Chunk.m_ChunkZ; + sChunkHeader * Header = NULL; + int Offset = 0; + for (sChunkHeaders::iterator itr = m_ChunkHeaders.begin(); itr != m_ChunkHeaders.end(); ++itr) + { + if (((*itr)->m_ChunkX == ChunkX) && ((*itr)->m_ChunkZ == ChunkZ)) + { + Header = *itr; + break; + } + Offset += (*itr)->m_CompressedSize; + } + if ((Header == NULL) || (Offset + Header->m_CompressedSize > (int)m_DataContents.size())) + { + // Chunk not found / data invalid + return false; + } + + a_UncompressedSize = Header->m_UncompressedSize; + a_Data.assign(m_DataContents, Offset, Header->m_CompressedSize); + return true; +} + + + + + +bool cWSSCompact::cPAKFile::SaveChunk(const cChunkCoords & a_Chunk, cWorld * a_World) +{ + if (!SaveChunkToData(a_Chunk, a_World)) + { + return false; + } + if (m_NumDirty > MAX_DIRTY_CHUNKS) + { + SynchronizeFile(); + } + return true; +} + + + + + +void cWSSCompact::cPAKFile::UpdateChunk1To2() +{ + int Offset = 0; + AString NewDataContents; + int ChunksConverted = 0; + for (sChunkHeaders::iterator itr = m_ChunkHeaders.begin(); itr != m_ChunkHeaders.end(); ++itr) + { + sChunkHeader * Header = *itr; + + if( ChunksConverted % 32 == 0 ) + { + LOGINFO("Updating \"%s\" version 1 to version 2: %d %%", m_FileName.c_str(), (ChunksConverted * 100) / m_ChunkHeaders.size() ); + } + ChunksConverted++; + + AString Data; + int UncompressedSize = Header->m_UncompressedSize; + Data.assign(m_DataContents, Offset, Header->m_CompressedSize); + Offset += Header->m_CompressedSize; + + // Crude data integrity check: + int ExpectedSize = (16*128*16)*2 + (16*128*16)/2; // For version 1 + if (UncompressedSize < ExpectedSize) + { + LOGWARNING("Chunk [%d, %d] has too short decompressed data (%d bytes out of %d needed), erasing", + Header->m_ChunkX, Header->m_ChunkZ, + UncompressedSize, ExpectedSize + ); + Offset += Header->m_CompressedSize; + continue; + } + + // Decompress the data: + AString UncompressedData; + { + int errorcode = UncompressString(Data.data(), Data.size(), UncompressedData, UncompressedSize); + if (errorcode != Z_OK) + { + LOGERROR("Error %d decompressing data for chunk [%d, %d]", + errorcode, + Header->m_ChunkX, Header->m_ChunkZ + ); + Offset += Header->m_CompressedSize; + continue; + } + } + + if (UncompressedSize != (int)UncompressedData.size()) + { + LOGWARNING("Uncompressed data size differs (exp %d bytes, got %d) for chunk [%d, %d]", + UncompressedSize, UncompressedData.size(), + Header->m_ChunkX, Header->m_ChunkZ + ); + Offset += Header->m_CompressedSize; + continue; + } + + + // Old version is 128 blocks high with YZX axis order + char ConvertedData[cChunkDef::BlockDataSize]; + int Index = 0; + unsigned int InChunkOffset = 0; + for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) + { + for( int y = 0; y < 128; ++y ) + { + ConvertedData[Index++] = UncompressedData[y + z * 128 + x * 128 * 16 + InChunkOffset]; + } + // Add 128 empty blocks after an old y column + memset(ConvertedData + Index, E_BLOCK_AIR, 128); + Index += 128; + } + InChunkOffset += (16 * 128 * 16); + for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) // Metadata + { + for( int y = 0; y < 64; ++y ) + { + ConvertedData[Index++] = UncompressedData[y + z * 64 + x * 64 * 16 + InChunkOffset]; + } + memset(ConvertedData + Index, 0, 64); + Index += 64; + } + InChunkOffset += (16 * 128 * 16) / 2; + for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) // Block light + { + for( int y = 0; y < 64; ++y ) + { + ConvertedData[Index++] = UncompressedData[y + z * 64 + x * 64 * 16 + InChunkOffset]; + } + memset(ConvertedData + Index, 0, 64); + Index += 64; + } + InChunkOffset += (16*128*16)/2; + for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) // Sky light + { + for( int y = 0; y < 64; ++y ) + { + ConvertedData[Index++] = UncompressedData[y + z * 64 + x * 64 * 16 + InChunkOffset]; + } + memset(ConvertedData + Index, 0, 64); + Index += 64; + } + InChunkOffset += (16 * 128 * 16) / 2; + + AString Converted(ConvertedData, ARRAYCOUNT(ConvertedData)); + + // Add JSON data afterwards + if (UncompressedData.size() > InChunkOffset) + { + Converted.append( UncompressedData.begin() + InChunkOffset, UncompressedData.end() ); + } + + // Re-compress data + AString CompressedData; + { + int errorcode = CompressString(Converted.data(), Converted.size(), CompressedData); + if (errorcode != Z_OK) + { + LOGERROR("Error %d compressing data for chunk [%d, %d]", + errorcode, + Header->m_ChunkX, Header->m_ChunkZ + ); + continue; + } + } + + // Save into file's cache + Header->m_UncompressedSize = Converted.size(); + Header->m_CompressedSize = CompressedData.size(); + NewDataContents.append( CompressedData ); + } + + // Done converting + m_DataContents = NewDataContents; + m_ChunkVersion = 2; + SynchronizeFile(); + + LOGINFO("Updated \"%s\" version 1 to version 2", m_FileName.c_str() ); +} + + + + + +void cWSSCompact::cPAKFile::UpdateChunk2To3() +{ + int Offset = 0; + AString NewDataContents; + int ChunksConverted = 0; + for (sChunkHeaders::iterator itr = m_ChunkHeaders.begin(); itr != m_ChunkHeaders.end(); ++itr) + { + sChunkHeader * Header = *itr; + + if( ChunksConverted % 32 == 0 ) + { + LOGINFO("Updating \"%s\" version 2 to version 3: %d %%", m_FileName.c_str(), (ChunksConverted * 100) / m_ChunkHeaders.size() ); + } + ChunksConverted++; + + AString Data; + int UncompressedSize = Header->m_UncompressedSize; + Data.assign(m_DataContents, Offset, Header->m_CompressedSize); + Offset += Header->m_CompressedSize; + + // Crude data integrity check: + const int ExpectedSize = (16*256*16)*2 + (16*256*16)/2; // For version 2 + if (UncompressedSize < ExpectedSize) + { + LOGWARNING("Chunk [%d, %d] has too short decompressed data (%d bytes out of %d needed), erasing", + Header->m_ChunkX, Header->m_ChunkZ, + UncompressedSize, ExpectedSize + ); + Offset += Header->m_CompressedSize; + continue; + } + + // Decompress the data: + AString UncompressedData; + { + int errorcode = UncompressString(Data.data(), Data.size(), UncompressedData, UncompressedSize); + if (errorcode != Z_OK) + { + LOGERROR("Error %d decompressing data for chunk [%d, %d]", + errorcode, + Header->m_ChunkX, Header->m_ChunkZ + ); + Offset += Header->m_CompressedSize; + continue; + } + } + + if (UncompressedSize != (int)UncompressedData.size()) + { + LOGWARNING("Uncompressed data size differs (exp %d bytes, got %d) for chunk [%d, %d]", + UncompressedSize, UncompressedData.size(), + Header->m_ChunkX, Header->m_ChunkZ + ); + Offset += Header->m_CompressedSize; + continue; + } + + char ConvertedData[ExpectedSize]; + memset(ConvertedData, 0, ExpectedSize); + + // Cannot use cChunk::MakeIndex because it might change again????????? + // For compatibility, use what we know is current + #define MAKE_2_INDEX( x, y, z ) ( y + (z * 256) + (x * 256 * 16) ) + #define MAKE_3_INDEX( x, y, z ) ( x + (z * 16) + (y * 16 * 16) ) + + unsigned int InChunkOffset = 0; + for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) for( int y = 0; y < 256; ++y ) // YZX Loop order is important, in 1.1 Y was first then Z then X + { + ConvertedData[ MAKE_3_INDEX(x, y, z) ] = UncompressedData[InChunkOffset]; + ++InChunkOffset; + } // for y, z, x + + + unsigned int index2 = 0; + for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) for( int y = 0; y < 256; ++y ) + { + ConvertedData[ InChunkOffset + MAKE_3_INDEX(x, y, z)/2 ] |= ( (UncompressedData[ InChunkOffset + index2/2 ] >> ((index2&1)*4) ) & 0x0f ) << ((x&1)*4); + ++index2; + } + InChunkOffset += index2 / 2; + index2 = 0; + + for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) for( int y = 0; y < 256; ++y ) + { + ConvertedData[ InChunkOffset + MAKE_3_INDEX(x, y, z)/2 ] |= ( (UncompressedData[ InChunkOffset + index2/2 ] >> ((index2&1)*4) ) & 0x0f ) << ((x&1)*4); + ++index2; + } + InChunkOffset += index2 / 2; + index2 = 0; + + for( int x = 0; x < 16; ++x ) for( int z = 0; z < 16; ++z ) for( int y = 0; y < 256; ++y ) + { + ConvertedData[ InChunkOffset + MAKE_3_INDEX(x, y, z)/2 ] |= ( (UncompressedData[ InChunkOffset + index2/2 ] >> ((index2&1)*4) ) & 0x0f ) << ((x&1)*4); + ++index2; + } + InChunkOffset += index2 / 2; + index2 = 0; + + AString Converted(ConvertedData, ExpectedSize); + + // Add JSON data afterwards + if (UncompressedData.size() > InChunkOffset) + { + Converted.append( UncompressedData.begin() + InChunkOffset, UncompressedData.end() ); + } + + // Re-compress data + AString CompressedData; + { + int errorcode = CompressString(Converted.data(), Converted.size(), CompressedData); + if (errorcode != Z_OK) + { + LOGERROR("Error %d compressing data for chunk [%d, %d]", + errorcode, + Header->m_ChunkX, Header->m_ChunkZ + ); + continue; + } + } + + // Save into file's cache + Header->m_UncompressedSize = Converted.size(); + Header->m_CompressedSize = CompressedData.size(); + NewDataContents.append( CompressedData ); + } + + // Done converting + m_DataContents = NewDataContents; + m_ChunkVersion = 3; + SynchronizeFile(); + + LOGINFO("Updated \"%s\" version 2 to version 3", m_FileName.c_str() ); +} + + + + + +bool cWSSCompact::LoadChunkFromData(const cChunkCoords & a_Chunk, int & a_UncompressedSize, const AString & a_Data, cWorld * a_World) +{ + // Crude data integrity check: + if (a_UncompressedSize < cChunkDef::BlockDataSize) + { + LOGWARNING("Chunk [%d, %d] has too short decompressed data (%d bytes out of %d needed), erasing", + a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, + a_UncompressedSize, cChunkDef::BlockDataSize + ); + EraseChunkData(a_Chunk); + return false; + } + + // Decompress the data: + AString UncompressedData; + int errorcode = UncompressString(a_Data.data(), a_Data.size(), UncompressedData, a_UncompressedSize); + if (errorcode != Z_OK) + { + LOGERROR("Error %d decompressing data for chunk [%d, %d]", + errorcode, + a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ + ); + return false; + } + + if (a_UncompressedSize != (int)UncompressedData.size()) + { + LOGWARNING("Uncompressed data size differs (exp %d bytes, got %d) for chunk [%d, %d]", + a_UncompressedSize, UncompressedData.size(), + a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ + ); + return false; + } + + cEntityList Entities; + cBlockEntityList BlockEntities; + bool IsLightValid = false; + + if (a_UncompressedSize > cChunkDef::BlockDataSize) + { + Json::Value root; // will contain the root value after parsing. + Json::Reader reader; + if ( !reader.parse( UncompressedData.data() + cChunkDef::BlockDataSize, root, false ) ) + { + LOGERROR("Failed to parse trailing JSON in chunk [%d, %d]!", + a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ + ); + } + else + { + LoadEntitiesFromJson(root, Entities, BlockEntities, a_World); + IsLightValid = root.get("IsLightValid", false).asBool(); + } + } + + BLOCKTYPE * BlockData = (BLOCKTYPE *)UncompressedData.data(); + NIBBLETYPE * MetaData = (NIBBLETYPE *)(BlockData + cChunkDef::MetaOffset); + NIBBLETYPE * BlockLight = (NIBBLETYPE *)(BlockData + cChunkDef::LightOffset); + NIBBLETYPE * SkyLight = (NIBBLETYPE *)(BlockData + cChunkDef::SkyLightOffset); + + a_World->SetChunkData( + a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, + BlockData, MetaData, + IsLightValid ? BlockLight : NULL, + IsLightValid ? SkyLight : NULL, + NULL, NULL, + Entities, BlockEntities, + false + ); + + return true; +} + + + + + +bool cWSSCompact::cPAKFile::EraseChunkData(const cChunkCoords & a_Chunk) +{ + int ChunkX = a_Chunk.m_ChunkX; + int ChunkZ = a_Chunk.m_ChunkZ; + int Offset = 0; + for (sChunkHeaders::iterator itr = m_ChunkHeaders.begin(); itr != m_ChunkHeaders.end(); ++itr) + { + if (((*itr)->m_ChunkX == ChunkX) && ((*itr)->m_ChunkZ == ChunkZ)) + { + m_DataContents.erase(Offset, (*itr)->m_CompressedSize); + delete *itr; + itr = m_ChunkHeaders.erase(itr); + return true; + } + Offset += (*itr)->m_CompressedSize; + } + + return false; +} + + + + + +bool cWSSCompact::cPAKFile::SaveChunkToData(const cChunkCoords & a_Chunk, cWorld * a_World) +{ + // Serialize the chunk: + cJsonChunkSerializer Serializer; + if (!a_World->GetChunkData(a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ, Serializer)) + { + // Chunk not valid + LOG("cWSSCompact: Trying to save chunk [%d, %d, %d] that has no data, ignoring request.", a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ); + return false; + } + + AString Data; + Data.assign((const char *)Serializer.GetBlockData(), cChunkDef::BlockDataSize); + if (Serializer.HasJsonData()) + { + AString JsonData; + Json::StyledWriter writer; + JsonData = writer.write(Serializer.GetRoot()); + Data.append(JsonData); + } + + // Compress the data: + AString CompressedData; + int errorcode = CompressString(Data.data(), Data.size(), CompressedData); + if ( errorcode != Z_OK ) + { + LOGERROR("Error %i compressing data for chunk [%d, %d, %d]", errorcode, a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ); + return false; + } + + // Erase any existing data for the chunk: + EraseChunkData(a_Chunk); + + // Save the header: + sChunkHeader * Header = new sChunkHeader; + if (Header == NULL) + { + LOGWARNING("Cannot create a new chunk header to save chunk [%d, %d, %d]", a_Chunk.m_ChunkX, a_Chunk.m_ChunkY, a_Chunk.m_ChunkZ); + return false; + } + Header->m_CompressedSize = (int)CompressedData.size(); + Header->m_ChunkX = a_Chunk.m_ChunkX; + Header->m_ChunkZ = a_Chunk.m_ChunkZ; + Header->m_UncompressedSize = (int)Data.size(); + m_ChunkHeaders.push_back(Header); + + m_DataContents.append(CompressedData.data(), CompressedData.size()); + + m_NumDirty++; + return true; +} + + + + + +#define WRITE(Var) \ + if (f.Write(&Var, sizeof(Var)) != sizeof(Var)) \ + { \ + LOGERROR("cWSSCompact: ERROR writing %s to file \"%s\" (line %d); file offset %d", #Var, m_FileName.c_str(), __LINE__, f.Tell()); \ + return; \ + } + +void cWSSCompact::cPAKFile::SynchronizeFile(void) +{ + cFile f; + if (!f.Open(m_FileName, cFile::fmWrite)) + { + LOGERROR("Cannot open PAK file \"%s\" for writing", m_FileName.c_str()); + return; + } + + WRITE(m_PakVersion); + WRITE(m_ChunkVersion); + short NumChunks = (short)m_ChunkHeaders.size(); + WRITE(NumChunks); + for (sChunkHeaders::iterator itr = m_ChunkHeaders.begin(); itr != m_ChunkHeaders.end(); ++itr) + { + WRITE(**itr); + } + if (f.Write(m_DataContents.data(), m_DataContents.size()) != (int)m_DataContents.size()) + { + LOGERROR("cWSSCompact: ERROR writing chunk contents to file \"%s\" (line %d); file offset %d", m_FileName.c_str(), __LINE__, f.Tell()); + return; + } + m_NumDirty = 0; +} + + + + diff --git a/source/WorldStorage/WSSCompact.h b/src/WorldStorage/WSSCompact.h index e6a013eaf..e6a013eaf 100644 --- a/source/WorldStorage/WSSCompact.h +++ b/src/WorldStorage/WSSCompact.h diff --git a/source/WorldStorage/WorldStorage.cpp b/src/WorldStorage/WorldStorage.cpp index f290ec128..f290ec128 100644 --- a/source/WorldStorage/WorldStorage.cpp +++ b/src/WorldStorage/WorldStorage.cpp diff --git a/src/WorldStorage/WorldStorage.h b/src/WorldStorage/WorldStorage.h new file mode 100644 index 000000000..98e7e1686 --- /dev/null +++ b/src/WorldStorage/WorldStorage.h @@ -0,0 +1,135 @@ + +// WorldStorage.h + +// Interfaces to the cWorldStorage class representing the chunk loading / saving thread +// This class decides which storage schema to use for saving; it queries all available schemas for loading +// Also declares the base class for all storage schemas, cWSSchema +// Helper serialization class cJsonChunkSerializer is declared as well + + + + + +#pragma once +#ifndef WORLDSTORAGE_H_INCLUDED +#define WORLDSTORAGE_H_INCLUDED + +#include "../ChunkDef.h" +#include "../OSSupport/IsThread.h" +#include "json/json.h" + + + + + +// fwd: +class cWorld; + + + + + +/// Interface that all the world storage schemas need to implement +class cWSSchema abstract +{ +public: + cWSSchema(cWorld * a_World) : m_World(a_World) {} + virtual ~cWSSchema() {} // Force the descendants' destructors to be virtual + + virtual bool LoadChunk(const cChunkCoords & a_Chunk) = 0; + virtual bool SaveChunk(const cChunkCoords & a_Chunk) = 0; + virtual const AString GetName(void) const = 0; + +protected: + + cWorld * m_World; +} ; + +typedef std::list<cWSSchema *> cWSSchemaList; + + + + + +/// The actual world storage class +class cWorldStorage : + public cIsThread +{ + typedef cIsThread super; + +public: + + cWorldStorage(void); + ~cWorldStorage(); + + void QueueLoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ, bool a_Generate); // Queues the chunk for loading; if not loaded, the chunk will be generated if a_Generate is true + void QueueSaveChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ); + + /// Signals that a message should be output to the console when all the chunks have been saved + void QueueSavedMessage(void); + + /// Loads the chunk specified; returns true on success, false on failure + bool LoadChunk(int a_ChunkX, int a_ChunkY, int a_ChunkZ); + + void UnqueueLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ); + void UnqueueSave(const cChunkCoords & a_Chunk); + + bool Start(cWorld * a_World, const AString & a_StorageSchemaName); // Hide the cIsThread's Start() method, we need to provide args + void Stop(void); // Hide the cIsThread's Stop() method, we need to signal the event + void WaitForFinish(void); + void WaitForQueuesEmpty(void); + + int GetLoadQueueLength(void); + int GetSaveQueueLength(void); + +protected: + + struct sChunkLoad + { + int m_ChunkX; + int m_ChunkY; + int m_ChunkZ; + bool m_Generate; // If true, the chunk will be generated if it cannot be loaded + + sChunkLoad(int a_ChunkX, int a_ChunkY, int a_ChunkZ, bool a_Generate) : m_ChunkX(a_ChunkX), m_ChunkY(a_ChunkY), m_ChunkZ(a_ChunkZ), m_Generate(a_Generate) {} + } ; + + typedef std::list<sChunkLoad> sChunkLoadQueue; + + cWorld * m_World; + AString m_StorageSchemaName; + + // Both queues are locked by the same CS + cCriticalSection m_CSQueues; + sChunkLoadQueue m_LoadQueue; + cChunkCoordsList m_SaveQueue; + + cEvent m_Event; // Set when there's any addition to the queues + cEvent m_evtRemoved; // Set when an item has been removed from the queue, either by the worker thread or the Unqueue methods + + /// All the storage schemas (all used for loading) + cWSSchemaList m_Schemas; + + /// The one storage schema used for saving + cWSSchema * m_SaveSchema; + + void InitSchemas(void); + + virtual void Execute(void) override; + + /// Loads one chunk from the queue (if any queued); returns true if there are more chunks in the load queue + bool LoadOneChunk(void); + + /// Saves one chunk from the queue (if any queued); returns true if there are more chunks in the save queue + bool SaveOneChunk(void); +} ; + + + + + +#endif // WORLDSTORAGE_H_INCLUDED + + + + diff --git a/source/XMLParser.h b/src/XMLParser.h index f492d1a5d..f492d1a5d 100644 --- a/source/XMLParser.h +++ b/src/XMLParser.h diff --git a/source/lua5.1.dll b/src/lua5.1.dll Binary files differindex 515cf8b30..515cf8b30 100644 --- a/source/lua5.1.dll +++ b/src/lua5.1.dll diff --git a/source/main.cpp b/src/main.cpp index 1f6aad24f..1f6aad24f 100644 --- a/source/main.cpp +++ b/src/main.cpp diff --git a/source/tolua++.exe b/src/tolua++.exe Binary files differindex e5cec6d78..e5cec6d78 100644 --- a/source/tolua++.exe +++ b/src/tolua++.exe diff --git a/src/tolua++.h b/src/tolua++.h new file mode 100644 index 000000000..8da427fe3 --- /dev/null +++ b/src/tolua++.h @@ -0,0 +1,186 @@ +/* tolua +** Support code for Lua bindings. +** Written by Waldemar Celes +** TeCGraf/PUC-Rio +** Apr 2003 +** $Id: $ +*/ + +/* This code is free software; you can redistribute it and/or modify it. +** The software provided hereunder is on an "as is" basis, and +** the author has no obligation to provide maintenance, support, updates, +** enhancements, or modifications. +*/ + + +#ifndef TOLUA_H +#define TOLUA_H + +#ifndef TOLUA_API +#define TOLUA_API extern +#endif + +#define TOLUA_VERSION "tolua++-1.0.92" + +#ifdef __cplusplus +extern "C" { +#endif + +#define tolua_pushcppstring(x,y) tolua_pushstring(x,y.c_str()) +#define tolua_iscppstring tolua_isstring + +#define tolua_iscppstringarray tolua_isstringarray +#define tolua_pushfieldcppstring(L,lo,idx,s) tolua_pushfieldstring(L, lo, idx, s.c_str()) + +#ifndef TEMPLATE_BIND + #define TEMPLATE_BIND(p) +#endif + +#define TOLUA_TEMPLATE_BIND(p) + +#define TOLUA_PROTECTED_DESTRUCTOR +#define TOLUA_PROPERTY_TYPE(p) + +typedef int lua_Object; + +#include "lua/src/lua.h" +#include "lua/src/lauxlib.h" + +struct tolua_Error +{ + int index; + int array; + const char* type; +}; +typedef struct tolua_Error tolua_Error; + +#define TOLUA_NOPEER LUA_REGISTRYINDEX /* for lua 5.1 */ + +TOLUA_API const char* tolua_typename (lua_State* L, int lo); +TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err); +TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err); +TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err); +TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err); +TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err); +TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err); +TOLUA_API int tolua_isvaluearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isbooleanarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isnumberarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isstringarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_istablearray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isuserdataarray + (lua_State* L, int lo, int dim, int def, tolua_Error* err); +TOLUA_API int tolua_isusertypearray + (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err); + +TOLUA_API void tolua_open (lua_State* L); + +TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size); +TOLUA_API int tolua_register_gc (lua_State* L, int lo); +TOLUA_API int tolua_default_collect (lua_State* tolua_S); + +TOLUA_API void tolua_usertype (lua_State* L, const char* type); +TOLUA_API void tolua_beginmodule (lua_State* L, const char* name); +TOLUA_API void tolua_endmodule (lua_State* L); +TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar); +TOLUA_API void tolua_class (lua_State* L, const char* name, const char* base); +TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col); +TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func); +TOLUA_API void tolua_constant (lua_State* L, const char* name, lua_Number value); +TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set); +TOLUA_API void tolua_array (lua_State* L,const char* name, lua_CFunction get, lua_CFunction set); + +/* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type); */ +/* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */ + +TOLUA_API void tolua_pushvalue (lua_State* L, int lo); +TOLUA_API void tolua_pushboolean (lua_State* L, int value); +TOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value); +TOLUA_API void tolua_pushstring (lua_State* L, const char* value); +TOLUA_API void tolua_pushuserdata (lua_State* L, void* value); +TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type); +TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type); +TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v); +TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v); +TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v); +TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v); +TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v); +TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type); +TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type); + +TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def); +TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def); +TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def); +TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def); +TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def); +TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def); +TOLUA_API lua_Number tolua_tofieldnumber (lua_State* L, int lo, int index, lua_Number def); +TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def); +TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def); +TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def); +TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def); +TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def); + +TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name); + +TOLUA_API int class_gc_event (lua_State* L); + +#ifdef __cplusplus +static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) { + + const char* s = tolua_tostring(L, narg, def); + return s?s:""; +}; + +static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) { + + const char* s = tolua_tofieldstring(L, lo, index, def); + return s?s:""; +}; + +#else +#define tolua_tocppstring tolua_tostring +#define tolua_tofieldcppstring tolua_tofieldstring +#endif + +TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index); + +#ifndef Mtolua_new +#define Mtolua_new(EXP) new EXP +#endif + +#ifndef Mtolua_delete +#define Mtolua_delete(EXP) delete EXP +#endif + +#ifndef Mtolua_new_dim +#define Mtolua_new_dim(EXP, len) new EXP[len] +#endif + +#ifndef Mtolua_delete_dim +#define Mtolua_delete_dim(EXP) delete [] EXP +#endif + +#ifndef tolua_outside +#define tolua_outside +#endif + +#ifndef tolua_owned +#define tolua_owned +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/tolua_base.h b/src/tolua_base.h index 4f1038c09..4f1038c09 100644 --- a/source/tolua_base.h +++ b/src/tolua_base.h diff --git a/source/virtual_method_hooks.lua b/src/virtual_method_hooks.lua index 15ff1d7f8..15ff1d7f8 100644 --- a/source/virtual_method_hooks.lua +++ b/src/virtual_method_hooks.lua diff --git a/tolua++-1.0.93/include/tolua++.h b/tolua++-1.0.93/include/tolua++.h deleted file mode 100644 index ed5344926..000000000 --- a/tolua++-1.0.93/include/tolua++.h +++ /dev/null @@ -1,186 +0,0 @@ -/* tolua -** Support code for Lua bindings. -** Written by Waldemar Celes -** TeCGraf/PUC-Rio -** Apr 2003 -** $Id: $ -*/ - -/* This code is free software; you can redistribute it and/or modify it. -** The software provided hereunder is on an "as is" basis, and -** the author has no obligation to provide maintenance, support, updates, -** enhancements, or modifications. -*/ - - -#ifndef TOLUA_H -#define TOLUA_H - -#ifndef TOLUA_API -#define TOLUA_API extern -#endif - -#define TOLUA_VERSION "tolua++-1.0.92" - -#ifdef __cplusplus -extern "C" { -#endif - -#define tolua_pushcppstring(x,y) tolua_pushstring(x,y.c_str()) -#define tolua_iscppstring tolua_isstring - -#define tolua_iscppstringarray tolua_isstringarray -#define tolua_pushfieldcppstring(L,lo,idx,s) tolua_pushfieldstring(L, lo, idx, s.c_str()) - -#ifndef TEMPLATE_BIND - #define TEMPLATE_BIND(p) -#endif - -#define TOLUA_TEMPLATE_BIND(p) - -#define TOLUA_PROTECTED_DESTRUCTOR -#define TOLUA_PROPERTY_TYPE(p) - -typedef int lua_Object; - -#include "lua.h" -#include "lauxlib.h" - -struct tolua_Error -{ - int index; - int array; - const char* type; -}; -typedef struct tolua_Error tolua_Error; - -#define TOLUA_NOPEER LUA_REGISTRYINDEX /* for lua 5.1 */ - -TOLUA_API const char* tolua_typename (lua_State* L, int lo); -TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err); -TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err); -TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err); -TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err); -TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err); -TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err); -TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err); -TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err); -TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err); -TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err); -TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err); -TOLUA_API int tolua_isvaluearray - (lua_State* L, int lo, int dim, int def, tolua_Error* err); -TOLUA_API int tolua_isbooleanarray - (lua_State* L, int lo, int dim, int def, tolua_Error* err); -TOLUA_API int tolua_isnumberarray - (lua_State* L, int lo, int dim, int def, tolua_Error* err); -TOLUA_API int tolua_isstringarray - (lua_State* L, int lo, int dim, int def, tolua_Error* err); -TOLUA_API int tolua_istablearray - (lua_State* L, int lo, int dim, int def, tolua_Error* err); -TOLUA_API int tolua_isuserdataarray - (lua_State* L, int lo, int dim, int def, tolua_Error* err); -TOLUA_API int tolua_isusertypearray - (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err); - -TOLUA_API void tolua_open (lua_State* L); - -TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size); -TOLUA_API int tolua_register_gc (lua_State* L, int lo); -TOLUA_API int tolua_default_collect (lua_State* tolua_S); - -TOLUA_API void tolua_usertype (lua_State* L, const char* type); -TOLUA_API void tolua_beginmodule (lua_State* L, const char* name); -TOLUA_API void tolua_endmodule (lua_State* L); -TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar); -TOLUA_API void tolua_class (lua_State* L, const char* name, const char* base); -TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col); -TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func); -TOLUA_API void tolua_constant (lua_State* L, const char* name, lua_Number value); -TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set); -TOLUA_API void tolua_array (lua_State* L,const char* name, lua_CFunction get, lua_CFunction set); - -/* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type); */ -/* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */ - -TOLUA_API void tolua_pushvalue (lua_State* L, int lo); -TOLUA_API void tolua_pushboolean (lua_State* L, int value); -TOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value); -TOLUA_API void tolua_pushstring (lua_State* L, const char* value); -TOLUA_API void tolua_pushuserdata (lua_State* L, void* value); -TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type); -TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type); -TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v); -TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v); -TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v); -TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v); -TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v); -TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type); -TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type); - -TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def); -TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def); -TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def); -TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def); -TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def); -TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def); -TOLUA_API lua_Number tolua_tofieldnumber (lua_State* L, int lo, int index, lua_Number def); -TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def); -TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def); -TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def); -TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def); -TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def); - -TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name); - -TOLUA_API int class_gc_event (lua_State* L); - -#ifdef __cplusplus -static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) { - - const char* s = tolua_tostring(L, narg, def); - return s?s:""; -}; - -static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) { - - const char* s = tolua_tofieldstring(L, lo, index, def); - return s?s:""; -}; - -#else -#define tolua_tocppstring tolua_tostring -#define tolua_tofieldcppstring tolua_tofieldstring -#endif - -TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index); - -#ifndef Mtolua_new -#define Mtolua_new(EXP) new EXP -#endif - -#ifndef Mtolua_delete -#define Mtolua_delete(EXP) delete EXP -#endif - -#ifndef Mtolua_new_dim -#define Mtolua_new_dim(EXP, len) new EXP[len] -#endif - -#ifndef Mtolua_delete_dim -#define Mtolua_delete_dim(EXP) delete [] EXP -#endif - -#ifndef tolua_outside -#define tolua_outside -#endif - -#ifndef tolua_owned -#define tolua_owned -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/tolua++-1.0.93/src/bin/tolua.c b/tolua++-1.0.93/src/bin/tolua.c deleted file mode 100644 index cc9f9adcd..000000000 --- a/tolua++-1.0.93/src/bin/tolua.c +++ /dev/null @@ -1,169 +0,0 @@ -/* tolua -** Support code for Lua bindings. -** Written by Waldemar Celes -** TeCGraf/PUC-Rio -** Aug 2003 -** $Id:$ -*/ - -/* This code is free software; you can redistribute it and/or modify it. -** The software provided hereunder is on an "as is" basis, and -** the author has no obligation to provide maintenance, support, updates, -** enhancements, or modifications. -*/ - -#include "tolua++.h" - -#include "lua.h" -#include "lualib.h" -#include "lauxlib.h" - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> - - -static void help (void) -{ - fprintf(stderr,"\n" - "usage: tolua++ [options] input_file\n" - "\n" - "Command line options are:\n" - " -v : print version information.\n" - " -o file : set output file; default is stdout.\n" - " -H file : create include file.\n" - " -n name : set package name; default is input file root name.\n" - " -p : parse only.\n" - " -P : parse and print structure information (for debug).\n" - " -S : disable support for c++ strings.\n" - " -1 : substract 1 to operator[] index (for compatibility with tolua5).\n" - " -L file : run lua file (with dofile()) before doing anything.\n" - " -D : disable automatic exporting of destructors for classes that have\n" - " constructors (for compatibility with tolua5)\n" - " -W : disable warnings for unsupported features (for compatibility\n" - " with tolua5)\n" - " -C : disable cleanup of included lua code (for easier debugging)\n" - " -E value[=value] : add extra values to the luastate\n" - " -t : export a list of types asociates with the C++ typeid name\n" - " -q : don't print warnings to the console\n" - " -h : print this message.\n" - "Should the input file be omitted, stdin is assumed;\n" - "in that case, the package name must be explicitly set.\n\n" - ); -} - -static void version (void) -{ - fprintf(stderr, "%s (written by W. Celes, A. Manzur)\n",TOLUA_VERSION); -} - -static void setfield (lua_State* L, int table, char* f, char* v) -{ - lua_pushstring(L,f); - lua_pushstring(L,v); - lua_settable(L,table); -} - -static void add_extra (lua_State* L, char* value) { - int len; - lua_getglobal(L, "_extra_parameters"); - len = luaL_getn(L, -1); - lua_pushstring(L, value); - lua_rawseti(L, -2, len+1); - lua_pop(L, 1); -}; - -static void error (char* o) -{ - fprintf(stderr,"tolua: unknown option '%s'\n",o); - help(); - exit(1); -} - -int main (int argc, char* argv[]) -{ - #ifdef LUA_VERSION_NUM /* lua 5.1 */ - lua_State* L = luaL_newstate(); - luaL_openlibs(L); - #else - lua_State* L = lua_open(); - luaopen_base(L); - luaopen_io(L); - luaopen_string(L); - luaopen_table(L); - luaopen_math(L); - luaopen_debug(L); - #endif - - lua_pushstring(L,TOLUA_VERSION); lua_setglobal(L,"TOLUA_VERSION"); - lua_pushstring(L,LUA_VERSION); lua_setglobal(L,"TOLUA_LUA_VERSION"); - - if (argc==1) - { - help(); - return 0; - } - else - { - int i, t; - lua_newtable(L); - lua_setglobal(L, "_extra_parameters"); - lua_newtable(L); - lua_pushvalue(L,-1); - lua_setglobal(L,"flags"); - t = lua_gettop(L); - for (i=1; i<argc; ++i) - { - if (*argv[i] == '-') - { - switch (argv[i][1]) - { - case 'v': version(); return 0; - case 'h': help(); return 0; - case 'p': setfield(L,t,"p",""); break; - case 'P': setfield(L,t,"P",""); break; - case 'o': setfield(L,t,"o",argv[++i]); break; - case 'n': setfield(L,t,"n",argv[++i]); break; - case 'H': setfield(L,t,"H",argv[++i]); break; - case 'S': setfield(L,t,"S",""); break; - case '1': setfield(L,t,"1",""); break; - case 'L': setfield(L,t,"L",argv[++i]); break; - case 'D': setfield(L,t,"D",""); break; - case 'W': setfield(L,t,"W",""); break; - case 'C': setfield(L,t,"C",""); break; - case 'E': add_extra(L,argv[++i]); break; - case 't': setfield(L,t,"t",""); break; - case 'q': setfield(L,t,"q",""); break; - default: error(argv[i]); break; - } - } - else - { - setfield(L,t,"f",argv[i]); - break; - } - } - lua_pop(L,1); - } -/* #define TOLUA_SCRIPT_RUN */ -#ifndef TOLUA_SCRIPT_RUN - { - int tolua_tolua_open (lua_State* L); - tolua_tolua_open(L); - } -#else - { - char* p; - char path[BUFSIZ]; - strcpy(path,argv[0]); - p = strrchr(path,'/'); - if (p==NULL) p = strrchr(path,'\\'); - p = (p==NULL) ? path : p+1; - sprintf(p,"%s","../src/bin/lua/"); - lua_pushstring(L,path); lua_setglobal(L,"path"); - strcat(path,"all.lua"); - lua_dofile(L,path); - } -#endif - return 0; -} diff --git a/tolua++-1.0.93/src/lib/tolua_event.c b/tolua++-1.0.93/src/lib/tolua_event.c deleted file mode 100644 index 8258867b4..000000000 --- a/tolua++-1.0.93/src/lib/tolua_event.c +++ /dev/null @@ -1,536 +0,0 @@ -/* tolua: event functions -** Support code for Lua bindings. -** Written by Waldemar Celes -** TeCGraf/PUC-Rio -** Apr 2003 -** $Id: $ -*/ - -/* This code is free software; you can redistribute it and/or modify it. -** The software provided hereunder is on an "as is" basis, and -** the author has no obligation to provide maintenance, support, updates, -** enhancements, or modifications. -*/ - -#include <stdio.h> - -#include "tolua++.h" - -/* Store at ubox - * It stores, creating the corresponding table if needed, - * the pair key/value in the corresponding ubox table -*/ -static void storeatubox (lua_State* L, int lo) -{ - #ifdef LUA_VERSION_NUM - lua_getfenv(L, lo); - if (lua_rawequal(L, -1, TOLUA_NOPEER)) { - lua_pop(L, 1); - lua_newtable(L); - lua_pushvalue(L, -1); - lua_setfenv(L, lo); /* stack: k,v,table */ - }; - lua_insert(L, -3); - lua_settable(L, -3); /* on lua 5.1, we trade the "tolua_peers" lookup for a settable call */ - lua_pop(L, 1); - #else - /* stack: key value (to be stored) */ - lua_pushstring(L,"tolua_peers"); - lua_rawget(L,LUA_REGISTRYINDEX); /* stack: k v ubox */ - lua_pushvalue(L,lo); - lua_rawget(L,-2); /* stack: k v ubox ubox[u] */ - if (!lua_istable(L,-1)) - { - lua_pop(L,1); /* stack: k v ubox */ - lua_newtable(L); /* stack: k v ubox table */ - lua_pushvalue(L,1); - lua_pushvalue(L,-2); /* stack: k v ubox table u table */ - lua_rawset(L,-4); /* stack: k v ubox ubox[u]=table */ - } - lua_insert(L,-4); /* put table before k */ - lua_pop(L,1); /* pop ubox */ - lua_rawset(L,-3); /* store at table */ - lua_pop(L,1); /* pop ubox[u] */ - #endif -} - -/* Module index function -*/ -static int module_index_event (lua_State* L) -{ - lua_pushstring(L,".get"); - lua_rawget(L,-3); - if (lua_istable(L,-1)) - { - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - if (lua_iscfunction(L,-1)) - { - lua_call(L,0,1); - return 1; - } - else if (lua_istable(L,-1)) - return 1; - } - /* call old index meta event */ - if (lua_getmetatable(L,1)) - { - lua_pushstring(L,"__index"); - lua_rawget(L,-2); - lua_pushvalue(L,1); - lua_pushvalue(L,2); - if (lua_isfunction(L,-1)) - { - lua_call(L,2,1); - return 1; - } - else if (lua_istable(L,-1)) - { - lua_gettable(L,-3); - return 1; - } - } - lua_pushnil(L); - return 1; -} - -/* Module newindex function -*/ -static int module_newindex_event (lua_State* L) -{ - lua_pushstring(L,".set"); - lua_rawget(L,-4); - if (lua_istable(L,-1)) - { - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); - if (lua_iscfunction(L,-1)) - { - lua_pushvalue(L,1); /* only to be compatible with non-static vars */ - lua_pushvalue(L,3); /* value */ - lua_call(L,2,0); - return 0; - } - } - /* call old newindex meta event */ - if (lua_getmetatable(L,1) && lua_getmetatable(L,-1)) - { - lua_pushstring(L,"__newindex"); - lua_rawget(L,-2); - if (lua_isfunction(L,-1)) - { - lua_pushvalue(L,1); - lua_pushvalue(L,2); - lua_pushvalue(L,3); - lua_call(L,3,0); - } - } - lua_settop(L,3); - lua_rawset(L,-3); - return 0; -} - -/* Class index function - * If the object is a userdata (ie, an object), it searches the field in - * the alternative table stored in the corresponding "ubox" table. -*/ -static int class_index_event (lua_State* L) -{ - int t = lua_type(L,1); - if (t == LUA_TUSERDATA) - { - /* Access alternative table */ - #ifdef LUA_VERSION_NUM /* new macro on version 5.1 */ - lua_getfenv(L,1); - if (!lua_rawequal(L, -1, TOLUA_NOPEER)) { - lua_pushvalue(L, 2); /* key */ - lua_gettable(L, -2); /* on lua 5.1, we trade the "tolua_peers" lookup for a gettable call */ - if (!lua_isnil(L, -1)) - return 1; - }; - #else - lua_pushstring(L,"tolua_peers"); - lua_rawget(L,LUA_REGISTRYINDEX); /* stack: obj key ubox */ - lua_pushvalue(L,1); - lua_rawget(L,-2); /* stack: obj key ubox ubox[u] */ - if (lua_istable(L,-1)) - { - lua_pushvalue(L,2); /* key */ - lua_rawget(L,-2); /* stack: obj key ubox ubox[u] value */ - if (!lua_isnil(L,-1)) - return 1; - } - #endif - lua_settop(L,2); /* stack: obj key */ - /* Try metatables */ - lua_pushvalue(L,1); /* stack: obj key obj */ - while (lua_getmetatable(L,-1)) - { /* stack: obj key obj mt */ - lua_remove(L,-2); /* stack: obj key mt */ - if (lua_isnumber(L,2)) /* check if key is a numeric value */ - { - /* try operator[] */ - lua_pushstring(L,".geti"); - lua_rawget(L,-2); /* stack: obj key mt func */ - if (lua_isfunction(L,-1)) - { - lua_pushvalue(L,1); - lua_pushvalue(L,2); - lua_call(L,2,1); - return 1; - } - } - else - { - lua_pushvalue(L,2); /* stack: obj key mt key */ - lua_rawget(L,-2); /* stack: obj key mt value */ - if (!lua_isnil(L,-1)) - return 1; - else - lua_pop(L,1); - /* try C/C++ variable */ - lua_pushstring(L,".get"); - lua_rawget(L,-2); /* stack: obj key mt tget */ - if (lua_istable(L,-1)) - { - lua_pushvalue(L,2); - lua_rawget(L,-2); /* stack: obj key mt value */ - if (lua_iscfunction(L,-1)) - { - lua_pushvalue(L,1); - lua_pushvalue(L,2); - lua_call(L,2,1); - return 1; - } - else if (lua_istable(L,-1)) - { - /* deal with array: create table to be returned and cache it in ubox */ - void* u = *((void**)lua_touserdata(L,1)); - lua_newtable(L); /* stack: obj key mt value table */ - lua_pushstring(L,".self"); - lua_pushlightuserdata(L,u); - lua_rawset(L,-3); /* store usertype in ".self" */ - lua_insert(L,-2); /* stack: obj key mt table value */ - lua_setmetatable(L,-2); /* set stored value as metatable */ - lua_pushvalue(L,-1); /* stack: obj key met table table */ - lua_pushvalue(L,2); /* stack: obj key mt table table key */ - lua_insert(L,-2); /* stack: obj key mt table key table */ - storeatubox(L,1); /* stack: obj key mt table */ - return 1; - } - } - } - lua_settop(L,3); - } - lua_pushnil(L); - return 1; - } - else if (t== LUA_TTABLE) - { - module_index_event(L); - return 1; - } - lua_pushnil(L); - return 1; -} - -/* Newindex function - * It first searches for a C/C++ varaible to be set. - * Then, it either stores it in the alternative ubox table (in the case it is - * an object) or in the own table (that represents the class or module). -*/ -static int class_newindex_event (lua_State* L) -{ - int t = lua_type(L,1); - if (t == LUA_TUSERDATA) - { - /* Try accessing a C/C++ variable to be set */ - lua_getmetatable(L,1); - while (lua_istable(L,-1)) /* stack: t k v mt */ - { - if (lua_isnumber(L,2)) /* check if key is a numeric value */ - { - /* try operator[] */ - lua_pushstring(L,".seti"); - lua_rawget(L,-2); /* stack: obj key mt func */ - if (lua_isfunction(L,-1)) - { - lua_pushvalue(L,1); - lua_pushvalue(L,2); - lua_pushvalue(L,3); - lua_call(L,3,0); - return 0; - } - } - else - { - lua_pushstring(L,".set"); - lua_rawget(L,-2); /* stack: t k v mt tset */ - if (lua_istable(L,-1)) - { - lua_pushvalue(L,2); - lua_rawget(L,-2); /* stack: t k v mt tset func */ - if (lua_iscfunction(L,-1)) - { - lua_pushvalue(L,1); - lua_pushvalue(L,3); - lua_call(L,2,0); - return 0; - } - lua_pop(L,1); /* stack: t k v mt tset */ - } - lua_pop(L,1); /* stack: t k v mt */ - if (!lua_getmetatable(L,-1)) /* stack: t k v mt mt */ - lua_pushnil(L); - lua_remove(L,-2); /* stack: t k v mt */ - } - } - lua_settop(L,3); /* stack: t k v */ - - /* then, store as a new field */ - storeatubox(L,1); - } - else if (t== LUA_TTABLE) - { - module_newindex_event(L); - } - return 0; -} - -static int class_call_event(lua_State* L) { - - if (lua_istable(L, 1)) { - lua_pushstring(L, ".call"); - lua_rawget(L, 1); - if (lua_isfunction(L, -1)) { - - lua_insert(L, 1); - lua_call(L, lua_gettop(L)-1, 1); - - return 1; - }; - }; - tolua_error(L,"Attempt to call a non-callable object.",NULL); - return 0; -}; - -static int do_operator (lua_State* L, const char* op) -{ - if (lua_isuserdata(L,1)) - { - /* Try metatables */ - lua_pushvalue(L,1); /* stack: op1 op2 */ - while (lua_getmetatable(L,-1)) - { /* stack: op1 op2 op1 mt */ - lua_remove(L,-2); /* stack: op1 op2 mt */ - lua_pushstring(L,op); /* stack: op1 op2 mt key */ - lua_rawget(L,-2); /* stack: obj key mt func */ - if (lua_isfunction(L,-1)) - { - lua_pushvalue(L,1); - lua_pushvalue(L,2); - lua_call(L,2,1); - return 1; - } - lua_settop(L,3); - } - } - tolua_error(L,"Attempt to perform operation on an invalid operand",NULL); - return 0; -} - -static int class_add_event (lua_State* L) -{ - return do_operator(L,".add"); -} - -static int class_sub_event (lua_State* L) -{ - return do_operator(L,".sub"); -} - -static int class_mul_event (lua_State* L) -{ - return do_operator(L,".mul"); -} - -static int class_div_event (lua_State* L) -{ - return do_operator(L,".div"); -} - -static int class_lt_event (lua_State* L) -{ - return do_operator(L,".lt"); -} - -static int class_le_event (lua_State* L) -{ - return do_operator(L,".le"); -} - -static int class_eq_event (lua_State* L) -{ - /* copying code from do_operator here to return false when no operator is found */ - if (lua_isuserdata(L,1)) - { - /* Try metatables */ - lua_pushvalue(L,1); /* stack: op1 op2 */ - while (lua_getmetatable(L,-1)) - { /* stack: op1 op2 op1 mt */ - lua_remove(L,-2); /* stack: op1 op2 mt */ - lua_pushstring(L,".eq"); /* stack: op1 op2 mt key */ - lua_rawget(L,-2); /* stack: obj key mt func */ - if (lua_isfunction(L,-1)) - { - lua_pushvalue(L,1); - lua_pushvalue(L,2); - lua_call(L,2,1); - return 1; - } - lua_settop(L,3); - } - } - - lua_settop(L, 3); - lua_pushboolean(L, 0); - return 1; -} - -/* -static int class_gc_event (lua_State* L) -{ - void* u = *((void**)lua_touserdata(L,1)); - fprintf(stderr, "collecting: looking at %p\n", u); - lua_pushstring(L,"tolua_gc"); - lua_rawget(L,LUA_REGISTRYINDEX); - lua_pushlightuserdata(L,u); - lua_rawget(L,-2); - if (lua_isfunction(L,-1)) - { - lua_pushvalue(L,1); - lua_call(L,1,0); - lua_pushlightuserdata(L,u); - lua_pushnil(L); - lua_rawset(L,-3); - } - lua_pop(L,2); - return 0; -} -*/ -TOLUA_API int class_gc_event (lua_State* L) -{ - void* u = *((void**)lua_touserdata(L,1)); - int top; - /*fprintf(stderr, "collecting: looking at %p\n", u);*/ - /* - lua_pushstring(L,"tolua_gc"); - lua_rawget(L,LUA_REGISTRYINDEX); - */ - lua_pushvalue(L, lua_upvalueindex(1)); - lua_pushlightuserdata(L,u); - lua_rawget(L,-2); /* stack: gc umt */ - lua_getmetatable(L,1); /* stack: gc umt mt */ - /*fprintf(stderr, "checking type\n");*/ - top = lua_gettop(L); - if (tolua_fast_isa(L,top,top-1, lua_upvalueindex(2))) /* make sure we collect correct type */ - { - /*fprintf(stderr, "Found type!\n");*/ - /* get gc function */ - lua_pushliteral(L,".collector"); - lua_rawget(L,-2); /* stack: gc umt mt collector */ - if (lua_isfunction(L,-1)) { - /*fprintf(stderr, "Found .collector!\n");*/ - } - else { - lua_pop(L,1); - /*fprintf(stderr, "Using default cleanup\n");*/ - lua_pushcfunction(L,tolua_default_collect); - } - - lua_pushvalue(L,1); /* stack: gc umt mt collector u */ - lua_call(L,1,0); - - lua_pushlightuserdata(L,u); /* stack: gc umt mt u */ - lua_pushnil(L); /* stack: gc umt mt u nil */ - lua_rawset(L,-5); /* stack: gc umt mt */ - } - lua_pop(L,3); - return 0; -} - - -/* Register module events - * It expects the metatable on the top of the stack -*/ -TOLUA_API void tolua_moduleevents (lua_State* L) -{ - lua_pushstring(L,"__index"); - lua_pushcfunction(L,module_index_event); - lua_rawset(L,-3); - lua_pushstring(L,"__newindex"); - lua_pushcfunction(L,module_newindex_event); - lua_rawset(L,-3); -} - -/* Check if the object on the top has a module metatable -*/ -TOLUA_API int tolua_ismodulemetatable (lua_State* L) -{ - int r = 0; - if (lua_getmetatable(L,-1)) - { - lua_pushstring(L,"__index"); - lua_rawget(L,-2); - r = (lua_tocfunction(L,-1) == module_index_event); - lua_pop(L,2); - } - return r; -} - -/* Register class events - * It expects the metatable on the top of the stack -*/ -TOLUA_API void tolua_classevents (lua_State* L) -{ - lua_pushstring(L,"__index"); - lua_pushcfunction(L,class_index_event); - lua_rawset(L,-3); - lua_pushstring(L,"__newindex"); - lua_pushcfunction(L,class_newindex_event); - lua_rawset(L,-3); - - lua_pushstring(L,"__add"); - lua_pushcfunction(L,class_add_event); - lua_rawset(L,-3); - lua_pushstring(L,"__sub"); - lua_pushcfunction(L,class_sub_event); - lua_rawset(L,-3); - lua_pushstring(L,"__mul"); - lua_pushcfunction(L,class_mul_event); - lua_rawset(L,-3); - lua_pushstring(L,"__div"); - lua_pushcfunction(L,class_div_event); - lua_rawset(L,-3); - - lua_pushstring(L,"__lt"); - lua_pushcfunction(L,class_lt_event); - lua_rawset(L,-3); - lua_pushstring(L,"__le"); - lua_pushcfunction(L,class_le_event); - lua_rawset(L,-3); - lua_pushstring(L,"__eq"); - lua_pushcfunction(L,class_eq_event); - lua_rawset(L,-3); - - lua_pushstring(L,"__call"); - lua_pushcfunction(L,class_call_event); - lua_rawset(L,-3); - - lua_pushstring(L,"__gc"); - lua_pushstring(L, "tolua_gc_event"); - lua_rawget(L, LUA_REGISTRYINDEX); - /*lua_pushcfunction(L,class_gc_event);*/ - lua_rawset(L,-3); -} - diff --git a/tolua++-1.0.93/src/lib/tolua_is.c b/tolua++-1.0.93/src/lib/tolua_is.c deleted file mode 100644 index c486b271e..000000000 --- a/tolua++-1.0.93/src/lib/tolua_is.c +++ /dev/null @@ -1,621 +0,0 @@ -/* tolua: functions to check types. -** Support code for Lua bindings. -** Written by Waldemar Celes -** TeCGraf/PUC-Rio -** Apr 2003 -** $Id: $ -*/ - -/* This code is free software; you can redistribute it and/or modify it. -** The software provided hereunder is on an "as is" basis, and -** the author has no obligation to provide maintenance, support, updates, -** enhancements, or modifications. -*/ - -#include "tolua++.h" -#include "lauxlib.h" - -#include <stdlib.h> -#include <string.h> - -/* a fast check if a is b, without parameter validation - i.e. if b is equal to a or a superclass of a. */ -TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index) -{ - int result; - if (lua_rawequal(L,mt_indexa,mt_indexb)) - result = 1; - else - { - if (super_index) { - lua_pushvalue(L, super_index); - } else { - lua_pushliteral(L,"tolua_super"); - lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */ - }; - lua_pushvalue(L,mt_indexa); /* stack: super mta */ - lua_rawget(L,-2); /* stack: super super[mta] */ - lua_pushvalue(L,mt_indexb); /* stack: super super[mta] mtb */ - lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super super[mta] typenameB */ - lua_rawget(L,-2); /* stack: super super[mta] bool */ - result = lua_toboolean(L,-1); - lua_pop(L,3); - } - return result; -} - -/* Push and returns the corresponding object typename */ -TOLUA_API const char* tolua_typename (lua_State* L, int lo) -{ - int tag = lua_type(L,lo); - if (tag == LUA_TNONE) - lua_pushstring(L,"[no object]"); - else if (tag != LUA_TUSERDATA && tag != LUA_TTABLE) - lua_pushstring(L,lua_typename(L,tag)); - else if (tag == LUA_TUSERDATA) - { - if (!lua_getmetatable(L,lo)) - lua_pushstring(L,lua_typename(L,tag)); - else - { - lua_rawget(L,LUA_REGISTRYINDEX); - if (!lua_isstring(L,-1)) - { - lua_pop(L,1); - lua_pushstring(L,"[undefined]"); - } - } - } - else /* is table */ - { - lua_pushvalue(L,lo); - lua_rawget(L,LUA_REGISTRYINDEX); - if (!lua_isstring(L,-1)) - { - lua_pop(L,1); - lua_pushstring(L,"table"); - } - else - { - lua_pushstring(L,"class "); - lua_insert(L,-2); - lua_concat(L,2); - } - } - return lua_tostring(L,-1); -} - -TOLUA_API void tolua_error (lua_State* L, const char* msg, tolua_Error* err) -{ - if (msg[0] == '#') - { - const char* expected = err->type; - const char* provided = tolua_typename(L,err->index); - if (msg[1]=='f') - { - int narg = err->index; - if (err->array) - luaL_error(L,"%s\n argument #%d is array of '%s'; array of '%s' expected.\n", - msg+2,narg,provided,expected); - else - luaL_error(L,"%s\n argument #%d is '%s'; '%s' expected.\n", - msg+2,narg,provided,expected); - } - else if (msg[1]=='v') - { - if (err->array) - luaL_error(L,"%s\n value is array of '%s'; array of '%s' expected.\n", - msg+2,provided,expected); - else - luaL_error(L,"%s\n value is '%s'; '%s' expected.\n", - msg+2,provided,expected); - } - } - else - luaL_error(L,msg); -} - -/* the equivalent of lua_is* for usertable */ -static int lua_isusertable (lua_State* L, int lo, const char* type) -{ - int r = 0; - if (lo < 0) lo = lua_gettop(L)+lo+1; - lua_pushvalue(L,lo); - lua_rawget(L,LUA_REGISTRYINDEX); /* get registry[t] */ - if (lua_isstring(L,-1)) - { - r = strcmp(lua_tostring(L,-1),type)==0; - if (!r) - { - /* try const */ - lua_pushstring(L,"const "); - lua_insert(L,-2); - lua_concat(L,2); - r = lua_isstring(L,-1) && strcmp(lua_tostring(L,-1),type)==0; - } - } - lua_pop(L, 1); - return r; -} - -int push_table_instance(lua_State* L, int lo) { - - if (lua_istable(L, lo)) { - - lua_pushstring(L, ".c_instance"); - lua_gettable(L, lo); - if (lua_isuserdata(L, -1)) { - - lua_replace(L, lo); - return 1; - } else { - - lua_pop(L, 1); - return 0; - }; - } else { - return 0; - }; - - return 0; -}; - -/* the equivalent of lua_is* for usertype */ -static int lua_isusertype (lua_State* L, int lo, const char* type) -{ - if (!lua_isuserdata(L,lo)) { - if (!push_table_instance(L, lo)) { - return 0; - }; - }; - { - /* check if it is of the same type */ - int r; - const char *tn; - if (lua_getmetatable(L,lo)) /* if metatable? */ - { - lua_rawget(L,LUA_REGISTRYINDEX); /* get registry[mt] */ - tn = lua_tostring(L,-1); - r = tn && (strcmp(tn,type) == 0); - lua_pop(L, 1); - if (r) - return 1; - else - { - /* check if it is a specialized class */ - lua_pushstring(L,"tolua_super"); - lua_rawget(L,LUA_REGISTRYINDEX); /* get super */ - lua_getmetatable(L,lo); - lua_rawget(L,-2); /* get super[mt] */ - if (lua_istable(L,-1)) - { - int b; - lua_pushstring(L,type); - lua_rawget(L,-2); /* get super[mt][type] */ - b = lua_toboolean(L,-1); - lua_pop(L,3); - if (b) - return 1; - } - } - } - } - return 0; -} - -TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err) -{ - if (lua_gettop(L)<abs(lo)) - return 1; - err->index = lo; - err->array = 0; - err->type = "[no object]"; - return 0; -} - -TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err) -{ - if (def && lua_gettop(L)<abs(lo)) - return 1; - if (lua_isnil(L,lo) || lua_isboolean(L,lo)) - return 1; - err->index = lo; - err->array = 0; - err->type = "boolean"; - return 0; -} - -TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err) -{ - if (def && lua_gettop(L)<abs(lo)) - return 1; - if (lua_isnumber(L,lo)) - return 1; - err->index = lo; - err->array = 0; - err->type = "number"; - return 0; -} - -TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err) -{ - if (def && lua_gettop(L)<abs(lo)) - return 1; - if (lua_isnil(L,lo) || lua_isstring(L,lo)) - return 1; - err->index = lo; - err->array = 0; - err->type = "string"; - return 0; -} - -TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err) -{ - if (def && lua_gettop(L)<abs(lo)) - return 1; - if (lua_istable(L,lo)) - return 1; - err->index = lo; - err->array = 0; - err->type = "table"; - return 0; -} - -TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err) -{ - if (def && lua_gettop(L)<abs(lo)) - return 1; - if (lua_isusertable(L,lo,type)) - return 1; - err->index = lo; - err->array = 0; - err->type = type; - return 0; -} - - -TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err) -{ - if (def && lua_gettop(L)<abs(lo)) - return 1; - if (lua_isnil(L,lo) || lua_isuserdata(L,lo)) - return 1; - err->index = lo; - err->array = 0; - err->type = "userdata"; - return 0; -} - -TOLUA_API int tolua_isvaluenil (lua_State* L, int lo, tolua_Error* err) { - - if (lua_gettop(L)<abs(lo)) - return 0; /* somebody else should chack this */ - if (!lua_isnil(L, lo)) - return 0; - - err->index = lo; - err->array = 0; - err->type = "value"; - return 1; -}; - -TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err) -{ - if (def || abs(lo)<=lua_gettop(L)) /* any valid index */ - return 1; - err->index = lo; - err->array = 0; - err->type = "value"; - return 0; -} - -TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err) -{ - if (def && lua_gettop(L)<abs(lo)) - return 1; - if (lua_isnil(L,lo) || lua_isusertype(L,lo,type)) - return 1; - err->index = lo; - err->array = 0; - err->type = type; - return 0; -} - -TOLUA_API int tolua_isvaluearray - (lua_State* L, int lo, int dim, int def, tolua_Error* err) -{ - if (!tolua_istable(L,lo,def,err)) - return 0; - else - return 1; -} - -TOLUA_API int tolua_isbooleanarray - (lua_State* L, int lo, int dim, int def, tolua_Error* err) -{ - if (!tolua_istable(L,lo,def,err)) - return 0; - else - { - int i; - for (i=1; i<=dim; ++i) - { - lua_pushnumber(L,i); - lua_gettable(L,lo); - if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->array = 1; - err->type = "boolean"; - return 0; - } - lua_pop(L,1); - } - } - return 1; -} - -TOLUA_API int tolua_isnumberarray - (lua_State* L, int lo, int dim, int def, tolua_Error* err) -{ - if (!tolua_istable(L,lo,def,err)) - return 0; - else - { - int i; - for (i=1; i<=dim; ++i) - { - lua_pushnumber(L,i); - lua_gettable(L,lo); - if (!lua_isnumber(L,-1) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->array = 1; - err->type = "number"; - return 0; - } - lua_pop(L,1); - } - } - return 1; -} - -TOLUA_API int tolua_isstringarray - (lua_State* L, int lo, int dim, int def, tolua_Error* err) -{ - if (!tolua_istable(L,lo,def,err)) - return 0; - else - { - int i; - for (i=1; i<=dim; ++i) - { - lua_pushnumber(L,i); - lua_gettable(L,lo); - if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->array = 1; - err->type = "string"; - return 0; - } - lua_pop(L,1); - } - } - return 1; -} - -TOLUA_API int tolua_istablearray - (lua_State* L, int lo, int dim, int def, tolua_Error* err) -{ - if (!tolua_istable(L,lo,def,err)) - return 0; - else - { - int i; - for (i=1; i<=dim; ++i) - { - lua_pushnumber(L,i); - lua_gettable(L,lo); - if (! lua_istable(L,-1) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->array = 1; - err->type = "table"; - return 0; - } - lua_pop(L,1); - } - } - return 1; -} - -TOLUA_API int tolua_isuserdataarray - (lua_State* L, int lo, int dim, int def, tolua_Error* err) -{ - if (!tolua_istable(L,lo,def,err)) - return 0; - else - { - int i; - for (i=1; i<=dim; ++i) - { - lua_pushnumber(L,i); - lua_gettable(L,lo); - if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->array = 1; - err->type = "userdata"; - return 0; - } - lua_pop(L,1); - } - } - return 1; -} - -TOLUA_API int tolua_isusertypearray - (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err) -{ - if (!tolua_istable(L,lo,def,err)) - return 0; - else - { - int i; - for (i=1; i<=dim; ++i) - { - lua_pushnumber(L,i); - lua_gettable(L,lo); - if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->type = type; - err->array = 1; - return 0; - } - lua_pop(L,1); - } - } - return 1; -} - -#if 0 -int tolua_isbooleanfield - (lua_State* L, int lo, int i, int def, tolua_Error* err) -{ - lua_pushnumber(L,i); - lua_gettable(L,lo); - if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->array = 1; - err->type = "boolean"; - return 0; - } - lua_pop(L,1); - return 1; -} - -int tolua_isnumberfield - (lua_State* L, int lo, int i, int def, tolua_Error* err) -{ - lua_pushnumber(L,i); - lua_gettable(L,lo); - if (!lua_isnumber(L,-1) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->array = 1; - err->type = "number"; - return 0; - } - lua_pop(L,1); - return 1; -} - -int tolua_isstringfield - (lua_State* L, int lo, int i, int def, tolua_Error* err) -{ - lua_pushnumber(L,i); - lua_gettable(L,lo); - if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->array = 1; - err->type = "string"; - return 0; - } - lua_pop(L,1); - return 1; -} - -int tolua_istablefield - (lua_State* L, int lo, int i, int def, tolua_Error* err) -{ - lua_pushnumber(L,i+1); - lua_gettable(L,lo); - if (! lua_istable(L,-1) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->array = 1; - err->type = "table"; - return 0; - } - lua_pop(L,1); -} - -int tolua_isusertablefield - (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err) -{ - lua_pushnumber(L,i); - lua_gettable(L,lo); - if (! lua_isusertable(L,-1,type) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->array = 1; - err->type = type; - return 0; - } - lua_pop(L,1); - return 1; -} - -int tolua_isuserdatafield - (lua_State* L, int lo, int i, int def, tolua_Error* err) -{ - lua_pushnumber(L,i); - lua_gettable(L,lo); - if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->array = 1; - err->type = "userdata"; - return 0; - } - lua_pop(L,1); - return 1; -} - -int tolua_isusertypefield - (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err) -{ - lua_pushnumber(L,i); - lua_gettable(L,lo); - if (!(lua_isnil(L,-1) || lua_isusertype(L,-1,type)) && - !(def && lua_isnil(L,-1)) - ) - { - err->index = lo; - err->type = type; - err->array = 1; - return 0; - } - lua_pop(L,1); - return 1; -} - -#endif diff --git a/tolua++-1.0.93/src/lib/tolua_map.c b/tolua++-1.0.93/src/lib/tolua_map.c deleted file mode 100644 index d00e7069b..000000000 --- a/tolua++-1.0.93/src/lib/tolua_map.c +++ /dev/null @@ -1,704 +0,0 @@ -/* tolua: functions to map features -** Support code for Lua bindings. -** Written by Waldemar Celes -** TeCGraf/PUC-Rio -** Apr 2003 -** $Id: $ -*/ - -/* This code is free software; you can redistribute it and/or modify it. -** The software provided hereunder is on an "as is" basis, and -** the author has no obligation to provide maintenance, support, updates, -** enhancements, or modifications. -*/ - -#include "tolua++.h" -#include "tolua_event.h" -#include "lauxlib.h" - -#include <string.h> -#include <stdio.h> -#include <stdlib.h> -#include <math.h> - - -/* Create metatable - * Create and register new metatable -*/ -static int tolua_newmetatable (lua_State* L, char* name) -{ - int r = luaL_newmetatable(L,name); - - #ifdef LUA_VERSION_NUM /* only lua 5.1 */ - if (r) { - lua_pushvalue(L, -1); - lua_pushstring(L, name); - lua_settable(L, LUA_REGISTRYINDEX); /* reg[mt] = type_name */ - }; - #endif - - if (r) - tolua_classevents(L); /* set meta events */ - lua_pop(L,1); - return r; -} - -/* Map super classes - * It sets 'name' as being also a 'base', mapping all super classes of 'base' in 'name' -*/ -static void mapsuper (lua_State* L, const char* name, const char* base) -{ - /* push registry.super */ - lua_pushstring(L,"tolua_super"); - lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */ - luaL_getmetatable(L,name); /* stack: super mt */ - lua_rawget(L,-2); /* stack: super table */ - if (lua_isnil(L,-1)) - { - /* create table */ - lua_pop(L,1); - lua_newtable(L); /* stack: super table */ - luaL_getmetatable(L,name); /* stack: super table mt */ - lua_pushvalue(L,-2); /* stack: super table mt table */ - lua_rawset(L,-4); /* stack: super table */ - } - - /* set base as super class */ - lua_pushstring(L,base); - lua_pushboolean(L,1); - lua_rawset(L,-3); /* stack: super table */ - - /* set all super class of base as super class of name */ - luaL_getmetatable(L,base); /* stack: super table base_mt */ - lua_rawget(L,-3); /* stack: super table base_table */ - if (lua_istable(L,-1)) - { - /* traverse base table */ - lua_pushnil(L); /* first key */ - while (lua_next(L,-2) != 0) - { - /* stack: ... base_table key value */ - lua_pushvalue(L,-2); /* stack: ... base_table key value key */ - lua_insert(L,-2); /* stack: ... base_table key key value */ - lua_rawset(L,-5); /* stack: ... base_table key */ - } - } - lua_pop(L,3); /* stack: <empty> */ -} - -/* creates a 'tolua_ubox' table for base clases, and -// expects the metatable and base metatable on the stack */ -static void set_ubox(lua_State* L) { - - /* mt basemt */ - if (!lua_isnil(L, -1)) { - lua_pushstring(L, "tolua_ubox"); - lua_rawget(L,-2); - } else { - lua_pushnil(L); - }; - /* mt basemt base_ubox */ - if (!lua_isnil(L,-1)) { - lua_pushstring(L, "tolua_ubox"); - lua_insert(L, -2); - /* mt basemt key ubox */ - lua_rawset(L,-4); - /* (mt with ubox) basemt */ - } else { - /* mt basemt nil */ - lua_pop(L, 1); - lua_pushstring(L,"tolua_ubox"); lua_newtable(L); - /* make weak value metatable for ubox table to allow userdata to be - garbage-collected */ - lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */ - lua_setmetatable(L, -2); /* stack:mt basemt string ubox */ - lua_rawset(L,-4); - }; - -}; - -/* Map inheritance - * It sets 'name' as derived from 'base' by setting 'base' as metatable of 'name' -*/ -static void mapinheritance (lua_State* L, const char* name, const char* base) -{ - /* set metatable inheritance */ - luaL_getmetatable(L,name); - - if (base && *base) - luaL_getmetatable(L,base); - else { - - if (lua_getmetatable(L, -1)) { /* already has a mt, we don't overwrite it */ - lua_pop(L, 2); - return; - }; - luaL_getmetatable(L,"tolua_commonclass"); - }; - - set_ubox(L); - - lua_setmetatable(L,-2); - lua_pop(L,1); -} - -/* Object type -*/ -static int tolua_bnd_type (lua_State* L) -{ - tolua_typename(L,lua_gettop(L)); - return 1; -} - -/* Take ownership -*/ -static int tolua_bnd_takeownership (lua_State* L) -{ - int success = 0; - if (lua_isuserdata(L,1)) - { - if (lua_getmetatable(L,1)) /* if metatable? */ - { - lua_pop(L,1); /* clear metatable off stack */ - /* force garbage collection to avoid C to reuse a to-be-collected address */ - #ifdef LUA_VERSION_NUM - lua_gc(L, LUA_GCCOLLECT, 0); - #else - lua_setgcthreshold(L,0); - #endif - - success = tolua_register_gc(L,1); - } - } - lua_pushboolean(L,success!=0); - return 1; -} - -/* Release ownership -*/ -static int tolua_bnd_releaseownership (lua_State* L) -{ - int done = 0; - if (lua_isuserdata(L,1)) - { - void* u = *((void**)lua_touserdata(L,1)); - /* force garbage collection to avoid releasing a to-be-collected address */ - #ifdef LUA_VERSION_NUM - lua_gc(L, LUA_GCCOLLECT, 0); - #else - lua_setgcthreshold(L,0); - #endif - lua_pushstring(L,"tolua_gc"); - lua_rawget(L,LUA_REGISTRYINDEX); - lua_pushlightuserdata(L,u); - lua_rawget(L,-2); - lua_getmetatable(L,1); - if (lua_rawequal(L,-1,-2)) /* check that we are releasing the correct type */ - { - lua_pushlightuserdata(L,u); - lua_pushnil(L); - lua_rawset(L,-5); - done = 1; - } - } - lua_pushboolean(L,done!=0); - return 1; -} - -/* Type casting -*/ -static int tolua_bnd_cast (lua_State* L) -{ - -/* // old code - void* v = tolua_tousertype(L,1,NULL); - const char* s = tolua_tostring(L,2,NULL); - if (v && s) - tolua_pushusertype(L,v,s); - else - lua_pushnil(L); - return 1; -*/ - - void* v; - const char* s; - if (lua_islightuserdata(L, 1)) { - v = tolua_touserdata(L, 1, NULL); - } else { - v = tolua_tousertype(L, 1, 0); - }; - - s = tolua_tostring(L,2,NULL); - if (v && s) - tolua_pushusertype(L,v,s); - else - lua_pushnil(L); - return 1; -} - -/* Inheritance -*/ -static int tolua_bnd_inherit (lua_State* L) { - - /* stack: lua object, c object */ - lua_pushstring(L, ".c_instance"); - lua_pushvalue(L, -2); - lua_rawset(L, -4); - /* l_obj[".c_instance"] = c_obj */ - - return 0; -}; - -#ifdef LUA_VERSION_NUM /* lua 5.1 */ -static int tolua_bnd_setpeer(lua_State* L) { - - /* stack: userdata, table */ - if (!lua_isuserdata(L, -2)) { - lua_pushstring(L, "Invalid argument #1 to setpeer: userdata expected."); - lua_error(L); - }; - - if (lua_isnil(L, -1)) { - - lua_pop(L, 1); - lua_pushvalue(L, TOLUA_NOPEER); - }; - lua_setfenv(L, -2); - - return 0; -}; - -static int tolua_bnd_getpeer(lua_State* L) { - - /* stack: userdata */ - lua_getfenv(L, -1); - if (lua_rawequal(L, -1, TOLUA_NOPEER)) { - lua_pop(L, 1); - lua_pushnil(L); - }; - return 1; -}; -#endif - -/* static int class_gc_event (lua_State* L); */ - -TOLUA_API void tolua_open (lua_State* L) -{ - int top = lua_gettop(L); - lua_pushstring(L,"tolua_opened"); - lua_rawget(L,LUA_REGISTRYINDEX); - if (!lua_isboolean(L,-1)) - { - lua_pushstring(L,"tolua_opened"); lua_pushboolean(L,1); lua_rawset(L,LUA_REGISTRYINDEX); - - #ifndef LUA_VERSION_NUM /* only prior to lua 5.1 */ - /* create peer object table */ - lua_pushstring(L, "tolua_peers"); lua_newtable(L); - /* make weak key metatable for peers indexed by userdata object */ - lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "k"); lua_rawset(L, -3); /* stack: string peers mt */ - lua_setmetatable(L, -2); /* stack: string peers */ - lua_rawset(L,LUA_REGISTRYINDEX); - #endif - - /* create object ptr -> udata mapping table */ - lua_pushstring(L,"tolua_ubox"); lua_newtable(L); - /* make weak value metatable for ubox table to allow userdata to be - garbage-collected */ - lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */ - lua_setmetatable(L, -2); /* stack: string ubox */ - lua_rawset(L,LUA_REGISTRYINDEX); - - lua_pushstring(L,"tolua_super"); lua_newtable(L); lua_rawset(L,LUA_REGISTRYINDEX); - lua_pushstring(L,"tolua_gc"); lua_newtable(L);lua_rawset(L,LUA_REGISTRYINDEX); - - /* create gc_event closure */ - lua_pushstring(L, "tolua_gc_event"); - lua_pushstring(L, "tolua_gc"); - lua_rawget(L, LUA_REGISTRYINDEX); - lua_pushstring(L, "tolua_super"); - lua_rawget(L, LUA_REGISTRYINDEX); - lua_pushcclosure(L, class_gc_event, 2); - lua_rawset(L, LUA_REGISTRYINDEX); - - tolua_newmetatable(L,"tolua_commonclass"); - - tolua_module(L,NULL,0); - tolua_beginmodule(L,NULL); - tolua_module(L,"tolua",0); - tolua_beginmodule(L,"tolua"); - tolua_function(L,"type",tolua_bnd_type); - tolua_function(L,"takeownership",tolua_bnd_takeownership); - tolua_function(L,"releaseownership",tolua_bnd_releaseownership); - tolua_function(L,"cast",tolua_bnd_cast); - tolua_function(L,"inherit", tolua_bnd_inherit); - #ifdef LUA_VERSION_NUM /* lua 5.1 */ - tolua_function(L, "setpeer", tolua_bnd_setpeer); - tolua_function(L, "getpeer", tolua_bnd_getpeer); - #endif - - tolua_endmodule(L); - tolua_endmodule(L); - } - lua_settop(L,top); -} - -/* Copy a C object -*/ -TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size) -{ - void* clone = (void*)malloc(size); - if (clone) - memcpy(clone,value,size); - else - tolua_error(L,"insuficient memory",NULL); - return clone; -} - -/* Default collect function -*/ -TOLUA_API int tolua_default_collect (lua_State* tolua_S) -{ - void* self = tolua_tousertype(tolua_S,1,0); - free(self); - return 0; -} - -/* Do clone -*/ -TOLUA_API int tolua_register_gc (lua_State* L, int lo) -{ - int success = 1; - void *value = *(void **)lua_touserdata(L,lo); - lua_pushstring(L,"tolua_gc"); - lua_rawget(L,LUA_REGISTRYINDEX); - lua_pushlightuserdata(L,value); - lua_rawget(L,-2); - if (!lua_isnil(L,-1)) /* make sure that object is not already owned */ - success = 0; - else - { - lua_pushlightuserdata(L,value); - lua_getmetatable(L,lo); - lua_rawset(L,-4); - } - lua_pop(L,2); - return success; -} - -/* Register a usertype - * It creates the correspoding metatable in the registry, for both 'type' and 'const type'. - * It maps 'const type' as being also a 'type' -*/ -TOLUA_API void tolua_usertype (lua_State* L, const char* type) -{ - char ctype[128] = "const "; - strncat(ctype,type,120); - - /* create both metatables */ - if (tolua_newmetatable(L,ctype) && tolua_newmetatable(L,type)) - mapsuper(L,type,ctype); /* 'type' is also a 'const type' */ -} - - -/* Begin module - * It pushes the module (or class) table on the stack -*/ -TOLUA_API void tolua_beginmodule (lua_State* L, const char* name) -{ - if (name) - { - lua_pushstring(L,name); - lua_rawget(L,-2); - } - else - lua_pushvalue(L,LUA_GLOBALSINDEX); -} - -/* End module - * It pops the module (or class) from the stack -*/ -TOLUA_API void tolua_endmodule (lua_State* L) -{ - lua_pop(L,1); -} - -/* Map module - * It creates a new module -*/ -#if 1 -TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar) -{ - if (name) - { - /* tolua module */ - lua_pushstring(L,name); - lua_rawget(L,-2); - if (!lua_istable(L,-1)) /* check if module already exists */ - { - lua_pop(L,1); - lua_newtable(L); - lua_pushstring(L,name); - lua_pushvalue(L,-2); - lua_rawset(L,-4); /* assing module into module */ - } - } - else - { - /* global table */ - lua_pushvalue(L,LUA_GLOBALSINDEX); - } - if (hasvar) - { - if (!tolua_ismodulemetatable(L)) /* check if it already has a module metatable */ - { - /* create metatable to get/set C/C++ variable */ - lua_newtable(L); - tolua_moduleevents(L); - if (lua_getmetatable(L,-2)) - lua_setmetatable(L,-2); /* set old metatable as metatable of metatable */ - lua_setmetatable(L,-2); - } - } - lua_pop(L,1); /* pop module */ -} -#else -TOLUA_API void tolua_module (lua_State* L, const char* name, int hasvar) -{ - if (name) - { - /* tolua module */ - lua_pushstring(L,name); - lua_newtable(L); - } - else - { - /* global table */ - lua_pushvalue(L,LUA_GLOBALSINDEX); - } - if (hasvar) - { - /* create metatable to get/set C/C++ variable */ - lua_newtable(L); - tolua_moduleevents(L); - if (lua_getmetatable(L,-2)) - lua_setmetatable(L,-2); /* set old metatable as metatable of metatable */ - lua_setmetatable(L,-2); - } - if (name) - lua_rawset(L,-3); /* assing module into module */ - else - lua_pop(L,1); /* pop global table */ -} -#endif - -static void push_collector(lua_State* L, const char* type, lua_CFunction col) { - - /* push collector function, but only if it's not NULL, or if there's no - collector already */ - if (!col) return; - luaL_getmetatable(L,type); - lua_pushstring(L,".collector"); - /* - if (!col) { - lua_pushvalue(L, -1); - lua_rawget(L, -3); - if (!lua_isnil(L, -1)) { - lua_pop(L, 3); - return; - }; - lua_pop(L, 1); - }; - // */ - lua_pushcfunction(L,col); - - lua_rawset(L,-3); - lua_pop(L, 1); -}; - -/* Map C class - * It maps a C class, setting the appropriate inheritance and super classes. -*/ -TOLUA_API void tolua_cclass (lua_State* L, const char* lname, const char* name, const char* base, lua_CFunction col) -{ - char cname[128] = "const "; - char cbase[128] = "const "; - strncat(cname,name,120); - strncat(cbase,base,120); - - mapinheritance(L,name,base); - mapinheritance(L,cname,name); - - mapsuper(L,cname,cbase); - mapsuper(L,name,base); - - lua_pushstring(L,lname); - - push_collector(L, name, col); - /* - luaL_getmetatable(L,name); - lua_pushstring(L,".collector"); - lua_pushcfunction(L,col); - - lua_rawset(L,-3); - */ - - luaL_getmetatable(L,name); - lua_rawset(L,-3); /* assign class metatable to module */ - - /* now we also need to store the collector table for the const - instances of the class */ - push_collector(L, cname, col); - /* - luaL_getmetatable(L,cname); - lua_pushstring(L,".collector"); - lua_pushcfunction(L,col); - lua_rawset(L,-3); - lua_pop(L,1); - */ - - -} - -/* Add base - * It adds additional base classes to a class (for multiple inheritance) - * (not for now) -TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base) { - - char cname[128] = "const "; - char cbase[128] = "const "; - strncat(cname,name,120); - strncat(cbase,base,120); - - mapsuper(L,cname,cbase); - mapsuper(L,name,base); -}; -*/ - -/* Map function - * It assigns a function into the current module (or class) -*/ -TOLUA_API void tolua_function (lua_State* L, const char* name, lua_CFunction func) -{ - lua_pushstring(L,name); - lua_pushcfunction(L,func); - lua_rawset(L,-3); -} - -/* sets the __call event for the class (expects the class' main table on top) */ -/* never really worked :( -TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type) { - - lua_getmetatable(L, -1); - //luaL_getmetatable(L, type); - lua_pushstring(L,"__call"); - lua_pushcfunction(L,func); - lua_rawset(L,-3); - lua_pop(L, 1); -}; -*/ - -/* Map constant number - * It assigns a constant number into the current module (or class) -*/ -TOLUA_API void tolua_constant (lua_State* L, const char* name, lua_Number value) -{ - lua_pushstring(L,name); - tolua_pushnumber(L,value); - lua_rawset(L,-3); -} - - -/* Map variable - * It assigns a variable into the current module (or class) -*/ -TOLUA_API void tolua_variable (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set) -{ - /* get func */ - lua_pushstring(L,".get"); - lua_rawget(L,-2); - if (!lua_istable(L,-1)) - { - /* create .get table, leaving it at the top */ - lua_pop(L,1); - lua_newtable(L); - lua_pushstring(L,".get"); - lua_pushvalue(L,-2); - lua_rawset(L,-4); - } - lua_pushstring(L,name); - lua_pushcfunction(L,get); - lua_rawset(L,-3); /* store variable */ - lua_pop(L,1); /* pop .get table */ - - /* set func */ - if (set) - { - lua_pushstring(L,".set"); - lua_rawget(L,-2); - if (!lua_istable(L,-1)) - { - /* create .set table, leaving it at the top */ - lua_pop(L,1); - lua_newtable(L); - lua_pushstring(L,".set"); - lua_pushvalue(L,-2); - lua_rawset(L,-4); - } - lua_pushstring(L,name); - lua_pushcfunction(L,set); - lua_rawset(L,-3); /* store variable */ - lua_pop(L,1); /* pop .set table */ - } -} - -/* Access const array - * It reports an error when trying to write into a const array -*/ -static int const_array (lua_State* L) -{ - luaL_error(L,"value of const array cannot be changed"); - return 0; -} - -/* Map an array - * It assigns an array into the current module (or class) -*/ -TOLUA_API void tolua_array (lua_State* L, const char* name, lua_CFunction get, lua_CFunction set) -{ - lua_pushstring(L,".get"); - lua_rawget(L,-2); - if (!lua_istable(L,-1)) - { - /* create .get table, leaving it at the top */ - lua_pop(L,1); - lua_newtable(L); - lua_pushstring(L,".get"); - lua_pushvalue(L,-2); - lua_rawset(L,-4); - } - lua_pushstring(L,name); - - lua_newtable(L); /* create array metatable */ - lua_pushvalue(L,-1); - lua_setmetatable(L,-2); /* set the own table as metatable (for modules) */ - lua_pushstring(L,"__index"); - lua_pushcfunction(L,get); - lua_rawset(L,-3); - lua_pushstring(L,"__newindex"); - lua_pushcfunction(L,set?set:const_array); - lua_rawset(L,-3); - - lua_rawset(L,-3); /* store variable */ - lua_pop(L,1); /* pop .get table */ -} - - -TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name) { - - #ifdef LUA_VERSION_NUM /* lua 5.1 */ - luaL_loadbuffer(L, B, size, name) || lua_pcall(L, 0, 0, 0); - #else - lua_dobuffer(L, B, size, name); - #endif -}; - diff --git a/tolua++-1.0.93/src/lib/tolua_push.c b/tolua++-1.0.93/src/lib/tolua_push.c deleted file mode 100644 index 639414755..000000000 --- a/tolua++-1.0.93/src/lib/tolua_push.c +++ /dev/null @@ -1,171 +0,0 @@ -/* tolua: functions to push C values. -** Support code for Lua bindings. -** Written by Waldemar Celes -** TeCGraf/PUC-Rio -** Apr 2003 -** $Id: $ -*/ - -/* This code is free software; you can redistribute it and/or modify it. -** The software provided hereunder is on an "as is" basis, and -** the author has no obligation to provide maintenance, support, updates, -** enhancements, or modifications. -*/ - -#include "tolua++.h" -#include "lauxlib.h" - -#include <stdlib.h> - -TOLUA_API void tolua_pushvalue (lua_State* L, int lo) -{ - lua_pushvalue(L,lo); -} - -TOLUA_API void tolua_pushboolean (lua_State* L, int value) -{ - lua_pushboolean(L,value); -} - -TOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value) -{ - lua_pushnumber(L,value); -} - -TOLUA_API void tolua_pushstring (lua_State* L, const char* value) -{ - if (value == NULL) - lua_pushnil(L); - else - lua_pushstring(L,value); -} - -TOLUA_API void tolua_pushuserdata (lua_State* L, void* value) -{ - if (value == NULL) - lua_pushnil(L); - else - lua_pushlightuserdata(L,value); -} - -TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type) -{ - if (value == NULL) - lua_pushnil(L); - else - { - luaL_getmetatable(L, type); - lua_pushstring(L,"tolua_ubox"); - lua_rawget(L,-2); /* stack: mt ubox */ - if (lua_isnil(L, -1)) { - lua_pop(L, 1); - lua_pushstring(L, "tolua_ubox"); - lua_rawget(L, LUA_REGISTRYINDEX); - }; - lua_pushlightuserdata(L,value); - lua_rawget(L,-2); /* stack: mt ubox ubox[u] */ - if (lua_isnil(L,-1)) - { - lua_pop(L,1); /* stack: mt ubox */ - lua_pushlightuserdata(L,value); - *(void**)lua_newuserdata(L,sizeof(void *)) = value; /* stack: mt ubox u newud */ - lua_pushvalue(L,-1); /* stack: mt ubox u newud newud */ - lua_insert(L,-4); /* stack: mt newud ubox u newud */ - lua_rawset(L,-3); /* stack: mt newud ubox */ - lua_pop(L,1); /* stack: mt newud */ - /*luaL_getmetatable(L,type);*/ - lua_pushvalue(L, -2); /* stack: mt newud mt */ - lua_setmetatable(L,-2); /* stack: mt newud */ - - #ifdef LUA_VERSION_NUM - lua_pushvalue(L, TOLUA_NOPEER); - lua_setfenv(L, -2); - #endif - } - else - { - /* check the need of updating the metatable to a more specialized class */ - lua_insert(L,-2); /* stack: mt ubox[u] ubox */ - lua_pop(L,1); /* stack: mt ubox[u] */ - lua_pushstring(L,"tolua_super"); - lua_rawget(L,LUA_REGISTRYINDEX); /* stack: mt ubox[u] super */ - lua_getmetatable(L,-2); /* stack: mt ubox[u] super mt */ - lua_rawget(L,-2); /* stack: mt ubox[u] super super[mt] */ - if (lua_istable(L,-1)) - { - lua_pushstring(L,type); /* stack: mt ubox[u] super super[mt] type */ - lua_rawget(L,-2); /* stack: mt ubox[u] super super[mt] flag */ - if (lua_toboolean(L,-1) == 1) /* if true */ - { - lua_pop(L,3); /* mt ubox[u]*/ - lua_remove(L, -2); - return; - } - } - /* type represents a more specilized type */ - /*luaL_getmetatable(L,type); // stack: mt ubox[u] super super[mt] flag mt */ - lua_pushvalue(L, -5); /* stack: mt ubox[u] super super[mt] flag mt */ - lua_setmetatable(L,-5); /* stack: mt ubox[u] super super[mt] flag */ - lua_pop(L,3); /* stack: mt ubox[u] */ - } - lua_remove(L, -2); /* stack: ubox[u]*/ - } -} - -TOLUA_API void tolua_pushusertype_and_takeownership (lua_State* L, void* value, const char* type) -{ - tolua_pushusertype(L,value,type); - tolua_register_gc(L,lua_gettop(L)); -} - -TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v) -{ - lua_pushnumber(L,index); - lua_pushvalue(L,v); - lua_settable(L,lo); -} - -TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v) -{ - lua_pushnumber(L,index); - lua_pushboolean(L,v); - lua_settable(L,lo); -} - - -TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v) -{ - lua_pushnumber(L,index); - tolua_pushnumber(L,v); - lua_settable(L,lo); -} - -TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v) -{ - lua_pushnumber(L,index); - tolua_pushstring(L,v); - lua_settable(L,lo); -} - -TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v) -{ - lua_pushnumber(L,index); - tolua_pushuserdata(L,v); - lua_settable(L,lo); -} - -TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type) -{ - lua_pushnumber(L,index); - tolua_pushusertype(L,v,type); - lua_settable(L,lo); -} - -TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type) -{ - lua_pushnumber(L,index); - tolua_pushusertype(L,v,type); - tolua_register_gc(L,lua_gettop(L)); - lua_settable(L,lo); -} - diff --git a/tolua++-1.0.93/src/lib/tolua_to.c b/tolua++-1.0.93/src/lib/tolua_to.c deleted file mode 100644 index 542ca67d1..000000000 --- a/tolua++-1.0.93/src/lib/tolua_to.c +++ /dev/null @@ -1,133 +0,0 @@ -/* tolua: funcitons to convert to C types -** Support code for Lua bindings. -** Written by Waldemar Celes -** TeCGraf/PUC-Rio -** Apr 2003 -** $Id: $ -*/ - -/* This code is free software; you can redistribute it and/or modify it. -** The software provided hereunder is on an "as is" basis, and -** the author has no obligation to provide maintenance, support, updates, -** enhancements, or modifications. -*/ - -#include "tolua++.h" - -#include <string.h> -#include <stdlib.h> - -TOLUA_API lua_Number tolua_tonumber (lua_State* L, int narg, lua_Number def) -{ - return lua_gettop(L)<abs(narg) ? def : lua_tonumber(L,narg); -} - -TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def) -{ - return lua_gettop(L)<abs(narg) ? def : lua_tostring(L,narg); -} - -TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def) -{ - - /* return lua_gettop(L)<abs(narg) ? def : lua_touserdata(L,narg); */ - - if (lua_gettop(L)<abs(narg)) { - return def; - }; - - if (lua_islightuserdata(L, narg)) { - - return lua_touserdata(L,narg); - }; - - return tolua_tousertype(L, narg, def); -} - -extern int push_table_instance(lua_State* L, int lo); - -TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def) -{ - if (lua_gettop(L)<abs(narg)) - return def; - else - { - void* u; - if (!lua_isuserdata(L, narg)) { - if (!push_table_instance(L, narg)) return NULL; - }; - u = lua_touserdata(L,narg); - return (u==NULL) ? NULL : *((void**)u); /* nil represents NULL */ - } -} - -TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def) -{ - return lua_gettop(L)<abs(narg) ? def : narg; -} - -TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def) -{ - return lua_gettop(L)<abs(narg) ? def : lua_toboolean(L,narg); -} - -TOLUA_API lua_Number tolua_tofieldnumber (lua_State* L, int lo, int index, lua_Number def) -{ - double v; - lua_pushnumber(L,index); - lua_gettable(L,lo); - v = lua_isnil(L,-1) ? def : lua_tonumber(L,-1); - lua_pop(L,1); - return v; -} - -TOLUA_API const char* tolua_tofieldstring -(lua_State* L, int lo, int index, const char* def) -{ - const char* v; - lua_pushnumber(L,index); - lua_gettable(L,lo); - v = lua_isnil(L,-1) ? def : lua_tostring(L,-1); - lua_pop(L,1); - return v; -} - -TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def) -{ - void* v; - lua_pushnumber(L,index); - lua_gettable(L,lo); - v = lua_isnil(L,-1) ? def : lua_touserdata(L,-1); - lua_pop(L,1); - return v; -} - -TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def) -{ - void* v; - lua_pushnumber(L,index); - lua_gettable(L,lo); - v = lua_isnil(L,-1) ? def : (*(void **)(lua_touserdata(L, -1))); /* lua_unboxpointer(L,-1); */ - lua_pop(L,1); - return v; -} - -TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def) -{ - int v; - lua_pushnumber(L,index); - lua_gettable(L,lo); - v = lua_isnil(L,-1) ? def : lo; - lua_pop(L,1); - return v; -} - -TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def) -{ - int v; - lua_pushnumber(L,index); - lua_gettable(L,lo); - v = lua_isnil(L,-1) ? 0 : lua_toboolean(L,-1); - lua_pop(L,1); - return v; -} |