Update #includes

- Reorder them so that system libraries come first
- Use C++-style headers (`<cmath>`) instead of C-style headers (`<math.h>`)
This commit is contained in:
Tomoaki Kawada 2016-12-03 19:04:58 +09:00
parent ebd79c0099
commit 624d291f79
49 changed files with 112 additions and 71 deletions

View File

@ -18,6 +18,11 @@
*/
#include <cstring>
#include <exception>
#include <cstdlib>
#include <vector>
#include "ALDevice.h"
#include "ALFuncs.h"
#include <Client/GameMap.h>
@ -28,10 +33,6 @@
#include <Core/IAudioStream.h>
#include <Core/Settings.h>
#include <Core/WavAudioStream.h>
#include <cstring>
#include <exception>
#include <stdlib.h>
#include <vector>
DEFINE_SPADES_SETTING(s_maxPolyphonics, "96");
DEFINE_SPADES_SETTING(s_eax, "1");

View File

@ -20,9 +20,10 @@
#pragma once
#include <Client/IAudioDevice.h>
#include <map>
#include <Client/IAudioDevice.h>
namespace spades {
namespace audio {

View File

@ -18,7 +18,7 @@
*/
#include <ctype.h>
#include <cctype>
#include "ChatWindow.h"
#include "Client.h"

View File

@ -19,11 +19,11 @@
*/
#include "Client.h"
#include <cmath>
#include <cstdlib>
#include "Client.h"
#include <Core/ConcurrentDispatch.h>
#include <Core/Settings.h>
#include <Core/Strings.h>

View File

@ -19,16 +19,17 @@
*/
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include "GameMap.h"
#include <Core/AutoLocker.h>
#include <Core/Debug.h>
#include <Core/Exception.h>
#include <Core/FileManager.h>
#include <Core/IStream.h>
#include <algorithm>
#include <math.h>
#include <stdlib.h>
#include <vector>
namespace spades {
namespace client {

View File

@ -19,6 +19,8 @@
*/
#include <ctime> //windows needs this.
#include "HitTestDebugger.h"
#include "GameMap.h"
#include "Player.h"
@ -30,7 +32,6 @@
#include <Core/Strings.h>
#include <Draw/SWPort.h>
#include <Draw/SWRenderer.h>
#include <time.h> //windows needs this.
SPADES_SETTING(cg_smp);

View File

@ -1,4 +1,3 @@
#include "MumbleLink.h"
#include <cassert>
#include <cstring>
@ -11,6 +10,8 @@
#include <unistd.h>
#endif
#include "MumbleLink.h"
namespace spades {
struct MumbleLinkedMemory {
uint32_t uiVersion;

View File

@ -23,6 +23,8 @@
#include <string.h>
#include <vector>
#include <enet/enet.h>
#include "CTFGameMode.h"
#include "Client.h"
#include "GameMap.h"
@ -40,7 +42,6 @@
#include <Core/MemoryStream.h>
#include <Core/Settings.h>
#include <Core/Strings.h>
#include <enet/enet.h>
DEFINE_SPADES_SETTING(cg_protocolVersion, "3");
DEFINE_SPADES_SETTING(cg_unicode, "1");

View File

@ -20,9 +20,10 @@
#pragma once
#include <Core/Math.h>
#include <string>
#include <Core/Math.h>
namespace spades {
namespace client {
class Client;

View File

@ -23,6 +23,7 @@
#include <Core/Math.h>
#include "Client.h"
#include "ILocalEntity.h"
namespace spades {
namespace client {
class IImage;

View File

@ -20,6 +20,7 @@
*/
#include "Player.h"
#include <Core/Debug.h>
#include <Core/Exception.h>
#include <Core/Settings.h>

View File

@ -19,6 +19,7 @@
*/
#include "Quake3Font.h"
#include "IRenderer.h"
#include <Core/Debug.h>

View File

@ -21,6 +21,7 @@
#pragma once
#include "IFont.h"
#define PROP_SPACE_WIDTH -2
namespace spades {

View File

@ -19,9 +19,9 @@
*/
#include <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <Core/Debug.h>
#include <Core/Settings.h>

View File

@ -7,6 +7,7 @@
#include <iterator>
#include "CP437.h"
#include <Core/Debug.h>
static const uint16_t cp437map[256] = {

View File

@ -3,10 +3,11 @@
* WTFPL
*/
#include <Core/Math.h>
#include <cstdint>
#include <string>
#include <Core/Math.h>
namespace spades {
class CP437 {
class ReverseMap;

View File

@ -23,14 +23,6 @@
#include <Imports/SDL.h>
#include "AutoLocker.h"
#include "ConcurrentDispatch.h"
#include "Debug.h"
#include "Exception.h"
#include "Mutex.h"
#include "Settings.h"
#include "Thread.h"
#include <OpenSpades.h>
#if defined(__APPLE__)
#include <sys/sysctl.h>
#else
@ -46,6 +38,14 @@
#endif
#endif
#include "AutoLocker.h"
#include "ConcurrentDispatch.h"
#include "Debug.h"
#include "Exception.h"
#include "Mutex.h"
#include "Settings.h"
#include "Thread.h"
#include <OpenSpades.h>
#include "ThreadLocalStorage.h"
DEFINE_SPADES_SETTING(core_numDispatchQueueThreads, "auto");

View File

@ -1,8 +1,9 @@
// WTFPL
#include "CpuID.h"
#include <string.h>
#include <cstring>
#include "CpuID.h"
namespace spades {

View File

@ -2,7 +2,7 @@
#pragma once
#include <array>
#include <stdint.h>
#include <cstdint>
#include <string>
#if defined(__i386__) || defined(_M_IX86)

View File

@ -18,10 +18,6 @@
*/
#include "DirectoryFileSystem.h"
#include "Debug.h"
#include "Exception.h"
#include "SdlFileStream.h"
#include <sys/stat.h>
#ifdef WIN32
@ -35,6 +31,12 @@
#include <dirent.h>
#endif
#include "DirectoryFileSystem.h"
#include "Debug.h"
#include "Exception.h"
#include "SdlFileStream.h"
namespace spades {
DirectoryFileSystem::DirectoryFileSystem(const std::string &r, bool canWrite)

View File

@ -20,9 +20,10 @@
#pragma once
#include "IStream.h"
#include <vector>
#include "IStream.h"
namespace spades {
class DynamicMemoryStream : public IStream {
std::vector<unsigned char> memory;

View File

@ -22,11 +22,6 @@
#include <Imports/SDL.h>
#include "FltkPreferenceImporter.h"
#include "SdlFileStream.h"
#include <Core/Debug.h>
#include <Core/Strings.h>
#ifdef WIN32
#include <wchar.h>
#include <windows.h>
@ -34,6 +29,11 @@
#include <unistd.h>
#endif
#include "FltkPreferenceImporter.h"
#include "SdlFileStream.h"
#include <Core/Debug.h>
#include <Core/Strings.h>
namespace spades {
#ifdef WIN32

View File

@ -18,10 +18,11 @@
*/
#include <cctype>
#include "IBitmapCodec.h"
#include "Debug.h"
#include "Exception.h"
#include <ctype.h>
namespace spades {

View File

@ -22,7 +22,7 @@
#include <algorithm> // std::max / std::min
#include <cstdint> // uint32_t --> msvc
#include <math.h>
#include <cmath>
#include <random>
#include <string>
#include <vector>

View File

@ -20,9 +20,10 @@
#pragma once
#include "IStream.h"
#include <Imports/SDL.h>
#include "IStream.h"
namespace spades {
class SdlFileStream : public IStream {
SDL_RWops *ops;

View File

@ -21,12 +21,13 @@
#include <cstring>
#include <memory>
#include <Imports/SDL.h>
#include "Bitmap.h"
#include "Debug.h"
#include "Exception.h"
#include "IBitmapCodec.h"
#include "IStream.h"
#include <Imports/SDL.h>
namespace spades {
class SdlImageReader : public IBitmapCodec {

View File

@ -18,10 +18,10 @@
*/
#include "ServerAddress.h"
#include <enet/enet.h>
#include "ServerAddress.h"
namespace spades {
// unsigned long version of atol, cross-platform (including MSVC)

View File

@ -18,8 +18,6 @@
*/
#include "StdStream.h"
#include "Exception.h"
#ifndef _MSC_VER
#include <unistd.h>
#else
@ -27,6 +25,10 @@
#define ftruncate _chsize
#define fileno _fileno
#endif
#include "StdStream.h"
#include "Exception.h"
#include "Debug.h"
namespace spades {

View File

@ -18,8 +18,9 @@
*/
#include "Stopwatch.h"
#include <Imports/SDL.h>
#include "Stopwatch.h"
#include "Debug.h"
#ifdef WIN32

View File

@ -21,6 +21,7 @@
#include <typeinfo>
#include <Imports/SDL.h>
#include "AutoLocker.h"
#include "ConcurrentDispatch.h"
#include "Debug.h"

View File

@ -18,7 +18,6 @@
*/
#include "ThreadLocalStorage.h"
#include <vector>
#ifdef WIN32
@ -27,6 +26,8 @@
#include <pthread.h>
#endif
#include "ThreadLocalStorage.h"
namespace spades {
class ThreadLocalStorageImplInternal;

View File

@ -20,9 +20,10 @@
#pragma once
#include "Exception.h"
#include <string>
#include "Exception.h"
namespace spades {
class ThreadLocalStorageImpl {

View File

@ -1,5 +1,3 @@
#include "VersionInfo.h"
#if __linux__
#define OS_PLATFORM_LINUX
#elif TARGET_OS_MAC
@ -10,6 +8,8 @@
#include <sstream>
#endif
#include "VersionInfo.h"
std::string VersionInfo::GetVersionInfo() {
#if defined(OS_PLATFORM_LINUX)
return std::string("Linux");

View File

@ -1,4 +1,5 @@
#pragma once
#include <string>
class VersionInfo {

View File

@ -22,6 +22,7 @@
#include <unzip/unzip.h>
// ioapi.h must be included after unzip.h
#include <unzip/ioapi.h>
#include <Core/Debug.h>

View File

@ -20,10 +20,11 @@
#pragma once
#include <vector>
#include <Client/IModel.h>
#include <Client/IRenderer.h>
#include "GLDynamicLight.h"
#include <vector>
namespace spades {
namespace draw {

View File

@ -18,9 +18,10 @@
*/
#include <cstdio>
#include "GLProgramUniform.h"
#include <Core/Exception.h>
#include <stdio.h>
#include <Core/Debug.h>
namespace spades {

View File

@ -20,9 +20,10 @@
#pragma once
#include "IGLDevice.h"
#include <vector>
#include "IGLDevice.h"
namespace spades {
namespace draw {
class GLShader {

View File

@ -20,12 +20,13 @@
#pragma once
#include <cstdint>
#include <vector>
#include <Core/Math.h>
#include "GLProgramAttribute.h"
#include "GLProgramUniform.h"
#include "IGLSpriteRenderer.h"
#include <cstdint>
#include <vector>
namespace spades {
namespace draw {

View File

@ -20,10 +20,11 @@
#pragma once
#include "IGLDevice.h"
#include <vector>
#include <cstdint>
#include "IGLDevice.h"
namespace spades {
namespace client {
class GameMap;

View File

@ -18,6 +18,8 @@
*/
#include <algorithm>
#include "SWFlatMapRenderer.h"
#include "SWImage.h"
#include "SWMapRenderer.h"
@ -25,7 +27,6 @@
#include <Client/GameMap.h>
#include <Core/Debug.h>
#include <Core/Exception.h>
#include <algorithm>
namespace spades {
namespace draw {

View File

@ -21,6 +21,11 @@
#include <algorithm> //std::sort
#include <memory>
#if !defined(__APPLE__) && __unix
#include <sys/stat.h>
#include <sys/types.h>
#endif
#include <Imports/SDL.h>
#include <zlib.h>
@ -50,11 +55,6 @@
#include <Core/Bitmap.h>
#include <Core/MemoryStream.h>
#if !defined(__APPLE__) && __unix
#include <sys/stat.h>
#include <sys/types.h>
#endif
#if _MSC_VER >= 1900 // Visual Studio 2015 or higher
extern "C" {
FILE __iob_func[3] = {*stdin, *stdout, *stderr};

View File

@ -18,12 +18,13 @@
*/
#include <Imports/OpenGL.h>
#include <Imports/SDL.h>
#include "SDLGLDevice.h"
#include <Core/Debug.h>
#include <Core/Exception.h>
#include <Core/Settings.h>
#include <Imports/OpenGL.h>
#include <Imports/SDL.h>
using namespace spades::draw;

View File

@ -20,10 +20,11 @@
#pragma once
#include <Draw/IGLDevice.h>
#include <Imports/OpenGL.h>
#include <Imports/SDL.h>
#include <Draw/IGLDevice.h>
namespace spades {
namespace gui {
class SDLGLDevice : public draw::IGLDevice {

View File

@ -18,13 +18,13 @@
*/
#include "SDLGLDevice.h"
#include <cctype>
#include <cstring>
#include <memory>
#include "SDLRunner.h"
#include "SDLGLDevice.h"
#include <Audio/ALDevice.h>
#include <Audio/NullDevice.h>
#include <Audio/YsrDevice.h>

View File

@ -22,9 +22,10 @@
#include <string>
#include <Imports/SDL.h>
#include <Core/IRunnable.h>
#include <Core/ServerAddress.h>
#include <Imports/SDL.h>
namespace spades {
namespace client {

View File

@ -19,6 +19,7 @@
*/
#include "StartupScreen.h"
#include "StartupScreenHelper.h"
#include <Audio/NullDevice.h>
#include <Client/Client.h>

View File

@ -26,6 +26,7 @@
#include <Imports/SDL.h>
#include "StartupScreenHelper.h"
#include "StartupScreen.h"
#include <Audio/ALDevice.h>
#include <Audio/YsrDevice.h>

View File

@ -29,6 +29,8 @@
#include <Core/RefCountedObject.h>
#include <ScriptBindings/ScriptManager.h>
// scriptarray.h must be included after ScriptManager.h or it won't be able to
// find angelscript.h
#include <AngelScript/addons/scriptarray.h>
namespace spades {