[Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
> On Sat, Dec 01, 2001 at 07:36:00PM +0000, Gregory Berkolaiko wrote:
> >
> > more to follow.
another patch in the wall.
It fixes one non-obvious bug in generate_warmap and removes redundant
initialisations. It might even make things faster.
G.
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page from News and Sport to Email and
Music Charts
http://uk.my.yahoo.com ? rfile1
? rfile2
? saves
Index: server/gotohand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gotohand.c,v
retrieving revision 1.123
diff -u -r1.123 gotohand.c
--- server/gotohand.c 2001/12/02 13:30:38 1.123
+++ server/gotohand.c 2001/12/02 16:40:40
@@ -377,9 +377,16 @@
(punit ? unit_type(punit)->name : "NULL"));
if (punit) {
+ /* Checking for warmap in existence.
+ * If the previous warmap was for a city and our unit is
+ * in that city, use city's warmap. */
if (pcity && pcity == warmap.warcity)
return;
- if (warmap.warunit == punit && !warmap.cost[punit->x][punit->y])
+ /* If the previous warmap was for the same unit and it's still
+ * correct (warmap.cost[x][y] == 0), reuse it. */
+ if (warmap.warunit == punit &&
+ (is_sailing_unit(punit) ? (warmap.seacost[punit->x][punit->y] == 0):
+ (warmap.cost[punit->x][punit->y] == 0)))
return;
pcity = NULL;
@@ -390,10 +397,8 @@
if (punit) {
if (is_sailing_unit(punit)) {
- init_warmap(punit->x, punit->y, LAND_MOVING);
really_generate_warmap(pcity, punit, SEA_MOVING);
} else {
- init_warmap(punit->x, punit->y, SEA_MOVING);
really_generate_warmap(pcity, punit, LAND_MOVING);
}
warmap.orig_x = punit->x;
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/01
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Gregory Berkolaiko, 2001/12/01
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/01
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068),
Gregory Berkolaiko <=
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/02
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Gregory Berkolaiko, 2001/12/02
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/02
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Gregory Berkolaiko, 2001/12/03
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/03
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Gregory Berkolaiko, 2001/12/03
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/03
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Gregory Berkolaiko, 2001/12/04
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Raimar Falke, 2001/12/04
- [Freeciv-Dev] Re: Cleaning up gotohand.c (PR#1068), Gregory Berkolaiko, 2001/12/04
|
|