Replace typedef
by using
.
This commit is contained in:
parent
c7c66dfcfd
commit
77e3f63bb8
23 changed files with 50 additions and 52 deletions
|
@ -120,7 +120,7 @@ static int CompareGr(int a, int b) { return a > b; }
|
|||
static int CompareLeEq(int a, int b) { return a <= b; }
|
||||
static int CompareLe(int a, int b) { return a < b; }
|
||||
|
||||
typedef int (*CompareFunction)(int, int);
|
||||
using CompareFunction = int (*)(int, int);
|
||||
|
||||
/**
|
||||
** Returns a function pointer to the comparison function
|
||||
|
|
|
@ -166,7 +166,7 @@ public:
|
|||
bool Instant; /// true to ignore TimeCost
|
||||
};
|
||||
|
||||
typedef COrder *COrderPtr;
|
||||
using COrderPtr = COrder *;
|
||||
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
|
|
@ -44,7 +44,7 @@ public:
|
|||
virtual void Init(const char *s, lua_State *l);
|
||||
|
||||
private:
|
||||
typedef bool BinOpFunc(int lhs, int rhs);
|
||||
using BinOpFunc = bool (int lhs, int rhs);
|
||||
|
||||
private:
|
||||
std::string leftVar;
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
#include <stdint.h>
|
||||
|
||||
typedef uint32_t IntColor; // Uint32 in SDL
|
||||
using IntColor = uint32_t; // Uint32 in SDL
|
||||
|
||||
struct SDL_Color;
|
||||
struct lua_State;
|
||||
|
|
|
@ -126,7 +126,7 @@ extern void CommandSharedVision(int player, bool state, int opponent);
|
|||
/**
|
||||
** Unit references over network, or for memory saving.
|
||||
*/
|
||||
typedef unsigned short UnitRef;
|
||||
using UnitRef = unsigned short;
|
||||
|
||||
/// Send stop command
|
||||
extern void SendCommandStopUnit(CUnit &unit);
|
||||
|
|
|
@ -82,7 +82,7 @@ enum ButtonCmd {
|
|||
};
|
||||
|
||||
class ButtonAction;
|
||||
typedef bool (*ButtonCheckFunc)(const CUnit &, const ButtonAction &);
|
||||
using ButtonCheckFunc = bool (*)(const CUnit &, const ButtonAction &);
|
||||
|
||||
/// Action of button
|
||||
class ButtonAction
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <utility>
|
||||
#include <variant>
|
||||
|
||||
typedef int lua_Object; // from tolua++.h
|
||||
using lua_Object = int; // from tolua++.h
|
||||
struct lua_State;
|
||||
|
||||
class LuaCallback
|
||||
|
|
|
@ -300,7 +300,7 @@ extern int ReplayRevealMap;
|
|||
// in map_fog.c
|
||||
//
|
||||
/// Function to (un)mark the vision table.
|
||||
typedef void MapMarkerFunc(const CPlayer &player, const unsigned int index);
|
||||
using MapMarkerFunc = void(const CPlayer &player, const unsigned int index);
|
||||
|
||||
/// Filter map flags through fog
|
||||
extern int MapFogFilterFlags(CPlayer &player, const Vec2i &pos, int mask);
|
||||
|
@ -383,7 +383,7 @@ extern bool UnitCanBeAt(const CUnit &unit, const Vec2i &pos);
|
|||
extern void PreprocessMap();
|
||||
|
||||
// in unit.c
|
||||
//typedef void MapClearField(const Vec2i &tilePos);
|
||||
//using MapClearField = void(const Vec2i &tilePos);
|
||||
|
||||
/// Mark on vision table the Sight of the unit.
|
||||
void MapMarkUnitSight(CUnit &unit);
|
||||
|
|
|
@ -73,9 +73,9 @@
|
|||
(int)(((ad) >> 8) & 0xff), (int)((ad) & 0xff)
|
||||
|
||||
#ifdef USE_WINSOCK
|
||||
typedef SOCKET Socket;
|
||||
using Socket = SOCKET;
|
||||
#else
|
||||
typedef int Socket;
|
||||
using Socket = int;
|
||||
#endif
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
|
|
@ -140,7 +140,7 @@ enum VisitResult {
|
|||
class TerrainTraversal
|
||||
{
|
||||
public:
|
||||
typedef short int dataType;
|
||||
using dataType = short int;
|
||||
public:
|
||||
void SetSize(unsigned int width, unsigned int height);
|
||||
void Init();
|
||||
|
|
|
@ -73,7 +73,7 @@ class PathFinderData;
|
|||
class SpellType;
|
||||
struct lua_State;
|
||||
|
||||
typedef COrder *COrderPtr;
|
||||
using COrderPtr = COrder *;
|
||||
|
||||
/*
|
||||
** Configuration of the small (unit) AI.
|
||||
|
|
|
@ -50,8 +50,8 @@ class CMap;
|
|||
class CUnitCache
|
||||
{
|
||||
public:
|
||||
typedef std::vector<CUnit *>::iterator iterator;
|
||||
typedef std::vector<CUnit *>::const_iterator const_iterator;
|
||||
using iterator = std::vector<CUnit *>::iterator;
|
||||
using const_iterator = std::vector<CUnit *>::const_iterator;
|
||||
|
||||
public:
|
||||
CUnitCache() : Units() {}
|
||||
|
|
|
@ -50,7 +50,7 @@ struct lua_State;
|
|||
class CUnitManager
|
||||
{
|
||||
public:
|
||||
typedef std::vector<CUnit *>::iterator Iterator;
|
||||
using Iterator = std::vector<CUnit *>::iterator;
|
||||
public:
|
||||
CUnitManager();
|
||||
void Init();
|
||||
|
|
|
@ -93,7 +93,7 @@ extern uint32_t fletcher32(const std::string &content);
|
|||
#endif
|
||||
|
||||
#ifndef HAVE_ERRNOT
|
||||
typedef int errno_t;
|
||||
using errno_t = int;
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_STRCPYS
|
||||
|
|
|
@ -159,11 +159,11 @@ inline int Distance(const Vec2T<T> &pos1, const Vec2T<T> &pos2)
|
|||
return isqrt(SquareDistance(pos1, pos2));
|
||||
}
|
||||
|
||||
typedef Vec2T<short int> Vec2i;
|
||||
typedef Vec2T<int> PixelPos;
|
||||
typedef Vec2T<int> PixelDiff;
|
||||
typedef Vec2T<int> PixelSize;
|
||||
typedef Vec2T<double> PixelPrecise;
|
||||
using Vec2i = Vec2T<short int>;
|
||||
using PixelPos = Vec2T<int>;
|
||||
using PixelDiff = Vec2T<int>;
|
||||
using PixelSize = Vec2T<int>;
|
||||
using PixelPrecise = Vec2T<double>;
|
||||
|
||||
//@}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ static std::vector<Missile *> GlobalMissiles; /// all global missiles on map
|
|||
static std::vector<Missile *> LocalMissiles; /// all local missiles on map
|
||||
|
||||
/// lookup table for missile names
|
||||
typedef std::map<std::string, MissileType *> MissileTypeMap;
|
||||
using MissileTypeMap = std::map<std::string, MissileType *>;
|
||||
static MissileTypeMap MissileTypes;
|
||||
|
||||
std::vector<BurningBuildingFrame *> BurningBuildingFrames; /// Burning building frames
|
||||
|
@ -576,11 +576,9 @@ static bool MissileDrawLevelCompare(const Missile *const l, const Missile *const
|
|||
*/
|
||||
void FindAndSortMissiles(const CViewport &vp, std::vector<Missile *> &table)
|
||||
{
|
||||
typedef std::vector<Missile *>::const_iterator MissilePtrConstiterator;
|
||||
|
||||
// Loop through global missiles, then through locals.
|
||||
for (MissilePtrConstiterator i = GlobalMissiles.begin(); i != GlobalMissiles.end(); ++i) {
|
||||
Missile &missile = *(*i);
|
||||
for (auto* missilePtr : GlobalMissiles) {
|
||||
Missile &missile = *missilePtr;
|
||||
if (missile.Delay || missile.Hidden) {
|
||||
continue; // delayed or hidden -> aren't shown
|
||||
}
|
||||
|
@ -590,8 +588,8 @@ void FindAndSortMissiles(const CViewport &vp, std::vector<Missile *> &table)
|
|||
}
|
||||
}
|
||||
|
||||
for (MissilePtrConstiterator i = LocalMissiles.begin(); i != LocalMissiles.end(); ++i) {
|
||||
Missile &missile = *(*i);
|
||||
for (auto* missilePtr : LocalMissiles) {
|
||||
Missile &missile = *missilePtr;
|
||||
if (missile.Delay || missile.Hidden) {
|
||||
continue; // delayed or hidden -> aren't shown
|
||||
}
|
||||
|
|
|
@ -53,18 +53,18 @@
|
|||
#include <Iphlpapi.h>
|
||||
#pragma comment(lib, "Iphlpapi.lib")
|
||||
|
||||
typedef const char *setsockopttype;
|
||||
typedef char *recvfrombuftype;
|
||||
typedef char *recvbuftype;
|
||||
typedef const char *sendtobuftype;
|
||||
typedef const char *sendbuftype;
|
||||
typedef int socklen_t;
|
||||
using setsockopttype = const char *;
|
||||
using recvfrombuftype = char *;
|
||||
using recvbuftype = char *;
|
||||
using sendtobuftype = const char *;
|
||||
using sendbuftype = const char *;
|
||||
using socklen_t = int;
|
||||
#else
|
||||
typedef const void *setsockopttype;
|
||||
typedef void *recvfrombuftype;
|
||||
typedef void *recvbuftype;
|
||||
typedef const void *sendtobuftype;
|
||||
typedef const void *sendbuftype;
|
||||
using setsockopttype = const void *;
|
||||
using recvfrombuftype = void *;
|
||||
using recvbuftype = void *;
|
||||
using sendtobuftype = const void *;
|
||||
using sendbuftype = const void *;
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -85,10 +85,10 @@ namespace pvpgn
|
|||
return temp;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
enum t_hash_variant{
|
||||
do_blizzard_hash,
|
||||
do_sha1_hash
|
||||
} t_hash_variant;
|
||||
};
|
||||
|
||||
static void hash_init(t_hash * hash);
|
||||
static void do_hash(t_hash * hash, std::uint32_t * tmp);
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
-- Variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
typedef std::map<std::string, std::string> EntriesType;
|
||||
using EntriesType = std::map<std::string, std::string>;
|
||||
static EntriesType Entries;
|
||||
|
||||
/*----------------------------------------------------------------------------
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
-- Variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
typedef std::map<std::string, CIcon *> IconMap;
|
||||
using IconMap = std::map<std::string, CIcon *>;
|
||||
static IconMap Icons; /// Map of ident to icon.
|
||||
|
||||
|
||||
|
|
|
@ -47,10 +47,10 @@
|
|||
-- Variables
|
||||
----------------------------------------------------------------------------*/
|
||||
|
||||
typedef std::map<std::string, CFont *> FontMap;
|
||||
using FontMap = std::map<std::string, CFont *>;
|
||||
static FontMap Fonts; /// Font mappings
|
||||
|
||||
typedef std::map<std::string, CFontColor *> FontColorMap;
|
||||
using FontColorMap = std::map<std::string, CFontColor *>;
|
||||
static FontColorMap FontColors; /// Map of ident to font color.
|
||||
|
||||
static CFontColor *FontColor; /// Current font color
|
||||
|
@ -65,7 +65,7 @@ static std::string DefaultReverseColorIndex; /// Default reverse color index
|
|||
** Font color graphics
|
||||
** Usage: FontColorGraphics[CFont *font][CFontColor *color]
|
||||
*/
|
||||
typedef std::map<const CFontColor *, CGraphic *> FontColorGraphicMap;
|
||||
using FontColorGraphicMap = std::map<const CFontColor *, CGraphic *>;
|
||||
static std::map<const CFont *, FontColorGraphicMap> FontColorGraphics;
|
||||
|
||||
// FIXME: remove these
|
||||
|
|
|
@ -874,9 +874,9 @@ class CRenderer : public CPrimitives
|
|||
|
||||
};
|
||||
|
||||
typedef CRenderer<2, 0xfbde> Primitive16_555_t;
|
||||
typedef CRenderer<2, 0xf7de> Primitive16_565_t;
|
||||
typedef CRenderer<4, 0> Primitive32_t;
|
||||
using Primitive16_555_t = CRenderer<2, 0xfbde>;
|
||||
using Primitive16_565_t = CRenderer<2, 0xf7de>;
|
||||
using Primitive32_t = CRenderer<4, 0>;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -281,11 +281,11 @@ static void InitKey2Str()
|
|||
}
|
||||
|
||||
#ifdef USE_WIN32
|
||||
typedef enum PROCESS_DPI_AWARENESS {
|
||||
enum PROCESS_DPI_AWARENESS {
|
||||
PROCESS_DPI_UNAWARE = 0,
|
||||
PROCESS_SYSTEM_DPI_AWARE = 1,
|
||||
PROCESS_PER_MONITOR_DPI_AWARE = 2
|
||||
} PROCESS_DPI_AWARENESS;
|
||||
};
|
||||
|
||||
static void setDpiAware() {
|
||||
void* userDLL;
|
||||
|
|
Loading…
Reference in a new issue