jhaagsma / ee_npc

Earth Empires Non-Player-Country Project!
6 stars 7 forks source link

Remove unnecessary updatemain and update_c calls on ai servers #21

Open jobbish-sql opened 3 years ago

jobbish-sql commented 3 years ago

Sometimes we do full updates of the $c object just in case we got out of sync. Ideally, we would only do this at the start of turns and when we run into an unexpected condition. To find the situations where we can get out of sync, we should prevent code like this from running on the ai servers only:

    if (!$c->turns % 5) {                   //Grab new copy every 5 turns
        $c->updateMain(); //we probably don't need to do this *EVERY* turn
    }