computer.cpp
case COMPACT_MISS_LAUNCH:
As I understand missile silo bug has been in the game for a few years now. There are actually three things this part of the code is supposed to do, and only one of them works, which is launching a nuke. What is not working, and can also screw the map or crash the game, is formation of nuke gas and removal of the missile from the silo after the launch.
Here is how to fix all that:
case COMPACT_MISS_LAUNCH: {
// Target Acquisition.
point target = g->cur_om.choose_point(g, 0);
if (target.x == -1) {
// print_line("Launch canceled.");
g->add_msg("Target Acquisition canceled");
return;
}
if(query_yn("Confirm nuclear missile launch."))
{
//CAT-s: rocket
playSound(61);
g->add_msg("Nuclear missile launched!");
}
else
{
g->add_msg("Nuclear missile launched aborted.");
return;
}
// g->add_msg("x: %d, y: %d", g->u.posx, g->u.posy);
g->refresh_all();
//CAT-mgs: quick replacement
for(int i= g->u.posx +8; i < g->u.posx +15; i++)
{
for(int j= g->u.posy +3; j < g->u.posy +12; j++)
{
if(one_in(4))
g->explosion(i+rng(-1,1), j+rng(-1,1), rng(4,10), 0, true);
else
g->m.add_field(NULL, i+rng(-2,2), j+rng(-2,2), fd_nuke_gas, rng(1,9));
}
}
//CAT-mgs: not working vvv
//...ERASE MISSILE, OPEN SILO, DISABLE COMPUTER
// For each level between here and the surface, remove the missile
for (int level = g->levz; level <= 0; level++)
{
//CAT-mg: fix 1
map tmpmap(&g->itypes, &g->mapitems, &g->traps);
tmpmap.load(g, g->levx, g->levy, level, false);
if(level < 0)
tmpmap.translate(t_missile, t_hole);
else
if(level == 0)
tmpmap.translate(t_metal_floor, t_hole);
//CAT-mg: fix 2
tmpmap.save(&g->cur_om, g->turn, g->levx, g->levy, level);
}
for(int x = target.x - 2; x <= target.x + 2; x++)
{
for(int y = target.y - 2; y <= target.y + 2; y++)
g->nuke(x, y);
}
activate_failure(g, COMPFAIL_SHUTDOWN);
} break;
I added fires and launch explosions animation beside nuke gas, and also for surface hatch to get open.