Skip to content

Commit

Permalink
Remove stuff from Config.h that doesn't belong
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfy1339 authored and jacob1 committed Nov 23, 2017
1 parent 6cfaed0 commit 87f3ada
Show file tree
Hide file tree
Showing 9 changed files with 104 additions and 65 deletions.
19 changes: 0 additions & 19 deletions src/Config.h
Expand Up @@ -163,10 +163,6 @@
#define GLASS_IOR 1.9
#define GLASS_DISP 0.07

//some compatibility stuff for non-standard compilers
#if defined(WIN) && !defined(strcasecmp)
#define strcasecmp stricmp
#endif
#if defined(_MSC_VER)
#if _MSC_VER < 1800
#define fmin min
Expand All @@ -178,21 +174,6 @@
#endif
#endif

#if defined(_MSC_VER)
#define TPT_INLINE _inline
#else
#define TPT_INLINE inline
#endif

// old Platform.h stuff, maybe we should have a file for these kinds of things
typedef unsigned short Uint16;

#ifndef NULL
# define NULL 0
#endif

#include <climits>

#define SDEUT
//#define REALHEAT

Expand Down
25 changes: 13 additions & 12 deletions src/PowderToySDL.cpp
Expand Up @@ -3,6 +3,7 @@
#include <map>
#include <string>
#include <ctime>
#include <climits>
#ifdef WIN
#define _WIN32_WINNT 0x0501 //Necessary for some macros and functions, tells windows.h to include functions only available in Windows XP or later
#include <direct.h>
Expand Down Expand Up @@ -34,7 +35,7 @@
#include <ApplicationServices/ApplicationServices.h>
extern "C" {
char * readClipboard();
void writeClipboard(const char * clipboardData);
void writeClipboard(const char * clipboardData);
}
#endif

Expand Down Expand Up @@ -779,7 +780,7 @@ void EngineProcess()

engine->Tick();
engine->Draw();

if(scale != engine->Scale || fullscreen != engine->Fullscreen)
{
sdl_scrn = SDLSetScreen(engine->Scale, engine->Fullscreen);
Expand Down Expand Up @@ -844,7 +845,7 @@ bool LoadWindowPosition(int scale)

int savedWindowX = Client::Ref().GetPrefInteger("WindowX", INT_MAX);
int savedWindowY = Client::Ref().GetPrefInteger("WindowY", INT_MAX);

// Center the window on the primary desktop by default
int newWindowX = (desktopWidth - windowW) / 2;
int newWindowY = (desktopHeight - windowH) / 2;
Expand Down Expand Up @@ -878,7 +879,7 @@ bool LoadWindowPosition(int scale)
}
}
}

SetWindowPos(sysInfo.window, 0, newWindowX, newWindowY, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER);

