Attack fleet movement always on top.

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • Attack fleet movement always on top.

      Hello guys, I want to ask basic question, are there any way how to make that when player get attacked the fleet movement of attack is always the first and in top of an array. For example if you are attacked and then move your fleet away from planet the attack fleet movement will become second in the array. But I want to make that It is always on top as the most important.
    • in the mysql statment you can use orderby mission, time, then they get sortet by mission and secondary by time
      but this is not exactly what u want
      you colud also sort the array via php , as a loop
      sort out the attackmissions and other ones, them push the othermissions-array to the attackmissions array.


      PHP Source Code

      1. $attacks = array();
      2. $other = array();
      3. foreach($fleetarray as $key => $value){
      4. if($value['mission'] == attacknumber){
      5. $attacks[] = $value;
      6. }else{
      7. $other[] = $value
      8. }
      9. }
      10. array_push($attacks, ...$other)
      11. $fleetarray = $attacks;
      Display All

      it's just a sponanius idea, there are probably smarter ways to get them sorted directly from the db, may nested selects or something, or by using some array-sort-functions of php.