[Freeciv-Dev] Re: [PATCH] Improvement effects speedup (PR#1094)
[Top] [All Lists]
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
 
On Mon, 14 Jan 2002, Vasco Alexandre Da Silva Costa wrote:
> On Mon, 14 Jan 2002, Raimar Falke wrote:
> 
> > On Wed, Dec 05, 2001 at 12:17:05PM -0800, Ben Webb wrote:
> > 
> > What is the status of this patch? Has it been superseded?
> 
> I would like to merge this with fixes to speed up the city report dialog.
> The problem is the same and the solution can be the same.
> That's why this hasn't been committed yet.
Actually, there are two distinct problems:
1. update_all_effects() is currently called whenever a city_info, 
   short_city or game_info packet is received. In reality, updates are 
   only required if these packets add or remove improvements/Wonders.
2. On loading a savegame, or during a turn update, many cities may build 
   or sell improvements. Since update_all_effects() currently updates, er, 
   "all" effects, it makes sense to call it only once, rather than for 
   each city which has changed its list of improvements.
        I believe the "city report dialog speedup" issue is the same as 
(2) here, but (1) is a large contributor to the problem, and should, 
IMHO, be applied ASAP. This can be resolved by applying the patch minus 
the "do_deferred_effect_updates" portion, such that the try_update_effects 
function reads
static void try_update_effects(int need_effect_update)
{
  if (need_effect_update) {
    update_all_effects();
  }
}
If desired, I can split this patch and post it.
P.S. I set out to use the START_TURN packet to signal "all deferred effect 
     updates should now be performed" for (2) since this seemed to be the 
     purpose of the packet. However, I found I had to add extra handling 
     to handle_game_state() and handle_new_year(), since the START_TURN 
     packet does not seem to get sent under all circumstances (e.g. 
     restarting from a savegame, reconnecting to a running game, etc.) Can 
     the START_TURN packet be sent under these circumstances too, or would 
     this break agents? If the latter, perhaps we could add a suitable "do 
     all updates at start of turn" packet.
        Ben
-- 
ben@xxxxxxxxxxxxxxxxxxxxxx           http://bellatrix.pcl.ox.ac.uk/~ben/
"I have nothing to do to-day. My practice is never very absorbing."
        - Sir Arthur Conan Doyle
 
- [Freeciv-Dev] Re: [PATCH] Improvement effects speedup (PR#1094), Raimar Falke, 2002/01/14
- [Freeciv-Dev] Re: [PATCH] Improvement effects speedup (PR#1094), Ben Webb, 2002/01/14
 
- [Freeciv-Dev] Re: [PATCH] Improvement effects speedup (PR#1094),
Ben Webb <=
 
- [Freeciv-Dev] Re: [PATCH] Improvement effects speedup (PR#1094), Vasco Alexandre Da Silva Costa, 2002/01/14
 
- [Freeciv-Dev] Re: [PATCH] Improvement effects speedup (PR#1094), Ben Webb, 2002/01/15
 
- [Freeciv-Dev] Re: [PATCH] Improvement effects speedup (PR#1094), Vasco Alexandre Da Silva Costa, 2002/01/15
 
- [Freeciv-Dev] Re: [PATCH] Improvement effects speedup (PR#1094), Ben Webb, 2002/01/21
 
  
 
 
 
 | 
 |