[ChunkLightmap] Crash fixed. [ServerApplication] '--port' argument added.
This commit is contained in:
parent
03bffbb666
commit
b7735ca71a
@ -90,7 +90,8 @@ void ChunkLightmap::updateTorchlight() {
|
||||
if (getTorchlight(surroundingNode.x, surroundingNode.y, surroundingNode.z) + 2 <= lightLevel) {
|
||||
setTorchlight(surroundingNode.x, surroundingNode.y, surroundingNode.z, lightLevel - 1);
|
||||
|
||||
if (!Registry::getInstance().getBlock(m_chunk->getBlock(surroundingNode.x, surroundingNode.y, surroundingNode.z)).isOpaque()) {
|
||||
u16 block = m_chunk->getBlock(surroundingNode.x, surroundingNode.y, surroundingNode.z);
|
||||
if (!block || !Registry::getInstance().getBlock(block).isOpaque()) {
|
||||
m_lightBfsQueue.emplace(surroundingNode.x, surroundingNode.y, surroundingNode.z);
|
||||
}
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ class ServerApplication : public gk::CoreApplication {
|
||||
ServerWorld m_world;
|
||||
|
||||
Registry m_registry;
|
||||
|
||||
int m_port = 4242;
|
||||
};
|
||||
|
||||
#endif // SERVERAPPLICATION_HPP_
|
||||
|
@ -13,7 +13,13 @@
|
||||
*/
|
||||
#include "ServerApplication.hpp"
|
||||
|
||||
using namespace std::literals::string_literals;
|
||||
|
||||
ServerApplication::ServerApplication(int argc, char **argv) : gk::CoreApplication(argc, argv) {
|
||||
if (argc == 3 && argv[1] == "--port"s) {
|
||||
m_port = std::stoi(argv[2]);
|
||||
}
|
||||
|
||||
m_loadSDL = false;
|
||||
}
|
||||
|
||||
@ -22,7 +28,7 @@ void ServerApplication::init() {
|
||||
|
||||
Registry::setInstance(m_registry);
|
||||
|
||||
m_server.init(4242);
|
||||
m_server.init(m_port);
|
||||
m_server.setRunning(true);
|
||||
m_server.setGameStarted(false);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user