table.cpp fix
This commit is contained in:
parent
6e7cd26e28
commit
55bbf876f8
|
|
@ -34,8 +34,7 @@ int screenMain(Config &conf){
|
||||||
win = SDL_CreateWindow("The Journal", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SDL_WINDOW_RESIZABLE | SDL_WINDOW_TRANSPARENT);
|
win = SDL_CreateWindow("The Journal", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SDL_WINDOW_RESIZABLE | SDL_WINDOW_TRANSPARENT);
|
||||||
|
|
||||||
if (!win){
|
if (!win){
|
||||||
snprintf(msg, sizeof msg, "Error creating window: %s", SDL_GetError());
|
crash(Exception::MEOW, "Error creating window: %s", SDL_GetError());
|
||||||
crash(msg, Exception::MEOW, false);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -142,7 +142,6 @@ static void setupShaderSource(GLuint shader, GLenum type, const unsigned char *b
|
||||||
|
|
||||||
void Shader::init(const unsigned char *vert, int vertSize, const unsigned char *frag, int fragSize, const char *vertName, const char *fragName, const char *programName) {
|
void Shader::init(const unsigned char *vert, int vertSize, const unsigned char *frag, int fragSize, const char *vertName, const char *fragName, const char *programName) {
|
||||||
GLint success;
|
GLint success;
|
||||||
char msg[512];
|
|
||||||
|
|
||||||
/* Compile vertex shader */
|
/* Compile vertex shader */
|
||||||
setupShaderSource(vertShader, GL_VERTEX_SHADER, vert, vertSize);
|
setupShaderSource(vertShader, GL_VERTEX_SHADER, vert, vertSize);
|
||||||
|
|
@ -152,8 +151,7 @@ void Shader::init(const unsigned char *vert, int vertSize, const unsigned char *
|
||||||
|
|
||||||
if (!success){
|
if (!success){
|
||||||
printShaderLog(vertShader);
|
printShaderLog(vertShader);
|
||||||
snprintf(msg, sizeof msg, "GLSL: An error occured while compiling vertex shader '%s' in program '%s'", vertName, programName);
|
crash(Exception::MKXPError, "GLSL: An error occured while compiling vertex shader '%s' in program '%s'", vertName, programName);
|
||||||
crash(msg, Exception::MKXPError ,true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compile fragment shader */
|
/* Compile fragment shader */
|
||||||
|
|
@ -164,8 +162,7 @@ void Shader::init(const unsigned char *vert, int vertSize, const unsigned char *
|
||||||
|
|
||||||
if (!success){
|
if (!success){
|
||||||
printShaderLog(fragShader);
|
printShaderLog(fragShader);
|
||||||
snprintf(msg, sizeof msg, "GLSL: An error occured while compiling fragment shader '%s' in program '%s'", fragName, programName);
|
crash(Exception::MKXPError, "GLSL: An error occured while compiling fragment shader '%s' in program '%s'", fragName, programName);
|
||||||
crash(msg, Exception::MKXPError, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Link shader program */
|
/* Link shader program */
|
||||||
|
|
@ -182,8 +179,7 @@ void Shader::init(const unsigned char *vert, int vertSize, const unsigned char *
|
||||||
|
|
||||||
if (!success){
|
if (!success){
|
||||||
printProgramLog(program);
|
printProgramLog(program);
|
||||||
snprintf(msg, sizeof msg, "GLSL: An error occured while linking program '%s' (vertex '%s', fragment '%s')", programName, vertName, fragName);
|
crash(Exception::MKXPError, "GLSL: An error occured while linking program '%s' (vertex '%s', fragment '%s')", programName, vertName, fragName);
|
||||||
crash(msg, Exception::MKXPError, true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ void Table::serialize(char *buffer) const{
|
||||||
|
|
||||||
Table *Table::deserialize(const char *data, int len){
|
Table *Table::deserialize(const char *data, int len){
|
||||||
if (len < 20)
|
if (len < 20)
|
||||||
crash("Marshal: Table: bad file format", Exception::RGSSError, true);
|
crash(Exception::RGSSError, "Marshal: Table: bad file format");
|
||||||
|
|
||||||
readInt32(&data);
|
readInt32(&data);
|
||||||
int x = readInt32(&data);
|
int x = readInt32(&data);
|
||||||
|
|
@ -123,10 +123,10 @@ Table *Table::deserialize(const char *data, int len){
|
||||||
int size = readInt32(&data);
|
int size = readInt32(&data);
|
||||||
|
|
||||||
if (size != x*y*z)
|
if (size != x*y*z)
|
||||||
crash("Marshal: Table: bad file format", Exception::RGSSError, true);
|
crash(Exception::RGSSError, "Marshal: Table: bad file format");
|
||||||
|
|
||||||
if (len != 20 + x*y*z*2)
|
if (len != 20 + x*y*z*2)
|
||||||
crash("Marshal: Table: bad file format", Exception::RGSSError, true);
|
crash(Exception::RGSSError, "Marshal: Table: bad file format");
|
||||||
|
|
||||||
Table *t = new Table(x, y, z);
|
Table *t = new Table(x, y, z);
|
||||||
memcpy(dataPtr(t->data), data, sizeof(int16_t)*size);
|
memcpy(dataPtr(t->data), data, sizeof(int16_t)*size);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue