Преглед изворни кода

Merge branch 'master' of github.com:taylor001/crown

Daniele Bartolini пре 11 година
родитељ
комит
97b3e35703
6 измењених фајлова са 9 додато и 14 уклоњено
  1. 0 1
      .gitignore
  2. 3 3
      engine/console_server.cpp
  3. 4 6
      engine/console_server.h
  4. 1 1
      engine/core/log.h
  5. 0 2
      engine/device.cpp
  6. 1 1
      engine/lua/lua_device.cpp

+ 0 - 1
.gitignore

@@ -1,6 +1,5 @@
 # Ignore build directory
 /.build
-/.installation
 
 # Ignore Python stuff
 __pycache__

+ 3 - 3
engine/console_server.cpp

@@ -66,7 +66,7 @@ namespace console_server_internal
 	}
 }
 
-void ConsoleServer::log_to_all(const char* msg, LogSeverity::Enum severity)
+void ConsoleServer::log(const char* msg, LogSeverity::Enum severity)
 {
 	using namespace string_stream;
 	using namespace console_server_internal;
@@ -80,7 +80,7 @@ void ConsoleServer::log_to_all(const char* msg, LogSeverity::Enum severity)
 	json << "\"severity\":\"" << stt[severity] << "\",";
 	json << "\"message\":\""; sanitize(json, msg) << "\"}";
 
-	send_to_all(c_str(json));
+	send(c_str(json));
 }
 
 void ConsoleServer::send(TCPSocket client, const char* json)
@@ -90,7 +90,7 @@ void ConsoleServer::send(TCPSocket client, const char* json)
 	client.write(json, len);
 }
 
-void ConsoleServer::send_to_all(const char* json)
+void ConsoleServer::send(const char* json)
 {
 	for (uint32_t i = 0; i < id_array::size(m_clients); i++)
 	{

+ 4 - 6
engine/console_server.h

@@ -6,8 +6,6 @@
 #pragma once
 
 #include "socket.h"
-#include "container_types.h"
-#include "queue.h"
 #include "id_array.h"
 
 namespace crown
@@ -36,8 +34,6 @@ struct Client
 	}
 };
 
-typedef IdArray<CE_MAX_CONSOLE_CLIENTS, Client> ClientArray;
-
 class ConsoleServer
 {
 public:
@@ -47,13 +43,13 @@ public:
 	ConsoleServer(uint16_t port, bool wait);
 	void shutdown();
 
-	void log_to_all(const char* msg, LogSeverity::Enum severity = LogSeverity::INFO);
+	void log(const char* msg, LogSeverity::Enum severity = LogSeverity::INFO);
 
 	/// Collects requests from clients and processes them all.
 	void update();
 
 	/// Sends the given JSON-encoded string to all clients.
-	void send_to_all(const char* json);
+	void send(const char* json);
 
 private:
 
@@ -70,6 +66,8 @@ private:
 private:
 
 	TCPSocket m_server;
+
+	typedef IdArray<CE_MAX_CONSOLE_CLIENTS, Client> ClientArray;
 	ClientArray m_clients;
 };
 

+ 1 - 1
engine/core/log.h

@@ -23,7 +23,7 @@ namespace log_internal
 			len = sizeof(buf) - 1;
 
 		buf[len] = '\0';
-		console_server_globals::console().log_to_all(buf, sev);
+		console_server_globals::console().log(buf, sev);
 		os::log(buf);
 	}
 

+ 0 - 2
engine/device.cpp

@@ -8,7 +8,6 @@
 #include "device.h"
 #include "log.h"
 #include "lua_environment.h"
-#include "lua_stack.h"
 #include "lua_system.h"
 #include "material_manager.h"
 #include "resource_manager.h"
@@ -18,7 +17,6 @@
 #include "world_manager.h"
 #include "memory.h"
 #include "os.h"
-#include <cstdlib>
 
 #define MAX_SUBSYSTEMS_HEAP 8 * 1024 * 1024
 

+ 1 - 1
engine/lua/lua_device.cpp

@@ -120,7 +120,7 @@ static int device_console_send(lua_State* L)
 	stack.pop(1);
 	json << "}";
 
-	console_server_globals::console().send_to_all(c_str(json));
+	console_server_globals::console().send(c_str(json));
 	return 0;
 }