IT Technology

std::map 注意事项

std::map 不能直接访问下标,否则size会自动变大。这坑和js如出一辙。
查询需用find,删除需用erase

    auto it = _tilesAniData.find(z);
    if (it != _tilesAniData.end()) { // remove old data
        delete it->second;
        _tilesAniData.erase(z);
    }

遍历

    for(auto it = _tilesAniData.begin(); it != _tilesAniData.end(); ++it) {
        delete it->second;
    }

iOS 12国行的特供联网提示框不弹出

非常蛋痛,必须请求带域名的http才能触发,直接ip地址不一定触发。

需要无脑请求一次带域名的网络。

local request = network.createHTTPRequest(function(event)
end, "http://cocos2d-lua.org", "GET")
request:start()

luajit 编译 windows, mac 下的64位程序

win

  1. 启动vs的64位编译

    xxx\vs2015\VC\vcvarsall.bat amd64
  2. 切换到luajit src目录,运行

    msvcbuild.bat gc64

mac

make clean
make CC="gcc -m64 -arch x86_64 -DLUAJIT_ENABLE_GC64"

加LUAJIT_ENABLE_GC64 决定了是否64位的bytecode

m4 在 mac 下 Abort trap: 6的解决

参考homebrew下的m4安装描述,https://github.com/Homebrew/homebrew-core/blob/master/Formula/m4.rb

 # Fix crash from usage of %n in dynamic format strings on High Sierra
  # Patch credit to Jeremy Huddleston Sequoia <jeremyhu@apple.com>
  if MacOS.version >= :high_sierra
    patch :p0 do
      url "https://raw.githubusercontent.com/macports/macports-ports/edf0ee1e2cf/devel/m4/files/secure_snprintf.patch"
      sha256 "57f972940a10d448efbd3d5ba46e65979ae4eea93681a85e1d998060b356e0d2"
    end
end

手动打上面的补丁,编译安装。