Random cleanup

This commit is contained in:
momo5502 2019-09-27 22:35:57 +02:00
parent 320d57599e
commit 9f98190944
37 changed files with 2965 additions and 3080 deletions

View File

@ -1,9 +1,7 @@
#include "std_include.hpp" #include "std_include.hpp"
#include "context_initializer.hpp" #include "context_initializer.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
context::context() : executer_(this), scheduler_(this), parameters_(this), event_handler_(this) context::context() : executer_(this), scheduler_(this), parameters_(this), event_handler_(this)
{ {
@ -35,4 +33,3 @@ namespace game
return &this->chai_; return &this->chai_;
} }
} }
}

View File

@ -4,9 +4,7 @@
#include "parameters.hpp" #include "parameters.hpp"
#include "event_handler.hpp" #include "event_handler.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
class context final class context final
{ {
@ -29,4 +27,3 @@ namespace game
event_handler event_handler_; event_handler event_handler_;
}; };
} }
}

View File

@ -1,11 +1,7 @@
#include "std_include.hpp" #include "std_include.hpp"
#include "context_initializer.hpp" #include "context_initializer.hpp"
namespace game namespace game::scripting::context_initializer
{
namespace scripting
{
namespace context_initializer
{ {
void initialize_entity(context* context) void initialize_entity(context* context)
{ {
@ -240,5 +236,3 @@ namespace game
chai->add_global(chaiscript::var(entity(context, level_id)), "level"); chai->add_global(chaiscript::var(entity(context, level_id)), "level");
} }
} }
}
}

View File

@ -1,13 +1,7 @@
#pragma once #pragma once
#include "context.hpp" #include "context.hpp"
namespace game namespace game::scripting::context_initializer
{
namespace scripting
{
namespace context_initializer
{ {
void initialize(context* context); void initialize(context* context);
} }
}
}

View File

@ -1,9 +1,7 @@
#include "std_include.hpp" #include "std_include.hpp"
#include "context.hpp" #include "context.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
entity::entity() : entity(nullptr, 0) entity::entity() : entity(nullptr, 0)
{ {
@ -131,4 +129,3 @@ namespace game
} }
} }
} }
}

View File

@ -1,9 +1,7 @@
#pragma once #pragma once
#include "game/game.hpp" #include "game/game.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
class context; class context;
class event_listener_handle; class event_listener_handle;
@ -42,4 +40,3 @@ namespace game
void release() const; void release() const;
}; };
} }
}

View File

@ -1,9 +1,7 @@
#pragma once #pragma once
#include "game/game.hpp" #include "game/game.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
class event final class event final
{ {
@ -13,4 +11,3 @@ namespace game
std::vector<native::VariableValue> arguments; std::vector<native::VariableValue> arguments;
}; };
} }
}

View File

@ -1,9 +1,7 @@
#include "std_include.hpp" #include "std_include.hpp"
#include "context.hpp" #include "context.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
event_handler::event_handler(context* context) : context_(context) event_handler::event_handler(context* context) : context_(context)
{ {
@ -121,4 +119,3 @@ namespace game
} }
} }
} }
}

View File

@ -3,9 +3,7 @@
#include "entity.hpp" #include "entity.hpp"
#include "event.hpp" #include "event.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
class context; class context;
@ -57,4 +55,3 @@ namespace game
void remove(const event_listener_handle& handle); void remove(const event_listener_handle& handle);
}; };
} }
}

View File

@ -6,9 +6,7 @@
#include "safe_executer.hpp" #include "safe_executer.hpp"
#include "context.hpp" #include "context.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
executer::executer(context* context) : context_(context) executer::executer(context* context) : context_(context)
{ {
@ -169,4 +167,3 @@ namespace game
return -1; return -1;
} }
} }
}

View File

@ -1,8 +1,6 @@
#pragma once #pragma once
namespace game namespace game::scripting
{
namespace scripting
{ {
class context; class context;
@ -31,4 +29,3 @@ namespace game
static int find_function_index(const std::string& function, bool prefer_global); static int find_function_index(const std::string& function, bool prefer_global);
}; };
} }
}

View File

@ -1,9 +1,7 @@
#include "std_include.hpp" #include "std_include.hpp"
#include "functions.hpp" #include "functions.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
std::map<std::string, int> instance_function_map = std::map<std::string, int> instance_function_map =
{ {
@ -748,4 +746,3 @@ namespace game
{"objective_playerenemyteam", 361}, {"objective_playerenemyteam", 361},
}; };
} }
}

View File

@ -1,10 +1,7 @@
#pragma once #pragma once
namespace game namespace game::scripting
{
namespace scripting
{ {
extern std::map<std::string, int> instance_function_map; extern std::map<std::string, int> instance_function_map;
extern std::map<std::string, int> global_function_map; extern std::map<std::string, int> global_function_map;
} }
}

View File

