| 250 | } |
| 251 | |
| 252 | static void _post_init(bool newc) |
| 253 | { |
| 254 | ASSERT(strwidth(you.your_name) <= MAX_NAME_LENGTH); |
| 255 | |
| 256 | // XXX: now that the player is loaded, do a layout. |
| 257 | // This is necessary to ensure that the message window is positioned, in |
| 258 | // case there are any early game warning messages to be logged. |
| 259 | #ifdef USE_TILE |
| 260 | tiles.resize(); |
| 261 | |
| 262 | #ifdef USE_TILE_WEB |
| 263 | if (!newc) |
| 264 | sync_last_milestone(); |
| 265 | #endif |
| 266 | #endif |
| 267 | |
| 268 | clua.load_persist(); |
| 269 | |
| 270 | // Load macros |
| 271 | macro_init(); |
| 272 | |
| 273 | crawl_state.need_save = crawl_state.game_started = true; |
| 274 | crawl_state.last_type = crawl_state.type; |
| 275 | crawl_state.marked_as_won = false; |
| 276 | |
| 277 | destroy_abyss(); |
| 278 | |
| 279 | calc_hp(); |
| 280 | calc_mp(); |
| 281 | shopping_list.refresh(); |
| 282 | populate_sets_by_obj_type(); |
| 283 | |
| 284 | run_map_local_preludes(); |
| 285 | |
| 286 | if (newc) |
| 287 | { |
| 288 | // n.b. temple already generated in setup_game at this point |
| 289 | if (Options.pregen_dungeon == level_gen_type::full |
| 290 | && crawl_state.game_has_random_floors()) |
| 291 | { |
| 292 | pregen_dungeon(level_id(NUM_BRANCHES, -1)); |
| 293 | } |
| 294 | |
| 295 | you.entering_level = false; |
| 296 | you.transit_stair = DNGN_UNSEEN; |
| 297 | you.depth = starting_absdepth() + 1; |
| 298 | you.where_are_you = root_branch; |
| 299 | if (you.depth > 1) |
| 300 | set_shafted(); |
| 301 | } |
| 302 | |
| 303 | // XXX: Any invalid level_id should do. |
| 304 | level_id old_level; |
| 305 | old_level.branch = NUM_BRANCHES; |
| 306 | |
| 307 | #ifdef USE_TILE_WEB |
| 308 | if (tiles.get_ui_state() == UI_CRT) |
| 309 | tiles.set_ui_state(UI_NORMAL); |
no test coverage detected