Merge pull request #31 from Gawaboumga/master

Some changes

Former-commit-id: f4ef15537da8edef3881def68dce39f6455f9b94
This commit is contained in:
Lynix 2014-09-03 13:47:39 +02:00
commit c86de3ed7e
6 changed files with 92 additions and 9 deletions

View File

@ -54,6 +54,7 @@
#include <Nazara/Core/InputStream.hpp> #include <Nazara/Core/InputStream.hpp>
#include <Nazara/Core/LockGuard.hpp> #include <Nazara/Core/LockGuard.hpp>
#include <Nazara/Core/Log.hpp> #include <Nazara/Core/Log.hpp>
#include <Nazara/Core/MemoryHelper.hpp>
#include <Nazara/Core/MemoryManager.hpp> #include <Nazara/Core/MemoryManager.hpp>
#include <Nazara/Core/MemoryPool.hpp> #include <Nazara/Core/MemoryPool.hpp>
#include <Nazara/Core/MemoryStream.hpp> #include <Nazara/Core/MemoryStream.hpp>

View File

@ -37,10 +37,10 @@ unsigned int NzLightManager::ComputeClosestLights(const NzVector3f& position, fl
light.score = std::numeric_limits<unsigned int>::max(); // Nous jouons au Golf light.score = std::numeric_limits<unsigned int>::max(); // Nous jouons au Golf
} }
for (unsigned int i = 0; i < m_lights.size(); ++i) for (auto it = m_lights.begin(); it != m_lights.end(); ++it)
{ {
const NzLight** lights = m_lights[i].first; const NzLight** lights = it->first;
unsigned int lightCount = m_lights[i].second; unsigned int lightCount = it->second;
for (unsigned int j = 0; j < lightCount; ++j) for (unsigned int j = 0; j < lightCount; ++j)
{ {

View File

@ -468,7 +468,7 @@ NzVector2ui NzTexture::GetSize() const
if (!m_impl) if (!m_impl)
{ {
NazaraError("Texture must be valid"); NazaraError("Texture must be valid");
return 0; return NzVector2ui(0, 0);
} }
#endif #endif

View File

@ -189,11 +189,9 @@ namespace
void MoveTriangleToEnd(int tri) void MoveTriangleToEnd(int tri)
{ {
auto it = std::find(tri_indices.begin(), tri_indices.end(), tri); auto it = std::find(tri_indices.begin(), tri_indices.end(), tri);
int t_ind = (it != tri_indices.end()) ? std::distance(tri_indices.begin(), it) : -1; NazaraAssert(it != tri_indices.end(), "Triangle not found");
NazaraAssert(t_ind >= 0, "Triangle not found"); tri_indices.erase(it);
tri_indices.erase(tri_indices.begin() + t_ind, tri_indices.begin() + t_ind + 1);
tri_indices.push_back(tri); tri_indices.push_back(tri);
} }
}; };

View File

@ -146,7 +146,7 @@ unsigned int NzUtility::ComponentCount[nzComponentType_Max+1] =
static_assert(nzComponentType_Max+1 == 14, "Component count array is incomplete"); static_assert(nzComponentType_Max+1 == 14, "Component count array is incomplete");
unsigned int NzUtility::ComponentStride[nzComponentType_Max+1] = std::size_t NzUtility::ComponentStride[nzComponentType_Max+1] =
{ {
4*sizeof(nzUInt8), // nzComponentType_Color 4*sizeof(nzUInt8), // nzComponentType_Color
1*sizeof(double), // nzComponentType_Double1 1*sizeof(double), // nzComponentType_Double1

84
writing style.md Normal file
View File

@ -0,0 +1,84 @@
Examples writing-style:
Alphabetical order for everything and try to regroup each methods beginning with the same letter in the header
Class header:
// Copyright (C) 2014 AUTHOR
// This file is part of the "Nazara Engine - MODULE module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_FILENAME_HPP
#define NAZARA_FILENAME_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/NzClass.hpp>
#include <STLHeader>
struct NzPossibleImplementation;
class NAZARA_API NzClassName
{
friend NzClassFriend;
public:
Constructors();
Destructor();
FunctionInAClass();
protected:
private:
NzClass m_variableName;
STL m_variableName;
dataType m_variableName;
NzPossibleImplementation* m_impl;
};
#endif // NAZARA_FILENAME_HPP
Class source:
// Copyright (C) 2014 AUTHOR
// This file is part of the "Nazara Engine - MODULE module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/MODULE/FILENAME.hpp>
#include <Nazara/NzClass.hpp>
#include <STLHeader>
#include <Nazara/MODULE/Debug.hpp>
struct NzPossibleImplementation {};
NzClassName::Constructors() :
m_variableName(init)
{
testsAndOtherInits;
}
NzClassName::PublicFunctions()
NzClassName::ProtectedFunctions()
NzClassName::PrivateFunctions()
Structure:
/!\ enum in Enums.hpp
enum nzEnum
{
nzEnum_1,
nzEnum_2,
nzEnum_Max = nzEnum_2
};
Function:
FunctionName()
{
variableName = init;
}