Improve some fatal error messages

This commit is contained in:
ROllerozxa 2024-05-19 22:20:59 +02:00
commit 5aa4e7bb77
13 changed files with 21 additions and 39 deletions

View file

@ -602,7 +602,7 @@ plug::plug(cable *c)
case CABLE_RED: this->set_material(&m_cable_red); break;
case CABLE_BLACK: this->set_material(&m_cable_black); break;
case CABLE_BLUE: this->set_material(&m_cable_blue); break;
default: tms_fatalf("invalid cable type %d", c->ctype);
default: tms_fatalf("Invalid cable type %d", c->ctype);
}
}

View file

@ -210,7 +210,7 @@ level_chunk::init_chunk_neighbours()
if (this->neighbours[x]) {
this->neighbours[x]->neighbours[7-x] = this;
} else {
//tms_fatalf("DAAAMN NIGGA");
//tms_fatalf("DAAAMN CUTIE");
}
}
}

View file

@ -210,7 +210,7 @@ chunk_preloader::preload_entity()
uint8_t type = w_lb.r_uint8();
switch (type) {
default:
tms_fatalf("invalid property type");
tms_fatalf("Invalid property type");
case P_INT8: w_lb.rp += sizeof(uint8_t); break;
case P_ID: case P_FLT: case P_INT:
w_lb.rp+=sizeof(uint32_t);
@ -511,7 +511,7 @@ chunk_preloader::unload(level_chunk *chunk)
entity *e = i->second;
if (e->type == ENTITY_CABLE) {
tms_fatalf("THIS SHOULD NEVER HAPPEN, CALL FBI");
tms_fatalf("This should never happen!");
}
/* this will destroy all joints created by connections and cables */

View file

@ -288,7 +288,7 @@ command::on_slider_change(int s, float value)
break;
default:
tms_fatalf("not implemented (%d)", this->cmd);
tms_fatalf("Command pad not implemented (%d)", this->cmd);
break;
}
}

View file

@ -477,7 +477,7 @@ my_writer(lua_State *L, const void *contents, size_t size, void *ud)
d->buf = (char*)realloc(d->buf, d->size + size + 1);
if (d->buf == NULL) {
tms_fatalf("Ran out of memory while writing lua state");
tms_fatalf("Ran out of memory while writing Lua state");
return 0;
}

View file

@ -411,11 +411,10 @@ read_cache(lvlbuf *lb)
uint8_t num_channels = lb->r_uint8();
if (width != al->width || height != al->height || num_channels != al->num_channels) {
tms_errorf("Mismatching atlas in texture cache");
tms_infof("%d != %d?", width, al->width);
tms_infof("%d != %d?", height, al->height);
tms_infof("%d != %d?", num_channels, al->num_channels);
tms_fatalf("a");
tms_fatalf("Mismatching atlas in texture cache");
return false;
}

View file

@ -1275,7 +1275,7 @@ tproject_step(void)
_fseek(fp, 0, SEEK_SET);
if (size > 8*1024*1024) {
tms_fatalf("file too big");
tms_fatalf("Puzzle solution file too big");
}
char *buf = (char*)malloc(size);
@ -2243,7 +2243,7 @@ write_memory_cb(void *contents, size_t size, size_t nmemb, void *userp)
mem->memory = (char*)realloc(mem->memory, mem->size + realsize + 1);
if (mem->memory == NULL) {
tms_fatalf("wmc out of memory!");
tms_fatalf("write_memory_cb out of memory!");
return 0;
}

View file

@ -200,7 +200,7 @@ terrain_transaction::apply()
if (chunk->generate_phase >= 5) {
/* XXX XXX XXX */
tms_fatalf("this should never happen, chunk xy: %d %d, dist: %d %d", chunk->pos_x, chunk->pos_y, this->start_x-chunk->pos_x, this->start_y-chunk->pos_y);
tms_fatalf("This should never happen, chunk xy: %d %d, dist: %d %d", chunk->pos_x, chunk->pos_y, this->start_x-chunk->pos_x, this->start_y-chunk->pos_y);
#if 1
chunk->remerge();
@ -555,7 +555,7 @@ level_chunk::generate_phase2(chunk_window *win)
}
if (curr_y > 500) {
tms_fatalf("No! %f %f", (curr_y)*8.f, heights[0]);
tms_fatalf("This shouldn't happen! (terrain generation) %f %f", (curr_y)*8.f, heights[0]);
break;
}

View file

