forked from 0ad/0ad
Misc. unity fixes (missing includes, undefs, and other things that could be considered generic cleanup)
This was SVN commit r7328.
This commit is contained in:
parent
4d891117c5
commit
5bb14c7a59
@ -404,6 +404,8 @@ PSRETURN GUI<T>::SetSetting(IGUIObject *pObject, const CStr& Setting,
|
||||
template PSRETURN GUI<T>::SetSetting(IGUIObject *pObject, const CStr& Setting, const T &Value, const bool& SkipMessage);
|
||||
#define GUITYPE_IGNORE_CGUISpriteInstance
|
||||
#include "GUItypes.h"
|
||||
#undef GUITYPE_IGNORE_CGUISpriteInstance
|
||||
#undef TYPE
|
||||
|
||||
// Don't instantiate GetSetting<CGUISpriteInstance> - this will cause linker errors if
|
||||
// you attempt to retrieve a sprite using GetSetting, since that copies the sprite
|
||||
|
@ -1381,7 +1381,7 @@ LibError snd_free(Handle& hvs)
|
||||
//
|
||||
// don't use list, to avoid lots of allocs (expect thousands of VSrcs).
|
||||
typedef std::deque<VSrc*> VSrcs;
|
||||
typedef VSrcs::iterator It;
|
||||
typedef VSrcs::iterator VSrcIt;
|
||||
static VSrcs vsrcs;
|
||||
|
||||
// don't need to sort now - caller will list_sort() during update.
|
||||
@ -1400,14 +1400,14 @@ static void list_add(VSrc* vs)
|
||||
*/
|
||||
static void list_foreach(void (*cb)(VSrc*), size_t skip = 0, size_t end_idx = 0)
|
||||
{
|
||||
It begin = vsrcs.begin() + skip;
|
||||
It end = vsrcs.end();
|
||||
VSrcIt begin = vsrcs.begin() + skip;
|
||||
VSrcIt end = vsrcs.end();
|
||||
if(end_idx)
|
||||
end = vsrcs.begin()+end_idx;
|
||||
|
||||
// can't use std::for_each: some entries may have been deleted
|
||||
// (i.e. set to 0) since last update.
|
||||
for(It it = begin; it != end; ++it)
|
||||
for(VSrcIt it = begin; it != end; ++it)
|
||||
{
|
||||
VSrc* vs = *it;
|
||||
if(vs)
|
||||
@ -1467,7 +1467,7 @@ static bool is_null(VSrc* vs)
|
||||
*/
|
||||
static void list_prune_removed()
|
||||
{
|
||||
It new_end = remove_if(vsrcs.begin(), vsrcs.end(), is_null);
|
||||
VSrcIt new_end = remove_if(vsrcs.begin(), vsrcs.end(), is_null);
|
||||
vsrcs.erase(new_end, vsrcs.end());
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,9 @@ ERROR_ASSOCIATE(ERR::STRING_NOT_TERMINATED, L"Invalid string (no 0 terminator fo
|
||||
// this source file implements generic versions and bridges the differences
|
||||
// with these macros. wsecure_crt.cpp #defines WSECURE_CRT and
|
||||
// includes this file.
|
||||
|
||||
// Note: These defines are all #undef:ed at the end of the file - remember to
|
||||
// add a corresponding #undef when adding a #define.
|
||||
#ifdef WSECURE_CRT
|
||||
# define tchar wchar_t
|
||||
# define T(string_literal) L ## string_literal
|
||||
@ -282,3 +285,16 @@ errno_t fopen_s(FILE** pfile, const char* filename, const char* mode)
|
||||
#endif
|
||||
|
||||
#endif // #if EMULATE_SECURE_CRT
|
||||
|
||||
#undef tchar
|
||||
#undef T
|
||||
#undef tnlen
|
||||
#undef tncpy_s
|
||||
#undef tcpy_s
|
||||
#undef tncat_s
|
||||
#undef tcat_s
|
||||
#undef tcmp
|
||||
#undef tcpy
|
||||
#undef tvsnprintf
|
||||
#undef tvsprintf_s
|
||||
#undef tsprintf_s
|
||||
|
@ -328,6 +328,7 @@ const AcpiTable* acpi_GetTable(const char* signature)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#define initState acpiInitState
|
||||
static ModuleInitState initState;
|
||||
|
||||
bool acpi_Init()
|
||||
@ -361,3 +362,4 @@ void acpi_Shutdown()
|
||||
|
||||
mahaf_Shutdown();
|
||||
}
|
||||
#undef initState
|
||||
|
@ -32,16 +32,20 @@
|
||||
|
||||
#if HAVE_X
|
||||
|
||||
#include "lib/debug.h"
|
||||
#include "lib/sysdep/gfx.h"
|
||||
|
||||
#define Cursor X__Cursor
|
||||
|
||||
#include <Xlib.h>
|
||||
#include <stdlib.h>
|
||||
#include <Xatom.h>
|
||||
|
||||
#include "lib/debug.h"
|
||||
#include "lib/sysdep/gfx.h"
|
||||
#include "SDL/SDL.h"
|
||||
#include "SDL/SDL_syswm.h"
|
||||
|
||||
#include <algorithm>
|
||||
#undef Cursor
|
||||
|
||||
static Display *SDL_Display;
|
||||
static Window SDL_Window;
|
||||
|
@ -136,7 +136,7 @@ struct TexCodecVTbl
|
||||
* usage: at file scope within the source file containing the codec's methods.
|
||||
**/
|
||||
#define TEX_CODEC_REGISTER(name)\
|
||||
static TexCodecVTbl vtbl = \
|
||||
static TexCodecVTbl UID__ = \
|
||||
{\
|
||||
name##_decode, name##_encode, name##_transform,\
|
||||
name##_is_hdr, name##_is_ext, name##_hdr_size,\
|
||||
@ -147,7 +147,7 @@ struct TexCodecVTbl
|
||||
/* will not run! as a workaround, we build an externally visible */\
|
||||
/* registration function that must be called via */\
|
||||
/* tex_codec_register_all - see comments there. */\
|
||||
void name##_register() { tex_codec_register(&vtbl); }
|
||||
void name##_register() { tex_codec_register(&UID__); }
|
||||
|
||||
|
||||
/**
|
||||
|
@ -26,3 +26,4 @@
|
||||
|
||||
#define WSECURE_CRT
|
||||
#include "secure_crt.cpp"
|
||||
#undef WSECURE_CRT
|
||||
|
@ -69,6 +69,7 @@
|
||||
|
||||
#include "scripting/ScriptableComplex.inl"
|
||||
#include "scripting/ScriptingHost.h"
|
||||
#include "scripting/ScriptGlue.h"
|
||||
#include "scripting/DOMEvent.h"
|
||||
#include "scripting/GameEvents.h"
|
||||
#include "scripting/ScriptableComplex.h"
|
||||
|
@ -42,22 +42,6 @@ struct SHotkeyMapping
|
||||
|
||||
typedef std::vector<SHotkeyMapping> KeyMapping;
|
||||
|
||||
enum {
|
||||
// 'Keycodes' for the mouse buttons
|
||||
MOUSE_LEFT = SDLK_LAST + SDL_BUTTON_LEFT,
|
||||
MOUSE_RIGHT = SDLK_LAST + SDL_BUTTON_RIGHT,
|
||||
MOUSE_MIDDLE = SDLK_LAST + SDL_BUTTON_MIDDLE,
|
||||
MOUSE_WHEELUP = SDLK_LAST + SDL_BUTTON_WHEELUP,
|
||||
MOUSE_WHEELDOWN = SDLK_LAST + SDL_BUTTON_WHEELDOWN,
|
||||
|
||||
// 'Keycodes' for the unified modifier keys
|
||||
UNIFIED_SHIFT,
|
||||
UNIFIED_CTRL,
|
||||
UNIFIED_ALT,
|
||||
UNIFIED_META,
|
||||
UNIFIED_SUPER
|
||||
};
|
||||
|
||||
/**
|
||||
* HK_MAX_KEYCODES: Global maximum number of keycodes, including our "fake" keycodes for
|
||||
* mouse buttons and unified modifiers.
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "ps/Player.h"
|
||||
#include "ps/Filesystem.h"
|
||||
#include "ps/World.h"
|
||||
#include "ps/GameSetup/Config.h"
|
||||
#include "renderer/Renderer.h"
|
||||
#include "scripting/GameEvents.h"
|
||||
#include "scripting/ScriptableComplex.inl"
|
||||
@ -57,9 +58,6 @@
|
||||
#include "ps/CLogger.h"
|
||||
#define LOG_CATEGORY L"world"
|
||||
|
||||
extern CStrW g_CursorName;
|
||||
extern float g_xres, g_yres;
|
||||
|
||||
static const double SELECT_DBLCLICK_RATE = 0.5;
|
||||
const int ORDER_DELAY = 5;
|
||||
|
||||
|
@ -18,10 +18,13 @@
|
||||
// Ooh, a file of keynames. Fun.
|
||||
|
||||
#include "precompiled.h"
|
||||
#include <map>
|
||||
|
||||
#include "KeyName.h"
|
||||
#include "CStr.h"
|
||||
#include "lib/external_libraries/sdl.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
static std::map<CStr,int> keymap;
|
||||
|
||||
struct SKeycodeMapping
|
||||
@ -31,20 +34,6 @@ struct SKeycodeMapping
|
||||
const char* altkeyname;
|
||||
};
|
||||
|
||||
// 'Keycodes' for the mouse buttons
|
||||
const int MOUSE_LEFT = SDLK_LAST + SDL_BUTTON_LEFT;
|
||||
const int MOUSE_RIGHT = SDLK_LAST + SDL_BUTTON_RIGHT;
|
||||
const int MOUSE_MIDDLE = SDLK_LAST + SDL_BUTTON_MIDDLE;
|
||||
const int MOUSE_WHEELUP = SDLK_LAST + SDL_BUTTON_WHEELUP;
|
||||
const int MOUSE_WHEELDOWN = SDLK_LAST + SDL_BUTTON_WHEELDOWN;
|
||||
|
||||
// 'Keycodes' for the unified modifier keys
|
||||
const int UNIFIED_SHIFT = MOUSE_WHEELDOWN + 1;
|
||||
const int UNIFIED_CTRL = MOUSE_WHEELDOWN + 2;
|
||||
const int UNIFIED_ALT = MOUSE_WHEELDOWN + 3;
|
||||
const int UNIFIED_META = MOUSE_WHEELDOWN + 4;
|
||||
const int UNIFIED_SUPER = MOUSE_WHEELDOWN + 5;
|
||||
|
||||
// You can use either key name in the config file...
|
||||
|
||||
static SKeycodeMapping keycodeMapping[] =
|
||||
|
@ -18,8 +18,27 @@
|
||||
#ifndef INCLUDED_KEYNAME
|
||||
#define INCLUDED_KEYNAME
|
||||
|
||||
// Need SDLK_* enum values.
|
||||
#include "lib/external_libraries/sdl.h"
|
||||
|
||||
extern void InitKeyNameMap();
|
||||
extern CStr FindKeyName( int keycode );
|
||||
extern int FindKeyCode( const CStr& keyname );
|
||||
|
||||
enum {
|
||||
// 'Keycodes' for the mouse buttons
|
||||
MOUSE_LEFT = SDLK_LAST + SDL_BUTTON_LEFT,
|
||||
MOUSE_RIGHT = SDLK_LAST + SDL_BUTTON_RIGHT,
|
||||
MOUSE_MIDDLE = SDLK_LAST + SDL_BUTTON_MIDDLE,
|
||||
MOUSE_WHEELUP = SDLK_LAST + SDL_BUTTON_WHEELUP,
|
||||
MOUSE_WHEELDOWN = SDLK_LAST + SDL_BUTTON_WHEELDOWN,
|
||||
|
||||
// 'Keycodes' for the unified modifier keys
|
||||
UNIFIED_SHIFT,
|
||||
UNIFIED_CTRL,
|
||||
UNIFIED_ALT,
|
||||
UNIFIED_META,
|
||||
UNIFIED_SUPER
|
||||
};
|
||||
|
||||
#endif // #ifndef INCLUDED_KEYNAME
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "ps/Util.h"
|
||||
|
||||
#include "lib/posix/posix_utsname.h"
|
||||
#include "lib/posix/posix_sock.h"
|
||||
#include "lib/ogl.h"
|
||||
|
@ -178,6 +178,9 @@ CMessage* CMessageFromJSVal(int mtid, ScriptInterface& scriptingInterface, jsval
|
||||
#define INTERFACE(name)
|
||||
#define COMPONENT(name)
|
||||
#include "simulation2/TypeList.h"
|
||||
#undef COMPONENT
|
||||
#undef INTERFACE
|
||||
#undef MESSAGE
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -18,6 +18,8 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
#include "Messages.h"
|
||||
#include "Handlers/MessageHandler.h"
|
||||
#include "CommandProc.h"
|
||||
|
||||
// We want to include Messages.h again below, with some different definitions,
|
||||
// so cheat and undefine its include-guard
|
||||
@ -35,17 +37,6 @@
|
||||
namespace AtlasMessage
|
||||
{
|
||||
|
||||
struct IMessage;
|
||||
|
||||
typedef void (*msgHandler)(IMessage*);
|
||||
typedef std::map<std::string, msgHandler> msgHandlers;
|
||||
extern msgHandlers& GetMsgHandlers();
|
||||
|
||||
struct Command;
|
||||
typedef Command* (*cmdHandler)(const void*);
|
||||
typedef std::map<std::string, cmdHandler> cmdHandlers;
|
||||
extern cmdHandlers& GetCmdHandlers();
|
||||
|
||||
#define MESSAGE(name, vals) \
|
||||
extern void f##name##_wrapper(AtlasMessage::IMessage*); \
|
||||
AtlasMessage::GetMsgHandlers().insert(std::pair<std::string, AtlasMessage::msgHandler>(#name, &f##name##_wrapper));
|
||||
|
Loading…
Reference in New Issue
Block a user