This commit is contained in:
halx99 2021-10-11 13:44:28 +08:00
parent c38681bdd0
commit b99a445519
3 changed files with 4 additions and 9 deletions

View File

@ -355,13 +355,9 @@ Node* SceneReader::createObject(const rapidjson::Value &dict, cocos2d::Node* par
cocos2d::Node* SceneReader::createObject(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, cocos2d::Node* parent, AttachComponentType attachComponent) cocos2d::Node* SceneReader::createObject(CocoLoader *cocoLoader, stExpCocoNode *cocoNode, cocos2d::Node* parent, AttachComponentType attachComponent)
{ {
const char *className = nullptr;
stExpCocoNode *pNodeArray = cocoNode->GetChildArray(cocoLoader); stExpCocoNode *pNodeArray = cocoNode->GetChildArray(cocoLoader);
std::string Key = pNodeArray[1].GetName(cocoLoader); std::string Key = pNodeArray[1].GetName(cocoLoader);
if (Key == "classname") const char *className = Key == "classname" ? pNodeArray[1].GetValue(cocoLoader) : "";
{
className = pNodeArray[1].GetValue(cocoLoader);
}
if(strcmp(className, "CCNode") == 0) if(strcmp(className, "CCNode") == 0)
{ {
Node* gb = nullptr; Node* gb = nullptr;

View File

@ -1,7 +1,8 @@
/**************************************************************************** /****************************************************************************
Copyright (c) 2013-2017 Chukong Technologies Inc. Copyright (c) 2013-2017 Chukong Technologies Inc.
Copyright (c) 2021 Bytedance Inc.
http://www.cocos2d-x.org https://adxe.org
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
@ -31,7 +32,7 @@ using namespace cocostudio;
void sendEvent(unsigned int event) void sendEvent(unsigned int event)
{ {
char buf[10]; char buf[10];
sprintf(buf, "%d", event); sprintf(buf, "%u", event);
std::string custom_event_name(buf); std::string custom_event_name(buf);
EventCustom eventCustom(custom_event_name); EventCustom eventCustom(custom_event_name);

View File

@ -867,8 +867,6 @@ bool luaval_to_fontdefinition(lua_State* L, int lo, FontDefinition* outValue , c
if (NULL == L || NULL == outValue) if (NULL == L || NULL == outValue)
return false; return false;
bool ok = true;
tolua_Error tolua_err; tolua_Error tolua_err;
bool ok = !!tolua_istable(L, lo, 0, &tolua_err); bool ok = !!tolua_istable(L, lo, 0, &tolua_err);
if (ok) if (ok)