Fix xcode warning that cause `getEngine` inline expansion

This commit is contained in:
gin0606 2014-08-12 12:46:14 +09:00
parent 89cf0c1e8c
commit 17aa2833db
6 changed files with 42 additions and 5 deletions

View File

@ -568,7 +568,9 @@
1AD71EF6180E27CF00808F54 /* CCPhysicsSprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD71EEF180E27CF00808F54 /* CCPhysicsSprite.h */; };
1AD71EF7180E27CF00808F54 /* CCPhysicsSprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AD71EEF180E27CF00808F54 /* CCPhysicsSprite.h */; };
1F36C031BE016A88AB195F1B /* ccRandom.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F36C53D12BFE7AD4C769D4D /* ccRandom.h */; };
1F36C5262E265FD5FFEA0D04 /* ccRandom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1F36CB4D61681865AFA7E8DC /* ccRandom.cpp */; };
1F36C5F58B5642071337D8E2 /* ccRandom.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F36C53D12BFE7AD4C769D4D /* ccRandom.h */; };
1F36CBBF38533B59D96661B1 /* ccRandom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1F36CB4D61681865AFA7E8DC /* ccRandom.cpp */; };
2958244B19873D8E00F9746D /* UIScale9Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2958244919873D8E00F9746D /* UIScale9Sprite.cpp */; };
2958244C19873D8E00F9746D /* UIScale9Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2958244919873D8E00F9746D /* UIScale9Sprite.cpp */; };
2958244D19873D8E00F9746D /* UIScale9Sprite.h in Headers */ = {isa = PBXBuildFile; fileRef = 2958244A19873D8E00F9746D /* UIScale9Sprite.h */; };
@ -2396,6 +2398,7 @@
1AD71EEE180E27CF00808F54 /* CCPhysicsSprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCPhysicsSprite.cpp; sourceTree = "<group>"; };
1AD71EEF180E27CF00808F54 /* CCPhysicsSprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCPhysicsSprite.h; sourceTree = "<group>"; };
1F36C53D12BFE7AD4C769D4D /* ccRandom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ccRandom.h; path = ../base/ccRandom.h; sourceTree = "<group>"; };
1F36CB4D61681865AFA7E8DC /* ccRandom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ccRandom.cpp; path = ../base/ccRandom.cpp; sourceTree = "<group>"; };
2905F9E918CF08D000240AA3 /* CocosGUI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CocosGUI.cpp; sourceTree = "<group>"; };
2905F9EA18CF08D000240AA3 /* CocosGUI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocosGUI.h; sourceTree = "<group>"; };
2905F9EB18CF08D000240AA3 /* GUIDefine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDefine.h; sourceTree = "<group>"; };
@ -3506,6 +3509,7 @@
50ABBE1C1925AB6F00A911A9 /* utlist.h */,
50ABBE1D1925AB6F00A911A9 /* ZipUtils.cpp */,
50ABBE1E1925AB6F00A911A9 /* ZipUtils.h */,
1F36CB4D61681865AFA7E8DC /* ccRandom.cpp */,
);
name = base;
path = ../cocos/2d;
@ -6912,6 +6916,7 @@
B6ACD897193D6693005E0B8A /* CCMeshSkin.cpp in Sources */,
B6ACD89E193DC0CC005E0B8A /* CCAnimate3D.cpp in Sources */,
B6AAF84119404E0D0069DE01 /* CCBundle3D.cpp in Sources */,
1F36CBBF38533B59D96661B1 /* ccRandom.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -7244,6 +7249,7 @@
B6ACD898193D6693005E0B8A /* CCMeshSkin.cpp in Sources */,
B6ACD89F193DC0CC005E0B8A /* CCAnimate3D.cpp in Sources */,
B6AAF84219404E0D0069DE01 /* CCBundle3D.cpp in Sources */,
1F36C5262E265FD5FFEA0D04 /* ccRandom.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -128,6 +128,7 @@ base/CCEventTouch.cpp \
base/CCIMEDispatcher.cpp \
base/CCNS.cpp \
base/CCProfiling.cpp \
base/ccRandom.cpp \
base/CCRef.cpp \
base/CCScheduler.cpp \
base/CCScriptSupport.cpp \

View File

@ -23,6 +23,7 @@ set(COCOS_BASE_SRC
base/CCIMEDispatcher.cpp
base/CCNS.cpp
base/CCProfiling.cpp
base/ccRandom.cpp
base/CCRef.cpp
base/CCScheduler.cpp
base/CCScriptSupport.cpp

32
cocos/base/ccRandom.cpp Normal file
View File

@ -0,0 +1,32 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) 2013-2014 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "ccRandom.h"
std::mt19937 &cocos2d::RandomHelper::getEngine() {
static std::random_device seed_gen;
static std::mt19937 engine(seed_gen());
return engine;
}

View File

@ -48,11 +48,7 @@ public:
return dist(mt);
}
private:
static std::mt19937 &getEngine() {
static std::random_device seed_gen;
static std::mt19937 engine(seed_gen());
return engine;
}
static std::mt19937 &getEngine();
};
/**

View File

@ -344,6 +344,7 @@
"cocos/base/CCProfiling.cpp",
"cocos/base/CCProfiling.h",
"cocos/base/CCProtocols.h",
"cocos/base/ccRandom.cpp",
"cocos/base/ccRandom.h",
"cocos/base/CCRef.cpp",
"cocos/base/CCRef.h",