Preprocessor purge round 7: Config.template.h
This commit is contained in:
parent
e97fd74503
commit
9542f98b82
52
.github/build.sh
vendored
52
.github/build.sh
vendored
@ -43,25 +43,27 @@ aarch64-android-bionic-static) ;;
|
||||
*) >&2 echo "configuration $BSH_HOST_ARCH-$BSH_HOST_PLATFORM-$BSH_HOST_LIBC-$BSH_STATIC_DYNAMIC is not supported" && exit 1;;
|
||||
esac
|
||||
|
||||
case $BSH_BUILD_PLATFORM in
|
||||
linux)
|
||||
sudo apt update
|
||||
if [[ $BSH_STATIC_DYNAMIC == static ]]; then
|
||||
sudo apt install libc6-dev libc6-dev-i386
|
||||
else
|
||||
sudo apt install libluajit-5.1-dev libcurl4-openssl-dev libfftw3-dev zlib1g-dev libsdl2-dev libbz2-dev libjsoncpp-dev
|
||||
fi
|
||||
if [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == windows-mingw ]]; then
|
||||
sudo apt install g++-mingw-w64-x86-64
|
||||
fi
|
||||
;;
|
||||
darwin)
|
||||
brew install pkg-config binutils
|
||||
if [[ $BSH_STATIC_DYNAMIC != static ]]; then
|
||||
brew install luajit curl fftw zlib sdl2 bzip2 jsoncpp
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if [[ -z ${BSH_NO_PACKAGES-} ]]; then
|
||||
case $BSH_BUILD_PLATFORM in
|
||||
linux)
|
||||
sudo apt update
|
||||
if [[ $BSH_STATIC_DYNAMIC == static ]]; then
|
||||
sudo apt install libc6-dev libc6-dev-i386
|
||||
else
|
||||
sudo apt install libluajit-5.1-dev libcurl4-openssl-dev libfftw3-dev zlib1g-dev libsdl2-dev libbz2-dev libjsoncpp-dev
|
||||
fi
|
||||
if [[ $BSH_HOST_PLATFORM-$BSH_HOST_LIBC == windows-mingw ]]; then
|
||||
sudo apt install g++-mingw-w64-x86-64
|
||||
fi
|
||||
;;
|
||||
darwin)
|
||||
brew install pkg-config binutils
|
||||
if [[ $BSH_STATIC_DYNAMIC != static ]]; then
|
||||
brew install luajit curl fftw zlib sdl2 bzip2 jsoncpp
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
function inplace_sed() {
|
||||
local subst=$1
|
||||
@ -232,9 +234,15 @@ fi
|
||||
if [[ $RELEASE_TYPE == stable ]]; then
|
||||
stable_or_beta=yes
|
||||
fi
|
||||
save_version=$(grep -w src/Config.template.h -e "#define SAVE_VERSION" | cut -d ' ' -f 3)
|
||||
minor_version=$(grep -w src/Config.template.h -e "#define MINOR_VERSION" | cut -d ' ' -f 3)
|
||||
build_num=$(grep -w src/Config.template.h -e "#define BUILD_NUM" | cut -d ' ' -f 3)
|
||||
set +e
|
||||
save_version=$(cat src/Config.template.h | sed -n 's/constexpr int SAVE_VERSION * = \([^;]*\);/\1/p')
|
||||
minor_version=$(cat src/Config.template.h | sed -n 's/constexpr int MINOR_VERSION * = \([^;]*\);/\1/p')
|
||||
build_num=$(cat src/Config.template.h | sed -n 's/constexpr int BUILD_NUM * = \([^;]*\);/\1/p')
|
||||
if [[ -z ${save_version-} ]] || [[ -z ${minor_version-} ]] || [[ -z ${build_num-} ]]; then
|
||||
>&2 echo "failed to extract version from Config.template.h"
|
||||
exit 1
|
||||
fi
|
||||
set -e
|
||||
if [[ $stable_or_beta == yes ]] && [[ $MOD_ID != 0 ]]; then
|
||||
save_version=$(echo $RELEASE_NAME | cut -d '.' -f 1)
|
||||
minor_version=$(echo $RELEASE_NAME | cut -d '.' -f 2)
|
||||
|
29
meson.build
29
meson.build
@ -318,6 +318,11 @@ endif
|
||||
|
||||
app_exe = get_option('app_exe')
|
||||
app_id = get_option('app_id')
|
||||
mod_id = get_option('mod_id')
|
||||
is_snapshot = get_option('snapshot')
|
||||
is_beta = get_option('beta')
|
||||
is_mod = mod_id > 0
|
||||
update_server = get_option('update_server')
|
||||
|
||||
conf_data.set('LIN', host_platform == 'linux')
|
||||
conf_data.set('AND', host_platform == 'android')
|
||||
@ -328,18 +333,22 @@ conf_data.set('X86_SSE3', x86_sse_level >= 30)
|
||||
conf_data.set('X86_SSE2', x86_sse_level >= 20)
|
||||
conf_data.set('X86_SSE', x86_sse_level >= 10)
|
||||
conf_data.set('_64BIT', is_64bit)
|
||||
conf_data.set('BETA', get_option('beta'))
|
||||
conf_data.set('BETA', is_beta)
|
||||
conf_data.set('NO_INSTALL_CHECK', not get_option('install_check'))
|
||||
conf_data.set('IGNORE_UPDATES', get_option('ignore_updates'))
|
||||
conf_data.set('MOD_ID', get_option('mod_id'))
|
||||
conf_data.set('MOD_ID', mod_id)
|
||||
conf_data.set('DEBUG', is_debug)
|
||||
conf_data.set('SNAPSHOT', get_option('snapshot'))
|
||||
conf_data.set('SNAPSHOT', is_snapshot)
|
||||
conf_data.set('MOD', is_mod)
|
||||
conf_data.set('SNAPSHOT_ID', get_option('snapshot_id'))
|
||||
conf_data.set('SERVER', '"@0@"'.format(get_option('server')))
|
||||
conf_data.set('STATICSERVER', '"@0@"'.format(get_option('static_server')))
|
||||
conf_data.set('IDENT_PLATFORM', '"@0@"'.format(ident_platform))
|
||||
conf_data.set('IDENT', '"@0@-@1@-@2@"'.format(host_arch, host_platform, host_libc).to_upper())
|
||||
conf_data.set('SERVER', get_option('server'))
|
||||
conf_data.set('STATICSERVER', get_option('static_server'))
|
||||
conf_data.set('UPDATESERVER', update_server)
|
||||
conf_data.set('USE_UPDATESERVER', update_server != '')
|
||||
conf_data.set('IDENT_PLATFORM', ident_platform)
|
||||
conf_data.set('IDENT', '@0@-@1@-@2@'.format(host_arch, host_platform, host_libc).to_upper())
|
||||
conf_data.set('ENFORCE_HTTPS', enforce_https)
|
||||
conf_data.set('ALLOW_FAKE_NEWER_VERSION', is_snapshot or is_beta or is_debug or is_mod)
|
||||
conf_data.set('APPNAME', get_option('app_name'))
|
||||
conf_data.set('APPCOMMENT', get_option('app_comment'))
|
||||
conf_data.set('APPEXE', app_exe)
|
||||
@ -347,12 +356,6 @@ conf_data.set('APPID', app_id)
|
||||
conf_data.set('APPDATA', get_option('app_data'))
|
||||
conf_data.set('APPVENDOR', get_option('app_vendor'))
|
||||
|
||||
if get_option('update_server') != ''
|
||||
conf_data.set('UPDATESERVER', '"@0@"'.format(get_option('update_server')))
|
||||
else
|
||||
conf_data.set('UPDATESERVER', false)
|
||||
endif
|
||||
|
||||
data_files = []
|
||||
|
||||
subdir('src')
|
||||
|
@ -1,13 +1,14 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
// Boolean macros (defined / not defined), would be great to get rid of them all.
|
||||
#mesondefine CURL_STATICLIB
|
||||
#mesondefine ZLIB_WINAPI
|
||||
|
||||
#mesondefine LUACONSOLE
|
||||
#mesondefine NOHTTP
|
||||
#mesondefine GRAVFFT
|
||||
#mesondefine RENDERER
|
||||
#mesondefine FONTEDITOR
|
||||
|
||||
#mesondefine BETA
|
||||
#mesondefine DEBUG
|
||||
#mesondefine IGNORE_UPDATES
|
||||
@ -15,6 +16,7 @@
|
||||
#mesondefine AND
|
||||
#mesondefine NO_INSTALL_CHECK
|
||||
#mesondefine SNAPSHOT
|
||||
#mesondefine MOD
|
||||
#mesondefine WIN
|
||||
#mesondefine MACOSX
|
||||
#mesondefine X86
|
||||
@ -22,133 +24,116 @@
|
||||
#mesondefine X86_SSE2
|
||||
#mesondefine X86_SSE3
|
||||
#mesondefine _64BIT
|
||||
#mesondefine SERVER
|
||||
#mesondefine STATICSERVER
|
||||
#mesondefine UPDATESERVER
|
||||
#mesondefine IDENT_PLATFORM
|
||||
#mesondefine IDENT
|
||||
#mesondefine ENFORCE_HTTPS
|
||||
#define APPNAME "@APPNAME@"
|
||||
#define APPCOMMENT "@APPCOMMENT@"
|
||||
#define APPEXE "@APPEXE@"
|
||||
#define APPID "@APPID@"
|
||||
#define APPDATA "@APPDATA@"
|
||||
#define APPVENDOR "@APPVENDOR@"
|
||||
#mesondefine ALLOW_FAKE_NEWER_VERSION
|
||||
#mesondefine USE_UPDATESERVER
|
||||
|
||||
constexpr char SERVER[] = "@SERVER@";
|
||||
constexpr char STATICSERVER[] = "@STATICSERVER@";
|
||||
constexpr char UPDATESERVER[] = "@UPDATESERVER@";
|
||||
constexpr char IDENT_PLATFORM[] = "@IDENT_PLATFORM@";
|
||||
constexpr char IDENT[] = "@IDENT@";
|
||||
constexpr char APPNAME[] = "@APPNAME@";
|
||||
constexpr char APPCOMMENT[] = "@APPCOMMENT@";
|
||||
constexpr char APPEXE[] = "@APPEXE@";
|
||||
constexpr char APPID[] = "@APPID@";
|
||||
constexpr char APPDATA[] = "@APPDATA@";
|
||||
constexpr char APPVENDOR[] = "@APPVENDOR@";
|
||||
|
||||
#ifdef WIN
|
||||
# define PATH_SEP "\\"
|
||||
# define PATH_SEP_CHAR '\\'
|
||||
constexpr char PATH_SEP[] = "\\";
|
||||
constexpr char PATH_SEP_CHAR = '\\';
|
||||
#else
|
||||
# define PATH_SEP "/"
|
||||
# define PATH_SEP_CHAR '/'
|
||||
constexpr char PATH_SEP[] = "/";
|
||||
constexpr char PATH_SEP_CHAR = '/';
|
||||
#endif
|
||||
|
||||
//VersionInfoStart
|
||||
#define SAVE_VERSION 97
|
||||
#define MINOR_VERSION 0
|
||||
#define BUILD_NUM 352
|
||||
#mesondefine SNAPSHOT_ID
|
||||
#mesondefine MOD_ID
|
||||
#define FUTURE_SAVE_VERSION 97
|
||||
#define FUTURE_MINOR_VERSION 0
|
||||
|
||||
#if !(defined(SNAPSHOT) || defined(BETA) || defined(DEBUG) || MOD_ID > 0)
|
||||
#undef FUTURE_SAVE_VERSION
|
||||
#undef FUTURE_MINOR_VERSION
|
||||
#endif
|
||||
constexpr int SAVE_VERSION = 97;
|
||||
constexpr int MINOR_VERSION = 0;
|
||||
constexpr int BUILD_NUM = 352;
|
||||
constexpr int SNAPSHOT_ID = @SNAPSHOT_ID@;
|
||||
constexpr int MOD_ID = @MOD_ID@;
|
||||
constexpr int FUTURE_SAVE_VERSION = 97;
|
||||
constexpr int FUTURE_MINOR_VERSION = 0;
|
||||
//VersionInfoEnd
|
||||
|
||||
#if !(defined(MACOSX) && defined(DEBUG))
|
||||
#define HIGH_QUALITY_RESAMPLE //High quality image resampling, slower but much higher quality than my terribad linear interpolation
|
||||
#endif
|
||||
|
||||
#if defined(SNAPSHOT)
|
||||
#define IDENT_RELTYPE "S"
|
||||
constexpr char IDENT_RELTYPE[] = "S";
|
||||
#elif defined(BETA)
|
||||
#define IDENT_RELTYPE "B"
|
||||
constexpr char IDENT_RELTYPE[] = "B";
|
||||
#else
|
||||
#define IDENT_RELTYPE "R"
|
||||
constexpr char IDENT_RELTYPE[] = "R";
|
||||
#endif
|
||||
|
||||
#if defined(X86_SSE3)
|
||||
#define IDENT_BUILD "SSE3"
|
||||
constexpr char IDENT_BUILD[] = "SSE3";
|
||||
#elif defined(X86_SSE2)
|
||||
#define IDENT_BUILD "SSE2"
|
||||
constexpr char IDENT_BUILD[] = "SSE2";
|
||||
#elif defined(X86_SSE)
|
||||
#define IDENT_BUILD "SSE"
|
||||
constexpr char IDENT_BUILD[] = "SSE";
|
||||
#else
|
||||
#define IDENT_BUILD "NO"
|
||||
constexpr char IDENT_BUILD[] = "NO";
|
||||
#endif
|
||||
|
||||
#define MTOS_EXPAND(str) #str
|
||||
#define MTOS(str) MTOS_EXPAND(str)
|
||||
constexpr char SCHEME[] = "https://";
|
||||
constexpr char STATICSCHEME[] = "https://";
|
||||
constexpr char LOCAL_SAVE_DIR[] = "Saves";
|
||||
constexpr char STAMPS_DIR[] = "stamps";
|
||||
constexpr char BRUSH_DIR[] = "Brushes";
|
||||
|
||||
#define SCHEME "https://"
|
||||
#define STATICSCHEME "https://"
|
||||
|
||||
#define LOCAL_SAVE_DIR "Saves"
|
||||
|
||||
#define STAMPS_DIR "stamps"
|
||||
|
||||
#define BRUSH_DIR "Brushes"
|
||||
|
||||
#ifndef M_GRAV
|
||||
#define M_GRAV 6.67300e-1
|
||||
#endif
|
||||
constexpr float M_GRAV = 6.67300e-1f;
|
||||
|
||||
#ifdef RENDERER
|
||||
#define MENUSIZE 0
|
||||
#define BARSIZE 0
|
||||
constexpr int MENUSIZE = 0;
|
||||
constexpr int BARSIZE = 0;
|
||||
#else
|
||||
#define MENUSIZE 40
|
||||
#define BARSIZE 17
|
||||
constexpr int MENUSIZE = 40;
|
||||
constexpr int BARSIZE = 17;
|
||||
#endif
|
||||
#define XRES 612
|
||||
#define YRES 384
|
||||
#define NPART XRES*YRES
|
||||
constexpr int XRES = 612;
|
||||
constexpr int YRES = 384;
|
||||
constexpr int NPART = XRES * YRES;
|
||||
|
||||
#define XCNTR XRES/2
|
||||
#define YCNTR YRES/2
|
||||
constexpr int XCNTR = XRES / 2;
|
||||
constexpr int YCNTR = YRES / 2;
|
||||
|
||||
#define WINDOWW (XRES+BARSIZE)
|
||||
#define WINDOWH (YRES+MENUSIZE)
|
||||
constexpr int WINDOWW = XRES + BARSIZE;
|
||||
constexpr int WINDOWH = YRES + MENUSIZE;
|
||||
|
||||
#define GRAV_DIFF
|
||||
|
||||
#define MAXSIGNS 16
|
||||
constexpr int MAXSIGNS = 16;
|
||||
|
||||
//CELL, the size of the pressure, gravity, and wall maps. Larger than 1 to prevent extreme lag
|
||||
#define CELL 4
|
||||
#define ISTP (CELL/2)
|
||||
#define CFDS (4.0f/CELL)
|
||||
#define SIM_MAXVELOCITY 1e4f
|
||||
constexpr int CELL = 4;
|
||||
constexpr int ISTP = CELL / 2;
|
||||
constexpr float CFDS = 4.0f / CELL;
|
||||
constexpr float SIM_MAXVELOCITY = 1e4f;
|
||||
|
||||
//Air constants
|
||||
#define AIR_TSTEPP 0.3f
|
||||
#define AIR_TSTEPV 0.4f
|
||||
#define AIR_VADV 0.3f
|
||||
#define AIR_VLOSS 0.999f
|
||||
#define AIR_PLOSS 0.9999f
|
||||
constexpr float AIR_TSTEPP = 0.3f;
|
||||
constexpr float AIR_TSTEPV = 0.4f;
|
||||
constexpr float AIR_VADV = 0.3f;
|
||||
constexpr float AIR_VLOSS = 0.999f;
|
||||
constexpr float AIR_PLOSS = 0.9999f;
|
||||
|
||||
#define NGOL 24
|
||||
constexpr int NGOL = 24;
|
||||
|
||||
#define CIRCLE_BRUSH 0
|
||||
#define SQUARE_BRUSH 1
|
||||
#define TRI_BRUSH 2
|
||||
#define BRUSH_NUM 3
|
||||
constexpr int CIRCLE_BRUSH = 0;
|
||||
constexpr int SQUARE_BRUSH = 1;
|
||||
constexpr int TRI_BRUSH = 2;
|
||||
constexpr int BRUSH_NUM = 3;
|
||||
|
||||
//Photon constants
|
||||
#define SURF_RANGE 10
|
||||
#define NORMAL_MIN_EST 3
|
||||
#define NORMAL_INTERP 20
|
||||
#define NORMAL_FRAC 16
|
||||
constexpr int SURF_RANGE = 10;
|
||||
constexpr int NORMAL_MIN_EST = 3;
|
||||
constexpr int NORMAL_INTERP = 20;
|
||||
constexpr int NORMAL_FRAC = 16;
|
||||
|
||||
#define REFRACT 0x80000000
|
||||
constexpr auto REFRACT = UINT32_C(0x80000000);
|
||||
|
||||
/* heavy flint glass, for awesome refraction/dispersion
|
||||
this way you can make roof prisms easily */
|
||||
#define GLASS_IOR 1.9
|
||||
#define GLASS_DISP 0.07
|
||||
constexpr float GLASS_IOR = 1.9f;
|
||||
constexpr float GLASS_DISP = 0.07f;
|
||||
|
||||
#define SDEUT
|
||||
#define R_TEMP 22
|
||||
constexpr float R_TEMP = 22;
|
||||
|
@ -544,8 +544,7 @@ void BlueScreen(String detailMessage)
|
||||
|
||||
String errorTitle = "ERROR";
|
||||
String errorDetails = "Details: " + detailMessage;
|
||||
String errorHelp = "An unrecoverable fault has occurred, please report the error by visiting the website below\n"
|
||||
SCHEME SERVER;
|
||||
String errorHelp = String("An unrecoverable fault has occurred, please report the error by visiting the website below\n") + SCHEME + SERVER;
|
||||
int currentY = 0, width, height;
|
||||
int errorWidth = 0;
|
||||
Graphics::textsize(errorHelp, errorWidth, height);
|
||||
|
@ -121,7 +121,7 @@ void Client::Initialise(ByteString proxy, ByteString cafile, ByteString capath,
|
||||
|
||||
//Read stamps library
|
||||
std::ifstream stampsLib;
|
||||
stampsLib.open(STAMPS_DIR PATH_SEP "stamps.def", std::ios::binary);
|
||||
stampsLib.open(ByteString::Build(STAMPS_DIR, PATH_SEP, "stamps.def"), std::ios::binary);
|
||||
while (!stampsLib.eof())
|
||||
{
|
||||
char data[11];
|
||||
@ -134,7 +134,7 @@ void Client::Initialise(ByteString proxy, ByteString cafile, ByteString capath,
|
||||
stampsLib.close();
|
||||
|
||||
//Begin version check
|
||||
versionCheckRequest = new http::Request(SCHEME SERVER "/Startup.json");
|
||||
versionCheckRequest = new http::Request(ByteString::Build(SCHEME, SERVER, "/Startup.json"));
|
||||
|
||||
if (authUser.UserID)
|
||||
{
|
||||
@ -142,9 +142,9 @@ void Client::Initialise(ByteString proxy, ByteString cafile, ByteString capath,
|
||||
}
|
||||
versionCheckRequest->Start();
|
||||
|
||||
#ifdef UPDATESERVER
|
||||
#ifdef USE_UPDATESERVER
|
||||
// use an alternate update server
|
||||
alternateVersionCheckRequest = new http::Request(SCHEME UPDATESERVER "/Startup.json");
|
||||
alternateVersionCheckRequest = new http::Request(ByteString::Build(SCHEME, UPDATESERVER, "/Startup.json"));
|
||||
usingAltUpdateServer = true;
|
||||
if (authUser.UserID)
|
||||
{
|
||||
@ -265,7 +265,7 @@ bool Client::CheckUpdate(http::Request *updateRequest, bool checkSession)
|
||||
|
||||
if (checkSession && status == 618)
|
||||
{
|
||||
AddServerNotification({ "Failed to load SSL certificates", SCHEME "powdertoy.co.uk/FAQ.html" });
|
||||
AddServerNotification({ "Failed to load SSL certificates", ByteString(SCHEME) + "powdertoy.co.uk/FAQ.html" });
|
||||
}
|
||||
|
||||
if (status != 200)
|
||||
@ -344,7 +344,7 @@ bool Client::CheckUpdate(http::Request *updateRequest, bool checkSession)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(SNAPSHOT) || MOD_ID > 0
|
||||
#if defined(SNAPSHOT) || defined(MOD)
|
||||
Json::Value snapshotVersion = versions["Snapshot"];
|
||||
int snapshotSnapshot = snapshotVersion["Snapshot"].asInt();
|
||||
ByteString snapshotFile = snapshotVersion["File"].asString();
|
||||
@ -517,7 +517,7 @@ RequestStatus Client::UploadSave(SaveInfo & save)
|
||||
lastError = "Cannot serialize game save";
|
||||
return RequestFailure;
|
||||
}
|
||||
#if defined(SNAPSHOT) || defined(BETA) || defined(DEBUG) || MOD_ID > 0
|
||||
#ifdef ALLOW_FAKE_NEWER_VERSION
|
||||
else if (fromNewerVersion && save.GetPublished())
|
||||
{
|
||||
lastError = "Cannot publish save, incompatible with latest release version.";
|
||||
@ -525,7 +525,7 @@ RequestStatus Client::UploadSave(SaveInfo & save)
|
||||
}
|
||||
#endif
|
||||
|
||||
data = http::Request::SimpleAuth(SCHEME SERVER "/Save.api", &dataStatus, userID, authUser.SessionID, {
|
||||
data = http::Request::SimpleAuth(ByteString::Build(SCHEME, SERVER, "/Save.api"), &dataStatus, userID, authUser.SessionID, {
|
||||
{ "Name", save.GetName().ToUtf8() },
|
||||
{ "Description", save.GetDescription().ToUtf8() },
|
||||
{ "Data:save.bin", ByteString(gameData.begin(), gameData.end()) },
|
||||
@ -570,7 +570,7 @@ void Client::MoveStampToFront(ByteString stampID)
|
||||
|
||||
SaveFile * Client::GetStamp(ByteString stampID)
|
||||
{
|
||||
ByteString stampFile = ByteString(STAMPS_DIR PATH_SEP + stampID + ".stm");
|
||||
ByteString stampFile = ByteString(ByteString::Build(STAMPS_DIR, PATH_SEP, stampID, ".stm"));
|
||||
SaveFile *saveFile = LoadSaveFile(stampFile);
|
||||
if (!saveFile)
|
||||
saveFile = LoadSaveFile(stampID);
|
||||
@ -606,7 +606,7 @@ ByteString Client::AddStamp(GameSave * saveData)
|
||||
else
|
||||
lastStampName++;
|
||||
ByteString saveID = ByteString::Build(Format::Hex(Format::Width(lastStampTime, 8)), Format::Hex(Format::Width(lastStampName, 2)));
|
||||
ByteString filename = STAMPS_DIR PATH_SEP + saveID + ".stm";
|
||||
ByteString filename = ByteString::Build(STAMPS_DIR, PATH_SEP, saveID, ".stm");
|
||||
|
||||
Platform::MakeDirectory(STAMPS_DIR);
|
||||
|
||||
@ -641,7 +641,7 @@ void Client::updateStamps()
|
||||
Platform::MakeDirectory(STAMPS_DIR);
|
||||
|
||||
std::ofstream stampsStream;
|
||||
stampsStream.open(ByteString(STAMPS_DIR PATH_SEP "stamps.def").c_str(), std::ios::binary);
|
||||
stampsStream.open(ByteString::Build(STAMPS_DIR, PATH_SEP, "stamps.def").c_str(), std::ios::binary);
|
||||
for (std::list<ByteString>::const_iterator iterator = stampIDs.begin(), end = stampIDs.end(); iterator != end; ++iterator)
|
||||
{
|
||||
stampsStream.write((*iterator).c_str(), 10);
|
||||
@ -700,7 +700,7 @@ RequestStatus Client::ExecVote(int saveID, int direction)
|
||||
{
|
||||
ByteString saveIDText = ByteString::Build(saveID);
|
||||
ByteString userIDText = ByteString::Build(authUser.UserID);
|
||||
data = http::Request::SimpleAuth(SCHEME SERVER "/Vote.api", &dataStatus, userIDText, authUser.SessionID, {
|
||||
data = http::Request::SimpleAuth(ByteString::Build(SCHEME, SERVER, "/Vote.api"), &dataStatus, userIDText, authUser.SessionID, {
|
||||
{ "ID", saveIDText },
|
||||
{ "Action", direction ? (direction == 1 ? "Up" : "Down") : "Reset" },
|
||||
{ "Key", authUser.SessionKey }
|
||||
@ -748,7 +748,7 @@ LoginStatus Client::Login(ByteString username, ByteString password, User & user)
|
||||
|
||||
ByteString data;
|
||||
int dataStatus;
|
||||
data = http::Request::Simple("https://" SERVER "/Login.json", &dataStatus, {
|
||||
data = http::Request::Simple(ByteString::Build("https://", SERVER, "/Login.json"), &dataStatus, {
|
||||
{ "name", username },
|
||||
{ "pass", password },
|
||||
});
|
||||
@ -1577,11 +1577,7 @@ bool Client::DoInstallation()
|
||||
|
||||
CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
||||
auto exe = Platform::ExecutableName();
|
||||
#ifndef IDI_DOC_ICON
|
||||
// make this fail so I don't remove #include "resource.h" again and get away with it
|
||||
# error where muh IDI_DOC_ICON D:
|
||||
#endif
|
||||
auto icon = exe + ",-" MTOS(IDI_DOC_ICON);
|
||||
auto icon = ByteString::Build(exe, ",-", IDI_DOC_ICON);
|
||||
auto path = Platform::GetCwd();
|
||||
auto open = ByteString::Build("\"", exe, "\" ddir \"", path, "\" \"file://%1\"");
|
||||
auto ptsave = ByteString::Build("\"", exe, "\" ddir \"", path, "\" \"%1\"");
|
||||
@ -1606,7 +1602,7 @@ bool Client::DoInstallation()
|
||||
ok = ok && shellLink->SetWorkingDirectory(Platform::WinWiden(path).c_str()) == S_OK;
|
||||
ok = ok && shellLink->SetDescription(Platform::WinWiden(APPNAME).c_str()) == S_OK;
|
||||
ok = ok && shellLink->QueryInterface(IID_IPersistFile, (LPVOID *)&shellLinkPersist) == S_OK;
|
||||
ok = ok && shellLinkPersist->Save(Platform::WinWiden(Platform::WinNarrow(programsPath) + "\\" APPNAME ".lnk").c_str(), TRUE) == S_OK;
|
||||
ok = ok && shellLinkPersist->Save(Platform::WinWiden(ByteString::Build(Platform::WinNarrow(programsPath), "\\", APPNAME, ".lnk")).c_str(), TRUE) == S_OK;
|
||||
if (shellLinkPersist)
|
||||
{
|
||||
shellLinkPersist->Release();
|
||||
@ -1653,9 +1649,9 @@ bool Client::DoInstallation()
|
||||
ByteString desktopData(powder_desktop, powder_desktop + powder_desktop_size);
|
||||
auto exe = Platform::ExecutableName();
|
||||
auto path = exe.SplitFromEndBy('/').Before();
|
||||
desktopData = desktopData.Substitute("Exec=" APPEXE, "Exec=" + desktopEscapeString(desktopEscapeExec(exe)));
|
||||
desktopData = desktopData.Substitute("Exec=" + ByteString(APPEXE), "Exec=" + desktopEscapeString(desktopEscapeExec(exe)));
|
||||
desktopData += ByteString::Build("Path=", desktopEscapeString(path), "\n");
|
||||
ByteString file = APPVENDOR "-" APPID ".desktop";
|
||||
ByteString file = ByteString::Build(APPVENDOR, "-", APPID, ".desktop");
|
||||
ok = ok && Platform::WriteFile(std::vector<char>(desktopData.begin(), desktopData.end()), file);
|
||||
ok = ok && !system(ByteString::Build("xdg-desktop-menu install ", file).c_str());
|
||||
ok = ok && !system(ByteString::Build("xdg-mime default ", file, " application/vnd.powdertoy.save").c_str());
|
||||
@ -1664,23 +1660,23 @@ bool Client::DoInstallation()
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
ByteString file = APPVENDOR "-save.xml";
|
||||
ByteString file = ByteString(APPVENDOR) + "-save.xml";
|
||||
ok = ok && Platform::WriteFile(std::vector<char>(save_xml, save_xml + save_xml_size), file);
|
||||
ok = ok && !system(ByteString::Build("xdg-mime install ", file).c_str());
|
||||
Platform::RemoveFile(file);
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
ByteString file = APPVENDOR "-cps.png";
|
||||
ByteString file = ByteString(APPVENDOR) + "-cps.png";
|
||||
ok = ok && Platform::WriteFile(std::vector<char>(icon_cps_png, icon_cps_png + icon_cps_png_size), file);
|
||||
ok = ok && !system(ByteString::Build("xdg-icon-resource install --noupdate --context mimetypes --size 64 ", file, " application-vnd.powdertoy.save").c_str());
|
||||
Platform::RemoveFile(file);
|
||||
}
|
||||
if (ok)
|
||||
{
|
||||
ByteString file = APPVENDOR "-exe.png";
|
||||
ByteString file = ByteString(APPVENDOR) + "-exe.png";
|
||||
ok = ok && Platform::WriteFile(std::vector<char>(icon_exe_png, icon_exe_png + icon_exe_png_size), file);
|
||||
ok = ok && !system(ByteString::Build("xdg-icon-resource install --noupdate --size 64 ", file, " " APPVENDOR "-" APPEXE).c_str());
|
||||
ok = ok && !system(ByteString::Build("xdg-icon-resource install --noupdate --size 64 ", file, " ", APPVENDOR, "-", APPEXE).c_str());
|
||||
Platform::RemoveFile(file);
|
||||
}
|
||||
if (ok)
|
||||
|
@ -675,7 +675,7 @@ void GameSave::readOPS(const std::vector<char> &data)
|
||||
minor = bson_iterator_int(&subiter);
|
||||
}
|
||||
}
|
||||
#if defined(SNAPSHOT) || defined(BETA) || defined(DEBUG) || MOD_ID > 0
|
||||
#ifdef ALLOW_FAKE_NEWER_VERSION
|
||||
if (major > FUTURE_SAVE_VERSION || (major == FUTURE_SAVE_VERSION && minor > FUTURE_MINOR_VERSION))
|
||||
#else
|
||||
if (major > SAVE_VERSION || (major == SAVE_VERSION && minor > MINOR_VERSION))
|
||||
@ -684,7 +684,7 @@ void GameSave::readOPS(const std::vector<char> &data)
|
||||
String errorMessage = String::Build("Save from a newer version: Requires version ", major, ".", minor);
|
||||
throw ParseException(ParseException::WrongVersion, errorMessage);
|
||||
}
|
||||
#if defined(SNAPSHOT) || defined(BETA) || defined(DEBUG) || MOD_ID > 0
|
||||
#ifdef ALLOW_FAKE_NEWER_VERSION
|
||||
else if (major > SAVE_VERSION || (major == SAVE_VERSION && minor > MINOR_VERSION))
|
||||
fakeNewerVersion = true;
|
||||
#endif
|
||||
@ -1241,6 +1241,8 @@ void GameSave::readOPS(const std::vector<char> &data)
|
||||
}
|
||||
}
|
||||
|
||||
#define MTOS_EXPAND(str) #str
|
||||
#define MTOS(str) MTOS_EXPAND(str)
|
||||
void GameSave::readPSv(const std::vector<char> &dataVec)
|
||||
{
|
||||
Renderer::PopulateTables();
|
||||
@ -1895,6 +1897,8 @@ void GameSave::readPSv(const std::vector<char> &dataVec)
|
||||
signs.push_back(tempSigns[i]);
|
||||
}
|
||||
}
|
||||
#undef MTOS
|
||||
#undef MTOS_EXPAND
|
||||
|
||||
std::pair<bool, std::vector<char>> GameSave::serialiseOPS() const
|
||||
{
|
||||
@ -2385,7 +2389,7 @@ std::pair<bool, std::vector<char>> GameSave::serialiseOPS() const
|
||||
}
|
||||
|
||||
bool fakeFromNewerVersion = false;
|
||||
#if defined(SNAPSHOT) || defined(BETA) || defined(DEBUG) || MOD_ID > 0
|
||||
#ifdef ALLOW_FAKE_NEWER_VERSION
|
||||
// Mark save as incompatible with latest release
|
||||
if (minimumMajorVersion > SAVE_VERSION || (minimumMajorVersion == SAVE_VERSION && minimumMinorVersion > MINOR_VERSION))
|
||||
fakeFromNewerVersion = true;
|
||||
|
@ -6,7 +6,7 @@
|
||||
namespace http
|
||||
{
|
||||
GetUserInfoRequest::GetUserInfoRequest(ByteString username) :
|
||||
APIRequest(SCHEME SERVER "/User.json?Name=" + username)
|
||||
APIRequest(ByteString::Build(SCHEME, SERVER, "/User.json?Name=", username))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -53,12 +53,12 @@ namespace http
|
||||
capath = newCapath;
|
||||
|
||||
user_agent = ByteString::Build(
|
||||
"PowderToy/", SAVE_VERSION, ".", MINOR_VERSION, " ("
|
||||
IDENT_PLATFORM
|
||||
"; " IDENT_BUILD
|
||||
"PowderToy/", SAVE_VERSION, ".", MINOR_VERSION,
|
||||
" (", IDENT_PLATFORM,
|
||||
"; ", IDENT_BUILD,
|
||||
"; M", MOD_ID,
|
||||
"; " IDENT
|
||||
") TPTPP/", SAVE_VERSION, ".", MINOR_VERSION, ".", BUILD_NUM, IDENT_RELTYPE ".", SNAPSHOT_ID
|
||||
"; ", IDENT,
|
||||
") TPTPP/", SAVE_VERSION, ".", MINOR_VERSION, ".", BUILD_NUM, IDENT_RELTYPE, ".", SNAPSHOT_ID
|
||||
);
|
||||
|
||||
worker_thread = std::thread([this]() { Worker(); });
|
||||
|
@ -6,7 +6,7 @@
|
||||
namespace http
|
||||
{
|
||||
SaveUserInfoRequest::SaveUserInfoRequest(UserInfo &info) :
|
||||
APIRequest(SCHEME SERVER "/Profile.json")
|
||||
APIRequest(ByteString::Build(SCHEME, SERVER, "/Profile.json"))
|
||||
{
|
||||
AddPostData({
|
||||
{ "Location", info.location.ToUtf8() },
|
||||
|
@ -7,8 +7,8 @@ namespace http
|
||||
ThumbnailRequest::ThumbnailRequest(int saveID, int saveDate, int width, int height) :
|
||||
ImageRequest((
|
||||
saveDate
|
||||
? ByteString::Build(STATICSCHEME STATICSERVER "/", saveID, "_", saveDate, "_small.png")
|
||||
: ByteString::Build(STATICSCHEME STATICSERVER "/", saveID, "_small.png")
|
||||
? ByteString::Build(STATICSCHEME, STATICSERVER, "/", saveID, "_", saveDate, "_small.png")
|
||||
: ByteString::Build(STATICSCHEME, STATICSERVER, "/", saveID, "_small.png")
|
||||
), width, height)
|
||||
{
|
||||
}
|
||||
|
@ -9,9 +9,7 @@
|
||||
#include "common/Platform.h"
|
||||
|
||||
#include "FontReader.h"
|
||||
#ifdef HIGH_QUALITY_RESAMPLE
|
||||
#include "resampler/resampler.h"
|
||||
#endif
|
||||
|
||||
#include <png.h>
|
||||
|
||||
|
@ -25,8 +25,8 @@ void Graphics::Finalise()
|
||||
|
||||
}
|
||||
|
||||
#define VIDXRES WINDOWW
|
||||
#define VIDYRES WINDOWH
|
||||
constexpr auto VIDXRES = WINDOWW;
|
||||
constexpr auto VIDYRES = WINDOWH;
|
||||
#define PIXELMETHODS_CLASS Graphics
|
||||
#define DO_CLIPCHECK
|
||||
#include "RasterDrawMethods.inl"
|
||||
|
@ -20,14 +20,8 @@
|
||||
#include "simulation/Gravity.h"
|
||||
#include "simulation/ElementClasses.h"
|
||||
|
||||
#ifdef LUACONSOLE
|
||||
#include "lua/LuaScriptInterface.h"
|
||||
#include "lua/LuaScriptHelper.h"
|
||||
#include "lua/LuaSmartRef.h"
|
||||
#endif
|
||||
|
||||
#define VIDXRES WINDOWW
|
||||
#define VIDYRES WINDOWH
|
||||
constexpr auto VIDXRES = WINDOWW;
|
||||
constexpr auto VIDYRES = WINDOWH;
|
||||
|
||||
|
||||
void Renderer::RenderBegin()
|
||||
|
@ -260,9 +260,9 @@ void GameController::PlaceSave(ui::Point position)
|
||||
void GameController::Install()
|
||||
{
|
||||
#if defined(MACOSX)
|
||||
new InformationMessage("No installation necessary", "You don't need to install " APPNAME " on OS X", false);
|
||||
new InformationMessage("No installation necessary", "You don't need to install " + String(APPNAME) + " on OS X", false);
|
||||
#elif defined(WIN) || defined(LIN)
|
||||
new ConfirmPrompt("Install " APPNAME, "Do you wish to install " APPNAME " on this computer?\nThis allows you to open save files and saves directly from the website.", { [] {
|
||||
new ConfirmPrompt("Install " + String(APPNAME), "Do you wish to install " + String(APPNAME) + " on this computer?\nThis allows you to open save files and saves directly from the website.", { [] {
|
||||
if (Client::Ref().DoInstallation())
|
||||
{
|
||||
new InformationMessage("Success", "Installation completed", false);
|
||||
@ -273,7 +273,7 @@ void GameController::Install()
|
||||
}
|
||||
} });
|
||||
#else
|
||||
new ErrorMessage("Cannot install", "You cannot install " APPNAME " on this platform");
|
||||
new ErrorMessage("Cannot install", "You cannot install " + String(APPNAME) + " on this platform");
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -581,7 +581,7 @@ bool GameController::MouseUp(int x, int y, unsigned button, MouseupReason reason
|
||||
}
|
||||
break;
|
||||
case sign::Type::Thread:
|
||||
Platform::OpenURI(ByteString::Build(SCHEME "powdertoy.co.uk/Discussions/Thread/View.html?Thread=", str.Substr(3, si.first - 3).ToUtf8()));
|
||||
Platform::OpenURI(ByteString::Build(SCHEME, "powdertoy.co.uk/Discussions/Thread/View.html?Thread=", str.Substr(3, si.first - 3).ToUtf8()));
|
||||
break;
|
||||
case sign::Type::Search:
|
||||
OpenSearch(str.Substr(3, si.first - 3));
|
||||
@ -1278,7 +1278,7 @@ void GameController::OpenSavePreview()
|
||||
|
||||
void GameController::OpenLocalBrowse()
|
||||
{
|
||||
new FileBrowserActivity(LOCAL_SAVE_DIR PATH_SEP, [this](std::unique_ptr<SaveFile> file) {
|
||||
new FileBrowserActivity(ByteString(LOCAL_SAVE_DIR) + PATH_SEP, [this](std::unique_ptr<SaveFile> file) {
|
||||
HistorySnapshot();
|
||||
LoadSaveFile(file.get());
|
||||
});
|
||||
@ -1616,7 +1616,7 @@ void GameController::NotifyUpdateAvailable(Client * sender)
|
||||
|
||||
#ifdef SNAPSHOT
|
||||
updateMessage << "Snapshot " << SNAPSHOT_ID;
|
||||
#elif MOD_ID > 0
|
||||
#elif defined(MOD)
|
||||
updateMessage << "Mod version " << SNAPSHOT_ID;
|
||||
#elif defined(BETA)
|
||||
updateMessage << SAVE_VERSION << "." << MINOR_VERSION << " Beta, Build " << BUILD_NUM;
|
||||
@ -1628,7 +1628,7 @@ void GameController::NotifyUpdateAvailable(Client * sender)
|
||||
if (info.Type == UpdateInfo::Beta)
|
||||
updateMessage << info.Major << "." << info.Minor << " Beta, Build " << info.Build;
|
||||
else if (info.Type == UpdateInfo::Snapshot)
|
||||
#if MOD_ID > 0
|
||||
#if defined(MOD)
|
||||
updateMessage << "Mod version " << info.Time;
|
||||
#else
|
||||
updateMessage << "Snapshot " << info.Time;
|
||||
@ -1646,7 +1646,7 @@ void GameController::NotifyUpdateAvailable(Client * sender)
|
||||
switch(sender->GetUpdateInfo().Type)
|
||||
{
|
||||
case UpdateInfo::Snapshot:
|
||||
#if MOD_ID > 0
|
||||
#if defined(MOD)
|
||||
gameModel->AddNotification(new UpdateNotification(this, "A new mod update is available - click here to update"));
|
||||
#else
|
||||
gameModel->AddNotification(new UpdateNotification(this, "A new snapshot is available - click here to update"));
|
||||
@ -1673,7 +1673,7 @@ void GameController::RunUpdater()
|
||||
new UpdateActivity();
|
||||
#else
|
||||
|
||||
#ifdef UPDATESERVER
|
||||
#ifdef USE_UPDATESERVER
|
||||
ByteString file = ByteString::Build(SCHEME, UPDATESERVER, Client::Ref().GetUpdateInfo().File);
|
||||
#else
|
||||
ByteString file = ByteString::Build(SCHEME, SERVER, Client::Ref().GetUpdateInfo().File);
|
||||
|
@ -5,7 +5,7 @@
|
||||
inline ByteString IntroText()
|
||||
{
|
||||
ByteStringBuilder sb;
|
||||
sb << "\bl\bU" APPNAME "\bU - Version " << SAVE_VERSION << "." << MINOR_VERSION << " - https://powdertoy.co.uk, irc.libera.chat #powder, https://tpt.io/discord\n"
|
||||
sb << "\bl\bU" << APPNAME << "\bU - Version " << SAVE_VERSION << "." << MINOR_VERSION << " - https://powdertoy.co.uk, irc.libera.chat #powder, https://tpt.io/discord\n"
|
||||
"\n"
|
||||
"\n"
|
||||
"\bgControl+C/V/X are Copy, Paste and cut respectively.\n"
|
||||
@ -35,14 +35,14 @@ inline ByteString IntroText()
|
||||
"\brIf you are planning on publishing any saves, use the release version.\n";
|
||||
#endif
|
||||
sb << "\n"
|
||||
<< "\bt" << SAVE_VERSION << "." << MINOR_VERSION << "." << BUILD_NUM << " " IDENT;
|
||||
<< "\bt" << SAVE_VERSION << "." << MINOR_VERSION << "." << BUILD_NUM << " " << IDENT;
|
||||
#ifdef SNAPSHOT
|
||||
sb << " SNAPSHOT " << SNAPSHOT_ID;
|
||||
#elif MOD_ID > 0
|
||||
#elif defined(MOD)
|
||||
sb << " MODVER " << SNAPSHOT_ID;
|
||||
#endif
|
||||
#if defined(X86_SSE) || defined(X86_SSE2) || defined(X86_SSE3)
|
||||
sb << " " IDENT_BUILD;
|
||||
sb << " " << IDENT_BUILD;
|
||||
#endif
|
||||
#ifdef LUACONSOLE
|
||||
sb << " LUACONSOLE";
|
||||
|
@ -27,7 +27,7 @@ void AvatarButton::Tick(float dt)
|
||||
if (!avatar && !tried && name.size() > 0)
|
||||
{
|
||||
tried = true;
|
||||
RequestSetup(SCHEME STATICSERVER "/avatars/" + name + ".png", Size.X, Size.Y);
|
||||
RequestSetup(ByteString::Build(SCHEME, STATICSERVER, "/avatars/", name, ".png"), Size.X, Size.Y);
|
||||
RequestStart();
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ void ProfileActivity::setUserInfo(UserInfo newInfo)
|
||||
{
|
||||
ui::Button * editAvatar = new ui::Button(ui::Point(Size.X - (40 + 16 + 75), currentY), ui::Point(75, 15), "Edit Avatar");
|
||||
editAvatar->SetActionCallback({ [] {
|
||||
Platform::OpenURI(SCHEME SERVER "/Profile/Avatar.html");
|
||||
Platform::OpenURI(ByteString::Build(SCHEME, SERVER, "/Profile/Avatar.html"));
|
||||
} });
|
||||
scrollPanel->AddChild(editAvatar);
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ private:
|
||||
|
||||
UpdateActivity::UpdateActivity() {
|
||||
ByteString file;
|
||||
#ifdef UPDATESERVER
|
||||
#ifdef USE_UPDATESERVER
|
||||
file = ByteString::Build(SCHEME, UPDATESERVER, Client::Ref().GetUpdateInfo().File);
|
||||
#else
|
||||
file = ByteString::Build(SCHEME, SERVER, Client::Ref().GetUpdateInfo().File);
|
||||
@ -145,14 +145,14 @@ void UpdateActivity::Exit()
|
||||
|
||||
void UpdateActivity::NotifyError(Task * sender)
|
||||
{
|
||||
#ifdef UPDATESERVER
|
||||
#ifdef USE_UPDATESERVER
|
||||
# define FIRST_LINE "Please go online to manually download a newer version.\n"
|
||||
#else
|
||||
# define FIRST_LINE "Please visit the website to download a newer version.\n"
|
||||
#endif
|
||||
new ConfirmPrompt("Autoupdate failed", FIRST_LINE "Error: " + sender->GetError(), { [this] {
|
||||
#ifndef UPDATESERVER
|
||||
Platform::OpenURI(SCHEME "powdertoy.co.uk/Download.html");
|
||||
#ifndef USE_UPDATESERVER
|
||||
Platform::OpenURI(ByteString(SCHEME) + "powdertoy.co.uk/Download.html");
|
||||
#endif
|
||||
Exit();
|
||||
}, [this] { Exit(); } });
|
||||
|
@ -1277,7 +1277,7 @@ int luatpt_getscript(lua_State* l)
|
||||
int runScript = luaL_optint(l, 3, 0);
|
||||
int confirmPrompt = luaL_optint(l, 4, 1);
|
||||
|
||||
ByteString url = ByteString::Build(SCHEME "starcatcher.us/scripts/main.lua?get=", scriptID);
|
||||
ByteString url = ByteString::Build(SCHEME, "starcatcher.us/scripts/main.lua?get=", scriptID);
|
||||
if (confirmPrompt && !ConfirmPrompt::Blocking("Do you want to install script?", url.FromUtf8(), "Install"))
|
||||
return 0;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#pragma once
|
||||
#include "Config.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
|
@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "Config.h"
|
||||
//http://lua-users.org/wiki/SimplerCppBinding
|
||||
|
||||
#include "LuaCompat.h"
|
||||
|
@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "Config.h"
|
||||
#include "simulation/Particle.h"
|
||||
#include "simulation/ElementDefs.h"
|
||||
#include "common/String.h"
|
||||
|
@ -318,7 +318,7 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
|
||||
lua_setfield(l, tptPropertiesVersion, "minor");
|
||||
lua_pushinteger(l, BUILD_NUM);
|
||||
lua_setfield(l, tptPropertiesVersion, "build");
|
||||
#if defined(SNAPSHOT) || MOD_ID > 0
|
||||
#if defined(SNAPSHOT) || defined(MOD)
|
||||
lua_pushinteger(l, SNAPSHOT_ID);
|
||||
#else
|
||||
lua_pushinteger(l, 0);
|
||||
@ -958,15 +958,15 @@ void LuaScriptInterface::initSimulationAPI()
|
||||
SETCONST(l, CELL);
|
||||
SETCONST(l, NT);
|
||||
SETCONST(l, ST);
|
||||
SETCONST(l, ITH);
|
||||
SETCONST(l, ITL);
|
||||
SETCONSTF(l, ITH);
|
||||
SETCONSTF(l, ITL);
|
||||
SETCONSTF(l, IPH);
|
||||
SETCONSTF(l, IPL);
|
||||
SETCONST(l, PT_NUM);
|
||||
lua_pushinteger(l, 0); lua_setfield(l, -2, "NUM_PARTS");
|
||||
SETCONST(l, R_TEMP);
|
||||
SETCONST(l, MAX_TEMP);
|
||||
SETCONST(l, MIN_TEMP);
|
||||
SETCONSTF(l, R_TEMP);
|
||||
SETCONSTF(l, MAX_TEMP);
|
||||
SETCONSTF(l, MIN_TEMP);
|
||||
SETCONSTF(l, MAX_PRESSURE);
|
||||
SETCONSTF(l, MIN_PRESSURE);
|
||||
|
||||
@ -4085,25 +4085,25 @@ void LuaScriptInterface::initPlatformAPI()
|
||||
|
||||
int LuaScriptInterface::platform_platform(lua_State * l)
|
||||
{
|
||||
lua_pushliteral(l, IDENT_PLATFORM);
|
||||
tpt_lua_pushByteString(l, IDENT_PLATFORM);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int LuaScriptInterface::platform_ident(lua_State * l)
|
||||
{
|
||||
lua_pushliteral(l, IDENT);
|
||||
tpt_lua_pushByteString(l, IDENT);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int LuaScriptInterface::platform_build(lua_State * l)
|
||||
{
|
||||
lua_pushliteral(l, IDENT_BUILD);
|
||||
tpt_lua_pushByteString(l, IDENT_BUILD);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int LuaScriptInterface::platform_releaseType(lua_State * l)
|
||||
{
|
||||
lua_pushliteral(l, IDENT_RELTYPE);
|
||||
tpt_lua_pushByteString(l, IDENT_RELTYPE);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -4457,7 +4457,7 @@ static int http_request(lua_State *l, bool isPost)
|
||||
|
||||
static int http_get_auth_token(lua_State *l)
|
||||
{
|
||||
return RequestHandle::Make(l, SCHEME SERVER "/ExternalAuth.api?Action=Get&Audience=" + format::URLEncode(tpt_lua_checkByteString(l, 1)), false, {}, RequestHandle::getAuthToken, {}, {});
|
||||
return RequestHandle::Make(l, ByteString::Build(SCHEME, SERVER, "/ExternalAuth.api?Action=Get&Audience=", format::URLEncode(tpt_lua_checkByteString(l, 1))), false, {}, RequestHandle::getAuthToken, {}, {});
|
||||
}
|
||||
|
||||
int LuaScriptInterface::http_get(lua_State * l)
|
||||
|
@ -1,5 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "Config.h"
|
||||
#include "LuaCompat.h"
|
||||
|
||||
class LuaSmartRef
|
||||
|
@ -23,13 +23,7 @@
|
||||
|
||||
static inline int resampler_range_check(int v, int h) { (void)h; resampler_assert((v >= 0) && (v < h)); return v; }
|
||||
|
||||
#ifndef max
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
#ifndef min
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#endif
|
||||
#include "common/tpt-minmax.h"
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE (1)
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include "Config.h"
|
||||
#include <cstdlib>
|
||||
|
||||
#define HIGH_QUALITY_RESAMPLE
|
||||
|
||||
#define RESAMPLER_DEBUG_OPS 0
|
||||
#define RESAMPLER_DEFAULT_FILTER "lanczos4"
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "Simulation.h"
|
||||
#include "SimulationData.h"
|
||||
|
||||
#define GRAV_DIFF
|
||||
|
||||
Gravity::Gravity()
|
||||
{
|
||||
|
@ -165,7 +165,7 @@ void Element_EMP_Trigger(Simulation *sim, int triggerCount)
|
||||
if (RNG::Ref().uniform01() < prob_randWIFI)
|
||||
{
|
||||
// Randomize channel
|
||||
parts[n].temp = float(RNG::Ref().between(0, MAX_TEMP-1));
|
||||
parts[n].temp = float(RNG::Ref().between(0, int(MAX_TEMP)-1));
|
||||
}
|
||||
if (RNG::Ref().uniform01() < prob_breakWIFI)
|
||||
{
|
||||
|
@ -93,7 +93,6 @@ static int update(UPDATE_FUNC_ARGS)
|
||||
Element_FIRE_update(UPDATE_FUNC_SUBCALL_ARGS);
|
||||
}
|
||||
break;
|
||||
#ifdef SDEUT
|
||||
case PT_DEUT:
|
||||
if (RNG::Ref().chance(pressureFactor + 1 + (parts[ID(r)].life/100), 1000))
|
||||
{
|
||||
@ -101,20 +100,6 @@ static int update(UPDATE_FUNC_ARGS)
|
||||
sim->kill_part(ID(r));
|
||||
}
|
||||
break;
|
||||
#else
|
||||
case PT_DEUT:
|
||||
if (RNG::Ref().chance(pressureFactor+1, 1000))
|
||||
{
|
||||
create_part(ID(r), x+rx, y+ry, PT_NEUT);
|
||||
parts[ID(r)].vx = 0.25f*parts[ID(r)].vx + parts[i].vx;
|
||||
parts[ID(r)].vy = 0.25f*parts[ID(r)].vy + parts[i].vy;
|
||||
parts[ID(r)].life --;
|
||||
parts[ID(r)].temp = restrict_flt(parts[ID(r)].temp + parts[ID(r)].life*17.0f, MIN_TEMP, MAX_TEMP);
|
||||
pv[y/CELL][x/CELL] += 6.0f * CFDS;
|
||||
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case PT_GUNP:
|
||||
if (RNG::Ref().chance(3, 200))
|
||||
sim->part_change_type(ID(r),x+rx,y+ry,PT_DUST);
|
||||
|
Loading…
Reference in New Issue
Block a user