Complete.Org:
Mailing Lists:
Archives:
freeciv-dev:
January 2001: [Freeciv-Dev] PATCH: ExternFixes |
[Freeciv-Dev] PATCH: ExternFixes[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Hi, here a patch for current CVS. I splitted it in Non-Amiga and Amiga part. There should be no problems with it, so I hope it is applied very fast (as it affects some files and they usually changes very fast :-) non-Amiga changes (added as ExternFix.diff and ExternFix.diff.gz): - added lots of extern statements to the related h-files and removed them from c-file which access these variables (Did this for GTK and XAW client also). - fixed problem of hardcoded civclient field sizes during step 1 :-) Now all the defintions and extern statements are in the h-file of the corresponding source and no longer spread throughout all the source files. Was a bad style. Amiga changes (added as ExternFixAmiga.diff.gz): - removed all the extern stuff like in none Amiga part and moved it to h-files - replaced IMPORT with extern and STATIC with static as it was not used always and mixed up is cruelty - moved sprite stuff from mapclass.c to graphics.c --> compiler is able to link again without optimizations :-) - updated makefiles Ciao ____ _ _ ____ _ _ _ _ ____ | | | | | | \ / | | | the cool Gremlin from Bischofswerda | __ | ____| | \/ | | | WWW: http://home.pages.de/~stoecker/ | | | | | | | | PGP key available on www page. |____| _|_ |____| _|_ _|_ |____| I hope AMIGA never ends to make fun! ************************************************************************ * snail-mail: Dirk Stoecker * e-mail: * * Geschwister-Scholl-Str. 10 * stoecker@xxxxxxxxxxxxxx * * 01877 Bischofswerda * phone: * * GERMANY * GERMANY +49 (0)3594/706666 * ************************************************************************
ExternFixAmiga.diff.gz
ExternFix.diff.gz diff -ur ../../freeciv-cvs/freeciv/client/civclient.h ./client/civclient.h --- ../../freeciv-cvs/freeciv/client/civclient.h Sat Jan 13 15:07:09 2001 +++ ./client/civclient.h Sat Jan 13 14:50:02 2001 @@ -31,5 +31,13 @@ void client_remove_cli_conn(struct connection *pconn); extern int turn_gold_difference; +extern int seconds_to_turndone; +extern int last_turn_gold_amount; +extern int did_advance_tech_this_turn; + +extern char metaserver[256]; +extern char server_host[512]; +extern char name[512]; +extern int server_port; #endif /* FC__CIVCLIENT_H */ diff -ur ../../freeciv-cvs/freeciv/client/climisc.c ./client/climisc.c --- ../../freeciv-cvs/freeciv/client/climisc.c Sat Jan 13 15:06:55 2001 +++ ./client/climisc.c Sat Jan 13 14:38:16 2001 @@ -39,6 +39,7 @@ #include "packets.h" #include "support.h" +#include "clinet.h" #include "chatline_g.h" #include "citydlg_g.h" #include "cityrep_g.h" @@ -47,8 +48,6 @@ #include "tilespec.h" #include "climisc.h" - -extern struct connection aconnection; /************************************************************************** ... diff -ur ../../freeciv-cvs/freeciv/client/clinet.c ./client/clinet.c --- ../../freeciv-cvs/freeciv/client/clinet.c Sat Jan 13 15:06:49 2001 +++ ./client/clinet.c Sat Jan 13 14:44:13 2001 @@ -68,8 +68,6 @@ struct connection aconnection; -extern char metaserver[]; - /************************************************************************** Close socket and cleanup. This one doesn't print a message, so should do so before-hand if necessary. diff -ur ../../freeciv-cvs/freeciv/client/control.c ./client/control.c --- ../../freeciv-cvs/freeciv/client/control.c Sat Jan 13 15:06:54 2001 +++ ./client/control.c Sat Jan 13 14:45:06 2001 @@ -31,14 +31,12 @@ #include "menu_g.h" #include "civclient.h" +#include "clinet.h" #include "goto.h" #include "options.h" #include "tilespec.h" #include "control.h" - -extern struct connection aconnection; - /* gui-dep code may adjust depending on tile size etc: */ int num_units_below = MAX_NUM_UNITS_BELOW; diff -ur ../../freeciv-cvs/freeciv/client/goto.c ./client/goto.c --- ../../freeciv-cvs/freeciv/client/goto.c Sat Jan 13 15:06:54 2001 +++ ./client/goto.c Sat Jan 13 14:37:40 2001 @@ -21,12 +21,11 @@ #include "packets.h" #include "unit.h" +#include "clinet.h" #include "control.h" #include "mapview_g.h" #include "goto.h" - -extern struct connection aconnection; struct client_goto_map goto_map; diff -ur ../../freeciv-cvs/freeciv/client/goto.h ./client/goto.h --- ../../freeciv-cvs/freeciv/client/goto.h Sat Jan 13 15:06:54 2001 +++ ./client/goto.h Sat Jan 13 13:55:23 2001 @@ -24,6 +24,10 @@ int src_x, src_y; }; +extern struct client_goto_map goto_map; +extern int line_dest_x; +extern int line_dest_y; + void create_goto_map(struct unit *punit, int src_x, int src_y, enum goto_move_restriction restriction); int transfer_route_to_stack(int dest_x, int dest_y); diff -ur ../../freeciv-cvs/freeciv/client/gui-gtk/connectdlg.c ./client/gui-gtk/connectdlg.c --- ../../freeciv-cvs/freeciv/client/gui-gtk/connectdlg.c Sat Jan 13 15:06:56 2001 +++ ./client/gui-gtk/connectdlg.c Sat Jan 13 14:40:27 2001 @@ -23,6 +23,7 @@ #include "support.h" #include "version.h" +#include "civclient.h" #include "chatline.h" #include "clinet.h" #include "colors.h" @@ -31,11 +32,6 @@ #include "connectdlg.h" -/* in civclient.c; FIXME hardcoded sizes */ -extern char name[]; -extern char server_host[]; -extern int server_port; - static GtkWidget *iname, *ihost, *iport; static GtkWidget *connw, *quitw; @@ -58,8 +54,8 @@ { char errbuf [512]; - mystrlcpy(name, gtk_entry_get_text(GTK_ENTRY(iname)), 512); - mystrlcpy(server_host, gtk_entry_get_text(GTK_ENTRY(ihost)), 512); + sz_strlcpy(name, gtk_entry_get_text(GTK_ENTRY(iname))); + sz_strlcpy(server_host, gtk_entry_get_text(GTK_ENTRY(ihost))); server_port=atoi(gtk_entry_get_text(GTK_ENTRY(iport))); if(connect_to_server(name, server_host, server_port, diff -ur ../../freeciv-cvs/freeciv/client/gui-gtk/helpdlg.c ./client/gui-gtk/helpdlg.c --- ../../freeciv-cvs/freeciv/client/gui-gtk/helpdlg.c Sat Jan 13 15:06:56 2001 +++ ./client/gui-gtk/helpdlg.c Sat Jan 13 14:10:08 2001 @@ -50,8 +50,6 @@ extern GtkWidget *toplevel; extern GdkWindow *root_window; -extern char long_buffer[64000]; /* helpdata.c */ - /* * Globals. */ diff -ur ../../freeciv-cvs/freeciv/client/gui-gtk/mapctrl.c ./client/gui-gtk/mapctrl.c --- ../../freeciv-cvs/freeciv/client/gui-gtk/mapctrl.c Sat Jan 13 15:06:57 2001 +++ ./client/gui-gtk/mapctrl.c Sat Jan 13 13:57:44 2001 @@ -310,8 +310,6 @@ update_line(x, y); } -extern int line_dest_x; /* from goto.c */ -extern int line_dest_y; /************************************************************************** ... **************************************************************************/ diff -ur ../../freeciv-cvs/freeciv/client/gui-gtk/mapview.c ./client/gui-gtk/mapview.c --- ../../freeciv-cvs/freeciv/client/gui-gtk/mapview.c Sat Jan 13 15:06:57 2001 +++ ./client/gui-gtk/mapview.c Sat Jan 13 13:57:25 2001 @@ -63,9 +63,6 @@ */ #define EXTRA_BOTTOM_ROW 1 - -extern int seconds_to_turndone; - extern GtkWidget * main_frame_civ_name; extern GtkWidget * main_label_info; extern GtkWidget * econ_label [10]; @@ -141,8 +138,6 @@ extern GdkCursor *patrol_cursor; GtkObject * map_hadj, *map_vadj; - -extern struct client_goto_map goto_map; /************************************************************************** ... diff -ur ../../freeciv-cvs/freeciv/client/gui-xaw/connectdlg.c ./client/gui-xaw/connectdlg.c --- ../../freeciv-cvs/freeciv/client/gui-xaw/connectdlg.c Sat Jan 13 15:07:05 2001 +++ ./client/gui-xaw/connectdlg.c Sat Jan 13 14:41:19 2001 @@ -31,6 +31,7 @@ #include "support.h" #include "version.h" +#include "civclient.h" #include "chatline.h" #include "clinet.h" #include "gui_stuff.h" @@ -43,11 +44,6 @@ extern Widget toplevel; extern Widget turn_done_button; -/* in civclient.c; FIXME hardcoded sizes */ -extern char name[]; -extern char server_host[]; -extern int server_port; - Widget iname, ihost, iport; Widget connw, metaw, quitw; @@ -152,9 +148,9 @@ char errbuf[512]; XtVaGetValues(iname, XtNstring, &dp, NULL); - mystrlcpy(name, (char*)dp, 512); + sz_strlcpy(name, (char*)dp); XtVaGetValues(ihost, XtNstring, &dp, NULL); - mystrlcpy(server_host, (char*)dp, 512); + sz_strlcpy(server_host, (char*)dp); XtVaGetValues(iport, XtNstring, &dp, NULL); sscanf((char*)dp, "%d", &server_port); diff -ur ../../freeciv-cvs/freeciv/client/gui-xaw/helpdlg.c ./client/gui-xaw/helpdlg.c --- ../../freeciv-cvs/freeciv/client/gui-xaw/helpdlg.c Sat Jan 13 15:07:05 2001 +++ ./client/gui-xaw/helpdlg.c Sat Jan 13 14:10:26 2001 @@ -111,7 +111,6 @@ enum help_page_type htype); static char *topic_list[1024]; -extern char long_buffer[64000]; /* helpdata.c */ #define TREE_NODE_UNKNOWN_TECH_BG "red" #define TREE_NODE_KNOWN_TECH_BG "green" diff -ur ../../freeciv-cvs/freeciv/client/gui-xaw/mapctrl.c ./client/gui-xaw/mapctrl.c --- ../../freeciv-cvs/freeciv/client/gui-xaw/mapctrl.c Sat Jan 13 15:07:06 2001 +++ ./client/gui-xaw/mapctrl.c Sat Jan 13 13:57:58 2001 @@ -317,8 +317,6 @@ return last_pcity = pcity2; } -extern int line_dest_x; /* from goto.c */ -extern int line_dest_y; /************************************************************************** ... **************************************************************************/ diff -ur ../../freeciv-cvs/freeciv/client/gui-xaw/mapview.c ./client/gui-xaw/mapview.c --- ../../freeciv-cvs/freeciv/client/gui-xaw/mapview.c Sat Jan 13 15:07:06 2001 +++ ./client/gui-xaw/mapview.c Sat Jan 13 13:58:18 2001 @@ -87,8 +87,6 @@ extern Pixmap gray50,gray25; extern int city_workers_color; -extern int seconds_to_turndone; - extern struct Sprite *intro_gfx_sprite; extern struct Sprite *radar_gfx_sprite; extern Cursor goto_cursor; @@ -115,8 +113,6 @@ the screen size */ Pixmap scaled_intro_pixmap; int scaled_intro_pixmap_width, scaled_intro_pixmap_height; - -extern struct client_goto_map goto_map; static void put_line(Pixmap pm, int canvas_src_x, int canvas_src_y, int map_src_x, int map_src_y, int dir, int first_draw); diff -ur ../../freeciv-cvs/freeciv/client/helpdata.h ./client/helpdata.h --- ../../freeciv-cvs/freeciv/client/helpdata.h Sat Jan 13 15:06:54 2001 +++ ./client/helpdata.h Sat Jan 13 14:09:20 2001 @@ -45,4 +45,6 @@ while((pitem=help_iter_next())) { #define help_items_iterate_end }} +extern char long_buffer[64000]; + #endif /* FC__HELPDATA_H */ diff -ur ../../freeciv-cvs/freeciv/client/packhand.c ./client/packhand.c --- ../../freeciv-cvs/freeciv/client/packhand.c Sat Jan 13 15:06:54 2001 +++ ./client/packhand.c Sat Jan 13 14:50:48 2001 @@ -62,12 +62,6 @@ #include "packhand.h" -extern int seconds_to_turndone; -extern int last_turn_gold_amount; -extern int did_advance_tech_this_turn; -extern char name[512]; - - static void handle_city_packet_common(struct city *pcity, int is_new, int popup); @@ -261,8 +255,8 @@ /* If we get here we didn't find a known tile. Refresh a random place to clear the intro gfx. */ center_tile_mapcanvas(map.xsize/2, map.ysize/2); - OUT: /* do nothing */ } + OUT: /* do nothing */ free_intro_radar_sprites(); } diff -ur ../../freeciv-cvs/freeciv/server/cityhand.h ./server/cityhand.h --- ../../freeciv-cvs/freeciv/server/cityhand.h Sat Jan 13 15:06:38 2001 +++ ./server/cityhand.h Sat Jan 13 15:03:32 2001 @@ -70,4 +70,7 @@ void package_city(struct city *pcity, struct packet_city_info *packet, int dipl_invest); +extern char **misc_city_names; +extern int num_misc_city_names; + #endif /* FC__CITYHAND_H */ diff -ur ../../freeciv-cvs/freeciv/server/cityturn.c ./server/cityturn.c --- ../../freeciv-cvs/freeciv/server/cityturn.c Sat Jan 13 15:06:38 2001 +++ ./server/cityturn.c Sat Jan 13 15:00:31 2001 @@ -48,8 +48,6 @@ #include "cityturn.h" -extern signed int minimap[MAP_MAX_WIDTH][MAP_MAX_HEIGHT]; - static void set_tax_income(struct city *pcity); static void set_food_trade_shields(struct city *pcity); static void add_buildings_effect(struct city *pcity); diff -ur ../../freeciv-cvs/freeciv/server/diplomats.c ./server/diplomats.c --- ../../freeciv-cvs/freeciv/server/diplomats.c Sat Jan 13 15:06:38 2001 +++ ./server/diplomats.c Sat Jan 13 14:56:08 2001 @@ -27,13 +27,13 @@ #include "citytools.h" #include "cityturn.h" #include "gamelog.h" +#include "gotohand.h" #include "plrhand.h" #include "unithand.h" #include "unittools.h" #include "diplomats.h" -extern struct move_cost_map warmap; /****************************************************************************/ diff -ur ../../freeciv-cvs/freeciv/server/gamelog.h ./server/gamelog.h --- ../../freeciv-cvs/freeciv/server/gamelog.h Sat Jan 13 15:06:43 2001 +++ ./server/gamelog.h Sat Jan 13 15:04:51 2001 @@ -57,4 +57,6 @@ void gamelog_map(void); void gamelog_save(void); +extern int gamelog_level; + #endif /* FC__GAMELOG_H */ diff -ur ../../freeciv-cvs/freeciv/server/gotohand.h ./server/gotohand.h --- ../../freeciv-cvs/freeciv/server/gotohand.h Sat Jan 13 15:06:43 2001 +++ ./server/gotohand.h Sat Jan 13 14:55:14 2001 @@ -41,4 +41,6 @@ int orig_x, orig_y; }; +extern struct move_cost_map warmap; + #endif /* FC__GOTOHAND_H */ diff -ur ../../freeciv-cvs/freeciv/server/maphand.c ./server/maphand.c --- ../../freeciv-cvs/freeciv/server/maphand.c Sat Jan 13 15:06:41 2001 +++ ./server/maphand.c Sat Jan 13 15:02:18 2001 @@ -31,6 +31,7 @@ #include "mapgen.h" /* assign_continent_numbers */ #include "plrhand.h" /* notify_player */ #include "sernet.h" +#include "srv_main.h" #include "unittools.h" #include "unithand.h" @@ -50,7 +51,6 @@ static void set_unknown_tiles_to_unsent(struct player *pplayer); static void shared_vision_change_seen(int x, int y, struct player *pplayer, int change); -extern enum server_states server_state; /************************************************************************** Used only in global_warming() and nuclear_winter() below. **************************************************************************/ diff -ur ../../freeciv-cvs/freeciv/server/ruleset.c ./server/ruleset.c --- ../../freeciv-cvs/freeciv/server/ruleset.c Sat Jan 13 15:06:42 2001 +++ ./server/ruleset.c Sat Jan 13 15:05:35 2001 @@ -34,14 +34,13 @@ #include "tech.h" #include "unit.h" +#include "cityhand.h" + #include "ruleset.h" static const char name_too_long[] = "Name \"%s\" too long; truncating."; #define check_name(name) check_strlen(name, MAX_LEN_NAME, name_too_long) #define name_strlcpy(dst, src) sz_loud_strlcpy(dst, src, name_too_long) - -extern char **misc_city_names; -extern int num_misc_city_names; static void openload_ruleset_file(struct section_file *file, char *subdir, char *whichset); diff -ur ../../freeciv-cvs/freeciv/server/settlers.c ./server/settlers.c --- ../../freeciv-cvs/freeciv/server/settlers.c Sat Jan 13 15:06:41 2001 +++ ./server/settlers.c Sat Jan 13 14:56:24 2001 @@ -36,8 +36,6 @@ #include "settlers.h" -extern struct move_cost_map warmap; - signed int minimap[MAP_MAX_WIDTH][MAP_MAX_HEIGHT]; static unsigned int territory[MAP_MAX_WIDTH][MAP_MAX_HEIGHT]; /* negative: in_city_radius, 0: unassigned, positive: city_des */ diff -ur ../../freeciv-cvs/freeciv/server/settlers.h ./server/settlers.h --- ../../freeciv-cvs/freeciv/server/settlers.h Sat Jan 13 15:06:43 2001 +++ ./server/settlers.h Sat Jan 13 15:00:17 2001 @@ -35,4 +35,6 @@ void contemplate_settling(struct player *pplayer, struct city *pcity); struct unit *other_passengers(struct unit *punit); +extern signed int minimap[MAP_MAX_WIDTH][MAP_MAX_HEIGHT]; + #endif /* FC__SETTLERS_H */ diff -ur ../../freeciv-cvs/freeciv/server/stdinhand.c ./server/stdinhand.c --- ../../freeciv-cvs/freeciv/server/stdinhand.c Sat Jan 13 15:06:39 2001 +++ ./server/stdinhand.c Sat Jan 13 15:05:07 2001 @@ -58,8 +58,6 @@ #define MAX_LEN_CMD MAX_LEN_PACKET /* to be used more widely - rp */ -extern int gamelog_level; - static enum cmdlevel_id default_access_level = ALLOW_INFO; static enum cmdlevel_id first_access_level = ALLOW_INFO;
|