@ -1,9 +1,7 @@
#include "std_include.hpp" #include "std_include.hpp"
#include "context.hpp" #include "context.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
parameters::parameters(context* context) : context_(context) parameters::parameters(context* context) : context_(context)
{ {
@ -150,4 +148,3 @@ namespace game
return this->load(native::scr_VmPub->top[1 - native::scr_VmPub->outparamcount]); return this->load(native::scr_VmPub->top[1 - native::scr_VmPub->outparamcount]);
} }
} }
}

View File

@ -1,9 +1,7 @@
#pragma once #pragma once
#include "game/game.hpp" #include "game/game.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
class context; class context;
@ -20,4 +18,3 @@ namespace game
context* context_; context* context_;
}; };
} }
}

View File

@ -3,11 +3,8 @@
#pragma warning(push) #pragma warning(push)
#pragma warning(disable: 4611) #pragma warning(disable: 4611)
namespace game
{ namespace game::scripting::safe_executer
namespace scripting
{
namespace safe_executer
{ {
static_assert(sizeof(jmp_buf) == 64); static_assert(sizeof(jmp_buf) == 64);
@ -58,6 +55,5 @@ namespace game
return true; return true;
} }
} }
}
}
#pragma warning(pop) #pragma warning(pop)

View File

@ -1,15 +1,9 @@
#pragma once #pragma once
#include "game/game.hpp" #include "game/game.hpp"
namespace game namespace game::scripting::safe_executer
{
namespace scripting
{
namespace safe_executer
{ {
bool call(const native::scr_call_t function, const native::scr_entref_t entref); bool call(const native::scr_call_t function, const native::scr_entref_t entref);
bool set_entity_field(const native::scr_entref_t entref, const int offset); bool set_entity_field(const native::scr_entref_t entref, const int offset);
bool get_entity_field(const native::scr_entref_t entref, const int offset, native::VariableValue* value); bool get_entity_field(const native::scr_entref_t entref, const int offset, native::VariableValue* value);
} }
}
}

View File

@ -1,9 +1,7 @@
#include "std_include.hpp" #include "std_include.hpp"
#include "context.hpp" #include "context.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
scheduler::scheduler(context* context) : context_(context) scheduler::scheduler(context* context) : context_(context)
{ {
@ -96,4 +94,3 @@ namespace game
} }
} }
} }
}

View File

@ -1,9 +1,7 @@
#pragma once #pragma once
#include "utils/concurrent_list.hpp" #include "utils/concurrent_list.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
class context; class context;
@ -42,4 +40,3 @@ namespace game
void remove(const task_handle& handle); void remove(const task_handle& handle);
}; };
} }
}

View File

@ -1,9 +1,7 @@
#include "std_include.hpp" #include "std_include.hpp"
#include "stack_isolation.hpp" #include "stack_isolation.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
stack_isolation::stack_isolation() stack_isolation::stack_isolation()
{ {
@ -27,4 +25,3 @@ namespace game
native::scr_VmPub->maxstack = this->max_stack_; native::scr_VmPub->maxstack = this->max_stack_;
} }
} }
}

View File

@ -1,9 +1,7 @@
#pragma once #pragma once
#include "game/game.hpp" #include "game/game.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
class stack_isolation final class stack_isolation final
{ {
@ -20,4 +18,3 @@ namespace game
unsigned int out_param_count_; unsigned int out_param_count_;
}; };
} }
}

View File

@ -1,9 +1,7 @@
#include "std_include.hpp" #include "std_include.hpp"
#include "variable_value.hpp" #include "variable_value.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
variable_value::variable_value(native::VariableValue value) : value_(value) variable_value::variable_value(native::VariableValue value) : value_(value)
{ {
@ -20,4 +18,3 @@ namespace game
return this->value_; return this->value_;
} }
} }
}

View File

@ -1,9 +1,7 @@
#pragma once #pragma once
#include "game/game.hpp" #include "game/game.hpp"
namespace game namespace game::scripting
{
namespace scripting
{ {
class variable_value final class variable_value final
{ {
@ -17,4 +15,3 @@ namespace game
native::VariableValue value_; native::VariableValue value_;
}; };
} }
}

View File

@ -254,7 +254,7 @@ namespace demonware
auto queue = datagram_packets_.find(s); auto queue = datagram_packets_.find(s);
if (queue != datagram_packets_.end()) if (queue != datagram_packets_.end())
{ {
const bool blocking = is_blocking_socket(s, UDP_BLOCKING); const auto blocking = is_blocking_socket(s, UDP_BLOCKING);
lock.unlock(); lock.unlock();
while (blocking && queue->second.empty()) while (blocking && queue->second.empty())

View File

@ -37,7 +37,7 @@
<body> <body>
<div class="content"> <div class="content">
<h1>No settings, yet!</h1> <h3>No settings, yet!</h3>
</div> </div>
</body> </body>

View File

@ -2,9 +2,7 @@
#include "memory.hpp" #include "memory.hpp"
#include "compression.hpp" #include "compression.hpp"
namespace utils namespace utils::compression
{
namespace compression
{ {
std::string zlib::compress(const std::string& data) std::string zlib::compress(const std::string& data)
{ {
@ -70,4 +68,3 @@ namespace utils
return buffer; return buffer;
} }
} }
}

View File

@ -2,9 +2,7 @@
#define CHUNK 16384 #define CHUNK 16384
namespace utils namespace utils::compression
{
namespace compression
{ {
class zlib final class zlib final
{ {
@ -13,4 +11,3 @@ namespace utils
static std::string decompress(const std::string& data); static std::string decompress(const std::string& data);
}; };
}; };
}

View File

@ -4,9 +4,7 @@
/// http://www.opensource.apple.com/source/CommonCrypto/CommonCrypto-55010/Source/libtomcrypt/doc/libTomCryptDoc.pdf /// http://www.opensource.apple.com/source/CommonCrypto/CommonCrypto-55010/Source/libtomcrypt/doc/libTomCryptDoc.pdf
namespace utils namespace utils::cryptography
{
namespace cryptography
{ {
ecc::key::key() ecc::key::key()
{ {
@ -323,4 +321,3 @@ namespace utils
return hash; return hash;
} }
} }
}

View File

@ -1,8 +1,6 @@
#pragma once #pragma once
namespace utils namespace utils::cryptography
{
namespace cryptography
{ {
class ecc final class ecc final
{ {
@ -92,4 +90,3 @@ namespace utils
static unsigned int compute(const char* key, size_t len); static unsigned int compute(const char* key, size_t len);
}; };
} }
}

View File

@ -2,9 +2,7 @@
#include "flags.hpp" #include "flags.hpp"
#include "string.hpp" #include "string.hpp"
namespace utils namespace utils::flags
{
namespace flags
{ {
void parse_flags(std::vector<std::string>& flags) void parse_flags(std::vector<std::string>& flags)
{ {
@ -49,4 +47,3 @@ namespace utils
return false; return false;
} }
} }
}

View File

@ -1,9 +1,6 @@
#pragma once #pragma once
namespace utils namespace utils::flags
{
namespace flags
{ {
bool has_flag(const std::string& flag); bool has_flag(const std::string& flag);
} }
}

View File

@ -1,9 +1,7 @@
#include <std_include.hpp> #include <std_include.hpp>
#include "io.hpp" #include "io.hpp"
namespace utils namespace utils::io
{
namespace io
{ {
bool file_exists(const std::string& file) bool file_exists(const std::string& file)
{ {
@ -107,4 +105,3 @@ namespace utils
return files; return files;
} }
} }
}

View File

@ -1,8 +1,6 @@
#pragma once #pragma once
namespace utils namespace utils::io
{
namespace io
{ {
bool file_exists(const std::string& file); bool file_exists(const std::string& file);
bool write_file(const std::string& file, const std::string& data, bool append = false); bool write_file(const std::string& file, const std::string& data, bool append = false);
@ -14,4 +12,3 @@ namespace utils
bool directory_is_empty(const std::string& directory); bool directory_is_empty(const std::string& directory);
std::vector<std::string> list_files(const std::string& directory); std::vector<std::string> list_files(const std::string& directory);
} }
}

View File

@ -1,9 +1,7 @@
#include <std_include.hpp> #include <std_include.hpp>
#include "nt.hpp" #include "nt.hpp"
namespace utils namespace utils::nt
{
namespace nt
{ {
module module::load(const std::string& name) module module::load(const std::string& name)
{ {
@ -204,4 +202,3 @@ namespace utils
ntdll.invoke_pascal<void>("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data); ntdll.invoke_pascal<void>("NtRaiseHardError", 0xC000007B, 0, nullptr, nullptr, 6, &data);
} }
} }
}

View File

@ -1,8 +1,6 @@
#pragma once #pragma once
namespace utils namespace utils::nt
{
namespace nt
{ {
class module final class module final
{ {
@ -88,4 +86,3 @@ namespace utils
void raise_hard_exception(); void raise_hard_exception();
} }
}

View File

@ -1,9 +1,7 @@
#include <std_include.hpp> #include <std_include.hpp>
#include "string.hpp" #include "string.hpp"
namespace utils namespace utils::string
{
namespace string
{ {
const char* va(const char* fmt, ...) const char* va(const char* fmt, ...)
{ {
@ -55,4 +53,3 @@ namespace utils
return result; return result;
} }
} }
}

View File

@ -1,9 +1,7 @@
#pragma once #pragma once
#include "memory.hpp" #include "memory.hpp"
namespace utils namespace utils::string
{
namespace string
{ {
template <size_t Buffers, size_t MinBufferSize> template <size_t Buffers, size_t MinBufferSize>
class va_provider final class va_provider final
@ -81,4 +79,3 @@ namespace utils
std::string dump_hex(const std::string& data, const std::string& separator = " "); std::string dump_hex(const std::string& data, const std::string& separator = " ");
} }
}