Style: Harmonize header includes in modules

This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
This commit is contained in:
Rémi Verschelde
2023-06-13 16:56:21 +02:00
parent 7734146060
commit 25b2f1780a
217 changed files with 572 additions and 415 deletions

View File

@ -33,6 +33,7 @@
#ifdef TOOLS_ENABLED
#include "../remote_debugger_peer_websocket.h"
#include "core/config/project_settings.h"
#include "editor/editor_log.h"
#include "editor/editor_node.h"

View File

@ -28,10 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#ifdef WEB_ENABLED
#include "emws_peer.h"
#ifdef WEB_ENABLED
#include "core/io/ip.h"
void EMWSPeer::_esws_on_connect(void *p_obj, char *p_proto) {

View File

@ -33,12 +33,14 @@
#ifdef WEB_ENABLED
#include "packet_buffer.h"
#include "websocket_peer.h"
#include "core/error/error_list.h"
#include "core/io/packet_peer.h"
#include "core/templates/ring_buffer.h"
#include "emscripten.h"
#include "packet_buffer.h"
#include "websocket_peer.h"
#include <emscripten.h>
extern "C" {
typedef void (*WSOnOpen)(void *p_ref, char *p_protocol);

View File

@ -30,15 +30,10 @@
#include "register_types.h"
#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.h"
#include "core/error/error_macros.h"
#include "remote_debugger_peer_websocket.h"
#include "websocket_multiplayer_peer.h"
#include "websocket_peer.h"
#include "remote_debugger_peer_websocket.h"
#ifdef WEB_ENABLED
#include "emws_peer.h"
#else
@ -46,8 +41,15 @@
#endif
#ifdef TOOLS_ENABLED
#include "editor/debugger/editor_debugger_server.h"
#include "editor/editor_debugger_server_websocket.h"
#endif
#include "core/config/project_settings.h"
#include "core/debugger/engine_debugger.h"
#include "core/error/error_macros.h"
#ifdef TOOLS_ENABLED
#include "editor/debugger/editor_debugger_server.h"
#include "editor/editor_node.h"
#endif

View File

@ -31,10 +31,10 @@
#ifndef REMOTE_DEBUGGER_PEER_WEBSOCKET_H
#define REMOTE_DEBUGGER_PEER_WEBSOCKET_H
#include "core/debugger/remote_debugger_peer.h"
#include "websocket_peer.h"
#include "core/debugger/remote_debugger_peer.h"
class RemoteDebuggerPeerWebSocket : public RemoteDebuggerPeer {
Ref<WebSocketPeer> ws_peer;
List<Array> in_queue;

View File

@ -31,12 +31,13 @@
#ifndef WEBSOCKET_MULTIPLAYER_PEER_H
#define WEBSOCKET_MULTIPLAYER_PEER_H
#include "websocket_peer.h"
#include "core/error/error_list.h"
#include "core/io/stream_peer_tls.h"
#include "core/io/tcp_server.h"
#include "core/templates/list.h"
#include "scene/main/multiplayer_peer.h"
#include "websocket_peer.h"
class WebSocketMultiplayerPeer : public MultiplayerPeer {
GDCLASS(WebSocketMultiplayerPeer, MultiplayerPeer);

View File

@ -28,12 +28,10 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/
#include "wsl_peer.h"
#ifndef WEB_ENABLED
#include "wsl_peer.h"
#include "wsl_peer.h"
#include "core/io/stream_peer_tls.h"
CryptoCore::RandomGenerator *WSLPeer::_static_rng = nullptr;

View File

@ -33,16 +33,16 @@
#ifndef WEB_ENABLED
#include "websocket_peer.h"
#include "packet_buffer.h"
#include "websocket_peer.h"
#include "core/crypto/crypto_core.h"
#include "core/error/error_list.h"
#include "core/io/packet_peer.h"
#include "core/io/stream_peer_tcp.h"
#include "core/templates/ring_buffer.h"
#include "wslay/wslay.h"
#include <wslay/wslay.h>
#define WSL_MAX_HEADER_SIZE 4096