Index: client/cityrepdata.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/cityrepdata.c,v retrieving revision 1.14 diff -u -r1.14 cityrepdata.c --- client/cityrepdata.c 2002/02/02 09:21:30 1.14 +++ client/cityrepdata.c 2002/02/24 10:21:31 @@ -144,7 +144,7 @@ char *name; int cost, turns; char *from_worklist = - worklist_is_empty(pcity->worklist) ? "" : + worklist_is_empty(&pcity->worklist) ? "" : concise_city_production ? "*" : _("(worklist)"); if(pcity->currently_building==B_CAPITAL) { Index: client/packhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v retrieving revision 1.220 diff -u -r1.220 packhand.c --- client/packhand.c 2002/02/21 08:46:44 1.220 +++ client/packhand.c 2002/02/24 10:21:33 @@ -408,7 +408,7 @@ pcity->is_building_unit=packet->is_building_unit; pcity->currently_building=packet->currently_building; if (city_is_new) { - pcity->worklist = create_worklist(); + init_worklist(&pcity->worklist); /* Initialise list of improvements with city/building wide equiv_range. */ improvement_status_init(pcity->improvements); @@ -416,7 +416,7 @@ /* Initialise city's vector of improvement effects. */ ceff_vector_init(&pcity->effects); } - copy_worklist(pcity->worklist, &packet->worklist); + copy_worklist(&pcity->worklist, &packet->worklist); pcity->did_buy=packet->did_buy; pcity->did_sell=packet->did_sell; pcity->was_happy=packet->was_happy; @@ -625,8 +625,9 @@ update_improvement_from_packet(pcity, B_CITY, packet->walls, &need_effect_update); - if (city_is_new) - pcity->worklist = create_worklist(); + if (city_is_new) { + init_worklist(&pcity->worklist); + } /* This sets dumb values for everything else. This is not really required, but just want to be at the safe side. */ @@ -656,7 +657,7 @@ pcity->city_options = 0; pcity->is_building_unit = FALSE; pcity->currently_building = 0; - init_worklist(pcity->worklist); + init_worklist(&pcity->worklist); pcity->airlift = FALSE; pcity->did_buy = 0; pcity->did_sell = FALSE; Index: client/gui-gtk/citydlg.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v retrieving revision 1.123 diff -u -r1.123 citydlg.c --- client/gui-gtk/citydlg.c 2002/02/21 08:56:18 1.123 +++ client/gui-gtk/citydlg.c 2002/02/24 10:21:36 @@ -1125,7 +1125,7 @@ gtk_label_parse_uline(GTK_LABEL(label), tab_title); pdialog->wl_editor = - create_worklist_editor(pdialog->pcity->worklist, pdialog->pcity, + create_worklist_editor(&pdialog->pcity->worklist, pdialog->pcity, (void *) pdialog, commit_city_worklist, NULL, 1); gtk_signal_connect(GTK_OBJECT(pdialog->shell), "key_press_event", GTK_SIGNAL_FUNC(pdialog->wl_editor->keyboard_handler), @@ -1940,7 +1940,7 @@ } my_snprintf(buf2, sizeof(buf2), "%s%s", descr, - worklist_is_empty(pcity->worklist) ? "" : _(" (worklist)")); + worklist_is_empty(&pcity->worklist) ? "" : _(" (worklist)")); gtk_frame_set_label(GTK_FRAME (pdialog->overview.currently_building_frame), buf2); gtk_progress_set_percentage(GTK_PROGRESS @@ -3721,7 +3721,7 @@ get_top_happiness_display(pdialog->pcity), TRUE, TRUE, 0); pdialog->cma_editor->pcity = new_pcity; pdialog->wl_editor->pcity = new_pcity; - pdialog->wl_editor->pwl = new_pcity->worklist; + pdialog->wl_editor->pwl = &new_pcity->worklist; pdialog->wl_editor->user_data = (void *) pdialog; center_tile_mapcanvas(pdialog->pcity->x, pdialog->pcity->y); Index: client/gui-gtk/wldlg.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/wldlg.c,v retrieving revision 1.22 diff -u -r1.22 wldlg.c --- client/gui-gtk/wldlg.c 2002/02/19 15:21:00 1.22 +++ client/gui-gtk/wldlg.c 2002/02/24 10:21:40 @@ -999,7 +999,7 @@ wid_encode(peditor->pcity->is_building_unit, FALSE, peditor->pcity->currently_building); peditor->worklist_wids[1] = WORKLIST_END; - copy_worklist_to_editor(peditor->pcity->worklist, peditor, + copy_worklist_to_editor(&peditor->pcity->worklist, peditor, MAX_LEN_WORKLIST); } else { peditor->worklist_wids[0] = WORKLIST_END; Index: client/gui-mui/citydlg.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-mui/citydlg.c,v retrieving revision 1.44 diff -u -r1.44 citydlg.c --- client/gui-mui/citydlg.c 2002/02/21 08:56:19 1.44 +++ client/gui-mui/citydlg.c 2002/02/24 10:21:41 @@ -1824,7 +1824,7 @@ sz_strlcpy(buf2, get_impr_name_ex(pcity, pcity->currently_building)); } - if (!worklist_is_empty(pcity->worklist)) + if (!worklist_is_empty(&pcity->worklist)) { my_snprintf(buf3, sizeof(buf3), _("%s (%s) (worklist)"), buf, buf2); } else Index: client/gui-win32/citydlg.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/citydlg.c,v retrieving revision 1.13 diff -u -r1.13 citydlg.c --- client/gui-win32/citydlg.c 2002/02/21 08:56:19 1.13 +++ client/gui-win32/citydlg.c 2002/02/24 10:21:43 @@ -1314,7 +1314,7 @@ **************************************************************************/ void worklist_callback(struct city_dialog *pdialog) { - popup_worklist(pdialog->pcity->worklist, + popup_worklist(&pdialog->pcity->worklist, pdialog->pcity,pdialog->mainwindow,(void *)pdialog, commit_city_worklist, NULL); } Index: client/gui-win32/wldlg.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-win32/wldlg.c,v retrieving revision 1.4 diff -u -r1.4 wldlg.c --- client/gui-win32/wldlg.c 2002/02/19 15:21:02 1.4 +++ client/gui-win32/wldlg.c 2002/02/24 10:21:45 @@ -830,7 +830,7 @@ wid_encode(peditor->pcity->is_building_unit, FALSE, peditor->pcity->currently_building); peditor->worklist_wids[1] = WORKLIST_END; - copy_worklist_to_editor(peditor->pcity->worklist, peditor, + copy_worklist_to_editor(&peditor->pcity->worklist, peditor, MAX_LEN_WORKLIST); } else { peditor->worklist_wids[0] = WORKLIST_END; Index: client/gui-xaw/citydlg.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/citydlg.c,v retrieving revision 1.65 diff -u -r1.65 citydlg.c --- client/gui-xaw/citydlg.c 2002/02/21 08:56:20 1.65 +++ client/gui-xaw/citydlg.c 2002/02/24 10:21:47 @@ -324,7 +324,7 @@ { struct city *pcity = pdialog ? pdialog->pcity : NULL; - if (pcity && worklist_is_empty(pcity->worklist)) { + if (pcity && worklist_is_empty(&pcity->worklist)) { mystrlcpy(retbuf, _("(is empty)"), n); } else { mystrlcpy(retbuf, _("(in prog.)"), n); @@ -2412,8 +2412,8 @@ XtPopup(pdialog->worklist_shell, XtGrabNone); } else { pdialog->worklist_shell = - popup_worklist(pdialog->pcity->worklist, pdialog->pcity, pdialog->shell, - (void *)pdialog, commit_city_worklist, + popup_worklist(&pdialog->pcity->worklist, pdialog->pcity, + pdialog->shell, (void *) pdialog, commit_city_worklist, cancel_city_worklist); } } Index: common/city.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/city.h,v retrieving revision 1.101 diff -u -r1.101 city.h --- common/city.h 2002/02/21 08:56:21 1.101 +++ common/city.h 2002/02/24 10:21:48 @@ -250,7 +250,7 @@ Impr_Status improvements[B_LAST]; struct ceff_vector effects; - struct worklist *worklist; + struct worklist worklist; enum city_tile_type city_map[CITY_MAP_SIZE][CITY_MAP_SIZE]; Index: common/game.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/game.c,v retrieving revision 1.129 diff -u -r1.129 game.c --- common/game.c 2002/02/21 09:44:51 1.129 +++ common/game.c 2002/02/24 10:21:49 @@ -632,7 +632,6 @@ city_list_unlink(&city_owner(pcity)->cities, pcity); map_set_city(pcity->x, pcity->y, NULL); idex_unregister_city(pcity); - free(pcity->worklist); free(pcity); } Index: common/worklist.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/worklist.c,v retrieving revision 1.11 diff -u -r1.11 worklist.c --- common/worklist.c 2002/02/14 15:17:23 1.11 +++ common/worklist.c 2002/02/24 10:21:52 @@ -20,18 +20,6 @@ #include "worklist.h" - -/**************************************************************** -... -****************************************************************/ -struct worklist *create_worklist(void) -{ - struct worklist *pwl = (struct worklist *)fc_malloc(sizeof(struct worklist)); - init_worklist(pwl); - - return pwl; -} - /**************************************************************** Initialize a worklist to be empty and have a default name. For elements, only really need to set [0], but initialize the @@ -48,14 +36,6 @@ pwl->wlefs[i] = WEF_END; pwl->wlids[i] = 0; } -} - -/**************************************************************** -... -****************************************************************/ -void destroy_worklist(struct worklist *pwl) -{ - free(pwl); } /**************************************************************** Index: common/worklist.h =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/worklist.h,v retrieving revision 1.5 diff -u -r1.5 worklist.h --- common/worklist.h 2002/02/14 15:17:23 1.5 +++ common/worklist.h 2002/02/24 10:21:52 @@ -35,9 +35,7 @@ int wlids[MAX_LEN_WORKLIST]; }; -struct worklist *create_worklist(void); void init_worklist(struct worklist *pwl); -void destroy_worklist(struct worklist *pwl); int worklist_length(const struct worklist *pwl); bool worklist_is_empty(const struct worklist *pwl); Index: server/cityhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/cityhand.c,v retrieving revision 1.110 diff -u -r1.110 cityhand.c --- server/cityhand.c 2002/02/11 10:38:07 1.110 +++ server/cityhand.c 2002/02/24 10:21:53 @@ -309,7 +309,7 @@ if (!player_owns_city(pplayer, pcity)) return; - copy_worklist(pcity->worklist, &preq->worklist); + copy_worklist(&pcity->worklist, &preq->worklist); send_city_info(pplayer, pcity); } Index: server/citytools.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v retrieving revision 1.165 diff -u -r1.165 citytools.c --- server/citytools.c 2002/02/21 09:44:52 1.165 +++ server/citytools.c 2002/02/24 10:21:55 @@ -941,7 +941,7 @@ pcity->currently_building=best_role_unit(pcity, L_FIRSTBUILD); /* Set up the worklist */ - pcity->worklist = create_worklist(); + init_worklist(&pcity->worklist); /* Initialise list of improvements with City- and Building-wide equiv_range */ improvement_status_init(pcity->improvements); @@ -1571,7 +1571,7 @@ packet->disbanded_shields=pcity->disbanded_shields; packet->caravan_shields=pcity->caravan_shields; - copy_worklist(&packet->worklist, pcity->worklist); + copy_worklist(&packet->worklist, &pcity->worklist); packet->diplomat_investigate=dipl_invest; packet->airlift=pcity->airlift; Index: server/cityturn.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v retrieving revision 1.177 diff -u -r1.177 cityturn.c --- server/cityturn.c 2002/02/21 08:56:22 1.177 +++ server/cityturn.c 2002/02/24 10:21:56 @@ -653,7 +653,7 @@ bool success = FALSE; int i; - if (worklist_is_empty(pcity->worklist)) + if (worklist_is_empty(&pcity->worklist)) /* Nothing in the worklist; bail now. */ return FALSE; @@ -663,7 +663,7 @@ bool is_unit; /* What's the next item in the worklist? */ - if (!worklist_peek_ith(pcity->worklist, &target, &is_unit, i)) + if (!worklist_peek_ith(&pcity->worklist, &target, &is_unit, i)) /* Nothing more in the worklist. Ah, well. */ break; @@ -686,7 +686,7 @@ new_target. */ get_unit_type(target)->name); /* Purge this worklist item. */ - worklist_remove(pcity->worklist, i-1); + worklist_remove(&pcity->worklist, i-1); /* Reset i to index to the now-next element. */ i--; @@ -724,7 +724,7 @@ get_impr_name_ex(pcity, target)); /* Purge this worklist item. */ - worklist_remove(pcity->worklist, i-1); + worklist_remove(&pcity->worklist, i-1); /* Reset i to index to the now-next element. */ i--; @@ -780,10 +780,10 @@ if (success) { /* i is the index immediately _after_ the item we're changing to. Remove the (i-1)th item from the worklist. */ - worklist_remove(pcity->worklist, i-1); + worklist_remove(&pcity->worklist, i-1); } - if (worklist_is_empty(pcity->worklist)) { + if (worklist_is_empty(&pcity->worklist)) { /* There *was* something in the worklist, but it's empty now. Bug the player about it. */ notify_player_ex(pplayer, pcity->x, pcity->y, E_WORKLIST, Index: server/savegame.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v retrieving revision 1.58 diff -u -r1.58 savegame.c --- server/savegame.c 2002/02/21 09:44:53 1.58 +++ server/savegame.c 2002/02/24 10:21:58 @@ -892,12 +892,12 @@ } } - pcity->worklist = create_worklist(); + init_worklist(&pcity->worklist); if (has_capability("worklists2", savefile_options)) { - worklist_load(file, "player%d.c%d", plrno, i, pcity->worklist); + worklist_load(file, "player%d.c%d", plrno, i, &pcity->worklist); } else { worklist_load_old(file, "player%d.c%d.worklist%d", - plrno, i, pcity->worklist); + plrno, i, &pcity->worklist); } map_set_city(pcity->x, pcity->y, pcity); @@ -1492,7 +1492,7 @@ buf[j]='\0'; secfile_insert_str(file, buf, "player%d.c%d.improvements", plrno, i); - worklist_save(file, "player%d.c%d", plrno, i, pcity->worklist); + worklist_save(file, "player%d.c%d", plrno, i, &pcity->worklist); } city_list_iterate_end;