@ -435,10 +435,6 @@ p_text::create_texture()
prev_index = g->parent->index;
}
if (strcmp(this->text, "Basic") == 0) {
//tms_fatalf("asd");
}
//tex->flip_y();
tex->upload();

View file

@ -64,17 +64,15 @@ static const char *tips[] = {
#ifdef TMS_BACKEND_PC
"Press space to quickadd objects by typing parts of their name. For example, press space, type 'cy' and press Enter to add a cylinder. Double-press space to add the last added object.",
#else
//"Use the quickadd button to quickly add your most commonly used objects and search for objects by name",
#endif
"You can copy an object by selecting it and then adding a new object of the same type. All properties, the rotation and the layer will be copied to the new object. For example, select a rotated plank and then add a new plank. The new plank will have the same size and rotation as the previously selected plank. Create another plank and it too will get the same properties.",
"You can copy an object by selecting it and then adding a new object of the same type. All properties, the rotation and the layer will be copied to the new object. For example, select a rotated plank and then add a new plank. The new plank will have the same size and rotation as the previously selected plank. Create another plank and it too will get the same properties.",
"When you publish a level to the community website, a screenshot will be taken at the current position of the camera. Use a Cam Marker to specify an exact location where the screenshot should be taken. Use many Cam Markers to give your level multiple screenshots.",
"When you publish a level to the community website, a screenshot will be taken at the current position of the camera. Use a Cam Marker to specify an exact location where the screenshot should be taken. Use many Cam Markers to give your level multiple screenshots.",
"If you want to automatically activate an RC when the level is started, use the RC Activator object.",
"If you want to automatically activate an RC when the level is started, use the RC Activator object.",
"Building something mechanically advanced? If it gets unstable or wobbly, try increasing physics iterations count in the Level Properties dialog. The velocity iterations number will affect joint parts (motors, linear motors, etc), while position iterations affects at what precision objects collide and interact, roughly speaking."
"Building something mechanically advanced? If it gets unstable or wobbly, try increasing physics iterations count in the Level Properties dialog. The velocity iterations number will affect joint parts (motors, linear motors, etc), while position iterations affects at what precision objects collide and interact, roughly speaking."
};
static const int num_tips = sizeof(tips)/sizeof(char*);

View file

@ -4805,11 +4805,7 @@ save_setting_row(struct table_setting_row *r)
break;
default:
#ifdef DEBUG
tms_fatalf("Unknown row type: %d", row.type);
#else
tms_errorf("Unknown row type: %d", row.type);
#endif
break;
}
}
@ -4829,11 +4825,7 @@ load_setting_row(struct table_setting_row *r)
break;
default:
#ifdef DEBUG
tms_fatalf("Unknown row type: %d", row.type);
#else
tms_errorf("Unknown row type: %d", row.type);
#endif
break;
}
}
@ -4853,11 +4845,7 @@ create_setting_row_widget(struct table_setting_row *r)
break;
default:
#ifdef DEBUG
tms_fatalf("Unknown row type: %d", row.type);
#else
tms_errorf("Unknown row type: %d", row.type);
#endif
tms_errorf("Unknown row type: %d", row.type);
break;
}
}
@ -11502,7 +11490,7 @@ static void wait_ui_ready()
SDL_LockMutex(ui_lock);
if (!ui_ready) {
SDL_CondWaitTimeout(ui_cond, ui_lock, 4000);
if (!ui_ready) tms_fatalf("could not initialize game");
if (!ui_ready) tms_fatalf("Could not initialise game (GTK not ready)");
}
SDL_UnlockMutex(ui_lock);
}

View file

@ -2632,7 +2632,7 @@ world::load_partial(uint32_t id, b2Vec2 position,
_fseek(fp, 0, SEEK_SET);
if (size > 8*1024*1024)
tms_fatalf("file too big");
tms_fatalf("Partial too big");
this->lb.reset();
this->lb.size = 0;
@ -2688,7 +2688,8 @@ world::open(int id_type, uint32_t id, bool paused, bool sandbox, uint32_t save_i
_fseek(fp, 0, SEEK_SET);
if (size > 8*1024*1024) {
tms_fatalf("file too big");
// XXX: Is this necessary? can we support larger levels
tms_fatalf("Level file too big");
}
this->lb.reset();

View file

@ -327,7 +327,7 @@ int main(int argc, char **argv)
#endif
if (_tms.screen == 0)
tms_fatalf("context has no initial screen, bailing out");
tms_fatalf("Context has no initial screen!");
do {
int i;