// True if we didn't use the default, i.e. the position was valid
Expand Down Expand Up @@ -921,7 +922,7 @@ void BlueScreen(const char * detailMessage){
int currentY = 0, width, height;
int errorWidth = 0;
Graphics::textsize(errorHelp.c_str(), errorWidth, height);

engine->g->drawtext((engine->GetWidth()/2)-(errorWidth/2), ((engine->GetHeight()/2)-100) + currentY, errorTitle.c_str(), 255, 255, 255, 255);
Graphics::textsize(errorTitle.c_str(), width, height);
currentY += height + 4;
Expand All @@ -933,9 +934,9 @@ void BlueScreen(const char * detailMessage){
engine->g->drawtext((engine->GetWidth()/2)-(errorWidth/2), ((engine->GetHeight()/2)-100) + currentY, errorHelp.c_str(), 255, 255, 255, 255);
Graphics::textsize(errorTitle.c_str(), width, height);
currentY += height + 4;

//Death loop
SDL_Event event;
SDL_Event event;
while(true)
{
while (SDL_PollEvent(&event))
Expand Down Expand Up @@ -975,7 +976,7 @@ int main(int argc, char * argv[])
#if defined(_DEBUG) && defined(_MSC_VER)
_CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
#endif
currentWidth = WINDOWW;
currentWidth = WINDOWW;
currentHeight = WINDOWH;


Expand Down Expand Up @@ -1013,7 +1014,7 @@ int main(int argc, char * argv[])
if(arguments["proxy"] == "false")
{
proxyString = "";
Client::Ref().SetPref("Proxy", "");
Client::Ref().SetPref("Proxy", "");
}
else
{
Expand Down Expand Up @@ -1065,7 +1066,7 @@ int main(int argc, char * argv[])
XA_TARGETS = XInternAtom(sdl_wminfo.info.x11.display, "TARGETS", 1);
XA_UTF8_STRING = XInternAtom(sdl_wminfo.info.x11.display, "UTF8_STRING", 1);
sdl_wminfo.info.x11.unlock_func();
}
}
else
{
fprintf(stderr, "X11 setup failed, X11 window info not found");
Expand Down Expand Up @@ -1203,7 +1204,7 @@ int main(int argc, char * argv[])
SDL_GetMouseState(&sdl_x, &sdl_y);
engine->onMouseMove(sdl_x*inputScale, sdl_y*inputScale);
EngineProcess();

#ifdef WIN
SaveWindowPosition();
#endif
Expand All @@ -1215,7 +1216,7 @@ int main(int argc, char * argv[])
BlueScreen(e.what());
}
#endif

Client::Ref().SetPref("Scale", ui::Engine::Ref().GetScale());
ui::Engine::Ref().CloseWindow();
delete gameController;
Expand Down
7 changes: 4 additions & 3 deletions src/bson/BSON.h
Expand Up @@ -26,7 +26,8 @@
#include <cstring>
#include <cstdio>
#include <cstdarg>
#include "Config.h"
#include <climits>
#include "common/tpt-inline.h"

#if defined(LIN) || defined(USE_STDINT)
#include <sys/types.h>
Expand Down Expand Up @@ -647,13 +648,13 @@ int bson_init_data( bson *b , char *data );


/**
* Initialize a BSON object, point its data pointer
* Initialize a BSON object, point its data pointer
* to the provided char*, and initialize the size
*
* @param b the BSON object to initialize.
* @param data the raw BSON data.
* @param size the size of the BSON data.
*
*
* @return BSON_OK or BSON_ERROR.
*/
int bson_init_data_size( bson *b , char *data , int size );
Expand Down
30 changes: 30 additions & 0 deletions src/common/tpt-compat.h
@@ -0,0 +1,30 @@
/*
* 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 3 of the License, or
* (at your option) 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 <http://www.gnu.org/licenses/>.
*/

#ifndef TPT_COMPAT_H
#define TPT_COMPAT_H

//some compatibility stuff for non-standard compilers
#if defined(WIN) && !defined(strcasecmp)
#define strcasecmp stricmp
#endif

typedef unsigned short Uint16;

#ifndef NULL
# define NULL 0
#endif

#endif
25 changes: 25 additions & 0 deletions src/common/tpt-inline.h
@@ -0,0 +1,25 @@
/*
* 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 3 of the License, or
* (at your option) 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 <http://www.gnu.org/licenses/>.
*/

#ifndef TPT_INLINE_H
#define TPT_INLINE_H

#if defined(_MSC_VER)
#define TPT_INLINE _inline
#else
#define TPT_INLINE inline
#endif

#endif
2 changes: 1 addition & 1 deletion src/debug/DebugInfo.h
@@ -1,7 +1,7 @@
#pragma once

#include "gui/interface/Point.h"
#include "Config.h"
#include "common/tpt-compat.h"

class DebugInfo
{
Expand Down
1 change: 1 addition & 0 deletions src/graphics/Graphics.h
Expand Up @@ -9,6 +9,7 @@
#include "OpenGLHeaders.h"
#endif
#include "Config.h"
#include "common/tpt-inline.h"
#include "Pixel.h"
#include "Icons.h"

Expand Down

0 comments on commit 87f3ada

Please sign in to comment.