mirror of
https://github.com/rwengine/openrw.git
synced 2024-09-18 16:32:32 +02:00
More nullptr
This commit is contained in:
parent
cf5efb9560
commit
2aa6d3b3b3
@ -24,7 +24,7 @@ SoundManager::SoundManager() {
|
||||
SoundManager::~SoundManager() {
|
||||
// De-initialize OpenAL
|
||||
if (alContext) {
|
||||
alcMakeContextCurrent(NULL);
|
||||
alcMakeContextCurrent(nullptr);
|
||||
alcDestroyContext(alContext);
|
||||
}
|
||||
|
||||
@ -32,13 +32,13 @@ SoundManager::~SoundManager() {
|
||||
}
|
||||
|
||||
bool SoundManager::initializeOpenAL() {
|
||||
alDevice = alcOpenDevice(NULL);
|
||||
alDevice = alcOpenDevice(nullptr);
|
||||
if (!alDevice) {
|
||||
RW_ERROR("Could not find OpenAL device!");
|
||||
return false;
|
||||
}
|
||||
|
||||
alContext = alcCreateContext(alDevice, NULL);
|
||||
alContext = alcCreateContext(alDevice, nullptr);
|
||||
if (!alContext) {
|
||||
RW_ERROR("Could not create OpenAL context!");
|
||||
return false;
|
||||
@ -102,7 +102,7 @@ void SoundManager::SoundSource::loadFromFile(const std::string& filename) {
|
||||
codecContext->codec = codec;
|
||||
|
||||
// Open the codec
|
||||
if (avcodec_open2(codecContext, codecContext->codec, NULL) != 0) {
|
||||
if (avcodec_open2(codecContext, codecContext->codec, nullptr) != 0) {
|
||||
av_frame_free(&frame);
|
||||
avformat_close_input(&formatContext);
|
||||
RW_ERROR("Couldn't open the audio codec context");
|
||||
|
@ -129,7 +129,7 @@ bool LoaderIDE::load(const std::string &filename, const PedStatsList &stats) {
|
||||
cars->level_ = std::atoi(buff.c_str());
|
||||
|
||||
getline(strstream, buff, ',');
|
||||
cars->componentrules_ = std::stoul(buff, 0, 16);
|
||||
cars->componentrules_ = std::stoul(buff, nullptr, 16);
|
||||
|
||||
switch (cars->vehicletype_) {
|
||||
case VehicleModelInfo::CAR:
|
||||
|
@ -37,7 +37,7 @@ public:
|
||||
btVehicleRaycasterResult& result) override {
|
||||
ClosestNotMeRayResultCallback rayCallback(
|
||||
_vehicle->collision->getBulletBody(), from, to);
|
||||
const void* res = 0;
|
||||
const void* res = nullptr;
|
||||
|
||||
_world->rayTest(from, to, rayCallback);
|
||||
|
||||
|
@ -115,13 +115,13 @@ GameRenderer::GameRenderer(Logger* log, GameData* _data)
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, fbTextures[0]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 128, 128, 0, GL_RGBA,
|
||||
GL_UNSIGNED_BYTE, NULL);
|
||||
GL_UNSIGNED_BYTE, nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, fbTextures[1]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_R16F, 128, 128, 0, GL_RED, GL_FLOAT,
|
||||
NULL);
|
||||
nullptr);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
@ -705,10 +705,10 @@ void GameRenderer::setViewport(int w, int h) {
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, fbTextures[0]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, w, h, 0, GL_RGB,
|
||||
GL_UNSIGNED_BYTE, NULL);
|
||||
GL_UNSIGNED_BYTE, nullptr);
|
||||
glBindTexture(GL_TEXTURE_2D, fbTextures[1]);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_R16F, w, h, 0, GL_RED, GL_FLOAT,
|
||||
NULL);
|
||||
nullptr);
|
||||
|
||||
glBindRenderbuffer(GL_RENDERBUFFER, fbRenderBuffers[0]);
|
||||
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, w, h);
|
||||
|
@ -16,7 +16,7 @@ constexpr GLuint kUBOIndexDraw = 2;
|
||||
|
||||
GLuint compileShader(GLenum type, const char* source) {
|
||||
GLuint shader = glCreateShader(type);
|
||||
glShaderSource(shader, 1, &source, NULL);
|
||||
glShaderSource(shader, 1, &source, nullptr);
|
||||
glCompileShader(shader);
|
||||
|
||||
GLint status;
|
||||
@ -30,7 +30,7 @@ GLuint compileShader(GLenum type, const char* source) {
|
||||
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &len);
|
||||
if (len > 1) {
|
||||
GLchar* buffer = new GLchar[len];
|
||||
glGetShaderInfoLog(shader, len, NULL, buffer);
|
||||
glGetShaderInfoLog(shader, len, nullptr, buffer);
|
||||
|
||||
GLint sourceLen;
|
||||
glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &sourceLen);
|
||||
@ -79,7 +79,7 @@ GLuint compileProgram(const char* vertex, const char* fragment) {
|
||||
glGetProgramiv(prog, GL_INFO_LOG_LENGTH, &len);
|
||||
if (len > 1) {
|
||||
GLchar* buffer = new GLchar[len];
|
||||
glGetProgramInfoLog(prog, len, NULL, buffer);
|
||||
glGetProgramInfoLog(prog, len, nullptr, buffer);
|
||||
|
||||
RW_ERROR("[OGL] Program InfoLog(" << prog << "):\n"
|
||||
<< buffer);
|
||||
@ -376,7 +376,7 @@ bool OpenGLRenderer::createUBO(Buffer &out, GLsizei size, GLsizei entrySize)
|
||||
{
|
||||
glGenBuffers(1, &out.name);
|
||||
glBindBuffer(GL_UNIFORM_BUFFER, out.name);
|
||||
glBufferData(GL_UNIFORM_BUFFER, size, NULL, GL_STREAM_DRAW);
|
||||
glBufferData(GL_UNIFORM_BUFFER, size, nullptr, GL_STREAM_DRAW);
|
||||
|
||||
if (entrySize != size) {
|
||||
GLint UBOAlignment;
|
||||
@ -399,7 +399,7 @@ void OpenGLRenderer::uploadUBOEntry(Buffer &buffer, const void *data, size_t siz
|
||||
RW_ASSERT(size <= buffer.entrySize);
|
||||
if (buffer.currentEntry >= buffer.entryCount) {
|
||||
// Orphan the buffer, we don't want it anymore
|
||||
glBufferData(GL_UNIFORM_BUFFER, buffer.bufferSize, NULL,
|
||||
glBufferData(GL_UNIFORM_BUFFER, buffer.bufferSize, nullptr,
|
||||
GL_STREAM_DRAW);
|
||||
buffer.currentEntry = 0;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ int main(int argc, char* argv[]) {
|
||||
logger.error("exception", ex.what());
|
||||
|
||||
if (SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, kErrorTitle,
|
||||
ex.what(), NULL) < 0) {
|
||||
ex.what(), nullptr) < 0) {
|
||||
SDL_Log("Failed to show message box\n");
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ GeometryPtr LoaderDFF::readGeometry(const RWBStream &stream) {
|
||||
size_t icount = std::accumulate(
|
||||
geom->subgeom.begin(), geom->subgeom.end(), 0u,
|
||||
[](size_t a, const SubGeometry &b) { return a + b.numIndices; });
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(uint32_t) * icount, 0,
|
||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(uint32_t) * icount, nullptr,
|
||||
GL_STATIC_DRAW);
|
||||
for (auto &sg : geom->subgeom) {
|
||||
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, sg.start * sizeof(uint32_t),
|
||||
|
@ -113,7 +113,7 @@ char* LoaderSDT::loadToMemory(size_t index, bool asWave) {
|
||||
fclose(fp);
|
||||
return raw_data;
|
||||
} else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/// Writes the contents of assetname to filename
|
||||
|
Loading…
Reference in New Issue
Block a user