From 3862ad59dc68293af12a1344a425682d7e004106 Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Sat, 28 Jun 2014 13:09:24 +0000 Subject: [PATCH] =?UTF-8?q?base:=20going=20on=20a=20lowercase=20rampage;?= =?UTF-8?q?=20today=E2=80=99s=20victim:=20Array.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/base/log.cpp | 2 +- src/commandstack.h | 6 +- src/dict.cpp | 2 +- src/easymesh/csgbsp.cpp | 24 +- src/easymesh/csgbsp.h | 8 +- src/easymesh/easymesh.cpp | 42 ++-- src/easymesh/easymesh.h | 8 +- src/easymesh/easymeshbuild.cpp | 14 +- src/easymesh/easymeshbuild.h | 24 +- src/easymesh/easymeshrender.cpp | 20 +- src/easymesh/easymeshrender.h | 10 +- src/gpu/lolfx-compiler.h | 2 +- src/gpu/shader.cpp | 10 +- src/image/codec/android-image.cpp | 38 +-- src/image/codec/gdiplus-image.cpp | 2 +- src/image/codec/imlib2-image.cpp | 2 +- src/image/codec/oric-image.cpp | 6 +- src/image/codec/ps3-image.cpp | 2 +- src/image/codec/sdl-image.cpp | 2 +- src/image/codec/zed-image.cpp | 24 +- src/image/codec/zed-palette-image.cpp | 2 +- src/image/filter/convolution.cpp | 14 +- src/image/image.cpp | 6 +- src/image/kernel.cpp | 2 +- src/image/resample.cpp | 2 +- src/input/controller.cpp | 6 +- src/input/controller.h | 14 +- src/input/input.cpp | 6 +- src/input/input.h | 24 +- src/lol/algorithm/aabb_tree.h | 40 ++-- src/lol/algorithm/portal.h | 12 +- src/lol/algorithm/sort.h | 4 +- src/lol/base/array.h | 324 +++++++++++++------------- src/lol/base/map.h | 6 +- src/lol/base/string.h | 4 +- src/lol/gpu/shader.h | 8 +- src/lol/image/image.h | 2 +- src/lol/math/array2d.h | 30 +-- src/lol/math/array3d.h | 30 +-- src/lol/sys/file.h | 8 +- src/lol/sys/init.h | 2 +- src/lol/sys/thread.h | 10 +- src/mesh/mesh.h | 6 +- src/messageservice.cpp | 6 +- src/messageservice.h | 2 +- src/platform/d3d9/d3d9input.cpp | 2 +- src/platform/nacl/nacl-instance.h | 2 +- src/platform/ps3/ps3input.cpp | 2 +- src/platform/sdl/sdlinput.cpp | 2 +- src/platform/xbox/xboxinput.cpp | 2 +- src/sample.cpp | 4 +- src/scene.cpp | 24 +- src/scene.h | 2 +- src/sys/file.cpp | 14 +- src/sys/init.cpp | 6 +- src/sys/thread.cpp | 4 +- src/ticker.cpp | 4 +- src/tileset.cpp | 10 +- src/utils.h | 2 +- src/world.cpp | 2 +- 60 files changed, 453 insertions(+), 447 deletions(-) diff --git a/src/base/log.cpp b/src/base/log.cpp index 146516c4..ae6d7723 100644 --- a/src/base/log.cpp +++ b/src/base/log.cpp @@ -97,7 +97,7 @@ void Log::Helper(MessageType type, char const *fmt, va_list ap) # if defined _WIN32 String buf = String(prefix[type]) + ": " + String::VPrintf(fmt, ap); - Array widechar; + array widechar; widechar.Resize(buf.Count() + 1); MultiByteToWideChar(CP_UTF8, 0, buf.C(), buf.Count() + 1, widechar.Data(), widechar.Count()); OutputDebugStringW(widechar.Data()); diff --git a/src/commandstack.h b/src/commandstack.h index 1c38dc03..bf35be45 100644 --- a/src/commandstack.h +++ b/src/commandstack.h @@ -24,9 +24,9 @@ namespace lol struct CommandStack { private: - Array m_commands; - Array m_floats; - Array m_ints; + array m_commands; + array m_floats; + array m_ints; int m_f_cur; int m_i_cur; diff --git a/src/dict.cpp b/src/dict.cpp index 2d452338..3e83c547 100644 --- a/src/dict.cpp +++ b/src/dict.cpp @@ -50,7 +50,7 @@ public: } private: - Array m_entities; + array m_entities; int nentities; }; diff --git a/src/easymesh/csgbsp.cpp b/src/easymesh/csgbsp.cpp index 2972715f..334833a2 100644 --- a/src/easymesh/csgbsp.cpp +++ b/src/easymesh/csgbsp.cpp @@ -68,9 +68,9 @@ int CsgBsp::TestPoint(int leaf_idx, vec3 point) void CsgBsp::AddTriangleToTree(int const &tri_idx, vec3 const &tri_p0, vec3 const &tri_p1, vec3 const &tri_p2) { // - Array< int, vec3, vec3, vec3 > tri_to_process; + array< int, vec3, vec3, vec3 > tri_to_process; // - Array< int, int, vec3, vec3, vec3, int > Leaf_to_add; + array< int, int, vec3, vec3, vec3, int > Leaf_to_add; //Tree is empty, so this leaf is the first if (m_tree.Count() == 0) @@ -228,14 +228,14 @@ void CsgBsp::AddTriangleToTree(int const &tri_idx, vec3 const &tri_p0, vec3 cons int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 const &tri_p2, //In order to easily build the actual vertices list afterward, this list stores each Vertices location and its source vertices & Alpha. // as { Point_Loc = Src_V0 + (Src_V1 - Src_V0) * Alpha; } - Array< vec3, int, int, float > &vert_list, + array< vec3, int, int, float > &vert_list, //This is the final triangle list : If Side_Status is LEAF_CURRENT, a new test will be done point by point. //<{IN|OUT}side_status, v0, v1, v2> - Array< int, int, int, int > &tri_list) + array< int, int, int, int > &tri_list) { //This list stores the current triangles to process. // - Array< Array< int >, int, int, int, int > tri_to_process; + array< array< int >, int, int, int, int > tri_to_process; //Tree is empty, ABORT ! if (m_tree.Count() == 0) @@ -248,7 +248,7 @@ int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 cons //Let's push the triangle in here. tri_to_process.Reserve(20); - tri_to_process.Push( Array< int >(), 0, 1, 2, 0); + tri_to_process.Push( array< int >(), 0, 1, 2, 0); tri_to_process.Last().m1.Push(0); while (tri_to_process.Count()) @@ -371,7 +371,7 @@ int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 cons t[(isec_base + 2) % 3], new_v_idx[v_idx1], new_v_idx[v_idx0]); else { - tri_to_process.Push(Array< int >(), t[(isec_base + 2) % 3], new_v_idx[v_idx1], new_v_idx[v_idx0], 0); + tri_to_process.Push(array< int >(), t[(isec_base + 2) % 3], new_v_idx[v_idx1], new_v_idx[v_idx0], 0); tri_to_process.Last().m1.Push(0); } @@ -384,9 +384,9 @@ int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 cons } else { - tri_to_process.Push(Array< int >(), t[isec_base], t[((isec_base + 1) % 3)], new_v_idx[v_idx0], 0); + tri_to_process.Push(array< int >(), t[isec_base], t[((isec_base + 1) % 3)], new_v_idx[v_idx0], 0); tri_to_process.Last().m1.Push(0); - tri_to_process.Push(Array< int >(), t[isec_base], new_v_idx[v_idx0], new_v_idx[v_idx1], 0); + tri_to_process.Push(array< int >(), t[isec_base], new_v_idx[v_idx0], new_v_idx[v_idx1], 0); tri_to_process.Last().m1.Push(0); } #else @@ -417,14 +417,14 @@ int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 cons continue; #endif #if 0 //Send the newly created triangle back to the beginning - tri_to_process.Push(Array< int >(), new_t[k], new_t[k + 1], new_t[k + 2], 0); + tri_to_process.Push(array< int >(), new_t[k], new_t[k + 1], new_t[k + 2], 0); tri_to_process.Last().m1.Push(0); #else //Inherit parent tree if (m_tree[leaf_idx].m_leaves[new_side[k / 3]] == LEAF_CURRENT && tri_to_process[tri_to_remove].m1.Count() == 1) tri_list.Push(new_side[k / 3], new_t[k], new_t[k + 1], new_t[k + 2]); else { - tri_to_process.Push(Array< int >(), new_t[k], new_t[k + 1], new_t[k + 2], 0); + tri_to_process.Push(array< int >(), new_t[k], new_t[k + 1], new_t[k + 2], 0); tri_to_process.Last().m1 = tri_to_process[tri_to_remove].m1; if (m_tree[leaf_idx].m_leaves[new_side[k / 3]] == LEAF_CURRENT) tri_to_process.Last().m1.Pop(); @@ -522,7 +522,7 @@ int CsgBsp::TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 cons res_total = res_total; tri_list[i].m1 = LEAF_BACK; #if 0 - tri_to_process.Push( Array< int >(), tri_list[i].m2, tri_list[i].m3, tri_list[i].m4, 0); + tri_to_process.Push( array< int >(), tri_list[i].m2, tri_list[i].m3, tri_list[i].m4, 0); tri_to_process.Last().m1.Push(0); tri_list.Remove(i--); break; diff --git a/src/easymesh/csgbsp.h b/src/easymesh/csgbsp.h index 1451367d..2e4b55d0 100644 --- a/src/easymesh/csgbsp.h +++ b/src/easymesh/csgbsp.h @@ -44,7 +44,7 @@ public: private: vec3 m_origin; vec3 m_normal; - Array< int, vec3, vec3, vec3 > m_tri_list; + array< int, vec3, vec3, vec3 > m_tri_list; ivec3 m_leaves; }; @@ -60,16 +60,16 @@ public: int TestTriangleToTree(vec3 const &tri_p0, vec3 const &tri_p1, vec3 const &tri_p2, //In order to easily build the actual vertices list afterward, this list stores each Vertices location and its source vertices & Alpha. // as { Point_Loc = Src_V0 + (Src_V1 - Src_V0) * Alpha; } - Array< vec3, int, int, float > &vert_list, + array< vec3, int, int, float > &vert_list, //This is the final triangle list : If Side_Status is LEAF_CURRENT, a new test will be done point by point. //<{IN|OUT}side_status, v0, v1, v2> - Array< int, int, int, int > &tri_list); + array< int, int, int, int > &tri_list); private: int AddLeaf(int leaf_type, vec3 origin, vec3 normal, int above_idx); int TestPoint(int leaf_idx, vec3 point); - Array m_tree; + array m_tree; }; } /* namespace lol */ diff --git a/src/easymesh/easymesh.cpp b/src/easymesh/easymesh.cpp index d2f5976f..963d0855 100644 --- a/src/easymesh/easymesh.cpp +++ b/src/easymesh/easymesh.cpp @@ -306,13 +306,13 @@ void EasyMesh::MeshCsg(CSGUsage csg_operation) } //A vertex dictionnary for vertices on the same spot. - Array< int, int > vertex_dict; + array< int, int > vertex_dict; //This list keeps track of the triangle that will need deletion at the end. - Array< int > triangle_to_kill; + array< int > triangle_to_kill; //Listing for each triangle of the vectors intersecting it. > - Array< int, Array< vec3, vec3, vec3 > > triangle_isec; + array< int, array< vec3, vec3, vec3 > > triangle_isec; //keep a track of the intersection point on the triangle. - Array< vec3, int > triangle_vertex; + array< vec3, int > triangle_vertex; for (int k = 0; k < 10; k++) triangle_vertex.Push(vec3(.0f), 0); @@ -343,8 +343,8 @@ void EasyMesh::MeshCsg(CSGUsage csg_operation) int start_point = (mesh_id == 0)?(cursor_start):(m_cursors.Last().m2); int end_point = (mesh_id == 0)?(m_cursors.Last().m2):(indices_count); CsgBsp &mesh_bsp = (mesh_id == 0)?(mesh_bsp_1):(mesh_bsp_0); - Array< vec3, int, int, float > vert_list; - Array< int, int, int, int > tri_list; + array< vec3, int, int, float > vert_list; + array< int, int, int, int > tri_list; vec3 n0(.0f); vec3 n1(.0f); vec4 c0(.0f); vec4 c1(.0f); @@ -699,7 +699,7 @@ void EasyMesh::ComputeNormals(int start, int vcount) BD()->IsEnabled(MeshBuildOperation::PostBuildComputeNormals)) return; - Array< Array > normals; + array< array > normals; normals.Resize(m_vert.Count()); for (int i = 0; i < vcount; i += 3) { @@ -734,7 +734,7 @@ void EasyMesh::ComputeNormals(int start, int vcount) //----------------------------------------------------------------------------- void EasyMesh::VerticesCleanup() { - Array vert_ids; + array vert_ids; vert_ids.Resize(m_vert.Count(), 0); //1: Remove triangles with two vertices on each other @@ -758,7 +758,7 @@ void EasyMesh::VerticesCleanup() } //2: Remove all unused vertices - Array old_vert = m_vert; + array old_vert = m_vert; int shift = 0; m_vert.Empty(); for (int i = 0; i < vert_ids.Count(); ++i) @@ -812,8 +812,8 @@ void EasyMesh::VerticesSeparate() return; } - Array< Array > new_ids; - Array vert_ids; + array< array > new_ids; + array vert_ids; vert_ids.Resize(m_vert.Count(), 0); //1: Mark all used vertices @@ -855,7 +855,7 @@ void EasyMesh::ComputeTexCoord(float uv_scale, int uv_offset) UNUSED(uv_scale, uv_offset); #if 0 VertexDictionnary vert_dict; - Array tri_list; + array tri_list; tri_list.Reserve(m_indices.Count() - m_cursors.Last().m2); for (int i = m_cursors.Last().m2; i < m_indices.Count(); i++) @@ -865,8 +865,8 @@ void EasyMesh::ComputeTexCoord(float uv_scale, int uv_offset) } //full triangle count - Array tri_done; - Array tri_check; + array tri_done; + array tri_check; int tri_count = (m_indices.Count() - m_cursors.Last().m2) / 3; tri_check << tri_list[0]; @@ -962,7 +962,7 @@ void EasyMesh::ComputeTexCoord(float uv_scale, int uv_offset) uv[2] = texu_dir * dot(v01, v02) + texv_dir * dot(v_dir, v02); //Set UV on ALL matching vertices! - Array matching_vert; + array matching_vert; for (int i = 0; i < 3; i++) { #if 1 @@ -1118,7 +1118,7 @@ void EasyMesh::RadialJitter(float r) return; } - Array Welded; + array Welded; Welded.Push(-1); for (int i = m_cursors.Last().m1 + 1; i < m_vert.Count(); i++) { @@ -1432,7 +1432,7 @@ void EasyMesh::AppendCapsule(int ndivisions, float h, float d) int ibase = m_indices.Count(); - Array vertices; + array vertices; float uv_h = 0; float uv_r = 0; @@ -2434,10 +2434,10 @@ void EasyMesh::SmoothMesh(int main_pass, int split_per_main_pass, int smooth_per } VertexDictionnary vert_dict; - Array smooth_buf[2]; - Array master_list; - Array matching_ids; - Array connected_vert; + array smooth_buf[2]; + array master_list; + array matching_ids; + array connected_vert; int smbuf = 0; for (int i = m_cursors.Last().m1; i < m_vert.Count(); i++) diff --git a/src/easymesh/easymesh.h b/src/easymesh/easymesh.h index b1b26077..e381ac2a 100644 --- a/src/easymesh/easymesh.h +++ b/src/easymesh/easymesh.h @@ -64,7 +64,7 @@ public: bool SetRender(bool should_render); private: - void UpdateVertexDict(Array< int, int > &vertex_dict); + void UpdateVertexDict(array< int, int > &vertex_dict); //------------------------------------------------------------------------- //Mesh CSG operations @@ -378,11 +378,11 @@ public: vec3 const &GetVertexLocation(int i) { return m_vert[i].m_coord; } //private: - Array m_indices; - Array m_vert; + array m_indices; + array m_vert; // - Array m_cursors; + array m_cursors; MeshRender m_state; diff --git a/src/easymesh/easymeshbuild.cpp b/src/easymesh/easymeshbuild.cpp index 7c5ab231..e41465ad 100644 --- a/src/easymesh/easymeshbuild.cpp +++ b/src/easymesh/easymeshbuild.cpp @@ -37,7 +37,7 @@ int VertexDictionnary::FindVertexMaster(const int search_idx) //----------------------------------------------------------------------------- //retrieve a list of matching vertices, doesn't include search_idx. -bool VertexDictionnary::FindMatchingVertices(const int search_idx, Array &matching_ids) +bool VertexDictionnary::FindMatchingVertices(const int search_idx, array &matching_ids) { int cur_mast = FindVertexMaster(search_idx); @@ -58,9 +58,9 @@ bool VertexDictionnary::FindMatchingVertices(const int search_idx, Array &m //----------------------------------------------------------------------------- //Will return connected vertices (through triangles), if returned vertex has matching ones, it only returns the master. -bool VertexDictionnary::FindConnectedVertices(const int search_idx, const Array &tri_list, const int tri0, Array &connected_vert, Array const *ignored_tri) +bool VertexDictionnary::FindConnectedVertices(const int search_idx, const array &tri_list, const int tri0, array &connected_vert, array const *ignored_tri) { - Array connected_tri; + array connected_tri; FindConnectedTriangles(search_idx, tri_list, tri0, connected_tri, ignored_tri); for (int i = 0; i < connected_tri.Count(); i++) @@ -88,20 +88,20 @@ bool VertexDictionnary::FindConnectedVertices(const int search_idx, const Array< return (connected_vert.Count() > 0); } //----------------------------------------------------------------------------- -bool VertexDictionnary::FindConnectedTriangles(const int search_idx, const Array &tri_list, const int tri0, Array &connected_tri, Array const *ignored_tri) +bool VertexDictionnary::FindConnectedTriangles(const int search_idx, const array &tri_list, const int tri0, array &connected_tri, array const *ignored_tri) { return FindConnectedTriangles(ivec3(search_idx, search_idx, search_idx), tri_list, tri0, connected_tri, ignored_tri); } //----------------------------------------------------------------------------- -bool VertexDictionnary::FindConnectedTriangles(const ivec2 &search_idx, const Array &tri_list, const int tri0, Array &connected_tri, Array const *ignored_tri) +bool VertexDictionnary::FindConnectedTriangles(const ivec2 &search_idx, const array &tri_list, const int tri0, array &connected_tri, array const *ignored_tri) { return FindConnectedTriangles(ivec3(search_idx, search_idx.x), tri_list, tri0, connected_tri, ignored_tri); } //----------------------------------------------------------------------------- -bool VertexDictionnary::FindConnectedTriangles(const ivec3 &search_idx, const Array &tri_list, const int tri0, Array &connected_tri, Array const *ignored_tri) +bool VertexDictionnary::FindConnectedTriangles(const ivec3 &search_idx, const array &tri_list, const int tri0, array &connected_tri, array const *ignored_tri) { int needed_validation = 0; - Array vert_list[3]; + array vert_list[3]; for (int i = 0; i < 3; i++) { //Small optim since above func will use this one diff --git a/src/easymesh/easymeshbuild.h b/src/easymesh/easymeshbuild.h index 0a3b7f44..50bf13bb 100644 --- a/src/easymesh/easymeshbuild.h +++ b/src/easymesh/easymeshbuild.h @@ -167,7 +167,7 @@ public: inline CommandStack &CmdStack() { return m_stack; } inline int &Cmdi() { return m_i_cmd; } inline int &CmdExecNb() { return m_exec_nb; } - inline Array &LoopStack(){ return m_loop_stack; } + inline array &LoopStack(){ return m_loop_stack; } inline vec4 &ColorA() { return m_color_a; } inline vec4 &ColorB() { return m_color_b; } inline vec2 &TexCoordOffset() { return m_texcoord_offset; } @@ -359,15 +359,15 @@ public: CommandStack m_stack; int m_i_cmd; int m_exec_nb; - Array m_loop_stack; + array m_loop_stack; vec4 m_color_a; vec4 m_color_b; vec2 m_texcoord_offset; vec2 m_texcoord_offset2; vec2 m_texcoord_scale; vec2 m_texcoord_scale2; - Array m_texcoord_custom_build[MeshType::MAX]; - Array m_texcoord_custom_build2[MeshType::MAX]; + array m_texcoord_custom_build[MeshType::MAX]; + array m_texcoord_custom_build2[MeshType::MAX]; uint32_t m_texcoord_build_type[MeshType::MAX]; uint32_t m_texcoord_build_type2[MeshType::MAX]; uint32_t m_build_flags; @@ -391,20 +391,20 @@ class VertexDictionnary { public: int FindVertexMaster(const int search_idx); - bool FindMatchingVertices(const int search_idx, Array &matching_ids); - bool FindConnectedVertices(const int search_idx, const Array &tri_list, const int tri0, Array &connected_vert, Array const *ignored_tri = nullptr); - bool FindConnectedTriangles(const int search_idx, const Array &tri_list, const int tri0, Array &connected_tri, Array const *ignored_tri = nullptr); - bool FindConnectedTriangles(const ivec2 &search_idx, const Array &tri_list, const int tri0, Array &connected_tri, Array const *ignored_tri = nullptr); - bool FindConnectedTriangles(const ivec3 &search_idx, const Array &tri_list, const int tri0, Array &connected_tri, Array const *ignored_tri = nullptr); + bool FindMatchingVertices(const int search_idx, array &matching_ids); + bool FindConnectedVertices(const int search_idx, const array &tri_list, const int tri0, array &connected_vert, array const *ignored_tri = nullptr); + bool FindConnectedTriangles(const int search_idx, const array &tri_list, const int tri0, array &connected_tri, array const *ignored_tri = nullptr); + bool FindConnectedTriangles(const ivec2 &search_idx, const array &tri_list, const int tri0, array &connected_tri, array const *ignored_tri = nullptr); + bool FindConnectedTriangles(const ivec3 &search_idx, const array &tri_list, const int tri0, array &connected_tri, array const *ignored_tri = nullptr); void AddVertex(int vert_id, vec3 vert_coord); void RemoveVertex(int vert_id); - bool GetMasterList(Array &ret_master_list) { ret_master_list = master_list; return ret_master_list.Count() > 0; } + bool GetMasterList(array &ret_master_list) { ret_master_list = master_list; return ret_master_list.Count() > 0; } void Clear() { vertex_list.Empty(); } private: // - Array vertex_list; + array vertex_list; //List of the master_ vertices - Array master_list; + array master_list; }; } /* namespace lol */ diff --git a/src/easymesh/easymeshrender.cpp b/src/easymesh/easymeshrender.cpp index c9dbbe5f..993d4b0e 100644 --- a/src/easymesh/easymeshrender.cpp +++ b/src/easymesh/easymeshrender.cpp @@ -152,8 +152,8 @@ void DefaultShaderData::SetupShaderDatas(mat4 const &model) mat4 modelview = view * model; mat3 normalmat = transpose(inverse(mat3(modelview))); /* FIXME: this should be hidden in the shader */ - Array const &lights = g_scene->GetLights(); - Array light_data; + array const &lights = g_scene->GetLights(); + array light_data; //This is not very nice, but necessary for emscripten WebGL generation. float f = 0.f; @@ -224,7 +224,7 @@ void GpuEasyMeshData::AddGpuData(GpuShaderData* gpudata, EasyMesh* src_mesh) if (!m_ibo) { - Array indexlist; + array indexlist; for (int i = 0; i < src_mesh->m_indices.Count(); i += 3) { indexlist << src_mesh->m_indices[i + 0]; @@ -292,7 +292,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh) VertexUsage::Color, VertexUsage::TexCoord)); - Array vertexlist; + array vertexlist; for (int i = 0; i < src_mesh->m_vert.Count(); i++) vertexlist.Push(src_mesh->m_vert[i].m_coord, src_mesh->m_vert[i].m_normal, @@ -309,7 +309,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh) VertexUsage::Color, VertexUsage::TexCoord)); - Array vertexlist; + array vertexlist; for (int i = 0; i < src_mesh->m_vert.Count(); i++) vertexlist.Push(src_mesh->m_vert[i].m_coord, src_mesh->m_vert[i].m_normal, @@ -321,7 +321,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh) { new_vdecl = new VertexDeclaration(VertexStream(VertexUsage::Position, VertexUsage::Color, VertexUsage::TexCoord)); - Array vertexlist; + array vertexlist; for (int i = 0; i < src_mesh->m_vert.Count(); i++) vertexlist.Push(src_mesh->m_vert[i].m_coord, src_mesh->m_vert[i].m_color, src_mesh->m_vert[i].m_texcoord); COPY_VBO; @@ -334,7 +334,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh) VertexUsage::Normal, VertexUsage::Color)); - Array vertexlist; + array vertexlist; for (int i = 0; i < src_mesh->m_vert.Count(); i++) vertexlist.Push(src_mesh->m_vert[i].m_coord, src_mesh->m_vert[i].m_normal, @@ -345,7 +345,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh) { new_vdecl = new VertexDeclaration(VertexStream(VertexUsage::Position, VertexUsage::TexCoord)); - Array vertexlist; + array vertexlist; for (int i = 0; i < src_mesh->m_vert.Count(); i++) vertexlist.Push(src_mesh->m_vert[i].m_coord, src_mesh->m_vert[i].m_texcoord); COPY_VBO; @@ -354,7 +354,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh) { new_vdecl = new VertexDeclaration(VertexStream(VertexUsage::Position, VertexUsage::TexCoord)); - Array vertexlist; + array vertexlist; for (int i = 0; i < src_mesh->m_vert.Count(); i++) vertexlist.Push(src_mesh->m_vert[i].m_coord, src_mesh->m_vert[i].m_texcoord.xy); COPY_VBO; @@ -363,7 +363,7 @@ void GpuEasyMeshData::SetupVertexData(uint16_t vflags, EasyMesh* src_mesh) { new_vdecl = new VertexDeclaration(VertexStream(VertexUsage::Position, VertexUsage::Color)); - Array vertexlist; + array vertexlist; for (int i = 0; i < src_mesh->m_vert.Count(); i++) vertexlist.Push(src_mesh->m_vert[i].m_coord, (u8vec4)(src_mesh->m_vert[i].m_color * 255.f)); COPY_VBO; diff --git a/src/easymesh/easymeshrender.h b/src/easymesh/easymeshrender.h index 50e83cfb..fe6fda00 100644 --- a/src/easymesh/easymeshrender.h +++ b/src/easymesh/easymeshrender.h @@ -80,8 +80,8 @@ protected: uint16_t m_vert_decl_flags; Shader* m_shader; int m_render_mode; - Array m_shader_uniform; - Array m_shader_attrib; + array m_shader_uniform; + array m_shader_attrib; }; class DefaultShaderData : public GpuShaderData @@ -96,7 +96,7 @@ public: void SetupDefaultData(bool with_UV); virtual void SetupShaderDatas(mat4 const &model); //-- - Array m_uniform_names; + array m_uniform_names; }; class GpuEasyMeshData @@ -115,9 +115,9 @@ public: private: void SetupVertexData(uint16_t vdecl_flags, EasyMesh* src_mesh); - Array m_gpudatas; + array m_gpudatas; //uint16_t are the vdecl/vbo flags to avoid copy same vdecl several times. - Array m_vdatas; int m_vertexcount; //We only need only one ibo for the whole mesh diff --git a/src/gpu/lolfx-compiler.h b/src/gpu/lolfx-compiler.h index c2fafe30..5b0e0f0c 100644 --- a/src/gpu/lolfx-compiler.h +++ b/src/gpu/lolfx-compiler.h @@ -46,7 +46,7 @@ private: BlockIsForeverFalse, BlockIsTrue, }; - Array m_pp_stack; + array m_pp_stack; char const *m_input; }; diff --git a/src/gpu/shader.cpp b/src/gpu/shader.cpp index 6bac0aa6..2353e869 100644 --- a/src/gpu/shader.cpp +++ b/src/gpu/shader.cpp @@ -129,7 +129,7 @@ Shader *Shader::Create(String const &name, String const &code) String src = String("\n") + code; /* Parse the crap */ - Array sections; + array sections; char *key = nullptr; for (char *parser = src.C(); *parser; ) { @@ -699,7 +699,7 @@ void Shader::SetUniform(ShaderUniform const &uni, TextureUniform tex, int index) * Uniform setters for arrays */ -void Shader::SetUniform(ShaderUniform const &uni, Array const &v) +void Shader::SetUniform(ShaderUniform const &uni, array const &v) { #if defined USE_D3D9 || defined _XBOX /* FIXME: this will not work properly because we don't know how tell DX9 @@ -722,7 +722,7 @@ void Shader::SetUniform(ShaderUniform const &uni, Array const &v) #endif } -void Shader::SetUniform(ShaderUniform const &uni, Array const &v) +void Shader::SetUniform(ShaderUniform const &uni, array const &v) { #if defined USE_D3D9 || defined _XBOX /* FIXME: this will not work properly because we don't know how tell DX9 @@ -745,7 +745,7 @@ void Shader::SetUniform(ShaderUniform const &uni, Array const &v) #endif } -void Shader::SetUniform(ShaderUniform const &uni, Array const &v) +void Shader::SetUniform(ShaderUniform const &uni, array const &v) { #if defined USE_D3D9 || defined _XBOX /* FIXME: this will not work properly because we don't know how tell DX9 @@ -768,7 +768,7 @@ void Shader::SetUniform(ShaderUniform const &uni, Array const &v) #endif } -void Shader::SetUniform(ShaderUniform const &uni, Array const &v) +void Shader::SetUniform(ShaderUniform const &uni, array const &v) { #if defined USE_D3D9 || defined _XBOX if (uni.flags & 1) diff --git a/src/image/codec/android-image.cpp b/src/image/codec/android-image.cpp index f085beb2..564a5b3c 100644 --- a/src/image/codec/android-image.cpp +++ b/src/image/codec/android-image.cpp @@ -45,9 +45,9 @@ public: virtual uint8_t *GetData() const; private: - jobject bmp; - jintArray array; - jint *pixels; + jobject m_bmp; + jintArray m_array; + jint *m_pixels; }; DECLARE_IMAGE_CODEC(AndroidImageCodec, 100) @@ -76,35 +76,35 @@ bool AndroidImageCodec::Load(Image *image, char const *path) mid = env->GetMethodID(cls, "openImage", "(Ljava/lang/String;)Landroid/graphics/Bitmap;"); jstring name = env->NewStringUTF(path); - bmp = env->CallObjectMethod(g_activity->clazz, mid, name); + m_bmp = env->CallObjectMethod(g_activity->clazz, mid, name); env->DeleteLocalRef(name); - if (!bmp) + if (!m_bmp) { #if !LOL_BUILD_RELEASE Log::Error("could not load %s\n", path); #endif return false; } - env->NewGlobalRef(bmp); + env->NewGlobalRef(m_bmp); /* Get image dimensions */ mid = env->GetMethodID(cls, "getWidth", "(Landroid/graphics/Bitmap;)I"); - m_size.x = env->CallIntMethod(g_activity->clazz, mid, bmp); + m_size.x = env->CallIntMethod(g_activity->clazz, mid, m_bmp); mid = env->GetMethodID(cls, "getHeight", "(Landroid/graphics/Bitmap;)I"); - m_size.y = env->CallIntMethod(g_activity->clazz, mid, bmp); + m_size.y = env->CallIntMethod(g_activity->clazz, mid, m_bmp); /* Get pixels */ - array = env->NewIntArray(m_size.x * m_size.y); - env->NewGlobalRef(array); + m_array = env->NewIntArray(m_size.x * m_size.y); + env->NewGlobalRef(m_array); mid = env->GetMethodID(cls, "getPixels", "(Landroid/graphics/Bitmap;[I)V"); - env->CallVoidMethod(g_activity->clazz, mid, bmp, array); + env->CallVoidMethod(g_activity->clazz, mid, m_bmp, m_array); - pixels = env->GetIntArrayElements(array, 0); + m_pixels = env->GetIntArrayElements(m_array, 0); for (int n = 0; n < m_size.x * m_size.y; n++) { - uint32_t u = pixels[n]; + uint32_t u = m_pixels[n]; u = (u & 0xff00ff00) | ((u & 0xff0000) >> 16) | ((u & 0xff) << 16); - pixels[n] = u; + m_pixels[n] = u; } m_format = PixelFormat::RGBA_8; @@ -132,20 +132,20 @@ bool AndroidImageCodec::Close() jclass cls = env->GetObjectClass(g_activity->clazz); jmethodID mid; - env->ReleaseIntArrayElements(array, pixels, 0); - env->DeleteGlobalRef(array); + env->ReleaseIntArrayElements(m_array, m_pixels, 0); + env->DeleteGlobalRef(m_array); /* Free image */ mid = env->GetMethodID(cls, "closeImage", "(Landroid/graphics/Bitmap;)V"); - env->CallVoidMethod(g_activity->clazz, mid, bmp); - env->DeleteGlobalRef(bmp); + env->CallVoidMethod(g_activity->clazz, mid, m_bmp); + env->DeleteGlobalRef(m_bmp); return true; } uint8_t *AndroidImageCodec::GetData() const { - return (uint8_t *)pixels; + return (uint8_t *)m_pixels; } } /* namespace lol */ diff --git a/src/image/codec/gdiplus-image.cpp b/src/image/codec/gdiplus-image.cpp index d67d534a..95d5bca4 100644 --- a/src/image/codec/gdiplus-image.cpp +++ b/src/image/codec/gdiplus-image.cpp @@ -58,7 +58,7 @@ bool GdiPlusImageCodec::Load(Image *image, char const *path) return false; } - Array pathlist = System::GetPathList(path); + array pathlist = System::GetPathList(path); Gdiplus::Bitmap *bitmap = nullptr; for (auto fullpath : pathlist) { diff --git a/src/image/codec/imlib2-image.cpp b/src/image/codec/imlib2-image.cpp index 939813e1..0cb7ebcf 100644 --- a/src/image/codec/imlib2-image.cpp +++ b/src/image/codec/imlib2-image.cpp @@ -42,7 +42,7 @@ bool Imlib2ImageCodec::Load(Image *image, char const *path) { Imlib_Image priv = nullptr; - Array pathlist = System::GetPathList(path); + array pathlist = System::GetPathList(path); for (int i = 0; i < pathlist.Count(); i++) { priv = imlib_load_image(pathlist[i].C()); diff --git a/src/image/codec/oric-image.cpp b/src/image/codec/oric-image.cpp index 1c962635..2e25b340 100644 --- a/src/image/codec/oric-image.cpp +++ b/src/image/codec/oric-image.cpp @@ -38,7 +38,7 @@ public: private: static String ReadScreen(char const *name); - static void WriteScreen(Image &image, Array &result); + static void WriteScreen(Image &image, array &result); }; DECLARE_IMAGE_CODEC(OricImageCodec, 100) @@ -116,7 +116,7 @@ bool OricImageCodec::Save(Image *image, char const *path) || toupper(path[len - 1]) != 'P') return false; - Array result; + array result; result << 0x16 << 0x16 << 0x16 << 0x16 << 0x24; result << 0 << 0xff << 0x80 << 0 << 0xbf << 0x3f << 0xa0 << 0; @@ -465,7 +465,7 @@ static uint8_t bestmove(ivec3 const *in, u8vec2 bgfg, return bestcommand; } -void OricImageCodec::WriteScreen(Image &image, Array &result) +void OricImageCodec::WriteScreen(Image &image, array &result) { ivec2 size = image.GetSize(); vec4 *pixels = image.Lock(); diff --git a/src/image/codec/ps3-image.cpp b/src/image/codec/ps3-image.cpp index 434057d9..afa6444e 100644 --- a/src/image/codec/ps3-image.cpp +++ b/src/image/codec/ps3-image.cpp @@ -98,7 +98,7 @@ bool Ps3ImageCodec::Load(Image *image, char const *path) CellPngDecSubHandle hsub; CellPngDecOpnInfo open_info; - Array pathlist = System::GetPathList(path); + array pathlist = System::GetPathList(path); for (int i = 0; i < pathlist.Count(); ++i) { String name = String(SYS_APP_HOME) + '/' + pathlist[i]; diff --git a/src/image/codec/sdl-image.cpp b/src/image/codec/sdl-image.cpp index 61ec6467..a92083f7 100644 --- a/src/image/codec/sdl-image.cpp +++ b/src/image/codec/sdl-image.cpp @@ -52,7 +52,7 @@ bool SdlImageCodec::Load(Image *image, char const *path) { SDL_Surface *surface = nullptr; - Array pathlist = System::GetPathList(path); + array pathlist = System::GetPathList(path); for (int i = 0; i < pathlist.Count(); i++) { surface = IMG_Load(pathlist[i].C()); diff --git a/src/image/codec/zed-image.cpp b/src/image/codec/zed-image.cpp index ef4713ca..3ecc3c96 100644 --- a/src/image/codec/zed-image.cpp +++ b/src/image/codec/zed-image.cpp @@ -31,7 +31,7 @@ public: virtual bool Load(Image *image, char const *path); virtual bool Save(Image *image, char const *path); - virtual bool RetrieveTiles(Array& tiles) + virtual bool RetrieveTiles(array& tiles) { bool result = m_tiles.Count() > 0; tiles += m_tiles; @@ -41,7 +41,7 @@ public: private: // - Array m_tiles; + array m_tiles; }; DECLARE_IMAGE_CODEC(ZedImageCodec, 0) @@ -60,14 +60,14 @@ bool ZedImageCodec::Load(Image *image, char const *path) { CompactSecondary(int32_t size) { m_size = size; } int32_t m_size; - Array m_tiles; + array m_tiles; }; struct CompactMain { CompactMain(int32_t size) { m_size = size; m_count = 0; } int32_t m_size; int32_t m_count; - Array m_secondary; + array m_secondary; }; struct Compacter2d { @@ -89,7 +89,7 @@ bool ZedImageCodec::Load(Image *image, char const *path) m_primary.Last().m_secondary << CompactSecondary(start + interval * j); } } - void CustomSetup(Array custom_list) + void CustomSetup(array custom_list) { for (int i = 0; i < custom_list.Count(); i++) { @@ -117,7 +117,7 @@ bool ZedImageCodec::Load(Image *image, char const *path) } } } - Array m_primary; + array m_primary; }; File file; @@ -125,7 +125,7 @@ bool ZedImageCodec::Load(Image *image, char const *path) //Put file in memory long file_size = file.GetSize(); - Array file_buffer; + array file_buffer; file_buffer.Resize(file_size); file.Read((uint8_t*)&file_buffer[0], file_size); file.Close(); @@ -136,7 +136,7 @@ bool ZedImageCodec::Load(Image *image, char const *path) file_count = *((uint16_t*)(&file_buffer[file_pos])); file_pos += sizeof(uint16_t); - Array file_offset; + array file_offset; file_offset.Resize(file_count); //Get all the file offsets for (int i = 0; i < file_count; i++) @@ -152,9 +152,9 @@ bool ZedImageCodec::Load(Image *image, char const *path) compacter.StepSetup(8, 8, 10); uint32_t total_size = 0; - Array file_convert; + array file_convert; file_convert.Reserve(file_size); - Array available_sizes; + array available_sizes; for (int i = 0; i < file_count; i++) { file_pos = file_offset[i]; @@ -176,10 +176,10 @@ bool ZedImageCodec::Load(Image *image, char const *path) /* Seems useless in the end //Retrieve Header & footer - Array header_data; + array header_data; header_data.Resize(header_length); memcpy(&header_data[0], &file_buffer[file_offset[i]], header_length); - Array footer_data; + array footer_data; uint32_t footer_length = lol::min((uint32_t)file_buffer.Count(), data_pos + data_length + header_length) - (data_pos + data_length); if (footer_length > 0) { diff --git a/src/image/codec/zed-palette-image.cpp b/src/image/codec/zed-palette-image.cpp index 2acd1b33..ec800291 100644 --- a/src/image/codec/zed-palette-image.cpp +++ b/src/image/codec/zed-palette-image.cpp @@ -47,7 +47,7 @@ bool ZedPaletteImageCodec::Load(Image *image, char const *path) //Put file in memory long file_size = file.GetSize(); - Array file_buffer; + array file_buffer; file_buffer.Resize(file_size); file.Read((uint8_t*)&file_buffer[0], file_size); file.Close(); diff --git a/src/image/filter/convolution.cpp b/src/image/filter/convolution.cpp index f8ead747..6746f6fc 100644 --- a/src/image/filter/convolution.cpp +++ b/src/image/filter/convolution.cpp @@ -21,8 +21,8 @@ namespace lol { -static Image SepConv(Image &src, Array const &hvec, - Array const &vvec); +static Image SepConv(Image &src, array const &hvec, + array const &vvec); static Image NonSepConv(Image &src, array2d const &kernel); Image Image::Convolution(array2d const &kernel) @@ -67,7 +67,7 @@ Image Image::Convolution(array2d const &kernel) if (separable) { /* Matrix rank is 1! Separate the filter. */ - Array hvec, vvec; + array hvec, vvec; float norm = 1.0f / lol::sqrt(lol::abs(kernel[bestx][besty])); for (int dx = 0; dx < ksize.x; dx++) @@ -192,8 +192,8 @@ static Image NonSepConv(Image &src, array2d const &kernel) } template -static Image SepConv(Image &src, Array const &hvec, - Array const &vvec) +static Image SepConv(Image &src, array const &hvec, + array const &vvec) { typedef typename PixelType::type pixel_t; @@ -254,8 +254,8 @@ static Image SepConv(Image &src, Array const &hvec, return dst; } -static Image SepConv(Image &src, Array const &hvec, - Array const &vvec) +static Image SepConv(Image &src, array const &hvec, + array const &vvec) { bool const wrap_x = src.GetWrapX() == WrapMode::Repeat; bool const wrap_y = src.GetWrapY() == WrapMode::Repeat; diff --git a/src/image/image.cpp b/src/image/image.cpp index f3d15efc..2fb07fc6 100644 --- a/src/image/image.cpp +++ b/src/image/image.cpp @@ -30,7 +30,7 @@ namespace lol * The bug was reported to Microsoft and fixed by them, but the fix * is not yet available. * https://connect.microsoft.com/VisualStudio/feedback/details/730878/ */ -static bool RegisterAllCodecs(Array &codeclist) +static bool RegisterAllCodecs(array &codeclist) { #if defined __ANDROID__ REGISTER_IMAGE_CODEC(AndroidImageCodec) @@ -73,7 +73,7 @@ public: } private: - Array m_codecs; + array m_codecs; map m_images; } g_image_loader; @@ -238,7 +238,7 @@ void Image::Unlock(void const *pixels) ASSERT(pixels == m_data->m_pixels[(int)m_data->m_format]->Data()); } -bool Image::RetrieveTiles(Array& tiles) const +bool Image::RetrieveTiles(array& tiles) const { /* TODO: re-implement this */ //return m_data->m_codecdata->RetrieveTiles(tiles); diff --git a/src/image/kernel.cpp b/src/image/kernel.cpp index 3a17ca5e..d2000dc2 100644 --- a/src/image/kernel.cpp +++ b/src/image/kernel.cpp @@ -188,7 +188,7 @@ array2d Image::NormalizeKernel(array2d const &kernel) { ivec2 size = kernel.GetSize(); - Array tmp; + array tmp; tmp.Resize(size.x * size.y); for (int y = 0; y < size.y; y++) diff --git a/src/image/resample.cpp b/src/image/resample.cpp index 9db75847..69cb0788 100644 --- a/src/image/resample.cpp +++ b/src/image/resample.cpp @@ -147,7 +147,7 @@ static Image ResizeBresenham(Image &image, ivec2 size) vec4 const *srcp = image.Lock(); vec4 *dstp = dst.Lock(); - Array aline, line; + array aline, line; aline.Resize(size.x); line.Resize(size.x); memset(line.Data(), 0, line.Bytes()); diff --git a/src/input/controller.cpp b/src/input/controller.cpp index 369b870d..6b8e8515 100644 --- a/src/input/controller.cpp +++ b/src/input/controller.cpp @@ -218,7 +218,7 @@ float AxisBinding::RetrieveCurrentValue() /////////////////////////////////////////////////////////////////////////////// // Controller -Array Controller::controllers; +array Controller::controllers; Controller::Controller(char const* name, int nb_keys, int nb_axis) { @@ -290,9 +290,9 @@ void Controller::Deactivate() m_activate_nextframe = false; } -Array Controller::DeactivateAll() +array Controller::DeactivateAll() { - Array result; + array result; for (int i = 0; i < controllers.Count(); ++i) { diff --git a/src/input/controller.h b/src/input/controller.h index 67ee631a..fc08316a 100644 --- a/src/input/controller.h +++ b/src/input/controller.h @@ -60,7 +60,7 @@ protected: } /** m1 is the InputDevice, m2 is the key index on the InputDevice */ - Array m_keybindings; + array m_keybindings; /** Value at the previous frame */ bool m_current; /** Value at the current frame */ @@ -112,9 +112,9 @@ protected: float RetrieveCurrentValue(); /** m1 is the InputDevice, m2 is the axis index on the InputDevice, m3 and m4 are an optional key indices to bind one or two keys over the axis */ - Array m_axisbindings; + array m_axisbindings; /** m1 is the InputDevice, m2 is the key index on the InputDevice for the negative value, m3 is the key index on the InputDevice for the positive value. Only one key is required to bind key over axis. */ - Array m_keybindings; + array m_keybindings; float m_current; float m_previous; @@ -135,7 +135,7 @@ public: /** Deactivate the controller on next frame */ void Deactivate(); /** Deactivate every active controller on next frame and return an array of deactivated (previously active) controllers */ - static Array DeactivateAll(); + static array DeactivateAll(); KeyBinding& GetKey(int index) { return m_keys[index]; } AxisBinding& GetAxis(int index) { return m_axis[index]; } @@ -143,11 +143,11 @@ public: static Controller* Get(char const* name); protected: - Array m_keys; - Array m_axis; + array m_keys; + array m_axis; private: - static Array controllers; + static array controllers; String m_name; bool m_activate_nextframe; bool m_deactivate_nextframe; diff --git a/src/input/input.cpp b/src/input/input.cpp index 09cd798b..c1ad54df 100644 --- a/src/input/input.cpp +++ b/src/input/input.cpp @@ -19,12 +19,12 @@ namespace lol { -Array InputDevice::devices; +array InputDevice::devices; bool InputDevice::m_capturemouse; -Array InputDevice::GetAvailableDevices() +array InputDevice::GetAvailableDevices() { - Array result; + array result; for (int i = 0; i < devices.Count(); ++i) { result.Push(devices[i]->m_name); diff --git a/src/input/input.h b/src/input/input.h index bdd6e680..ca146ba8 100644 --- a/src/input/input.h +++ b/src/input/input.h @@ -48,14 +48,14 @@ public: float GetAxisSensitivity(int index) const { return m_axis[index].m2; } /** Gets a list of the name of all available keys in this device */ - const Array& GetAllKeys() const { return m_keynames; } + const array& GetAllKeys() const { return m_keynames; } /** Gets a list of the name of all available axis in this device */ - const Array& GetAllAxis() const { return m_axisnames; } + const array& GetAllAxis() const { return m_axisnames; } /** Gets a list of the name of all available cursors in this device */ - const Array& GetAllCursors() const { return m_cursornames; } + const array& GetAllCursors() const { return m_cursornames; } /** Gets a list of the name of all available input devices */ - static Array GetAvailableDevices(); + static array GetAvailableDevices(); /** Gets an input device by its name */ static InputDevice* Get(const char* name) { return GetDevice(name); } /** Sets whether the mouse cursor should be captured. */ @@ -66,16 +66,16 @@ protected: String m_name; - Array m_keynames; - Array m_axisnames; - Array m_cursornames; + array m_keynames; + array m_axisnames; + array m_cursornames; /** key states (pressed/released) */ - Array m_keys; + array m_keys; /** axis states (value and sensitivity) */ - Array m_axis; + array m_axis; /** cursor position */ - Array m_cursors; + array m_cursors; static bool m_capturemouse; @@ -97,10 +97,10 @@ protected: } private: - static Array devices; + static array devices; template - int GetItemIndex(const char* name, const Array& array) const + int GetItemIndex(const char* name, const array& array) const { for (int i = 0; i < array.Count(); ++i) { diff --git a/src/lol/algorithm/aabb_tree.h b/src/lol/algorithm/aabb_tree.h index 2da8c1a2..055c9fea 100644 --- a/src/lol/algorithm/aabb_tree.h +++ b/src/lol/algorithm/aabb_tree.h @@ -29,9 +29,9 @@ namespace Debug { //-- template -void DrawInner(TREE *tree, Array &boxes, - Array &elements, - Array &leaves, int children, vec4 color) +void DrawInner(TREE *tree, array &boxes, + array &elements, + array &leaves, int children, vec4 color) { boxes.Push(tree->GetAABB(), Color::white); leaves.Push(0, boxes.Last().m1); @@ -70,9 +70,9 @@ void DrawInner(TREE *tree, Array &boxes, template void Draw(Quadtree* tree, vec4 color) { - Array boxes; - Array elements; - Array leaves; + array boxes; + array elements; + array leaves; DrawInner, TE, box2>(tree, boxes, elements, leaves, 4, color); @@ -101,9 +101,9 @@ void Draw(Quadtree* tree, vec4 color) template void Draw(Octree* tree, vec4 color) { - Array boxes; - Array elements; - Array leaves; + array boxes; + array elements; + array leaves; DrawInner, TE, box3>(tree, boxes, elements, leaves, 8, color); @@ -143,7 +143,7 @@ class AABBTree //Children pos in the list int m_children[child_nb]; //Element list - Array m_elements; + array m_elements; NodeLeaf(int parent) { @@ -156,7 +156,7 @@ class AABBTree struct TreeElement { TE* m_element; - Array m_leaves; + array m_leaves; inline bool operator==(const TE*& element) { return m_element == element; } }; @@ -235,7 +235,7 @@ private: TreeElement new_element; new_element.m_element = element; - new_element.m_leaves = Array(); + new_element.m_leaves = array(); m_elements << new_element; return m_elements.Count() - 1; } @@ -254,7 +254,7 @@ private: } //-- - bool TestLeaf(int leaf, const TB& leaf_bb, const TB& test_bb, Array& elements) + bool TestLeaf(int leaf, const TB& leaf_bb, const TB& test_bb, array& elements) { bool result = false; if (TestAABBVsAABB(leaf_bb, test_bb)) @@ -299,7 +299,7 @@ private: depth < m_max_depth) { //Extract elements - Array elements = m_tree[leaf].m_elements; + array elements = m_tree[leaf].m_elements; elements.PushUnique(AddElement(element)); m_tree[leaf].m_elements.Empty(); //Add children @@ -327,7 +327,7 @@ private: public: void RegisterElement(TE* element) { RegisterElement(element, 0, GetAABB(), 0); } void UnregisterElement(TE* element) { RemoveElement(element); } - bool FindElements(const TB& bbox, Array& elements) { return TestLeaf(0, GetAABB(), bbox, elements); } + bool FindElements(const TB& bbox, array& elements) { return TestLeaf(0, GetAABB(), bbox, elements); } void Clear() { m_tree.Empty(); @@ -353,20 +353,20 @@ public: void SetMaxDepth(int max_depth) { m_max_depth = max_depth; } void SetMaxElement(int max_element) { m_max_element = max_element; } - Array const & GetTree() const + array const & GetTree() const { return m_tree; } - Array const & GetElements() const + array const & GetElements() const { return m_elements; } protected: - Array m_tree; //actual tree - Array m_elements; //elements to leaves - Array m_free_leaves; //leaves removed from tree + array m_tree; //actual tree + array m_elements; //elements to leaves + array m_free_leaves; //leaves removed from tree TV m_size; //Main tree size int m_max_depth; //Maximum depth possible int m_max_element; //Maximum element per leaf diff --git a/src/lol/algorithm/portal.h b/src/lol/algorithm/portal.h index ace79b5d..69705dc6 100644 --- a/src/lol/algorithm/portal.h +++ b/src/lol/algorithm/portal.h @@ -278,7 +278,7 @@ public: private: //Portals associated with this room. - Array*> m_doors; + array*> m_doors; TE* m_element; }; @@ -298,9 +298,9 @@ public: } //Visible room getter - void GetVisibleRooms(PortalDoor* see_through, PortalRoom* start_room, Array*>& visible_rooms) + void GetVisibleRooms(PortalDoor* see_through, PortalRoom* start_room, array*>& visible_rooms) { - Array*> ignore_doors; + array*> ignore_doors; GetVisibleRooms(see_through, start_room, visible_rooms, ignore_doors); #if LOL_BUILD_DEBUG for (auto room : visible_rooms) @@ -322,7 +322,7 @@ public: #endif //LOL_BUILD_DEBUG } private: - void GetVisibleRooms(PortalDoor* see_through, PortalRoom* start_room, Array*>& visible_rooms, Array*>& ignore_doors) + void GetVisibleRooms(PortalDoor* see_through, PortalRoom* start_room, array*>& visible_rooms, array*>& ignore_doors) { for (auto door : start_room->m_doors) { @@ -381,8 +381,8 @@ public: private: //Portals associated with this room. - Array*> m_rooms; - Array*> m_doors; + array*> m_rooms; + array*> m_doors; }; } /* namespace lol */ diff --git a/src/lol/algorithm/sort.h b/src/lol/algorithm/sort.h index 0a2b7495..d44fbb8e 100644 --- a/src/lol/algorithm/sort.h +++ b/src/lol/algorithm/sort.h @@ -18,7 +18,7 @@ namespace lol { template -void ArrayBase::Sort(int sort) +void array_base::Sort(int sort) { int s = 0; // Classic bubble @@ -44,7 +44,7 @@ void ArrayBase::Sort(int sort) } template -void ArrayBase::SortQuickSwap(int start, int stop) +void array_base::SortQuickSwap(int start, int stop) { int m[3] = { diff --git a/src/lol/base/array.h b/src/lol/base/array.h index cdfd66b7..5b03b419 100644 --- a/src/lol/base/array.h +++ b/src/lol/base/array.h @@ -10,10 +10,10 @@ // // -// The Array class +// The array class // --------------- -// A very simple Array class not unlike the std::vector, with some nice -// additional features, eg. Array for automatic arrays of tuples. +// A very simple array class not unlike the std::vector, with some nice +// additional features, eg. array for automatic arrays of tuples. // #if !defined __LOL_BASE_ARRAY_H__ @@ -41,16 +41,16 @@ namespace lol * m_count are allocated. The rest is uninitialised memory. */ -template class ArrayBase +template class array_base { public: - typedef T Element; + typedef T element_t; - inline ArrayBase() : m_data(0), m_count(0), m_reserved(0) + inline array_base() : m_data(0), m_count(0), m_reserved(0) { } - inline ArrayBase(std::initializer_list const &list) + inline array_base(std::initializer_list const &list) : m_data(0), m_count(0), m_reserved(0) @@ -60,24 +60,24 @@ public: Push(elem); } - inline ~ArrayBase() + inline ~array_base() { for (int i = 0; i < m_count; i++) - m_data[i].~Element(); + m_data[i].~element_t(); delete[] reinterpret_cast(m_data); } - ArrayBase(ArrayBase const& that) : m_data(0), m_count(0), m_reserved(0) + array_base(array_base const& that) : m_data(0), m_count(0), m_reserved(0) { /* Reserve the exact number of values instead of what the other * array had reserved. Just a method for not wasting too much. */ Reserve(that.m_count); for (int i = 0; i < that.m_count; i++) - new(&m_data[i]) Element(that[i]); + new(&m_data[i]) element_t(that[i]); m_count = that.m_count; } - ArrayBase& operator=(ArrayBase const& that) + array_base& operator=(array_base const& that) { if ((uintptr_t)this != (uintptr_t)&that) { @@ -91,9 +91,9 @@ public: * remaining elements. */ Reserve(that.m_count); for (int i = 0; i < m_count && i < that.m_count; i++) - m_data[i] = Element(that[i]); + m_data[i] = element_t(that[i]); for (int i = m_count; i < that.m_count; i++) - new(&m_data[i]) Element(that[i]); + new(&m_data[i]) element_t(that[i]); } else { @@ -102,23 +102,23 @@ public: * that we do not have, and finally destroy the remaining * elements. */ for (int i = 0; i < m_count && i < that.m_count; i++) - m_data[i] = Element(that[i]); + m_data[i] = element_t(that[i]); for (int i = m_count; i < that.m_count; i++) - new(&m_data[i]) Element(that[i]); + new(&m_data[i]) element_t(that[i]); for (int i = that.m_count; i < m_count; i++) - m_data[i].~Element(); + m_data[i].~element_t(); } m_count = that.m_count; } return *this; } - ArrayBase& operator+=(ArrayBase const &that) + array_base& operator+=(array_base const &that) { int todo = that.m_count; Reserve(m_count + that.m_count); for (int i = 0; i < todo; i++) - new(&m_data[m_count + i]) Element(that[i]); + new(&m_data[m_count + i]) element_t(that[i]); m_count += todo; return *this; } @@ -132,7 +132,7 @@ public: return ret; } - inline Element& operator[](int n) + inline element_t& operator[](int n) { /* Allow array[0] even if size is zero so that people can * always use &array[0] to get a pointer to the data. */ @@ -141,14 +141,14 @@ public: return m_data[n]; } - inline Element const& operator[](int n) const + inline element_t const& operator[](int n) const { ASSERT(n >= 0); ASSERT(n < m_count || (!n && !m_count)); return m_data[n]; } - inline Element& operator[](uint32_t n) + inline element_t& operator[](uint32_t n) { /* Allow array[0] even if size is zero so that people can * always use &array[0] to get a pointer to the data. */ @@ -157,14 +157,14 @@ public: return m_data[n]; } - inline Element const& operator[](uint32_t n) const + inline element_t const& operator[](uint32_t n) const { ASSERT(n >= 0); ASSERT(n < m_count || (!n && !m_count)); return m_data[n]; } - inline Element& operator[](uint64_t n) + inline element_t& operator[](uint64_t n) { /* Allow array[0] even if size is zero so that people can * always use &array[0] to get a pointer to the data. */ @@ -173,52 +173,52 @@ public: return m_data[n]; } - inline Element const& operator[](uint64_t n) const + inline element_t const& operator[](uint64_t n) const { ASSERT(n >= 0); ASSERT(n < m_count || (!n && !m_count)); return m_data[n]; } - inline Element& Last() + inline element_t& Last() { ASSERT(m_count > 0); return m_data[m_count - 1]; } - inline Element *Data() + inline element_t *Data() { return m_data; } - inline Element const *Data() const + inline element_t const *Data() const { return m_data; } - inline Element const& Last() const + inline element_t const& Last() const { ASSERT(m_count > 0); return m_data[m_count - 1]; } - inline ArrayBase& operator<<(T const &x) + inline array_base& operator<<(T const &x) { if (m_count >= m_reserved) { T tmp = x; Grow(); - new (&m_data[m_count]) Element(tmp); + new (&m_data[m_count]) element_t(tmp); } else { - new (&m_data[m_count]) Element(x); + new (&m_data[m_count]) element_t(x); } ++m_count; return *this; } - inline ArrayBase& operator>>(T const &x) + inline array_base& operator>>(T const &x) { RemoveItem(x); return *this; @@ -248,10 +248,10 @@ public: for (int i = m_count; i > pos; --i) { - new (&m_data[i]) Element(m_data[i - 1]); - m_data[i - 1].~Element(); + new (&m_data[i]) element_t(m_data[i - 1]); + m_data[i - 1].~element_t(); } - new (&m_data[pos]) Element(x); + new (&m_data[pos]) element_t(x); ++m_count; } @@ -312,7 +312,7 @@ public: inline T Pop() { ASSERT(m_count > 0); - Element tmp = Last(); + element_t tmp = Last(); Remove(m_count - 1, 1); return tmp; } @@ -339,7 +339,7 @@ public: for (int i = pos; i + todelete < m_count; i++) m_data[i] = m_data[i + todelete]; for (int i = m_count - todelete; i < m_count; i++) - m_data[i].~Element(); + m_data[i].~element_t(); m_count -= todelete; } @@ -355,23 +355,23 @@ public: { if (pos + i < m_count - 1 - i) m_data[pos + i] = m_data[m_count - 1 - i]; - m_data[m_count - 1 - i].~Element(); + m_data[m_count - 1 - i].~element_t(); } m_count -= todelete; } - void Resize(int count, Element e = Element()) + void Resize(int count, element_t e = element_t()) { ASSERT(count >= 0); Reserve(count); /* Too many elements? Remove them. */ for (int i = count; i < m_count; ++i) - m_data[i].~Element(); + m_data[i].~element_t(); /* Not enough elements? Add some. */ for (int i = m_count; i < count; ++i) - new(&m_data[i]) Element(e); + new(&m_data[i]) element_t(e); m_count = count; } @@ -390,13 +390,13 @@ public: * information we could have. But until C++ gives us the proper * tools to deal with it, we assume new uint8_t[] returns properly * aligned data. */ - Element *tmp = reinterpret_cast(reinterpret_cast - (new uint8_t[sizeof(Element) * toreserve])); - ASSERT(tmp, "out of memory in Array class"); + element_t *tmp = reinterpret_cast(reinterpret_cast + (new uint8_t[sizeof(element_t) * toreserve])); + ASSERT(tmp, "out of memory in array class"); for (int i = 0; i < m_count; i++) { - new(&tmp[i]) Element(m_data[i]); - m_data[i].~Element(); + new(&tmp[i]) element_t(m_data[i]); + m_data[i].~element_t(); } delete[] reinterpret_cast(m_data); m_data = tmp; @@ -410,7 +410,7 @@ public: class ConstIterator { public: - ConstIterator(ArrayBase const *array, int pos) + ConstIterator(array_base const *array, int pos) : m_pos(pos), m_array(array) { } @@ -420,7 +420,7 @@ public: return m_pos != that.m_pos; } - Element const & operator *() const + element_t const & operator *() const { return (*m_array)[m_pos]; } @@ -433,13 +433,13 @@ public: private: int m_pos; - ArrayBase const *m_array; + array_base const *m_array; }; class Iterator { public: - Iterator(ArrayBase *array, int pos) + Iterator(array_base *array, int pos) : m_pos(pos), m_array(array) { } @@ -449,7 +449,7 @@ public: return m_pos != that.m_pos; } - Element operator *() + element_t operator *() { return (*m_array)[m_pos]; } @@ -462,7 +462,7 @@ public: private: int m_pos; - ArrayBase *m_array; + array_base *m_array; }; ConstIterator begin() const { return ConstIterator(this, 0); } @@ -472,7 +472,7 @@ public: public: inline int Count() const { return m_count; } - inline int Bytes() const { return m_count * sizeof(Element); } + inline int Bytes() const { return m_count * sizeof(element_t); } protected: void Grow() @@ -480,18 +480,18 @@ protected: Reserve(m_count * 13 / 8 + 8); } - Element *m_data; + element_t *m_data; int m_count, m_reserved; }; /* - * Element types + * element_t types */ template -class ArrayElement +class array_element { public: T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; T8 m8; @@ -499,7 +499,7 @@ public: template -class ArrayElement +class array_element { public: T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; T7 m7; @@ -507,64 +507,64 @@ public: template -class ArrayElement +class array_element { public: T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; T6 m6; }; template -class ArrayElement +class array_element { public: T1 m1; T2 m2; T3 m3; T4 m4; T5 m5; }; template -class ArrayElement +class array_element { public: T1 m1; T2 m2; T3 m3; T4 m4; }; template -class ArrayElement +class array_element { public: T1 m1; T2 m2; T3 m3; }; template -class ArrayElement +class array_element { public: T1 m1; T2 m2; }; /* - * Array specialisations implementing specific setters + * array specialisations implementing specific setters */ template -class Array : public ArrayBase, - Array> +class array : public array_base, + array> { #if INHERIT_CONSTRUCTORS - using ArrayBase, - Array>::ArrayBase; + using array_base, + array>::array_base; #else public: - typedef ArrayElement Element; + typedef array_element element_t; - inline Array() - : ArrayBase>::ArrayBase() {} + inline array() + : array_base>::array_base() {} - inline Array(std::initializer_list const &list) - : ArrayBase>::ArrayBase(list) {} + inline array(std::initializer_list const &list) + : array_base>::array_base(list) {} #endif public: @@ -602,24 +602,24 @@ public: template -class Array - : public ArrayBase, - Array> +class array + : public array_base, + array> { #if INHERIT_CONSTRUCTORS - using ArrayBase, - Array>::ArrayBase; + using array_base, + array>::array_base; #else public: - typedef ArrayElement Element; + typedef array_element element_t; - inline Array() - : ArrayBase>::ArrayBase() {} + inline array() + : array_base>::array_base() {} - inline Array(std::initializer_list const &list) - : ArrayBase>::ArrayBase(list) {} + inline array(std::initializer_list const &list) + : array_base>::array_base(list) {} #endif public: @@ -655,24 +655,24 @@ public: template -class Array - : public ArrayBase, - Array> +class array + : public array_base, + array> { #if INHERIT_CONSTRUCTORS - using ArrayBase, - Array>::ArrayBase; + using array_base, + array>::array_base; #else public: - typedef ArrayElement Element; + typedef array_element element_t; - inline Array() - : ArrayBase>::ArrayBase() {} + inline array() + : array_base>::array_base() {} - inline Array(std::initializer_list const &list) - : ArrayBase>::ArrayBase(list) {} + inline array(std::initializer_list const &list) + : array_base>::array_base(list) {} #endif public: @@ -705,24 +705,24 @@ public: }; template -class Array - : public ArrayBase, - Array> +class array + : public array_base, + array> { #if INHERIT_CONSTRUCTORS - using ArrayBase, - Array>::ArrayBase; + using array_base, + array>::array_base; #else public: - typedef ArrayElement Element; + typedef array_element element_t; - inline Array() - : ArrayBase>::ArrayBase() {} + inline array() + : array_base>::array_base() {} - inline Array(std::initializer_list const &list) - : ArrayBase>::ArrayBase(list) {} + inline array(std::initializer_list const &list) + : array_base>::array_base(list) {} #endif public: @@ -753,24 +753,24 @@ public: }; template -class Array - : public ArrayBase, - Array> +class array + : public array_base, + array> { #if INHERIT_CONSTRUCTORS - using ArrayBase, - Array>::ArrayBase; + using array_base, + array>::array_base; #else public: - typedef ArrayElement Element; + typedef array_element element_t; - inline Array() - : ArrayBase>::ArrayBase() {} + inline array() + : array_base>::array_base() {} - inline Array(std::initializer_list const &list) - : ArrayBase>::ArrayBase(list) {} + inline array(std::initializer_list const &list) + : array_base>::array_base(list) {} #endif public: @@ -797,24 +797,24 @@ public: }; template -class Array - : public ArrayBase, - Array> +class array + : public array_base, + array> { #if INHERIT_CONSTRUCTORS - using ArrayBase, - Array>::ArrayBase; + using array_base, + array>::array_base; #else public: - typedef ArrayElement Element; + typedef array_element element_t; - inline Array() - : ArrayBase>::ArrayBase() {} + inline array() + : array_base>::array_base() {} - inline Array(std::initializer_list const &list) - : ArrayBase>::ArrayBase(list) {} + inline array(std::initializer_list const &list) + : array_base>::array_base(list) {} #endif public: @@ -839,24 +839,24 @@ public: }; template -class Array - : public ArrayBase, - Array> +class array + : public array_base, + array> { #if INHERIT_CONSTRUCTORS - using ArrayBase, - Array>::ArrayBase; + using array_base, + array>::array_base; #else public: - typedef ArrayElement Element; + typedef array_element element_t; - inline Array() - : ArrayBase>::ArrayBase() {} + inline array() + : array_base>::array_base() {} - inline Array(std::initializer_list const &list) - : ArrayBase>::ArrayBase(list) {} + inline array(std::initializer_list const &list) + : array_base>::array_base(list) {} #endif public: @@ -879,27 +879,33 @@ public: }; template -class Array - : public ArrayBase> +class array + : public array_base> { #if INHERIT_CONSTRUCTORS - using ArrayBase>::ArrayBase; + using array_base>::array_base; #else public: - typedef T Element; + typedef T element_t; - inline Array() - : ArrayBase>::ArrayBase() {} + inline array() + : array_base>::array_base() {} - inline Array(std::initializer_list const &list) - : ArrayBase>::ArrayBase(list) {} + inline array(std::initializer_list const &list) + : array_base>::array_base(list) {} #endif }; +/* Transitional alias for the camelcase version of lol::array */ +template +using Array = array; + } /* namespace lol */ #endif // __LOL_BASE_ARRAY_H__ diff --git a/src/lol/base/map.h b/src/lol/base/map.h index 81df9b48..936d44a5 100644 --- a/src/lol/base/map.h +++ b/src/lol/base/map.h @@ -80,9 +80,9 @@ public: return false; } - Array Keys() const + array Keys() const { - Array ret; + array ret; for (auto it : m_array) ret.Push(it.m2); return ret; @@ -111,7 +111,7 @@ private: return FindIndex(key, hashed); } - Array m_array; + array m_array; }; } /* namespace lol */ diff --git a/src/lol/base/string.h b/src/lol/base/string.h index 0d0bd51e..3a52b27e 100644 --- a/src/lol/base/string.h +++ b/src/lol/base/string.h @@ -26,10 +26,10 @@ namespace lol { -class String : protected Array +class String : protected array { private: - typedef Array Super; + typedef array Super; public: inline String() diff --git a/src/lol/gpu/shader.h b/src/lol/gpu/shader.h index 118720e3..02184092 100644 --- a/src/lol/gpu/shader.h +++ b/src/lol/gpu/shader.h @@ -113,10 +113,10 @@ public: void SetUniform(ShaderUniform const &uni, mat4 const &m); void SetUniform(ShaderUniform const &uni, TextureUniform tex, int index); - void SetUniform(ShaderUniform const &uni, Array const &v); - void SetUniform(ShaderUniform const &uni, Array const &v); - void SetUniform(ShaderUniform const &uni, Array const &v); - void SetUniform(ShaderUniform const &uni, Array const &v); + void SetUniform(ShaderUniform const &uni, array const &v); + void SetUniform(ShaderUniform const &uni, array const &v); + void SetUniform(ShaderUniform const &uni, array const &v); + void SetUniform(ShaderUniform const &uni, array const &v); void Bind() const; void Unbind() const; diff --git a/src/lol/image/image.h b/src/lol/image/image.h index 0b8b9fd6..7a30b49d 100644 --- a/src/lol/image/image.h +++ b/src/lol/image/image.h @@ -91,7 +91,7 @@ public: template void Unlock2D(array2d const &); - bool RetrieveTiles(Array& tiles) const; + bool RetrieveTiles(array& tiles) const; /* Image processing kernels */ static array2d BayerKernel(ivec2 size); diff --git a/src/lol/math/array2d.h b/src/lol/math/array2d.h index e7179466..080d3100 100644 --- a/src/lol/math/array2d.h +++ b/src/lol/math/array2d.h @@ -33,11 +33,11 @@ namespace lol template -class array2d : protected Array +class array2d : protected array { public: - typedef Array Super; - typedef typename Super::Element Element; + typedef array super; + typedef typename super::element_t element_t; inline array2d() : m_size(0, 0) @@ -45,14 +45,14 @@ public: } inline array2d(std::initializer_list< - std::initializer_list> const &list) + std::initializer_list> const &list) : m_size(list.size() ? (int)(*list.begin()).size() : 0, (int)list.size()) { - Super::Reserve(m_size.x * m_size.y); + super::Reserve(m_size.x * m_size.y); for (auto l : list) for (auto elem : l) - Super::Push(elem); + super::Push(elem); } inline array2d(int w, int h) @@ -66,7 +66,7 @@ public: } /* Access elements directly using an ivec2 index */ - inline Element const &operator [](ivec2 pos) const + inline element_t const &operator [](ivec2 pos) const { ASSERT(pos.x >= 0); ASSERT(pos.y >= 0); @@ -80,7 +80,7 @@ public: return this->m_data[n]; } - inline Element &operator [](ivec2 pos) + inline element_t &operator [](ivec2 pos) { ASSERT(pos.x >= 0); ASSERT(pos.y >= 0); @@ -103,7 +103,7 @@ public: { } - inline Element &operator [](int j) + inline element_t &operator [](int j) { ASSERT(j >= 0); ASSERT(j < m_array.m_size.y); @@ -124,7 +124,7 @@ public: { } - inline Element const &operator [](int j) const + inline element_t const &operator [](int j) const { ASSERT(j >= 0); ASSERT(j < m_array.m_size.y); @@ -153,7 +153,7 @@ public: /* Resize the array. * FIXME: data gets scrambled; should we care? */ - inline void SetSize(ivec2 size, Element e = Element()) + inline void SetSize(ivec2 size, element_t e = element_t()) { this->Resize(size.x * size.y, e); m_size = size; @@ -165,10 +165,10 @@ public: } public: - inline Element *Data() { return Super::Data(); } - inline Element const *Data() const { return Super::Data(); } - inline int Count() const { return Super::Count(); } - inline int Bytes() const { return Super::Bytes(); } + inline element_t *Data() { return super::Data(); } + inline element_t const *Data() const { return super::Data(); } + inline int Count() const { return super::Count(); } + inline int Bytes() const { return super::Bytes(); } private: ivec2 m_size; diff --git a/src/lol/math/array3d.h b/src/lol/math/array3d.h index a1c30db5..4b1fa22f 100644 --- a/src/lol/math/array3d.h +++ b/src/lol/math/array3d.h @@ -33,11 +33,11 @@ namespace lol template -class array3d : protected Array +class array3d : protected array { public: - typedef Array Super; - typedef typename Super::Element Element; + typedef array super; + typedef typename super::element_t element_t; inline array3d() : m_size(0, 0, 0) @@ -46,17 +46,17 @@ public: inline array3d(std::initializer_list< std::initializer_list< - std::initializer_list>> const &list) + std::initializer_list>> const &list) : m_size(list.size() && (*list.begin()).size() ? (int)(*(*list.begin()).begin()).size() : 0, list.size() ? (int)(*list.begin()).size() : 0, (int)list.size()) { - Super::Reserve(m_size.x * m_size.y * m_size.z); + super::Reserve(m_size.x * m_size.y * m_size.z); for (auto ll : list) for (auto l : ll) for (auto elem : l) - Super::Push(elem); + super::Push(elem); } inline array3d(int w, int h, int d) @@ -70,7 +70,7 @@ public: } /* Access elements directly using an ivec3 index */ - inline Element const &operator [](ivec3 pos) const + inline element_t const &operator [](ivec3 pos) const { ASSERT(pos.x >= 0); ASSERT(pos.y >= 0); @@ -86,7 +86,7 @@ public: return this->m_data[n]; } - inline Element &operator [](ivec3 pos) + inline element_t &operator [](ivec3 pos) { ASSERT(pos.x >= 0); ASSERT(pos.y >= 0); @@ -120,7 +120,7 @@ public: { } - inline Element &operator [](int k) + inline element_t &operator [](int k) { ASSERT(k >= 0); ASSERT(k < m_array.m_size.z); @@ -162,7 +162,7 @@ public: { } - inline Element const &operator [](int k) const + inline element_t const &operator [](int k) const { ASSERT(k >= 0); ASSERT(k < m_array.m_size.z); @@ -203,7 +203,7 @@ public: /* Resize the array. * FIXME: data gets scrambled; should we care? */ - inline void SetSize(ivec3 size, Element e = Element()) + inline void SetSize(ivec3 size, element_t e = element_t()) { this->Resize(size.x * size.y * size.z, e); m_size = size; @@ -215,10 +215,10 @@ public: } public: - inline Element *Data() { return Super::Data(); } - inline Element const *Data() const { return Super::Data(); } - inline int Count() const { return Super::Count(); } - inline int Bytes() const { return Super::Bytes(); } + inline element_t *Data() { return super::Data(); } + inline element_t const *Data() const { return super::Data(); } + inline int Count() const { return super::Count(); } + inline int Bytes() const { return super::Bytes(); } private: ivec3 m_size; diff --git a/src/lol/sys/file.h b/src/lol/sys/file.h index f80b6ed6..f3fb73ec 100644 --- a/src/lol/sys/file.h +++ b/src/lol/sys/file.h @@ -72,11 +72,11 @@ public: void Close(); private: - bool GetContent(Array* files, Array* directories); + bool GetContent(array* files, array* directories); public: - bool GetContent(Array& files, Array& directories); - bool GetContent(Array& directories); - bool GetContent(Array& files); + bool GetContent(array& files, array& directories); + bool GetContent(array& directories); + bool GetContent(array& files); String GetName(); static String GetCurrent(); diff --git a/src/lol/sys/init.h b/src/lol/sys/init.h index 74a9fbca..fe2d1b8c 100644 --- a/src/lol/sys/init.h +++ b/src/lol/sys/init.h @@ -52,7 +52,7 @@ extern void Init(int argc, char *argv[], String const &sourcesubdir = LOL_CONFIG_SOURCESUBDIR); extern void AddDataDir(String const &dir); -extern Array GetPathList(String const &file); +extern array GetPathList(String const &file); } /* namespace System */ diff --git a/src/lol/sys/thread.h b/src/lol/sys/thread.h index 5706850e..7ff6d4a6 100644 --- a/src/lol/sys/thread.h +++ b/src/lol/sys/thread.h @@ -103,7 +103,7 @@ protected: bool AddWork(ThreadJob* job); //Fetch Results - bool FetchResult(Array& results); + bool FetchResult(array& results); //Base thread work function static void *BaseThreadWork(void* data); virtual void TickGame(float seconds); @@ -112,11 +112,11 @@ protected: /* Worker threads */ int m_thread_count; - Array m_threads; + array m_threads; Queue m_spawnqueue, m_donequeue; Queue m_jobqueue; Queue m_resultqueue; - Array m_job_dispatch; + array m_job_dispatch; }; //Generic class for thread manager, executes work and store results, for you to use @@ -130,7 +130,7 @@ public: //Work stuff bool AddJob(ThreadJob* job) { return AddWork(job); } - bool GetWorkResult(Array& results) + bool GetWorkResult(array& results) { results += m_job_result; m_job_result.Empty(); @@ -140,7 +140,7 @@ public: protected: virtual void TreatResult(ThreadJob* result) { m_job_result << result; } - Array m_job_result; + array m_job_result; }; #endif diff --git a/src/mesh/mesh.h b/src/mesh/mesh.h index b297763c..b150797a 100644 --- a/src/mesh/mesh.h +++ b/src/mesh/mesh.h @@ -37,7 +37,7 @@ public: void Render(); public: - Array m_submeshes; + array m_submeshes; }; /* @@ -68,10 +68,10 @@ protected: MeshPrimitive m_mesh_prim; Shader *m_shader; VertexDeclaration* m_vdecl; - Array m_vbos; + array m_vbos; IndexBuffer *m_ibo; - Array m_textures; + array m_textures; }; } /* namespace lol */ diff --git a/src/messageservice.cpp b/src/messageservice.cpp index 2932effd..6eb41e4d 100644 --- a/src/messageservice.cpp +++ b/src/messageservice.cpp @@ -79,7 +79,7 @@ bool MessageService::Send(MessageBucket id, const char* message) { ASSERT(0 <= id && (int)id < g_messageservice->m_bucket.Count()); MessageService& g = *g_messageservice; - Array& bucket = g.m_bucket[id]; + array& bucket = g.m_bucket[id]; bucket << MessageList(time(nullptr), String(message)); return true; } @@ -104,7 +104,7 @@ bool MessageService::FetchFirst(MessageBucket id, String& message, time_t& times { ASSERT(0 <= id && (int)id < g_messageservice->m_bucket.Count()); MessageService& g = *g_messageservice; - Array& bucket = g.m_bucket[id]; + array& bucket = g.m_bucket[id]; if (bucket.Count()) { @@ -135,7 +135,7 @@ bool MessageService::FetchAll(MessageBucket id, String& message, time_t& first_t { ASSERT(0 <= id && (int)id < g_messageservice->m_bucket.Count()); MessageService& g = *g_messageservice; - Array& bucket = g.m_bucket[id]; + array& bucket = g.m_bucket[id]; message = String(""); if (bucket.Count()) diff --git a/src/messageservice.h b/src/messageservice.h index ed4011b3..ee2935f3 100644 --- a/src/messageservice.h +++ b/src/messageservice.h @@ -80,7 +80,7 @@ public: static bool FetchAll(MessageBucket id, String& message, time_t &first_timestamp); private: - Array > m_bucket; + array > m_bucket; }; extern MessageService *g_messageservice; diff --git a/src/platform/d3d9/d3d9input.cpp b/src/platform/d3d9/d3d9input.cpp index 2624295d..5c9889d1 100644 --- a/src/platform/d3d9/d3d9input.cpp +++ b/src/platform/d3d9/d3d9input.cpp @@ -35,7 +35,7 @@ class D3d9InputData private: #if defined USE_XINPUT - Array m_joysticks; + array m_joysticks; #endif // USE_XINPUT }; diff --git a/src/platform/nacl/nacl-instance.h b/src/platform/nacl/nacl-instance.h index 7966de84..71fe0dea 100644 --- a/src/platform/nacl/nacl-instance.h +++ b/src/platform/nacl/nacl-instance.h @@ -34,7 +34,7 @@ private: InitViewportSize(); } - Array m_input_events; + array m_input_events; class InputDeviceInternal* m_mouse; class InputDeviceInternal* m_keyboard; diff --git a/src/platform/ps3/ps3input.cpp b/src/platform/ps3/ps3input.cpp index 8755bfe6..6c7c8a54 100644 --- a/src/platform/ps3/ps3input.cpp +++ b/src/platform/ps3/ps3input.cpp @@ -39,7 +39,7 @@ class Ps3InputData friend class Ps3Input; #if defined __CELLOS_LV2__ - Array m_joysticks; + array m_joysticks; vec2 mousepos; ivec3 mousebuttons; diff --git a/src/platform/sdl/sdlinput.cpp b/src/platform/sdl/sdlinput.cpp index 5c0ab569..27ac38c5 100644 --- a/src/platform/sdl/sdlinput.cpp +++ b/src/platform/sdl/sdlinput.cpp @@ -59,7 +59,7 @@ private: m_mousecapture(false) { } - Array m_joysticks; + array m_joysticks; InputDeviceInternal* m_mouse; InputDeviceInternal* m_keyboard; diff --git a/src/platform/xbox/xboxinput.cpp b/src/platform/xbox/xboxinput.cpp index 2cd7888c..2f902f39 100644 --- a/src/platform/xbox/xboxinput.cpp +++ b/src/platform/xbox/xboxinput.cpp @@ -33,7 +33,7 @@ class XboxInputData private: #if defined _XBOX - Array m_joysticks; + array m_joysticks; #endif }; diff --git a/src/sample.cpp b/src/sample.cpp index f61e7eae..c9570c66 100644 --- a/src/sample.cpp +++ b/src/sample.cpp @@ -86,7 +86,7 @@ Sample::Sample(char const *path) data->m_name = String(" ") + path; #if __CELLOS_LV2__ - Array pathlist = System::GetPathList(path); + array pathlist = System::GetPathList(path); File f; for (int i = 0; i < pathlist.Count(); ++i) { @@ -103,7 +103,7 @@ Sample::Sample(char const *path) Log::Error("could not load sample %s\n", path); } #elif defined USE_SDL_MIXER - Array pathlist = System::GetPathList(path); + array pathlist = System::GetPathList(path); for (int i = 0; i < pathlist.Count(); ++i) { data->m_chunk = Mix_LoadWAV(pathlist[i].C()); diff --git a/src/scene.cpp b/src/scene.cpp index 0c4a1e59..cec92794 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -59,30 +59,30 @@ class SceneData private: /* New scenegraph */ - Array m_primitives; + array m_primitives; /* Old API */ float m_new_line_time; int m_new_line_mask; float m_new_line_segment_size; vec4 m_new_line_color; - Array m_lines; + array m_lines; int m_debug_mask; Shader *m_line_shader; VertexDeclaration *m_line_vdecl; int m_tile_cam; - Array m_tiles; - Array m_palettes; - Array m_lights; + array m_tiles; + array m_palettes; + array m_lights; Shader *m_tile_shader; Shader *m_palette_shader; VertexDeclaration *m_tile_vdecl; - Array m_tile_bufs; + array m_tile_bufs; Camera *m_default_cam; - Array m_camera_stack; + array m_camera_stack; }; /* @@ -236,7 +236,7 @@ void Scene::AddLight(Light *l) data->m_lights.Push(l); } -Array const &Scene::GetLights() const +array const &Scene::GetLights() const { return data->m_lights; } @@ -277,8 +277,8 @@ void Scene::RenderPrimitives() u_normalmat = shader->GetUniformLocation("u_normalmat"); /* Per-scene environment */ - Array const &lights = GetLights(); - Array light_data; + array const &lights = GetLights(); + array light_data; /* FIXME: the 4th component of the position can be used for other things */ /* FIXME: GetUniform("blabla") is costly */ @@ -325,7 +325,7 @@ void Scene::RenderTiles() // XXX: rename to Blit() for (int p = 0; p < 2; p++) { Shader *shader = (p == 0) ? data->m_tile_shader : data->m_palette_shader; - Array& tiles = (p == 0) ? data->m_tiles : data->m_palettes; + array& tiles = (p == 0) ? data->m_tiles : data->m_palettes; if (tiles.Count() == 0) continue; @@ -434,7 +434,7 @@ void Scene::RenderLines(float seconds) // XXX: rename to Blit() if (!data->m_line_shader) data->m_line_shader = Shader::Create(LOLFX_RESOURCE_NAME(line)); - Array buff; + array buff; buff.Resize(linecount); int real_linecount = 0; mat4 const inv_view_proj = inverse(g_scene->GetCamera()->GetProjection() * g_scene->GetCamera()->GetView()); diff --git a/src/scene.h b/src/scene.h index 10408aa7..1c3f08eb 100644 --- a/src/scene.h +++ b/src/scene.h @@ -67,7 +67,7 @@ public: void AddLine(vec2 a, vec2 b, vec4 color, float az=-1.f, float bz=-1.f); void AddLight(Light *light); - Array const &GetLights() const; + array const &GetLights() const; private: SceneData *data; diff --git a/src/sys/file.cpp b/src/sys/file.cpp index 67c11780..28be4df5 100644 --- a/src/sys/file.cpp +++ b/src/sys/file.cpp @@ -144,7 +144,7 @@ class FileData String ReadString() { - Array buf; + array buf; buf.Resize(BUFSIZ); String ret; while (IsValid()) @@ -415,7 +415,7 @@ class DirectoryData #endif } - bool GetContentList(Array* files, Array* directories) + bool GetContentList(array* files, array* directories) { if (!IsValid()) return false; @@ -546,9 +546,9 @@ void Directory::Close() } //-- -bool Directory::GetContent(Array* files, Array* directories) +bool Directory::GetContent(array* files, array* directories) { - Array sfiles, sdirectories; + array sfiles, sdirectories; bool found_some = m_data->GetContentList(&sfiles, &sdirectories); if (directories) @@ -563,19 +563,19 @@ bool Directory::GetContent(Array* files, Array* directories) } //-- -bool Directory::GetContent(Array& files, Array& directories) +bool Directory::GetContent(array& files, array& directories) { return GetContent(&files, &directories); } //-- -bool Directory::GetContent(Array& directories) +bool Directory::GetContent(array& directories) { return GetContent(nullptr, &directories); } //-- -bool Directory::GetContent(Array& files) +bool Directory::GetContent(array& files) { return GetContent(&files, nullptr); } diff --git a/src/sys/init.cpp b/src/sys/init.cpp index 3a2aba83..98869122 100644 --- a/src/sys/init.cpp +++ b/src/sys/init.cpp @@ -37,7 +37,7 @@ namespace System # define SEPARATOR '/' #endif -static Array data_dir; +static array data_dir; void Init(int argc, char *argv[], String const &projectdir, @@ -157,9 +157,9 @@ void AddDataDir(String const &dir) data_dir << dir; } -Array GetPathList(String const &file) +array GetPathList(String const &file) { - Array ret; + array ret; for (int i = 0; i < data_dir.Count(); ++i) ret << data_dir[i] + file; diff --git a/src/sys/thread.cpp b/src/sys/thread.cpp index 8bdfb575..69c5f4ab 100644 --- a/src/sys/thread.cpp +++ b/src/sys/thread.cpp @@ -70,7 +70,7 @@ bool BaseThreadManager::AddWork(ThreadJob* job) return false; } -bool BaseThreadManager::FetchResult(Array& results) +bool BaseThreadManager::FetchResult(array& results) { ThreadJob* result; while (m_resultqueue.TryPop(result)) @@ -112,7 +112,7 @@ void BaseThreadManager::TickGame(float seconds) while (m_job_dispatch.Count() > 0 && AddWork(m_job_dispatch.Last())) m_job_dispatch.Pop(); - Array result; + array result; //Fetch and treat results if (FetchResult(result)) { diff --git a/src/ticker.cpp b/src/ticker.cpp index f82c076a..272b1565 100644 --- a/src/ticker.cpp +++ b/src/ticker.cpp @@ -57,8 +57,8 @@ public: private: /* Entity management */ - Array m_todolist, m_autolist; - Array m_list[Entity::ALLGROUP_END]; + array m_todolist, m_autolist; + array m_list[Entity::ALLGROUP_END]; int nentities; /* Fixed framerate management */ diff --git a/src/tileset.cpp b/src/tileset.cpp index 3651a8d6..3f4ddb0f 100644 --- a/src/tileset.cpp +++ b/src/tileset.cpp @@ -45,7 +45,7 @@ private: String m_name; /* Pixels, then texture coordinates */ - Array m_tiles; + array m_tiles; ivec2 m_tile_size, m_image_size, m_texture_size; Image *m_image; @@ -61,7 +61,7 @@ TileSet::TileSet(char const *path) { Init(path); - Array tiles; + array tiles; if (m_data->m_image->RetrieveTiles(tiles)) for (int i = 0; i < tiles.Count(); i++) AddTile(ibox2(tiles[0].m1, tiles[0].m1 + tiles[0].m2)); @@ -72,7 +72,7 @@ TileSet::TileSet(char const *path, Image* image) { Init(path, image); - Array tiles; + array tiles; if (m_data->m_image->RetrieveTiles(tiles)) for (int i = 0; i < tiles.Count(); i++) AddTile(ibox2(tiles[0].m1, tiles[0].m1 + tiles[0].m2)); @@ -102,7 +102,7 @@ TileSet::TileSet(char const *path, ivec2 size, ivec2 count) size * ivec2(i + 1, j + 1))); } - Array tiles; + array tiles; if (m_data->m_image->RetrieveTiles(tiles)) for (int i = 0; i < tiles.Count(); i++) AddTile(ibox2(tiles[i].m1, tiles[i].m1 + tiles[i].m2)); @@ -132,7 +132,7 @@ TileSet::TileSet(char const *path, Image* image, ivec2 size, ivec2 count) size * ivec2(i + 1, j + 1))); } - Array tiles; + array tiles; if (m_data->m_image->RetrieveTiles(tiles)) for (int i = 0; i < tiles.Count(); i++) AddTile(ibox2(tiles[i].m1, tiles[i].m1 + tiles[i].m2)); diff --git a/src/utils.h b/src/utils.h index 9a5c2816..698ad783 100644 --- a/src/utils.h +++ b/src/utils.h @@ -33,7 +33,7 @@ template< class T > inline void Swap( T& A, T& B ) //TODO: random struct //Gets a random Element from the given array, considering you have implemented what follows : //NEEDS : float T::m_weight; //if m_weight is 0, it automatically assumes that this step is ignored. -template< class T > inline int GetRandom(Array src) +template< class T > inline int GetRandom(array src) { float r_total = 0.f; float r_alpha = rand(1.f); diff --git a/src/world.cpp b/src/world.cpp index c56da3dd..57040a51 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -47,7 +47,7 @@ class WorldData char const *filename = lua_tostring(L, 1); int status = LUA_ERRFILE; - Array pathlist = System::GetPathList(filename); + array pathlist = System::GetPathList(filename); File f; for (int i = 0; i < pathlist.Count(); ++i) {