XGProyect / XG-Proyect-v3.x.x

XG Proyect is an OGame clone open-source web application framework designed for creating game clones, particularly those inspired by the popular game OGame, set in a vast and captivating space-themed universe.
https://xgproyect.org
GNU General Public License v3.0
149 stars 101 forks source link

Bug in research #560

Closed minideveloper1778 closed 1 year ago

minideveloper1778 commented 1 year ago

Hello!

ran into a research problem. If there is a research laboratory in the construction queue, the research cannot be completed.

screenshots: queue research

jonamix-ar commented 1 year ago

I understand the bug, if when you put the research laboratory in the construction queue, it lets you investigate, but in turn it is not a bug because when you press investigate while the laboratory is still in the queue, its construction is cancelled. I just tried it in pioneer I put a building and the laboratory in the queue and pressed an investigation, while if I was investigating the laboratory it got out of the construction queue when the building finished being built

Basically it is not a bug, but in ogame they changed the alert function now if you investigate and you have the laboratory in the construction queue its construction is canceled

LucasKovacs commented 1 year ago

So the alert needs to be removed? Functionality is ok?

jonamix-ar commented 1 year ago

RTA: 1 - The blocking function works well as it should, so you can't build the lab when researching. RTA: 2 - The message is deleted only appears in the inputs, what we can do is block the input build and leave a message is being investigated in the style of domes.

THIS ITS BUILDING LAB image

Research tooltip image

Research input image

Building lab in colony image

THIS IT'S REVERSE IMG image

Labs blocked its reserching image

Lab info image

Research labs in other planet whit intergalactic network image

jonamix-ar commented 1 year ago

Lo que si encontre en la 3.5 image

Deberia estar bloqueado. image

Encontre el bug

private function isLaboratoryInQueue()
    {
        $return = true;
        $current_building = '';
        $element_id = 0;

        if ($this->planet['planet_b_building_id'] != 0) {
            $current_queue = $this->planet['planet_b_building_id'];

            if (strpos($current_queue, ';')) {
                $queue = explode(';', $current_queue);

                for ($i = 0; $i < MAX_BUILDING_QUEUE_SIZE; $i++) {
                    if (isset($queue[$i])) {
                        $element_data = explode(',', $queue[$i]);
                        $element_id = $element_data[0];

                        if ($element_id == 31) {
                            break;
                        }
                    }
                }
            } else {
                $current_building = $current_queue;
            }

            if ($current_building == 31 or $element_id == 31) {
                $return = false;
            }
        }

        return $return;
    }

$queue = explode(';', $current_queue); ---> el explode tiene un ; y en la db esta con, "31,4,314.18181818182,1687124721.1818,build"

Lo que no entiendo por que cuando insertas la Construccion a la db la coloca con coma y los explode tan todos con ;

@LucasKovacs

LucasKovacs commented 1 year ago

Puede ser un bug. En un momento hice una revisión, y puede ser que me haya faltado cambiar algo. La verdad es que eso necesita volverse a hacer usando la clase Queue

LucasKovacs commented 1 year ago

Mirando de nuevo. El ; separa cada ítem, y la , separa los detalles de cada ítem.

LucasKovacs commented 1 year ago

I sent a fix that correctly checks the queue. Can you check if that's enough? Or do we need other fix for it?

jonamix-ar commented 1 year ago

I sent a fix that correctly checks the queue. Can you check if that's enough? Or do we need other fix for it?

Working perfect again reseach blocked whit lab upgrading.

LucasKovacs commented 1 year ago

Closed as fixed. XGP 3.5