From 0db888042bdbc2c1abecd1e4328ccb8ee448bd0e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 30 Jul 2018 06:17:29 +0300 Subject: Split updateprotocol.cpp into files for lower memory usage in compilation. --- src/CMakeLists.txt | 6 +++++ src/Makefile.am | 6 +++++ src/net/eathena/updateprotocol.cpp | 13 +++++---- src/net/eathena/updateprotocol_main.cpp | 47 +++++++++++++++++++++++++++++++++ src/net/eathena/updateprotocol_main.h | 29 ++++++++++++++++++++ src/net/eathena/updateprotocol_re.cpp | 47 +++++++++++++++++++++++++++++++++ src/net/eathena/updateprotocol_re.h | 29 ++++++++++++++++++++ src/net/eathena/updateprotocol_zero.cpp | 47 +++++++++++++++++++++++++++++++++ src/net/eathena/updateprotocol_zero.h | 29 ++++++++++++++++++++ 9 files changed, 246 insertions(+), 7 deletions(-) create mode 100644 src/net/eathena/updateprotocol_main.cpp create mode 100644 src/net/eathena/updateprotocol_main.h create mode 100644 src/net/eathena/updateprotocol_re.cpp create mode 100644 src/net/eathena/updateprotocol_re.h create mode 100644 src/net/eathena/updateprotocol_zero.cpp create mode 100644 src/net/eathena/updateprotocol_zero.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 1eaecb59b..f7b15bf85 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1750,6 +1750,12 @@ SET(SRCS net/eathena/traderecv.h net/eathena/updateprotocol.cpp net/eathena/updateprotocol.h + net/eathena/updateprotocol_main.cpp + net/eathena/updateprotocol_main.h + net/eathena/updateprotocol_re.cpp + net/eathena/updateprotocol_re.h + net/eathena/updateprotocol_zero.cpp + net/eathena/updateprotocol_zero.h net/eathena/vendinghandler.cpp net/eathena/vendinghandler.h net/eathena/vendingrecv.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 79200aa12..d1f3029b5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2060,6 +2060,12 @@ SRC += gui/windows/bankwindow.cpp \ net/eathena/traderecv.h \ net/eathena/updateprotocol.cpp \ net/eathena/updateprotocol.h \ + net/eathena/updateprotocol_main.cpp \ + net/eathena/updateprotocol_main.h \ + net/eathena/updateprotocol_re.cpp \ + net/eathena/updateprotocol_re.h \ + net/eathena/updateprotocol_zero.cpp \ + net/eathena/updateprotocol_zero.h \ net/eathena/vendinghandler.cpp \ net/eathena/vendinghandler.h \ net/eathena/vendingrecv.cpp \ diff --git a/src/net/eathena/updateprotocol.cpp b/src/net/eathena/updateprotocol.cpp index 26f8c92d2..b7e662e7e 100644 --- a/src/net/eathena/updateprotocol.cpp +++ b/src/net/eathena/updateprotocol.cpp @@ -24,6 +24,9 @@ #include "net/eathena/network.h" #include "net/eathena/protocolout.h" +#include "net/eathena/updateprotocol_main.h" +#include "net/eathena/updateprotocol_re.h" +#include "net/eathena/updateprotocol_zero.h" #include "debug.h" @@ -31,7 +34,6 @@ extern int packetVersion; extern int packetVersionMain; extern int packetVersionRe; extern int packetVersionZero; -extern int serverVersion; extern int evolPacketOffset; extern bool packets_main; extern bool packets_re; @@ -73,10 +75,10 @@ void updateProtocol() #define PACKETS_UPDATE #include "net/protocoloutupdate.h" #include "net/eathena/packetsout.inc" -#include "net/eathena/packetsout_shuffle_main.inc" -#include "net/eathena/packetsout_shuffle_re.inc" -#include "net/eathena/packetsout_shuffle_zero.inc" #undef packet + updateProtocolMain(); + updateProtocolRe(); + updateProtocolZero(); Network *const network = Network::mInstance; if (network != nullptr) { @@ -87,9 +89,6 @@ void updateProtocol() } PACKETSOUT_VOID -PACKETSOUT_SHUFFLE_MAIN_VOID -PACKETSOUT_SHUFFLE_RE_VOID -PACKETSOUT_SHUFFLE_ZERO_VOID PROTOCOLOUTUPDATE_VOID PROTOCOLOUT_VOID diff --git a/src/net/eathena/updateprotocol_main.cpp b/src/net/eathena/updateprotocol_main.cpp new file mode 100644 index 000000000..0a4c3c57f --- /dev/null +++ b/src/net/eathena/updateprotocol_main.cpp @@ -0,0 +1,47 @@ +/* + * The ManaPlus Client + * Copyright (C) 2015-2018 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "net/eathena/updateprotocol_main.h" + +#include "logger.h" + +#include "net/eathena/network.h" +#include "net/eathena/protocolout.h" + +#include "debug.h" + +extern int packetVersion; +extern bool packets_main; + +namespace EAthena +{ + +void updateProtocolMain() +{ +#include "net/protocoloutupdate.h" +#include "net/eathena/packetsout_shuffle_main.inc" +#undef packet +} + +PACKETSOUT_SHUFFLE_MAIN_VOID +PROTOCOLOUTUPDATE_VOID +PROTOCOLOUT_VOID + +} // namespace EAthena diff --git a/src/net/eathena/updateprotocol_main.h b/src/net/eathena/updateprotocol_main.h new file mode 100644 index 000000000..1ebdd0fc0 --- /dev/null +++ b/src/net/eathena/updateprotocol_main.h @@ -0,0 +1,29 @@ +/* + * The ManaPlus Client + * Copyright (C) 2015-2018 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NET_EATHENA_UPDATEPROTOCOL_MAIN_H +#define NET_EATHENA_UPDATEPROTOCOL_MAIN_H + +namespace EAthena +{ + void updateProtocolMain(); +} // namespace EAthena + +#endif // NET_EATHENA_UPDATEPROTOCOL_MAIN_H diff --git a/src/net/eathena/updateprotocol_re.cpp b/src/net/eathena/updateprotocol_re.cpp new file mode 100644 index 000000000..6552d3db8 --- /dev/null +++ b/src/net/eathena/updateprotocol_re.cpp @@ -0,0 +1,47 @@ +/* + * The ManaPlus Client + * Copyright (C) 2015-2018 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "net/eathena/updateprotocol_re.h" + +#include "logger.h" + +#include "net/eathena/network.h" +#include "net/eathena/protocolout.h" + +#include "debug.h" + +extern int packetVersion; +extern bool packets_re; + +namespace EAthena +{ + +void updateProtocolRe() +{ +#include "net/protocoloutupdate.h" +#include "net/eathena/packetsout_shuffle_re.inc" +#undef packet +} + +PACKETSOUT_SHUFFLE_RE_VOID +PROTOCOLOUTUPDATE_VOID +PROTOCOLOUT_VOID + +} // namespace EAthena diff --git a/src/net/eathena/updateprotocol_re.h b/src/net/eathena/updateprotocol_re.h new file mode 100644 index 000000000..57561ef13 --- /dev/null +++ b/src/net/eathena/updateprotocol_re.h @@ -0,0 +1,29 @@ +/* + * The ManaPlus Client + * Copyright (C) 2015-2018 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NET_EATHENA_UPDATEPROTOCOL_RE_H +#define NET_EATHENA_UPDATEPROTOCOL_RE_H + +namespace EAthena +{ + void updateProtocolRe(); +} // namespace EAthena + +#endif // NET_EATHENA_UPDATEPROTOCOL_RE_H diff --git a/src/net/eathena/updateprotocol_zero.cpp b/src/net/eathena/updateprotocol_zero.cpp new file mode 100644 index 000000000..11511195f --- /dev/null +++ b/src/net/eathena/updateprotocol_zero.cpp @@ -0,0 +1,47 @@ +/* + * The ManaPlus Client + * Copyright (C) 2015-2018 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "net/eathena/updateprotocol_zero.h" + +#include "logger.h" + +#include "net/eathena/network.h" +#include "net/eathena/protocolout.h" + +#include "debug.h" + +extern int packetVersion; +extern bool packets_zero; + +namespace EAthena +{ + +void updateProtocolZero() +{ +#include "net/protocoloutupdate.h" +#include "net/eathena/packetsout_shuffle_zero.inc" +#undef packet +} + +PACKETSOUT_SHUFFLE_ZERO_VOID +PROTOCOLOUTUPDATE_VOID +PROTOCOLOUT_VOID + +} // namespace EAthena diff --git a/src/net/eathena/updateprotocol_zero.h b/src/net/eathena/updateprotocol_zero.h new file mode 100644 index 000000000..a7edf174c --- /dev/null +++ b/src/net/eathena/updateprotocol_zero.h @@ -0,0 +1,29 @@ +/* + * The ManaPlus Client + * Copyright (C) 2015-2018 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef NET_EATHENA_UPDATEPROTOCOL_ZERO_H +#define NET_EATHENA_UPDATEPROTOCOL_ZERO_H + +namespace EAthena +{ + void updateProtocolZero(); +} // namespace EAthena + +#endif // NET_EATHENA_UPDATEPROTOCOL_ZERO_H -- cgit v1.2.3-70-g09d2