mirror of https://github.com/axmolengine/axmol.git
Warning fixes: 1) getZOrder —> getLocalZOrder. 2) long —> int
This commit is contained in:
parent
0468a1234b
commit
9f793f8a9b
|
@ -252,7 +252,7 @@ void ClippingNode::visit()
|
|||
{
|
||||
auto node = _children.at(i);
|
||||
|
||||
if ( node && node->getZOrder() < 0 )
|
||||
if ( node && node->getLocalZOrder() < 0 )
|
||||
node->visit();
|
||||
else
|
||||
break;
|
||||
|
|
|
@ -206,7 +206,7 @@ void EventDispatcher::visitTarget(Node* node)
|
|||
{
|
||||
child = children.at(i);
|
||||
|
||||
if ( child && child->getZOrder() < 0 )
|
||||
if ( child && child->getLocalZOrder() < 0 )
|
||||
visitTarget(child);
|
||||
else
|
||||
break;
|
||||
|
|
|
@ -72,8 +72,8 @@ bool nodeComparisonLess(const RCPtr<Object>& pp1, const RCPtr<Object>& pp2)
|
|||
Node *n1 = static_cast<Node*>(p1);
|
||||
Node *n2 = static_cast<Node*>(p2);
|
||||
|
||||
return( n1->getZOrder() < n2->getZOrder() ||
|
||||
( n1->getZOrder() == n2->getZOrder() && n1->getOrderOfArrival() < n2->getOrderOfArrival() )
|
||||
return( n1->getLocalZOrder() < n2->getLocalZOrder() ||
|
||||
( n1->getLocalZOrder() == n2->getLocalZOrder() && n1->getOrderOfArrival() < n2->getOrderOfArrival() )
|
||||
);
|
||||
}
|
||||
#else
|
||||
|
@ -82,8 +82,8 @@ bool nodeComparisonLess(Object* p1, Object* p2)
|
|||
Node *n1 = static_cast<Node*>(p1);
|
||||
Node *n2 = static_cast<Node*>(p2);
|
||||
|
||||
return( n1->getZOrder() < n2->getZOrder() ||
|
||||
( n1->getZOrder() == n2->getZOrder() && n1->getOrderOfArrival() < n2->getOrderOfArrival() )
|
||||
return( n1->getLocalZOrder() < n2->getLocalZOrder() ||
|
||||
( n1->getLocalZOrder() == n2->getLocalZOrder() && n1->getOrderOfArrival() < n2->getOrderOfArrival() )
|
||||
);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -125,7 +125,7 @@ void NodeGrid::visit()
|
|||
{
|
||||
auto node = _children.at(i);
|
||||
|
||||
if ( node && node->getZOrder() < 0 )
|
||||
if ( node && node->getLocalZOrder() < 0 )
|
||||
node->visit();
|
||||
else
|
||||
break;
|
||||
|
|
|
@ -218,7 +218,7 @@ void ParticleBatchNode::reorderChild(Node * aChild, int zOrder)
|
|||
|
||||
ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
|
||||
|
||||
if( zOrder == child->getZOrder() )
|
||||
if( zOrder == child->getLocalZOrder() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -280,7 +280,7 @@ void ParticleBatchNode::getCurrentIndex(int* oldIndex, int* newIndex, Node* chil
|
|||
Node* pNode = _children.at(i);
|
||||
|
||||
// new index
|
||||
if( pNode->getZOrder() > z && ! foundNewIdx )
|
||||
if( pNode->getLocalZOrder() > z && ! foundNewIdx )
|
||||
{
|
||||
*newIndex = i;
|
||||
foundNewIdx = true;
|
||||
|
@ -325,7 +325,7 @@ int ParticleBatchNode::searchNewPositionInChildrenForZ(int z)
|
|||
for( int i=0; i < count; i++ )
|
||||
{
|
||||
Node *child = _children.at(i);
|
||||
if (child->getZOrder() > z)
|
||||
if (child->getLocalZOrder() > z)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
|
|
|
@ -822,8 +822,8 @@ void Sprite::sortAllChildren()
|
|||
auto tempJ = static_cast<Node*>( _children->getObjectAtIndex(j) );
|
||||
|
||||
//continue moving element downwards while zOrder is smaller or when zOrder is the same but mutatedIndex is smaller
|
||||
while(j>=0 && ( tempI->getZOrder() < tempJ->getZOrder() ||
|
||||
( tempI->getZOrder() == tempJ->getZOrder() &&
|
||||
while(j>=0 && ( tempI->getLocalZOrder() < tempJ->getLocalZOrder() ||
|
||||
( tempI->getLocalZOrder() == tempJ->getLocalZOrder() &&
|
||||
tempI->getOrderOfArrival() < tempJ->getOrderOfArrival() ) ) )
|
||||
{
|
||||
_children->fastSetObject( tempJ, j+1 );
|
||||
|
|
|
@ -179,7 +179,7 @@ void SpriteBatchNode::reorderChild(Node *child, int zOrder)
|
|||
CCASSERT(child != nullptr, "the child should not be null");
|
||||
CCASSERT(_children.contains(child), "Child doesn't belong to Sprite");
|
||||
|
||||
if (zOrder == child->getZOrder())
|
||||
if (zOrder == child->getLocalZOrder())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -277,7 +277,7 @@ void SpriteBatchNode::updateAtlasIndex(Sprite* sprite, ssize_t* curIndex)
|
|||
{
|
||||
bool needNewIndex=true;
|
||||
|
||||
if (array.at(0)->getZOrder() >= 0)
|
||||
if (array.at(0)->getLocalZOrder() >= 0)
|
||||
{
|
||||
//all children are in front of the parent
|
||||
oldIndex = sprite->getAtlasIndex();
|
||||
|
@ -294,7 +294,7 @@ void SpriteBatchNode::updateAtlasIndex(Sprite* sprite, ssize_t* curIndex)
|
|||
|
||||
for(const auto &child: array) {
|
||||
Sprite* sp = static_cast<Sprite*>(child);
|
||||
if (needNewIndex && sp->getZOrder() >= 0)
|
||||
if (needNewIndex && sp->getLocalZOrder() >= 0)
|
||||
{
|
||||
oldIndex = sprite->getAtlasIndex();
|
||||
sprite->setAtlasIndex(*curIndex);
|
||||
|
@ -392,7 +392,7 @@ ssize_t SpriteBatchNode::rebuildIndexInOrder(Sprite *parent, ssize_t index)
|
|||
auto& children = parent->getChildren();
|
||||
for(const auto &child: children) {
|
||||
Sprite* sp = static_cast<Sprite*>(child);
|
||||
if (sp && (sp->getZOrder() < 0))
|
||||
if (sp && (sp->getLocalZOrder() < 0))
|
||||
{
|
||||
index = rebuildIndexInOrder(sp, index);
|
||||
}
|
||||
|
@ -407,7 +407,7 @@ ssize_t SpriteBatchNode::rebuildIndexInOrder(Sprite *parent, ssize_t index)
|
|||
|
||||
for(const auto &child: children) {
|
||||
Sprite* sp = static_cast<Sprite*>(child);
|
||||
if (sp && (sp->getZOrder() >= 0))
|
||||
if (sp && (sp->getLocalZOrder() >= 0))
|
||||
{
|
||||
index = rebuildIndexInOrder(sp, index);
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ ssize_t SpriteBatchNode::atlasIndexForChild(Sprite *sprite, int nZ)
|
|||
else
|
||||
{
|
||||
// previous & sprite belong to the same branch
|
||||
if ((prev->getZOrder() < 0 && nZ < 0) || (prev->getZOrder() >= 0 && nZ >= 0))
|
||||
if ((prev->getLocalZOrder() < 0 && nZ < 0) || (prev->getLocalZOrder() >= 0 && nZ >= 0))
|
||||
{
|
||||
return highestAtlasIndexInChild(prev) + 1;
|
||||
}
|
||||
|
|
|
@ -281,7 +281,7 @@ unsigned short* cc_utf8_to_utf16(const char* str_old, int length/* = -1 */, int*
|
|||
{
|
||||
long len = cc_utf8_strlen(str_old, length);
|
||||
if (rUtf16Size != nullptr) {
|
||||
*rUtf16Size = len;
|
||||
*rUtf16Size = static_cast<int>(len);
|
||||
}
|
||||
|
||||
unsigned short* str_new = new unsigned short[len + 1];
|
||||
|
|
|
@ -142,7 +142,7 @@ static int readTuple (const char* end, Str tuple[]) {
|
|||
}
|
||||
|
||||
static char* mallocString (Str* str) {
|
||||
int length = str->end - str->begin;
|
||||
long length = str->end - str->begin;
|
||||
char* string = MALLOC(char, length + 1);
|
||||
memcpy(string, str->begin, length);
|
||||
string[length] = '\0';
|
||||
|
@ -150,7 +150,7 @@ static char* mallocString (Str* str) {
|
|||
}
|
||||
|
||||
static int indexOf (const char** array, int count, Str* str) {
|
||||
int length = str->end - str->begin;
|
||||
long length = str->end - str->begin;
|
||||
int i;
|
||||
for (i = count - 1; i >= 0; i--)
|
||||
if (strncmp(array[i], str->begin, length) == 0) return i;
|
||||
|
@ -162,7 +162,7 @@ static int equals (Str* str, const char* other) {
|
|||
}
|
||||
|
||||
static int toInt (Str* str) {
|
||||
return strtol(str->begin, (char**)&str->end, 10);
|
||||
return static_cast<int>(strtol(str->begin, (char**)&str->end, 10));
|
||||
}
|
||||
|
||||
static spAtlas* abortAtlas (spAtlas* self) {
|
||||
|
@ -177,7 +177,7 @@ static const char* textureFilterNames[] = {"Nearest", "Linear", "MipMap", "MipMa
|
|||
spAtlas* spAtlas_readAtlas (const char* begin, int length, const char* dir) {
|
||||
int count;
|
||||
const char* end = begin + length;
|
||||
int dirLength = strlen(dir);
|
||||
size_t dirLength = strlen(dir);
|
||||
int needsSlash = dirLength > 0 && dir[dirLength - 1] != '/' && dir[dirLength - 1] != '\\';
|
||||
|
||||
spAtlas* self = NEW(spAtlas);
|
||||
|
@ -289,7 +289,7 @@ spAtlas* spAtlas_readAtlas (const char* begin, int length, const char* dir) {
|
|||
}
|
||||
|
||||
spAtlas* spAtlas_readAtlasFile (const char* path) {
|
||||
int dirLength;
|
||||
long dirLength;
|
||||
char *dir;
|
||||
int length;
|
||||
const char* data;
|
||||
|
|
|
@ -235,7 +235,7 @@ void Layout::stencilClippingVisit()
|
|||
{
|
||||
auto node = _children.at(i);
|
||||
|
||||
if ( node && node->getZOrder() < 0 )
|
||||
if ( node && node->getLocalZOrder() < 0 )
|
||||
node->visit();
|
||||
else
|
||||
break;
|
||||
|
|
|
@ -255,7 +255,7 @@ Widget* Widget::getChildByName(const char *name)
|
|||
|
||||
void Widget::addNode(Node* node)
|
||||
{
|
||||
addNode(node, node->getZOrder(), node->getTag());
|
||||
addNode(node, node->getLocalZOrder(), node->getTag());
|
||||
}
|
||||
|
||||
void Widget::addNode(Node * node, int zOrder)
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
****************************************************************************/
|
||||
|
||||
#include "WebSocket.h"
|
||||
#include "CCDirector.h"
|
||||
#include "CCScheduler.h"
|
||||
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
|
@ -521,7 +523,7 @@ int WebSocket::onSocketCallback(struct libwebsocket_context *ctx,
|
|||
|
||||
size_t remaining = data->len - data->issued;
|
||||
size_t n = std::min(remaining, c_bufferSize );
|
||||
CCLOG("[websocket:send] total: %d, sent: %d, remaining: %d, buffer size: %d", data->len, data->issued, remaining, n);
|
||||
CCLOG("[websocket:send] total: %d, sent: %d, remaining: %d, buffer size: %d", static_cast<int>(data->len), static_cast<int>(data->issued), static_cast<int>(remaining), static_cast<int>(n));
|
||||
|
||||
unsigned char* buf = new unsigned char[LWS_SEND_BUFFER_PRE_PADDING + n + LWS_SEND_BUFFER_POST_PADDING];
|
||||
|
||||
|
|
|
@ -30,8 +30,11 @@
|
|||
#ifndef __CC_WEBSOCKET_H__
|
||||
#define __CC_WEBSOCKET_H__
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "CCPlatformMacros.h"
|
||||
|
||||
#include <list>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
struct libwebsocket;
|
||||
struct libwebsocket_context;
|
||||
|
@ -153,8 +156,8 @@ private:
|
|||
unsigned int _port;
|
||||
std::string _path;
|
||||
|
||||
size_t _pendingFrameDataLen;
|
||||
unsigned int _currentDataLen;
|
||||
ssize_t _pendingFrameDataLen;
|
||||
ssize_t _currentDataLen;
|
||||
char *_currentData;
|
||||
|
||||
friend class WsThreadHelper;
|
||||
|
|
|
@ -572,7 +572,7 @@ void ScrollView::visit()
|
|||
for( ; i < _children.size(); i++ )
|
||||
{
|
||||
Node *child = _children.at(i);
|
||||
if ( child->getZOrder() < 0 )
|
||||
if ( child->getLocalZOrder() < 0 )
|
||||
{
|
||||
child->visit();
|
||||
}
|
||||
|
|
|
@ -1790,7 +1790,7 @@ void ReorderParticleSystems::onEnter()
|
|||
void ReorderParticleSystems::reorderSystem(float time)
|
||||
{
|
||||
auto system = static_cast<ParticleSystem*>(_batchNode->getChildren().at(1));
|
||||
_batchNode->reorderChild(system, system->getZOrder() - 1);
|
||||
_batchNode->reorderChild(system, system->getLocalZOrder() - 1);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
689b357d7acda141d13a3dfc4cb52aabb274f6cd
|
||||
c098eac3962854bc7d1981ec16aad7d2907c0e33
|
|
@ -155,7 +155,7 @@ void TestController::menuCallback(Object * sender)
|
|||
|
||||
// get the userdata, it's the index of the menu item clicked
|
||||
auto menuItem = static_cast<MenuItem *>(sender);
|
||||
int idx = menuItem->getZOrder() - 10000;
|
||||
int idx = menuItem->getLocalZOrder() - 10000;
|
||||
|
||||
// create the test scene and run it
|
||||
auto scene = g_aTestNames[idx].callback();
|
||||
|
|
Loading…
Reference in New Issue