ogamespec / ogame-opensource

This is revived OGame v 0.84 with old design.
Creative Commons Zero v1.0 Universal
87 stars 41 forks source link

Moon Destruction & Deploy #114

Closed ogamespec closed 5 months ago

ogamespec commented 7 months ago

I found a bug about moon destruction. when the moon is destroyed if you have the fleet on a mission deployment on that moon it is not diverted to the planet but returns to the planet of origin

by Quaua.

Check.

ogamespec commented 7 months ago

by Quaua:

I should have managed to fix it, but now the returning black deaths no longer show that they are returning from [::] but it takes the planet back to where the moon was, but I saw that they still don't appear in phalanxes. in any case now it no longer causes the fleets to retreat towards the destroyed moon but they all divert to the planet

function DestroyMoon ($moon_id, $when, $fleet_id)
{
    global $db_prefix;

    $moon = GetPlanet ( $moon_id );
    $planet = LoadPlanet ( $moon['g'], $moon['s'], $moon['p'], 1 );
    if ( $moon == NULL || $planet == NULL ) return;

    // Развернуть флоты летящие на луну
    $query = "SELECT * FROM ".$db_prefix."fleet WHERE target_planet = $moon_id AND mission = 9 AND fleet_id <> $fleet_id;";
    $result = dbquery ( $query );
    $rows = dbrows ($result);
    while ( $rows-- )
    {
        $fleet_obj = dbarray ( $result );
        RecallFleet ( $fleet_obj['fleet_id'], $when );
    }
    // Перенаправить возвращающиеся и улетающие флоты на планету.
    $query1 = "UPDATE ".$db_prefix."fleet SET target_planet = ".$planet['planet_id']." WHERE target_planet = $moon_id;";
    dbquery ( $query1 );
    $query = "UPDATE ".$db_prefix."fleet SET start_planet = ".$planet['planet_id']." WHERE start_planet = $moon_id;";
    dbquery ( $query );

    // Модифицировать статистику игрока
    $pp = PlanetPrice ($moon);
    AdjustStats ( $moon['owner_id'], $pp['points'], $pp['fpoints'], 0, '-' );
    RecalcRanks ();

    // Всё остальное уничтожается безвозвратно
    DestroyPlanet ( $moon_id );

    // Сделать текущей планетой - планету под уничтоженной луной
    SelectPlanet ( $planet['owner_id'], $planet['planet_id'] );
}
ogamespec commented 7 months ago

Quaua — fixed. now the black deaths return correctly from the moon [::], they are recalled after the moon is destroyed and the deploying fleets that were on the destroyed moon are no longer recalled but diverted to the planet

// Уничтожить луну, развернуть флоты, модифицировать статистику игрока.
// fleet_id - ID флота уничтожившего луну. Разворот этого флота контролируется боевым движком.
function DestroyMoon ($moon_id, $when, $fleet_id)
{
    global $db_prefix;

    $moon = GetPlanet ( $moon_id );
    $planet = LoadPlanet ( $moon['g'], $moon['s'], $moon['p'], 1 );
    if ( $moon == NULL || $planet == NULL ) return;

    // Развернуть флоты летящие на луну
    $query = "SELECT * FROM ".$db_prefix."fleet WHERE target_planet = $moon_id AND mission = 9 AND fleet_id <> $fleet_id;";
    $result = dbquery ( $query );
    $rows = dbrows ($result);
    while ( $rows-- )
    {
        $fleet_obj = dbarray ( $result );
        RecallFleet ( $fleet_obj['fleet_id'], $when );
    }
    // Перенаправить возвращающиеся и улетающие флоты на планету.
    $query1 = "UPDATE ".$db_prefix."fleet SET target_planet = ".$planet['planet_id']." WHERE mission < 100 AND target_planet = $moon_id;";
    dbquery ( $query1 );
    $query = "UPDATE ".$db_prefix."fleet SET start_planet = ".$planet['planet_id']." WHERE start_planet = $moon_id;";
    dbquery ( $query );

    // Модифицировать статистику игрока
    $pp = PlanetPrice ($moon);
    AdjustStats ( $moon['owner_id'], $pp['points'], $pp['fpoints'], 0, '-' );
    RecalcRanks ();

    // Всё остальное уничтожается безвозвратно
    DestroyPlanet ( $moon_id );

    // Сделать текущей планетой - планету под уничтоженной луной
    SelectPlanet ( $planet['owner_id'], $planet['planet_id'] );
}
ogamespec commented 5 months ago
$LOCA["en"]["CHANGELOG_0.78a"] =
    "New:\n" .
    "- Fusion power plant: new formula for energy generation: 30 * Fusion level* (1.05 + energy tech level * 0.01) ^ Fusion level<br />\n" .
    "- Moons can be attacked by interplanetary missiles. Interceptor missiles from a planet can defend the moon<br />\n" .
    "- RSS for commanders<br />\n" .
    "- Message when the offer to become friends is withdrawn<br />\n" .
    "- Averages in the empire view<br />\n\n" .
    "Fixed bugs:\n" .
    "- Improved game speed in universes<br />\n" .
    "- Intelligence can be shared with the alliance again<br />\n" .
    "- Coordinates with link in combat reports<br />\n" .
    "- Phalanx no longer shows returning fleets of other players<br />\n" .
    "- Defensive structures are displayed even without the presence of a shipyard<br />\n" .
    "- It is possible to hold at 0 hours again<br />\n" .
    "- Fixed an error when destroying the moon<br />\n\n" .
    "When the moon is destroyed:\n" .
    "- Own fleets flying to the moon are flying to the planet<br />\n" .
    "- All other fleets flying to the moon return to the start planet"

When the moon is destroyed: