PROTOCOL_VERSION, test items, MOTD fix (#18)

* Cleaned up protocol selection.

* cmake now works even if protocol option is omitted
* make now supports protocol selection
* removed PACKET_VERSION/CNPROTO_VERSION* redundancy
* ubuntu appveyor script has yet to be written
* cleaned up some trailing spaces

* Add some test items.

Ironically, this change is untested.

* [bugfix] Transmit MOTD when entering the game, not when loading screen fades.

This fixes unnecessary retransmission when /warping.
This commit is contained in:
dongresource
2020-08-21 19:38:45 +02:00
committed by GitHub
parent 1669ee3660
commit df18f3ccd1
6 changed files with 49 additions and 30 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
CNStructs.hpp - defines some basic structs & useful methods for packets used by FusionFall based on the version defined
*/
@@ -21,9 +21,9 @@
#include <time.h>
#endif
#include <cstring>
#include <string>
#include <locale>
#include <codecvt>
#include <string>
#include <locale>
#include <codecvt>
// TODO: rewrite U16toU8 & U8toU16 to not use codecvt
@@ -31,18 +31,15 @@ std::string U16toU8(char16_t* src);
int U8toU16(std::string src, char16_t* des); // returns number of char16_t that was written at des
uint64_t getTime();
// The CNPROTO_OVERRIDE definition is defined by cmake if you use it.
// If you don't use cmake, feel free to comment this out and change it around.
// Otherwise, use the PACKET_VERSION option (e.g. -DPACKET_VERSION=0104 in the cmake command) to change it.
#if !defined(CNPROTO_OVERRIDE)
//#define CNPROTO_VERSION_0728
#define CNPROTO_VERSION_0104
#endif
#if defined(CNPROTO_VERSION_0104)
#include "structs/0104.hpp"
#elif defined(CNPROTO_VERSION_0728)
// The PROTOCOL_VERSION definition is defined by the build system.
#if !defined(PROTOCOL_VERSION)
#error "PROTOCOL_VERSION not defined"
#elif PROTOCOL_VERSION == 728
#include "structs/0728.hpp"
#elif PROTOCOL_VERSION == 104
#include "structs/0104.hpp"
#else
#error Invalid PROTOCOL_VERSION
#endif
#endif