2002-12-31 Hans Ronne <hronne@telia.com> Fix so that the SDL small_font bitmap installs correctly. * images/Makefile.in (install-only): Also copy *.bmp files. 2002-12-30 Hans Ronne <hronne@telia.com> Fix wrapping bugs affecting the interfaces once and for all by restricting wrapping of x to the kernel. This was prompted by two new wrapping bugs being found in the tcltk interface (thanks to Lincoln Peters for reporting these bugs). The underlying problem in both cases was that area layer accessor macros (unit_at and connection_at) were being fed unwrapped x values. An inspection of the code revealed several more such bugs in the interface code. To fix these problems once and for all, we therefore wrap x in the three core accessor macros aref, aset and aadd and remove all wrapping in the interface code. * world.h (aref): Use wrapx(x) instead of x. (aset): Use wrapx(x) instead of x. (aadd): Use wrapx(x) instead of x. Go through the Mac interface code and clean out all now redundant wrapping of x in area layer accessor macros and functions. Also clean out other cases of redundant wrapping such as in calls to in_area and inside_area, which already wrap x. The Mac interface should now be completely free of wrapx calls. * macdraw.c (draw_terrain_transitions): Use x instead of xw. (draw_unseen_fuzz): Use x instead of xw everywhere. (draw_shore_images): Use x instead of xw everywhere. (draw_border_images): Use x instead of xw everywhere. * macmap.c (draw_meridians): Don't wrap x in inside_area. (draw_feature_names): Don't wrap x in terrain_visible. (draw_selections_at): Use is_located_at instead of wrapx. (update_cell): Use is_located_at instead of wrapx. (update_cell): Use was_located_at instead of wrapx. (update_cell): Don't wrap x in for_all_stack. (draw_unit_names_only): Use x instead of xw everywhere. * macrow.c (draw_row): Don't wrap x in the cloud code. (draw_row): Don't wrap x in the winds code. (draw_row): Don't wrap x in the temeperature code. (draw_row): Don't wrap x in cover and alt_cover. (draw_terrain_row): Use x0 instead of x0w everywhere. (draw_terrain_row): Use x instead of xw everywhere. (draw_terrain_row): Remove comment about wrapping. (draw_cliffs): Use x instead of xw everywhere. (draw_cliffs): Don't wrap x1 in elev_at. (draw_contours): Don't wrap x in contour_lines_at. (draw_gridlines): Use x instead of xw everywhere. (draw_gridlines): Don't wrap x1 in terrain_visible. (draw_gridlines): Remove comment about unwrapped x. (draw_shores): Use x instead of xw everywhere. (draw_shorelines): Use x instead of xw everywhere. (draw_shorelines): Don't wrap x1 in terrain_visible. (draw_shorelines): Don't wrap x1 in terrain_at. (draw_shorelines): Don't wrap x - 1 in in_area. (draw_shorelines): Don't wrap x - 1 in terrain_at. (draw_borders): Use x instead of xw everywhere. (draw_connections): Use x instead of xw everywhere. (draw_feature_boundary): Use x instead of xw everywhere. (draw_feature_boundary): Don't wrap x1 in terrain_visible. (draw_feature_boundary): Don't wrap x1 in terrain_at. (draw_feature_boundary): Don't wrap x1 in feature_at. (draw_people_row): Use x instead of xw everywhere. (draw_people_row): Don't wrap x1 in terrain_visible. (draw_people_row): Don't wrap x1 in terrain_at. (draw_people_row): Don't wrap x1 in people_side_at. (draw_people_row): Don't wrap x1 in control_side_at. (draw_materials): Don't wrap x in cell_terrain. (draw_materials): Don't wrap x in material_view. (draw_units): Use x instead of xw everywhere. (draw_ai_region): Use x instead of xw everywhere. (draw_ai_region): Don't wrap x1 in ai_region_at. (draw_region): Use x instead of xw everywhere. (draw_region): Don't wrap x1 in aref call. Go through the tcltk interface code and clean out all now redundant wrapping of x in area layer accessor macros and functions. Also clean out other cases of redundant wrapping such as in calls to in_area and inside_area, which already wrap x. The tcltk interface should now be completely free of wrapx calls. We also fix a number of bugs where x was wrapped in xform calls, either directly or by being wrapped in function calls within draw_row. * tkmap.c (cell_drawing_info): Change xw to x everywhere. (draw_terrain_iso): Change xw to x everywhere. (draw_terrain_iso): Don't wrap x1 in elev_at. (draw_row): Don't wrap i in for_all_stack. (draw_row): Don't wrap x in draw_people. (draw_row): Don't wrap x in draw_units. (draw_row): Don't wrap x in draw_resource_usage. (draw_row): Don't wrap x in draw_ai_region. (draw_terrain_row): Change xw to x everywhere. (draw_terrain_row): Change x0w to x0 everywhere. (draw_terrain_row): Change x1w to x1 everywhere. (draw_terrain_transitions): Change xw to x everywhere. Note: this includes the xform call where x incorrectly was wrapped. (draw_terrain_grid): Change xw to x everywhere. Note: this includes the xform call where x incorrectly was wrapped. (draw_terrain_grid): Don't wrap x1 in terrain_visible. (draw_contours): Remove wrapping of x. Note: this includes the xform call where x incorrectly was wrapped. (draw_clouds_row): Change xw to x everywhere. (draw_temperature_row): Change xw to x everywhere. (draw_winds_row): Change xw to x everywhere. (draw_units): Don't wrap x in for_all_view_stack. (draw_people): Change xw to x everywhere. (draw_people): Change xw1 to x1 everywhere. (draw_borders): Change xw to x everywhere. Note: this includes the xform call where x incorrectly was wrapped. (draw_borders_iso): Don't wrap x in m_terrain_visible. (draw_borders_iso): Don't wrap x in terrain_at. (draw_connections): Don't wrap x in m_terrain_visible. (draw_connections): Don't wrap x in terrain_at. (draw_connections_iso): Don't wrap x in m_terrain_visible. (draw_connections_iso): Don't wrap x in terrain_at. (draw_feature_boundary): Change xw to x everywhere. (draw_feature_boundary): Don't wrap x1 in terrain_at etc. (draw_ai_region): Change xw to x everywhere. (draw_ai_region): Don't wrap x1 in ai_region_at. (update_cell): Use is_located_at instead of wrapx. (update_cell): Use was_located_at instead of wrapx. Clean out wrapping of x in the curses interface. * cdraw.c (draw_units): Use x instead of xw. Call is_located_at for curunit instead. (draw_people): Don't wrap x in people_side_at. Similarly clean out wrapping of x in the sdl interface. * sdlmap.c (cell_drawing_info): Change xw to x everywhere. (draw_terrain_iso): Change xw to x everywhere. (draw_terrain_iso): Don't wrap x1 in elev_at. (draw_terrain_row): Change xw to x everywhere. (draw_terrain_row): Change x0w to x0 everywhere. (draw_terrain_row): Change x1w to x1 everywhere. (draw_borders): Change xw to x everywhere. Note: this includes the xform call where x incorrectly was wrapped. (draw_borders_iso): Don't wrap x in m_terrain_visible. (draw_borders_iso): Don't wrap x in terrain_at. (draw_connections): Don't wrap x in m_terrain_visible. (draw_connections): Don't wrap x in terrain_at. (draw_connections_iso): Don't wrap x in m_terrain_visible. (draw_connections_iso): Don't wrap x in terrain_at. (draw_terrain_transitions): Change xw to x everywhere. Note: this includes the xform call where x incorrectly was wrapped. (draw_terrain_grid): Change xw to x everywhere. Note: this includes the xform call where x incorrectly was wrapped. (draw_terrain_grid): Don't wrap x1 in terrain_visible. (draw_row): Don't wrap x in draw_people. (draw_row): Don't wrap x in draw_units. (draw_row): Don't wrap x in draw_resource_usage. (draw_row): Don't wrap x in draw_ai_region. (draw_clouds_row): Change xw to x everywhere. (draw_temperature_row): Change xw to x everywhere. (draw_winds_row): Change xw to x everywhere. (draw_units): Don't wrap x in for_all_view_stack. (draw_feature_boundary): Change xw to x everywhere. (draw_people): Change xw to x everywhere. (draw_people): Change xw1 to x1 everywhere. Similarly clean out wrapping of x in the x11 interface. * xdraw.c (draw_terrain_row): Change xw to x everywhere. (draw_terrain_row): Change x0w to x0 everywhere. (draw_terrain_row): Change x1w to x1 everywhere. (draw_contours): Remove wrapping of x. Note: this includes the xform call where x incorrectly was wrapped. (draw_elevations): Don't wrap x in m_terrain_visible. (draw_elevations): Don't wrap x in terrain_at. (draw_clouds_row): Change xw to x everywhere. (draw_temperature_row): Change xw to x everywhere. (draw_winds_row): Change xw to x everywhere. (draw_units): Change xw to x everywhere. (draw_people): Don't wrap x in terrain_visible. (draw_people): Don't wrap x in people_side_at. (draw_people): Don't wrap x1 in people_side_at. (draw_borders): Don't wrap x in terrain_visible. (draw_connections): Don't wrap x in terrain_visible. (draw_legend): Don't wrap x in terrain_visible. (draw_feature_boundary): Don't wrap x in terrain_visible. * xmap.c (draw_view_in_panner): Comment out the two calls to wrapx until tested further. Clean out wrapping as much as possible in the kernel. Keep it only in certain macros, functions that compute co-ordinates and where a wrapped output (ps or Dprintf) is expected. Add two new wrapping macros and wrap x in some existing ones. * mkterr.c (make_blobs): Use x instead of xw everywhere. (smooth_layer): Use x +1 and x -1 instead of nx and px. * plan.c (no_possible_moves): Replace obsolete unit_view by unit_view_at. Don't wrap fx + dirx[d]. Also replace obsolete vside and vtype by view_side and view_type. * ps.c (dump_ps_view): Don't wrap x in terrain_seen_at etc. (dump_ps_view): Don't wrap x in name_of_seen_unit_at etc. (dump_ps_view): Don't wrap x1 in unit_seen_at. (dump_ps_view): Don't wrap x2 in name_of_seen_unit_at etc. * read.c (read_rle): Don't wrap x - layer_area_x. * run.c (auto_pick_new_build_task): Don't wrap x in terrain_at. (auto_pick_new_build_task): Don't wrap x1 in terrain_at. * side.c (unit_view_at): Do wrap x when computing hash and when testing uv->x. (unit_view_next): Do wrap x when testing uv2->x. (cover_area_1): Don't wrap x in set_tmp1_at etc. (cover_area_1): Don't wrap x in set_tmp2_at etc. (cover_area_1): Don't wrap x in set_tmp3_at etc. (cover_area_1): Don't wrap x in the update code. (cover_area_1): Do wrap x in Negative coverage Dprintf. * side.h (terrain_visible): Don't wrap x in terrain_view. (units_visible): Don't wrap x in cover. * ui.c (xform_cell): Don't wrap x in elev_at. (xform_cell_top): Don't wrap x in elev_at and terrain_at. (find_unit_view_at): Don't wrap x in for_all_view_stack. (nearest_unit_view): Don't wrap x in find_unit_view_at and unit_view_at. (place_feature_legends): Don't wrap x1 in raw_feature_at and aref. (dump_text_view): Don't wrap x in unit_view_at. * unit.c (num_units_at): Don't wrap x in in_area. * unit.h (is_located_at): New macro. Wraps x before testing. Also tests first if unit is in_play. (was_located_at): New macro. Wraps x before testing. Also tests first for is_unit. * world.c (apply_to_area): Don't wrap x in in_area. (apply_to_area_plus_edge): Don't wrap x in in_area. (apply_to_ring): Don't wrap x in in_area. (apply_to_hexagon): Don't wrap x in in_area. Fix two year old bug in the Mac interface that prevented world size dialog variants from being implemented. * macinit.c (implement_variants): Add back missing call to do_module_variants at the end. (launch_game): Call implement_variants before starting the pre_player_setup stage. Fix typo in usused world macro. * world.h (xy_in_dir): Change d to dir. Fix bus errors in the world shape dialog under MacOS Classic. * macinit.c (world_shape_dialog): Replace call to SelectTheWindow with calls to ShowWindow and SelectWindow. Note: should figure out why SelectTheWindow now crashes Classic here - it works fine in all other places both with Classic and Carbon. (real_time_dialog): Ditto, just to make sure. (more_variants_dialog): Ditto, just to make sure. Fix long-standing bug in the Mac that prevented clicking on units to the east of the dateline if they were in the right half of the screen. * macdraw.c (draw_terrain_row): Disable runlength based drawing if the map is wider than the world circumference. * ui.c (xform_cell_flat): Remove Mac-specific vp->wide_viewport code and use Unix code instead. Note: keep the vp->wide_viewport code in calc_view_misc where it is essential. Further note: the reason for the Mac code in xform_cell_flat was a problem with runlength-based useblocks drawing if the map was wider than the world circumference. In that case, runs of cell that started at the left edge of the gworld would not be drawn. This rather minor problem has now been fixed by the hack in draw_terrain_row instead. (xform_cell_flat): Also remove obsolete run_error code that was commented out a long time ago. Fix unseen fuzz garbage at the edge of the map on the Mac. * macdraw.c (draw_unseen_fuzz): Remove extra point_in_dir calls. * macrow.c (draw_row): Check in_area before drawing unseen fuzz. Don't draw unseen fuzz in Mac designer mode. * macrow.c (draw_row): Don't call draw_unseen_fuzz if dside->designer. Make sunrise and dusk hit the whole map at once by suppressing cell updates while the lighting code is being recalculated. Note: doing so is OK since nothing happens in terms of unit actions before the maps are redrawn. * run2.c (suppress_update_cell_display): New global, init to false. (run_sun): Set suppress_update_cell_display while recomputing the lighting and coverage code. * macmap.c (suppress_update_cell_display): Declare extern. (update_cell_display): Check suppress_update_cell_display. * tkmain.c (suppress_update_cell_display): Declare extern. (update_cell_display): Check suppress_update_cell_display. * sdlmain.c (suppress_update_cell_display): Declare extern. (update_cell_display): Check suppress_update_cell_display. * xtmain.c (suppress_update_cell_display): Declare extern. (update_cell_display): Check suppress_update_cell_display. * cconq.c (suppress_update_cell_display): Declare extern. (update_cell_display): Check suppress_update_cell_display. * skelconq.c (suppress_update_cell_display): Declare extern. (update_cell_display): Check suppress_update_cell_display. 2002-12-28 Hans Ronne <hronne@telia.com> Simplify and clean up view control code on the Mac. Remove the map->see_all variable and use vp->show_all instead like in the kernel and the tcltk interface. Fix several bugs affecting designer mode switches. Apply macros from the tcltk interface that test for map->vp->show_all everywhere. * maccmd.c (get_a_visible_unit): Use (*mapp)->vp->show_all. * macconq.c (update_turn_display): Don't set map->see_all. * macconq.h (a_map): Remove map->see_all. * macdesign.c (enable_designing): Test for map->vp->show_all instead and don't set map->see_all. Remove incorrect toggling of dside->see_all. (disable_designing): Use dside->see_all to restore the view setting instead of tinkering with the frontmap (this piece of code seems wrong anyway). Set map->vp->show_all instead. * macdraw.c (m_terrain_visible): Copy macro from tkmap.c. (m_seen_border): Copy macro from tkmap.c. (cell_style): Use m_terrain_visible instead. (cell_overlay): Use map->vp->show_all instead. (mac_compute_transition): Call m_terrain_visible instead. (draw_shore_images): Use m_seen_border instead. (draw_border_images): Use m_seen_border instead. * macmap.c (draw_control_panel): Use map->vp->show_all. (draw_unit_names_only): Use map->vp->show_all. * macmouse.c (do_mouse_down_map_control_panel): Remove map->see-all. Only set map->vp->show_all. Remove code that incorrectly sets dside->see_all. (do_mouse_down_map_content): Remove tests for map->see_all and frontmap->see_all. Only test for side_sees_unit, which is the logical thing to do. * macrow.c (m_terrain_visible): Copy macro from tkmap.c. (m_seen_border): Copy macro from tkmap.c. (cell_style): Use m_terrain_visible instead. (cell_overlay): Use map->vp->show_all instead. (cell_terrain): Use map->vp->show_all and m_terrain_visible. (draw_row): Use map->vp->show_all and m_terrain_visible. (draw_shores): Use m_terrain_visible instead. (draw_borders): Use m_terrain_visible instead. (draw_connections): Use m_terrain_visible instead. (draw_units): Use map->vp->show_all instead. * macunit.c (draw_unit_closeup): Remove incorrect check of frontmap->see_all. Remove unnecessary warning beep on the Mac. * maclist.c (scroll_to_selected_unit_in_list): Don't beep just because there is no map open to scroll in. Make fuzzy edges of unseen regions work on the Mac (and other interfaces that do not use the x bitmaps). * fuzz24x26.gif: New file, converted from fuzz16.b. * fuzz44x48.gif: New file, converted from fuzz32.b. * fuzz88x96.gif: New file, converted from fuzz64.b. * terrain.imf (fuzz): Add new image family. * imf.dir (fuzz): Add new image family. * macinit.c (init_terrain_images): Init generic_fuzz. * macconq.h (draw_unseen_fuzz): Prototype new function. * macdraw.c (mac_compute_transition): Also test if (x, y) is visible as well as (x1, y1). (draw_unseen_fuzz): New function adapted from tkmap.c. * macrow.c (draw_row): Call draw_unseen_fuzz. * ui.h (generic_fuzz): Declare extern image family. * ui.c (generic_fuzz): New global image family. Speed up drawing of new cell coatings by run_environment. * run2.c (run_environment): Don't update cells one by one. Just redraw the entire map instead when done. Clean up side control border drawing code on the Mac. * macmap.c (update_cell_display): Remove control_sides_defined check, no longer needed. Fix so that terrain transitions work also for the view coverage and lighting overlays on the Mac. * macdraw.c (cell_overlay): Adapted macro from macrow.c. (mac_compute_transition): Add test for cell_overlay. (draw_terrain_transitions): Add coverage and lighting code. * macmap.c (update_cell_display): Add code updating adjacent cells also when the UPDATE_COVER flag is set (this is slow - should find a better way to do it). Fix failure of stippled cell overlays to overlap completely on the Mac. * macconq.h (coatrgns, lastcoatrgnx, lastcoatrgny): New globals. * macdraw.c (coatrgns, lastcoatrgnx, lastcoatrgny): Declare. (make_cell_clip): Make coatrgns which has one extra row of pixels at the NW border of the cell. (draw_hex_region): Offset coatrgns. Set lastcoatrgnx and lastcoatrgny. Use coatrgns when drawing coatings and overlays at zero angle. macinit.c (init_display): Allocate and initialize coatrgns, lastcoatrgnx and lastcoatrgny. 2002-12-27 Hans Ronne <hronne@telia.com> Fix terrain transition code for cell coatings in the tcltk interface. * tkmap.c (draw_terrain_transitions): Move call to cell_drawing_info for (x1, y1) to the start of the loop. Test for adjover instead of mainover when deciding whether to draw transition cell coatings. 2002-12-27 Hans Ronne <hronne@telia.com> Fix kernel bug (actually an overzealous anti-cheating measure) that caused updates of unseen areas at sunrise to fail. Thanks to Lincoln Peters for reporting this bug. * side.c (really_reset_coverage): New function, clone of reset_coverage that really does reset the coverage instead of just pretending to do so (we keep the old function for use by the interfaces so that cheating by repeated refreshing of the display still is impossible). * side.h (really_reset_coverage): New prototype. *run2.c (add_new_sides_to_game): Call really_reset_coverage instead. (run_sun): Call really_reset_coverage instead. 2002-12-27 Hans Ronne <hronne@telia.com> Fix day/night and view coverage drawing code on the Mac so that it works like in the tcltk interface. * macconq.c (update_area_display): Add missing content by copying the code from the tcltk version of the callback. * macdraw.c (draw_cell_block): Use PenPat(ltGray_pat()) for viewed terrain during the night and PenPat(gray_pat()) for terrain outside the view coverage. Use PenMode PatOr in both cases. Add explanations. (draw_hex_region): Ditto. * macrow.c (cell_overlay): Rearrange macro so that drawing of coverage takes precedence over drawing of night terrain. Fix so that drawing of cell coatings works on the Mac, similar to the tcltk interface. However, don't let coatings override coverage and daylight code. Add a separate coat argument instead and use notPatOr so that coatings and coverage can coexist peacefully in the same cell. * macconq.h (draw_cell_block): Add coat argument. (draw_hex_region): Add coat argument. * macdraw.c (mac_compute_transition): Add test for any_coating_at so that transitions also are drawn between cells with same terrain type but different coating types. (draw_cell_block): Add code for drawing cell coatings. (draw_hex_region): Add code for drawing cell coatings. (draw_terrain_sample): Add NONTTYPE for coat arg in draw_hex_region calls. * macrow.c (draw_terrain_row): Add coat and segcoat variables that are passed on to draw_cell_block and draw_hex_region. * tkmap.c (any_coating_at): Move function and prototype to the kernel. * ui.c (any_coating_at): Move function here from tkmap.c. * ui.h (any_coating_at): Move prototype here from tkmap.c. Change transition code so that higher-numbered terrain takes precedence over lower-numbered terrain (improves the appearance of most maps, particularly when beaches and other border types are drawn). Also make the tcltk and other interfaces draw transitions when the coating types for two adjacent cells differ. * macdraw.c (mac_compute_transition): Test for (t1 < t) instead. * ui.c (compute_transition): Test for (t1 < 1) instead. Also test for different coating types in adjacent cells. Fix so that cell coatings and other stippled regions are drawn with the correct foreground color in the MacTcl interface. * tkmac.c (XFillRectangles): Set RGBForeColor(&macColor) before drawing stippled regions. 2002-12-25 Hans Ronne <hronne@telia.com> Add support for a separate country border color to the Mac interface. * macconq.h (FEATURES): Increase to 11. (draw_country_borders): Remove shade arg from prototype. (bordercolor): Define as featColor[11]. * maccolors.c (set_default_colors): Initialize default_featColorName[11] to g_country_border_color() and featColorItemName[11] to "Borders". * macdraw.c (draw_country_borders): Remove shade arg and associated PenPat setting code. * macprefs.c (interp_mac_ui_data): Handle bordercolor. (ui_update_state): Update bordercolor. * macrow.c (draw_people_row): Remove shade in draw_country_borders calls. Use bordercolor and frontcolor to set the drawing color instead. Change the default country border color (pink) since it was too similar to the default feature border color (light-salmon). * gvar.def (country-border-color): Use deep-pink instead. Make the People and Control menu items toggle both borders and emblem rows on the Mac, similar to the tcltk interface. * macrow.c (draw_people_row): Rewrite and simplify function so that it works as intended. Remove people and controlling side emblems at the edge of the map. * macrow.c (draw_people_row): Don't set drawpop and drawcon at the edge of the map. * tkmap.c (draw_people): Don't set drawemblemhere at the edge of the map. Improve separation of people and controlling side emblems on the Mac. * macrow.c (draw_people_row): Use relative emblem offsets from the tcltk interface. 2002-12-25 Hans Ronne <hronne@telia.com> Update the pre-release version date. * version.h (VERSION): Change to December 2002. Make it possible to specify in the game files whether or not shorelines, feature boundaries and meridians should be drawn. The purpose of this is to override user preferences in cases where drawing them is absurd, such as in space games. Note: the override only applies on map creation. It is still possible to toggle these settings for an existing map. * gvar.def (g_feature_boundaries): New gvar. Initialize to -1. (g_meridians): New gvar. Initialize to -1. (g_shorelines): New gvar. Initialize to -1. * macmap.c (create_map): Use the gvars to set map->draw_meridians, map->featureborders and map->shorelines if they differ from -1. * tkmap.c (mapw_configure): Use the gvars to set vp->draw_meridians and vp->draw_feature_boundaries if they differ from -1 and the map widget is being created (flags != TK_CONFIG_ARGV_ONLY). Use the new gvars in the games. Set meridians to false in space games and small scale games. Set shorelines to false in games with non-water liquid terrain. Set feature-boundaries to true in games where features are real areas (provinces or countries) and to false where they are just used to position feature legends (e.g. one-cell "river" features). * cave.g (meridians): Set to false. * cave2.g (meridians): Set to false. * coral-sea.g (feature-boundaries): Set to false. * dukla.g (feature-boundaries): Set to false. * earth-1deg.g (feature-boundaries): Set to false. * earth-50km.g (feature-boundaries): Set to false. * galaxy.g (meridians): Set to false. * galaxy2.g (meridians): Set to false. * gettysburg.g (feature-boundaries): Set to false. * hill.g (meridians): Set to false. * insects.g (meridians): Set to false. * panzer.g (shorelines): Set to false. * pgu.g (shorelines): Set to false. * space.g (meridians): Set to false. * t-midearth.g (feature-boundaries): Set to false. * t-normandy.g (feature-boundaries): Set to false. * t-nw-eur.g (feature-boundaries): Set to true. * t-roman.g (feature-boundaries): Set to true. * tank.g (meridians): Set to false. Fix new mask init warning in the galaxy2 game. * galaxy2.g (trooper): Don't redefine the imf. Fix missing imf init warning in the quest game. * quest.g (centaur): Add image-name "horse". Hide feature borders by default on the Mac, similar to tcltk interface. * maccolors.c (default_featureborders): Initialize to FALSE. Don't draw meridians for the world map by default on the Mac. * macmap.c (create_map): Move map->vp->draw_meridians to section with separate world map branch. Limit Mac world map to 1/4 of screen instead of 1/3. * macmap.c (create_map): Divide by 4 instead of 3. Fix crashes in MacOS X due to unallocated area.peopleside being dereferenced in games with a non-zero country-radius-max. * mkunits.c (make_countries): Comment out code that tests for dopeoplesides and dopeopleindeps. Always allocate area.peopleside since it may be used even when the test returns false. Improve and simplify drawing of people borders (frontlines) on the Mac and make it consistent with the tcltk interface. * macdraw.c (draw_country_borders): Use only one gray_pat (medium gray) and don't divide width by 2. * macrow.c (draw_people_row): Reenable commented out hatched border code. However, draw full borders also against independent regions, and don't draw any borders against liquid terrain. Use only one gray_pat (medium gray). Draw extra emblem row at the edge of the map instead of at the edge of visible terrain. Draw emblems against liquid terrain and remove test for btimasks in control emblem drawing code. Fix bug in Mac cell update code that would prevent the necessary update of adjacent cells when control borders were drawn. Note: should overhaul and simplify the people/control border code further so that it works as in the tcltk interface. Specifically, it should be possible to turn borders on and off, not just emblems. User preferences for border display should also be added to both the Mac and tcltk interfaces. Further note: the control side area layer should be dynamically generated for all games. Now it has to be defined (painted) in the game file in order to be allocated and used in the game. * macmap.c (update_cell_display): Add test for control_sides_defined to the UPDATE_ADJ clause. Simplify the tcltk people and control border code somewhat and make it consistent with the Mac interface. * tkmap.c (draw_people): Only draw emblems (no borders) against liquid terrain. Draw full width unstippled borders against independent terrain. Remove cbitmask2 and pbitmask2, and associated code. Don't draw emblems at small magnifications. (draw_country_border_line): Remove heavy argument and associated code. 2002-11-26 Hans Ronne <hronne@telia.com> Fix bug in variants dialog due to last checkin. * tkconq.tcl (add_variants_dialog_items): Delete -pady 10. 2002-11-20 Hans Ronne <hronne@telia.com> Fix xconq compatibility with Tcl8.4.1 (thanks Stanley Sutton). * tkconq.tcl (add_variants_dialog_items): Change -pad 10 to -padx 10 -pady 10. Fix so that shores are drawn without flittering in the Mac interface. * macconq.h (draw_shores): Don't prototype extern here. (draw_gridlines): Don't prototype extern here. * macmap.c (update_cell): Eliminate the now redundant calls to draw_shores and draw_gridlines. * macrow.c (draw_shores): Prototype static here. (draw_gridlines): Prototype static here. (draw_row): Draw shores and borders before the grid. Draw extra rows of gridlines and units to cover any shores that are drawn. Fix bug due to typo in the ww2 division level Europe base module. * ww2-div-eur.g (consumption-per-fire): Add missing -per. 2002-11-16 Hans Ronne <hronne@telia.com> Fix so that window updates of blast images, fire line segments, scrolled regions etc. work correctly also under MacOS X. * macconq.c (update_fire_at_display, update_fire_into_display): Call QDFlushPortBuffer after Line ifdef MACOSX. (draw_unit_blast): Call QDFlushPortBuffer ifdef MACOSX. * macgworld.c (copy_from_gworld): Call QDFlushPortBuffer ifdef MACOSX (forces updates of everything that is drawn offscreen). * maclist.c (list_vscroll_fn): Call QDFlushPortBuffer ifdef MACOSX. (list_hscroll_fn): Call QDFlushPortBuffer ifdef MACOSX. * macmap.c (draw_related_maps): Call QDFlushPortBuffer ifdef MACOSX. Fix so that the small city map in the advanced unit closeup is drawn correctly also under MacOS X. * macunit.c (copy_rect_from_gworld, toggle_landuse_one_cell): Use my_GetWindowPort(win) in the CopyBits call. Tweak startup dialogs so that they look nice under MacOS X. * macinit.c (draw_player_setup_list): Tweak text positions. * Xconq.r (DITL 128 "Splash Items"): Tweak button sizes. (DITL 129 "New Game Items"): Tweak item sizes and positions. (DITL 130 "Player Setup Items"): Tweak item sizes and positions. (DITL 131 "Variants Items"): Tweak item sizes and positions. (DLOG 129 "New Game"): Increase width to 500 pixels. (DLOG 130 "Player Setup"): Increase width to 500 pixels. (DLOG 131 "Variants"): Increase width to 500 pixels. Tweak button sizes and positions in the Instructions and Help windows so that they look nice under MacOS X. * machelp.c (draw_help): Tweak horizontal line position. (create_instructions_window): Tweak button positions. * Xconq.r (CNTL 130 "Close Button"): Tweak position and size. (CNTL 131 "Topics Button"): Tweak position and size. (CNTL 132 "Help Button"): Tweak position and size. (CNTL 133 "Prev Button"): Tweak position and size. (CNTL 134 "Next Button"): Tweak position and size. (CNTL 135 "Back Button"): Tweak position and size. (WIND 135 "Help"): Increase width to 345 pixels. Fix the construction default button in the construction window so that it is drawn correctly under MacOS X. * macwins.c (calc_construction_rects): Tweak runlengthrect. (draw_construction_default): Call SetWindowDefaultButton ifdef MACOSX. * Xconq.r (CNTL 128 "Construct Button"): Tweak position. (CNTL 129 "Research Button"): Tweak position. (CNTL 136 "Develop Button"): Tweak position. Tweak various dialogs so that they look nice under MacOS X. * macinit.c (create_chat_dialog): Don't reposition the window. * Xconq.r (CNTL 700 "Preferences Popup"): Tweak label size. (DITL 139 "Chat Items"): Tweak button sizes. (DITL 700 "Preferences Items"): Tweak buttons. (DITL 700 "Preferences Font Items"): Tweak Edit Text items. (DITL 800 "Set Offscreen Buffers"): Tweak buttons. (DITL 800 "Set Meridians"): Tweak buttons. (DITL 802 "Set Feature Color Items"): Tweak text position. (DITL 812 "Set Terrain Color Items"): Tweak text position. (DITL 807 "Unit Build"): Tweak Edit Text item. (DITL 900 "Game Over Items"): Tweak buttons and text. Fix OSX crashes in Meridians and Offscreen Buffer dialogs. * macmenus.c (set_meridians): Fix itemnum pointer bug. (set_offscreen_buffers): Fix itemnum pointer bug. Add build patches for Solaris Forte (thanks Stanley Sutton). * INSTALL: Add addendum to build instructions. * Makefile.in (CFLAGS): Define as -g @CFLAGS@. 2002-11-11 Hans Ronne <hronne@telia.com> Fix really strange bug in the terrain popup menu that seems to have been introduced by DeRez. * Xconq.r (MENU 720 "Terrain Images Popup"): Change "172" back to "textMenuProc" (which it was before DeRezing). 2002-11-10 Hans Ronne <hronne@telia.com> Fix so that skelconq compiles again after being split into two files. * skelconq.c (autotest): Declare extern that now lives in autotest.c. (do_toolup_action): Don't declare it here (now needed in autotest.c). * autotest.c (do_toolup_action): Declare it here instead. (autotest): Declare extern needed in skelconq.c. (do_create_at_action): Declare extern. (do_enter_action): Declare extern. Fix so that cconq compiles again in the MacOS interface. Note: there are still problems with Window focusing that need to be solved. * v_maccur.c (macheads.h): Include it. Fix so the IMFApp compiles again in the MacOS Classic interface. * imfapp.c (draw_topline): Use GetFNum to get Monaco by font name. Remove conditionalized Carbon code. (add_library_path): Add missing prototype. Fix DebuggingCarbonLib warnings in the MacOS IMFApp code. Note: IMFApp still crashes in the image drawing code under OS9/Carbon. * imfapp.c (main): Conditionalize loading of DAs into the Apple menu. (adjust_menus): Don't enable obsolete miViewCQD item. Finally fix the Map Preferences Magnification menu under Carbon. * macprefs.c (set_preferences): Remove menu handling code. (add_preferences_topic_items): Remove menu handling code. * Xconq.r (MENU 709 "Magnification Popup"): New menu. (CNTL 709 "Magnification Popup"): Link to MENU 709 instead. Fix color scrambling in the Side Color dialog under OSX. * maccolors.c (set_side_colors): Use my_GetWindowPort instead of typecasting window to CGrafPtr. Fix flittering of the OK button in the help and instructions windows under OS9/Carbon. Also fix failure to redraw the buttons completely in instructionswin under OSX. * machelp.c (draw_instructions): Conditionalize for MACOSX instead and add a call to DrawControls. (draw_help): Conditionalize for MACOSX instead. Move DrawControls call inside the conditionalized code. Fix two CodeWarrior build errors with standard configuration under MACOSX. * macheads.h: Include <Carbon.h> instead of <Carbon/Carbon.h>. * macconq.h (connection_method): Remove obsolete global. * macconq.c (connection_method): Remove obsolete global. * mac.c (connection_method): Remove obsolete global. 2002-11-10 Hans Ronne <hronne@telia.com> Add Stanley Sutton's Win32 fixes for building with MS-Visual C. * socket.c (io.h): Include ifdef _MSC_VER. * tkconq.h (timeval): Define struct ifdef _MSC_VER. * tkwin32 (WinMain): Prototype extern "C" ifdef __cplusplus. (WinMain): Remove SetMessageQueue call that sneaked back into the code. * util.c (INT64): Define as __int64 ifdef _MSC_VER else as long long. (xrandom): Change long long to INT64. * win32.c (io.h, windows.h): Include ifdef _MSC_VER. (game_homedir): Use CreateDirectory instead of mkdir ifdef _MSC_VER. Fix division by zero error in some games (thanks Juergen Ruehle). * ai.c (exploring_worth): Return 0 if u_cp(u) <= 0. Fix so that checking of items in the Preferences : Map Items : Map Size popup menu works and so that the menu is enabled under Carbon. Note: should figure out why it still takes an extra click in the menu to enable it under Carbon and a pref panel switch to enable it under OSX. * macprefs.c (set_preferences): Add Size menu handling code. (add_preferences_topic_items): Add Size menu handling code. Fix so that the sides and features popup menus work under Carbon. * maccolors.c (sidespopup): Declare extern MenuHandle. (featurespopup): Declare extern MenuHandle. (build_sides_menu): Rename to build_sides_popup. Use sidespopup. (build_features_menu): Rename to build_features_popup. Use featurespopup. * macconq.h (build_sides_menu): Rename to build_sides_popup. (build_features_menu): Rename to build_features_popup. * macinit.c (init_menus): Init sidespopup and featurespopup. (launch_game_2): Call build_features_popup and build_sides_popup. * macmenus.c (sidespopup, featurespopup): Initialize to nil. * macprefs.c (set_preferences): Don't call build_features_menu and build_sides_menu here. Fix so that the colors popup menus work under Carbon. Also fix several existing bugs in the color setting dialogs. Note: scrambling of colors under OSX in the side color dialog still needs to be fixed. * maccolors.c (colorspopup): Declare extern MenuHandle. (terrainpopup): Declare extern MenuHandle. (set_side_colors): Rewrite for Carbon compatibility and fix bugs. (set_feature_color): Rewrite for Carbon compatibility and fix bugs. (set_terrain_color): Rewrite for Carbon compatibility and fix bugs. (build_colors_popup, build_terrain_popup): New functions. (append_image_names): Remove obsolete lib-mac reading code. List terrain images and patterns before solid colors. (append_color_names): Return num instead of TRUE. (append_terrain_names): Return num instead of TRUE. * macconq.h (build_colors_popup): New prototype. (build_terrain_popup): New prototype. * macdefs.h (mTerrainPopup): Define as 720. (dTerrainColor): Define as 812 with dialog items 1-5. * macinit.c (init_menus): Init colorspopup and terrainpopup. (launch_game_2): Call build_colors_popup & build_terrain_popup. * macmenus.c (colorspopup): Initialize to nil. (do_menu_command): Use colorsmenu instead of GetMenu(mColors). * Xconq.r (CNTL 720 "Terrain Images Popup"): New control. (CNTL 705 "Color ppat Popup"): Rename to "Colors Popup". (dctb 812 "Set Terrain Colors"): New dialog color table. (DITL 812 "Set Terrain Colors"): New dialog items list. (DLOG 812 "Set Terrain Colors"): New dialog. (MENU 705 "Color ppat Popup"): Rename to "Colors Popup". (MENU 720 "Terrain Images Popup"): New menu. Fix bug that prevented customized colorschemes from being loaded from the preferences file. Note: should find a way to respect schemes that are speficied in the game file, but not the default schemes. * maccolors.c (init_side_colors): Don't override default_colorscheme. 2002-11-08 Hans Ronne <hronne@telia.com> Update the pre-release version date. * version.h (VERSION): Change to November 2002. Fix OSX crashes due to access faults when gworlds are updated. * macgworld.c (update_gworld): Don't call UpdateGWorld (broken under OSX). Call DisposeGWorld + NewGWorld instead. Fix OSX crashes when switching AI during player setup. * macinit.c (hit_player_setup_dialog): Add ugly hack that makes things work under OSX. Note: should really make next_ai_type_name return an empty string at the end of the list instead of a NULL pointer. Fix OSX crashes due to NULL being returned by selected_unit_in_list. * maclist.c (do_mouse_down_list): Check that unit exists. Fix OSX crashes due to typecasting of dialog and window to GrafPtr. * macprefs.c (draw_font_sample): Use GetDialogPort instead. * macunit.c (draw_unit_size): Use GetWindowPort instead. Fix OSX crashes due to typecasting of chatwin to CGRafPtr. * macinit.c (draw_chat_dialog): Use GetWindowPort. Also move NewRgn and DisposeRgn inside conditionalized code block, where they belong. Fix OSX crashes when clicking in the wrong places on the map. * macmouse.c (do_mouse_down_map_content): Test if the nearest unit exists after each call to m_nearest_unit. Fix OSX crashes for planless units in the unit build dialog. * macwins.c (draw_unit_build_dialog): Check if unit->plan exists before dereferencing task and lasttask. Fix OSX crashes in the unit build dialog if there is no frontmap->curunit. * macunit.c (hit_unit_build_dialog): Call close_window if we lack either frontmap or frontmap->curunit. Fix OSX crashes due to string allocation bug in the advanced unit popup. * macunit.c (draw_advanced_content): Copy empty string into buf before feeding it into the c2p macro. Fix OSX crashes due to NULL a pointer being passed to GetDItem. * macunit.c (draw_advanced_content): Pass itemtype and itemhandle. Fix problem with certain dialogs blinking into view on creation. * Xconq.r (DLOG 130 "Player Seup"): Make initially invisible. (DLOG 132 "Progress"): Make initially invisible. (DLOG 134 "World Size"): Make initially invisible. (DLOG 135 "Real Time"): Make initially invisible. (DLOG 135 "More Variants Time"): Make initially invisible. (DLOG 138 "Configure Side"): Make initially invisible. (DLOG 160 "Mplayer"): Make initially invisible. (DLOG 501 "Designer Save"): Make initially invisible. (DLOG 501 "Designer Reshape"): Make initially invisible. (DLOG 804 "Unit Research"): Make initially invisible. (DLOG 805 "Global Research"): Make initially invisible. (DLOG 806 "Set Meridians"): Make initially invisible. (DLOG 807 "Unit Build"): Make initially invisible. (DLOG 808 "Unit Plan"): Make initially invisible. (DLOG 811 "Side Research"): Make initially invisible. (DLOG 900 "Game Over"): Make initially invisible. (DLOG 1000 "Init Warning"): Make initially invisible. (DLOG 4000 "Two Button Alert"): Make initially invisible. (DLOG 4001 "One Button Alert"): Make initially invisible. Fix so that the build popup menus work under both OS9/Carbon and OSX. * macunit.c (update_build_menu): New, replaces build_construction_menu. (draw_advanced_closeup): Call GetControlPopupMenuHandle under Carbon, else GetMenu. Call update_build_menu instead of build_construction_menu. (hit_closeup_dialog): Call GetControlPopupMenuHandle under Carbon, else GetMenu. Call update_build_menu instead of build_construction_menu. Add special PopUpMenuSelect code to make things work under OSX. Tweak itemrect so that the menu aligns correctly under both OS9 and OSx. (draw_unit_build_dialog): Call GetControlPopupMenuHandle under Carbon, else GetMenu. Call update_build_menu instead of build_construction_menu. (hit_unit_build_dialog): Call GetControlPopupMenuHandle under Carbon, else GetMenu. Call update_build_menu instead of build_construction_menu. Add special PopUpMenuSelect code to make things work under OSX. Tweak itemrect so that the menu aligns correctly under both OS9 and OSx. Fix so that the research popup menus work under both OS9/Carbon and OSX. * macconq.h (update_research_menu): New prototype. * macunit.c (draw_advanced_closeup): Call GetControlPopupMenuHandle under Carbon, else GetMenu. Call update_research_menu instead of build_research_menu. (hit_closeup_dialog): Call GetControlPopupMenuHandle under Carbon, else GetMenu. Call update_research_menu instead of build_research_menu. Add special PopUpMenuSelect code to make things work under OSX. Tweak itemrect so that the menu aligns correctly under both OS9 and OSx. (update_research_menu): New function, replaces build_research_menu. * macwins.c (update_research_menu): New function and prototype. (draw_research_dialog): Call GetControlPopupMenuHandle under Carbon, else GetMenu. Call update_research_menu instead of build_research_menu. (hit_research_dialog): Call GetControlPopupMenuHandle under Carbon, else GetMenu. Call update_research_menu instead of build_research_menu. Add special PopUpMenuSelect code to make things work under OSX. Tweak itemrect so that the menu aligns correctly under both OS9 and OSx. Fix the File/Colors submenu so that it works under Carbon. * maccolors.c (colorsmenu): Declare extern MenuHandle. (build_colors_menu): Use colorsmenu instead of static MenuHandle. Fix failure to display some setup dialogs under OSX. * macinit.c (world_shape_dialog): Call SelectTheWindow. (real_time_dialog): Call SelectTheWindow. (more_variants_dialog): Call SelectTheWindow. Fix mistaken commenting out of MakeDialogFloat in side research dialog. * macwins.c (show_research_dialog): Move MakeDialogFloat outside the commented out code block. Fix color scrambling in the advanced unit popup under Carbon. * macunit.c (draw_advanced_closeup): Conditionalize the call to RGBBackColor(&oldBack). Fix two menu item bugs detected by DebuggingCarbonLib. * macmenus.c (build_optional_terrain_type_menu): Only count the optional terrain types when enabling items. (adjust_menus): Use m + 1 instead of i when disabling items in the Material Types submenu. 2002-11-01 Hans Ronne <hronne@telia.com> Fix so that window resizing works in the carbonized Mac interface. * macconq.h (grow_map, grow_list): Remove size args. * macconq.c (grow_window): Call ResizeWindow instead of GrowWindow. * machelp.c (grow_help): Remove SizeWindow call. * macmap.c (grow_map): Remove SizeWindow call and size args. * maclist.c (grow_list): Remove SizeWindow call and size args. * macwins.c (grow_history): Remove SizeWindow call. (grow_construction): Remove SizeWindow call. (grow_notice): Remove SizeWindow call. (grow_scores): Remove SizeWindow call. Fix so that the list window is updated correctly in the Mac interface. * maclist.c (draw_list): Add back lines that were deleted. Fix so that text fonts are saved and restored correctly in the carbonized Mac interface. * macprefs.c (draw_font_sample): Call GetPortTextFont, GetPortTextSize and GetPortTextFace instead of using QD(thePort) in the carbonized app. * macunit.c (draw_unit_size): Call GetPortTextFont, GetPortTextSize and GetPortTextFace instead of using QD(thePort) in the carbonized app. Fix warning from DebuggingCarbonLib. * macmenus.c (init_menus): Conditionalize loading of 'DRVR' resources. 2002-10-31 Stan Shebs <shebs@apple.com> Set default items for dialogs instead of using draw_default_button. * maccmd.c (message_dialog, unit_rename_dialog): Use SetDialogDefaultItem. * maccolors (set_side_colors, set_feature_color, set_terrain_color): Ditto. * macinit.c (draw_splash_dialog, draw_newgame_dialog, draw_variants_dialog, world_shape_dialog, real_time_dialog, more_variants_dialog, draw_player_setup_dialog, hit_player_setup_dialog, configure_indepside_dialog): Ditto. * macmenus.c (do_about_box, find_location_dialog, worldmap_dialog, find_unit_dialog, set_offscreen_buffers, set_meridians, side_rename_dialog): Ditto. * macprefs.c (set_preferences): Ditto. * macunit.c (draw_simple_closeup, draw_advanced_closeup, draw_unit_build_dialog, unit_research_dialog, unit_plan_dialog): Ditto. * macwins.c (draw_research_dialog, side_research_dialog, draw_gameover_dialog, draw_alert_dialog): Ditto. * machelp.c (draw_instructions, draw_help): Use SetWindowDefaultButton for Carbon. * macconq.c, macconq.h (draw_default_button): Remove. 2002-10-29 Stan Shebs <shebs@apple.com> * mac.c (initial_vrefnum): Rename from initialvrefnum, change all uses. (initial_dirid): New global. (statistics_filename): Add Carbon dialog. (open_file, open_scorefile_for_reading, open_scorefile_for_writing): Use HSetVol instead of SetVol everywhere. (low_receive): Add a return value to dummy version. * macheads.h (my_GetWindowKind): New adapter macro. * Floating.c (IsFloating, IsDialog): Use it. * macconq.c (close_window, is_da_window, is_app_window): Ditto. * macgworld.c (update_all_dialogs, update_all_visible_windows): Ditto. * macheads.h (my_InvalWindowRgn): New adapter macro. * maclist.c (list_vscroll_fn, list_hscroll_fn): Use it. * macheads.h (my_GetControlBounds, my_GetControlHilite): New adapter macros. * machelp.c (draw_instructions, draw_help): Use them. * maccolors.c (pick_new_color): Add a return value. * macconq.c (get_files): Use HGetVol and HOpenResFile. (event_loop): Use GetDialogTextEditHandle. * macdesign.c (designer_save_dialog): Add Carbon code. * macgworld.c (scroll_map_window): Fix Carbon case (thanks to Hans Ronne). * macinit.c (open_game_from_name_and_volume): Add dirid arg, use HSetVol. (do_key_down_chat): Use GetDialogTextEditHandle. (create_newgame_dialog): Remove leftover sleep. (do_key_down_newgame): Always return a result. (open_game_dialog): Add Carbon code. (open_game_from_fsspec): Use HSetVol always. (launch_game): Always return a result. * macmenus.c (worldmap_dialog): Declare as void. (save_the_game): Add Carbon code. (reinit_advanced_unit_closeup): Always return result. * macmouse.c (do_mouse_down_map): Remove bogus MACOSX test. * macprefs.c (open_preferences): Enable for Carbon. * macunit.c (do_key_down_closeup, do_key_down_build): Use GetDialogTextEditHandle. (build_construction_menu): Test for nonempty task list. * macwins.c (draw_construction_default): Enable for Carbon. * macconq.c: Comment out SIOUX stubs. 2002-10-28 Stan Shebs <shebs@apple.com> Whack vestiges of MPW and Think support, streamline Mac headers. * cconq.c, skelconq.c, maccmd.c, macconq.c, macheads.h, machelp.c, macmenus.c, macprefs.c, macwins.c: Remove MPW and THINK_C ifdefs. * macheads.h: Remove !NEW_HEADERS cases, alphabetize Mac toolbox includes, make old routine name definitions apply to both Carbon and pre-Carbon (so don't define OLDROUTINENAMES in prefixes), remove unneeded argument lists in old macros. (my_GetPortVisibleRegion): Comment out for pre-Carbon until fixed. * macconq.c: Remove includes of errors.h and Sound.h. * macimf.c (mac_load_imf): Use GetResourceSizeOnDisk instead of SizeResource. * macinit.c (draw_newgame_dialog, do_key_down_newgame, hit_newgame_dialog): Use kFontIDNewYork instead of newYork. * macprefs.c (save_preferences): Use RemoveResource instead of RmveResource. * CconqMPW.r, IMFAppMPW.r, XconqMPW.r: Remove files, no longer used. * mpw-configure, mpw-config.in, mpw-make.in: Remove. * Makefile.in: Remove references to these. * INSTALL-mac: Remove MPW references, update generally. 2002-10-27 Stan Shebs <shebs@apple.com> * macheads.h (my_GetNextWindow): New adapter macro. * macconq.h (for_all_windows): Use it. * macconq.c (adjust_cursor, update_window, select_new_regions): Allocate/dispose visibility regions for Carbon. * macimf.c (mac_create_cicn): Use Carbon field names. (mac_init_cicn_1): Compute base addresses directly instead of with PlotCIcon. * macinit.c (draw_chat_dialog): Handle vis rgn for Carbon. * macmouse.c (scroll_to_unit): Ditto. * macwins.c (draw_construction): Ditto. (append_notice): Allocate noticeStyle before using. * macmap.c (draw_meridians): Always pass non-NULL to xform. * Floating.h (ReactToRemoval): Pass a WindowPtr. * Floating.c (ActivateTheWindow): myQElPtr is pre-Carbon only. (IsFloating): If Carbon, look for floating window class. (IsDialog): Unstub Carbon version. (IsVisible): Use my_IsWindowVisible. (UpdateFloats, HideTheWindow, DisposeTheWindow): Use my_GetNextWindow. (MakeFloat, MakeDialogFloat): Enable more of body if Carbon. (ReactToRemoval): Change arg to WindowPtr and rewrite for Carbon. (SelectTheWindow): Tweak for Carbon. (DragTheWindow): Do basic dragging if Carbon. (ShowFloats): Comment out. 2002-10-26 Stan Shebs <shebs@apple.com> Basic Carbonization of Mac Xconq. * imfapp.c, maccmd.c, maccolors.c, macconq.c, macconq.h, macdesign.c, macdraw.c, macgworld.c, machelp.c, macimf.c, macimf.h, macinit.c, maclist.c, macmap.c, macmenus.c, macmouse.c, macprefs.c, macrow.c, macunit.c, macwins.c: Global changes, including: - use of set_cursor_to_arrow instead of SetCursor on the QD arrow global, - use of macros black_pat etc instead of QDPat(black) etc, - use of my_thePortBits instead of QD portBits global, - use of my_GetPortBitMap instead of portBits field, - use of my_GetPortWindowPort and my_SetPortWindowPort instead of GetPort and SetPort for windows, - use of my_GetWindowPortBounds instead of portRect field, - use of GetWindowRegion instead of strucRgn and contRgn fields if Carbon, - use of my_InvalWindowRect instead of InvalRect, - use of my_IsWindowVisible instead of visible field, - separate window and dialog ptrs, the use of GetDialogWindow to convert, and the passing of dialog ptr to dialog functions such as DisposeDialog, - filling in of all arguments to GetDItem and friends * mac.c: Include macheads.h. (statistics_filename, open_file, open_scorefile_for_reading, open_scorefile_for_writing): Conditionalize for Carbon. * util.c: Include OSUtils.h if on Mac. * macheads.h: New file, mostly lifted from macconq.h, contains all the Mac includes and adapter macros. * macconq.h (UnitCloseup): Add dialog field. (for_all_windows): Conditionalize for Carbon. * Floating.c: Conditionalize for Carbon throughout. * Floating.h: Include macheads.h. * imfapp.c: Include macheads.h, use my_InvalWindowRect everywhere, conditionalize include of console.h. (white_pat_space): Define. (add_library_path): Dummy definition. * maccmd.c (valid): Add redefinition. * maccolors.c: Move ColorPicker.h include to macheads.h. (init_side_color): Check that dside non-NULL. (set_side_colors): Carbonize getting of back color. * macconq.c (main): Add (mostly broken) attempt at command argument handling. (missed_any_parameters, do_ae_open_application, do_ae_open_documents, do_ae_print_documents, do_ae_quit_application): Constify AE argument. (init_toolbox): Conditionalize pre-Carbon toolbox inits. (recalc_spacing, init_rect, get_files, event_loop, get_global_mouse, handle_event, close_window, update_window, select_new_unit, is_da_window, is_app_window, play_sound, position_on_screen, set_standard_state, set_game_file_type): Conditionalize for Carbon. (window_width, window_height): New functions, were macros in macconq.h. (set_cursor_from_arrow): New function. * macdesign.c (designer_save_dialog): Conditionalize for Carbon. * macdraw.c (black_pat_space, dkgray_pat_space, gray_pat_space, ltgray_pat_space, white_pat_space): Define. (best_terrain_images): Remove bogus extern keyword. (draw_unit_image): Make portbits local be a pointer to a BitMap. (draw_unit_mask_image, draw_unit_shadow, draw_unit_shadow_layer, draw_side_emblem, draw_hex_region, draw_terrain_transitions, draw_shore_images, draw_border_images, draw_blast_image): Similarly. (plot_sicn): Change first arg from window to port. * macgworld.c (scroll_map_window, update_all_dialogs, update_all_visible_dialogs): Conditionalize for Carbon. * machelp.c (helpwin): Define as window instead of dialog. (draw_instructions, draw_help, zoom_help): Conditionalize for Carbon. * macimf.c: Include macheads.h. (init_mac_image): Init with 'F' instead of nonportable '\F'. * macimf.h: Remove obsolete macro versions. * macinit.c (draw_variant_slider, draw_variant_help, draw_world_picture, draw_player_setup_list, draw_player_setup_advantage, draw_progress, dims_from_point): Change window arguments to dialogs. (splash_dlg, chat_dlg, new_game_dlg, world_shape_dlg, real_time_dlg, variants_dlg, more_variants_dlg, player_setup_dlg, progress_dlg): New globals. (draw_chat_dialog, do_key_down_chat, draw_newgame_dialog, open_game_dialog, open_game_from_fsspec, open_game_from_name_and_volume): Conditionalize for Carbon. * macmenus.c (do_menu_command, save_the_game, te_cut, te_copy, adjust_menus): Conditionalize for Carbon. (see_side_rename_string, get_side_rename_string): Change window arguments to dialogs. * macmouse.c (scroll_to_unit): Conditionalize for Carbon. (do_mouse_down_map): Conditionalize for MACOSX(?). * macprefs.c: Conditionalize includes on MACOSX. (draw_font_sample, force_sample_redraw, add_preferences_topic_items): Change window arguments to dialogs. (open_preferences): Conditionalize on Carbon. * macunit.c (unit_research_dialog): Include because OS X ld doesn't dead-strip. * macwins.c (research_dlg, game_over_dlg, alert_dlg): New globals. (noticewin, scoreswin): Change from dialog to window. (draw_construction, draw_construction_default, zoom_construction, zoom_notice, zoom_scores): Conditionalize for Carbon. 2002-10-21 Stan Shebs <shebs@apple.com> Carbonize Mac IMFApp. * imfapp.c: Add framework Carbon/Carbon.h for Mac OS X and old->new adapter macros if TARGET_API_MAC_CARBON. (white_pat, my_GetPortBitMap, my_GetPortBounds, my_GetWindowPort, my_GetWindowPortBounds, my_screenBits): New compat macros, use everywhere. (set_cursor_to_arrow): New function, use everywhere. (main, do_event, do_menu_command, draw_topline): Conditionalize for Carbon. (open_imf_dir_file, open_imf_file, open_resource_file, save_imf_dir_file, save_imf_file, save_resource_file): Add Carbon versions of file dialogs. (use_mac_charcodes): Define. * macimf.c: Include framework Carbon/Carbon.h for Mac OS X. (SaveResource): Define adapter macro if Carbon. (mac_create_cicn): Disable setting of changed fields if Carbon. 2002-10-21 Jim Kingdon <kingdon@panix.com> * win/wconq.c: Remove; replaced by tcltk/tkwin32.c. (From Juergen Ruehle). 2002-10-20 Hans Ronne <hronne@telia.com> Fix so that the use of terrain transitions with solid colors and gray stippled regions works correctly in the Mac tcltk interface. * tkmac.c (XFillRectangles): Use clip_x_origin and clip_y_origin instead of theRect.left and theRect.top in the clipping code. Add support for stippled gray regions (coverage and daylight) in the Mac tcltk interface. * tkmac.c (QDPat): Define new macro. (XFillRectangles): Add code that handles cases where XSetFillStyle was used to set gc->fill_style to FillStippled. Check gc->stipple and use the corresponding gray QDPat in patOr mode. Fix access violation crashes in monster.g under Windows. * monster.g (possible-sides): Comment out references to sides "monster" and "human" which are not defined in the base module. Note: should figure out why this matters only under Windows. Improve the player setup dialog with respect to how the player list and config buttons are organized. Also tweak bottom button row. * tkconq.tcl (popup_splash_screen): Increase button pady to 6. (popup_game_dialog): Increase .newgame.top height to 370 pixels. (popup_variants_dialog): Increase .newgame.top height to 370 pixels. (add_player_dialog_items): Add pady 3 to .newgame.top.plbuttons. Move the AI column 20 pixels to the left. Move the advantage column 10 pixels to the left. Tweak postitions of column labels. Add dummy frame for padding at the top. Reorganize the vertical button row and add labels "Sides" and "Players". Change button text "A+" and "A-" to "+" and "-". Remove pady for labels. Fix so that the entire content of the indepside config dialog is visible under Windows. (popup_indepside_config): Remove empty label at top. Tweak pady for the label and checkbuttons. Use auto_path [file join [file dirname [info script]] BWidget] to find BWidget also on the Mac and Windows tcltk platforms. * tkconq.tcl (lappend): Remove Mac and Windows specific code. 2002-10-19 Hans Ronne <hronne@telia.com> Fix problem with checkboxes under Windows (the select color is on all the time, thus hiding the checkmark). * tkconq.tcl (scolor): Set it to LemonChiffon on Windows. Further improvements to the tcltk indepside config dialog. * tkconq.tcl (add_player_dialog_items): Disable indepconfig button if side_ingame 0 is false. (set_indepside): Dont enable or disable indepconfig here. Remove commented out code and obsolete comments. (popup_indepside_config): Add separate bottom frame. Place buttons in grid within this frame instead of packing them. Improvements to the tcltk popup find unit by name dialog. * tkconq.tcl (popup_find_dialog): Make .find 240 x 160 pixels and set pack propagate false. Add separate bottom frame. Place buttons in grid within this frame instead of packing them. Add key bindings for both buttons. Make the Find button active by default. Add dummy frame on top. Make entry -relief sunken and 15 chars wide. (ok_find): Withdraw .find if something was found. Improvements to the tcltk popup meridian interval dialog. * tkconq.tcl (popup_meridian_interval_dialog): Make .meridian 240 x 160 pixels and set pack propagate false. Add separate bottom frame. Place buttons in grid within this frame instead of packing them. Add key bindings for both buttons. Make the OK button active by default. Add dummy frame on top. Make entry -relief sunken and 15 chars wide. Improvements to the tcltk popup contour interval dialog. * tkconq.tcl (popup_contour_interval_dialog): Make .contour 240 x 160 pixels and set pack propagate false. Add separate bottom frame. Place buttons in grid within this frame instead of packing them. Add key bindings for both buttons. Make the OK button active by default. Add dummy frame on top. Make entry -relief sunken and 15 chars wide. Add spacing label. Improvements to the tcltk scores window. * tkconq.tcl (popup_scores): Make Close button active by default. Add Return key binding for Close button. Increase its y padding. Improvements to the tcltk preferences dialog. * tkconq.tcl (popup_preferences_dialog): Place buttons in grid within bottom frame instead of packing them. Add key bindings for both buttons. Make the OK button active by default. Increase padding of buttons. Fix bug that prevented the want_checkpoints pref from being saved. * tkconq.tcl prefs(want_checkpoints): Set it to 0 by default. (want_checkpoints): Remove unused global. (cp_interval): Remove unused global. (init_newprefs): Set newprefs(want_checkpoints). (add_files_prefs_items): Use newprefs(want_checkpoints) instead. Config entry according to newprefs(want_checkpoints). (toggle_checkpoints): Use newprefs(want_checkpoints) instead. (ok_preferences): Set prefs(want_checkpoints). 2002-10-14 Hans Ronne <hronne@telia.com> Fix problem with X foreground color being inherited on unix. * tkconq.tcl (fgcolor): New global color. Set it to black. (afcolor): New global color. Set it to black. Set -fg $fgcolor for all items that have a foreground color. Set -activeforeground $afcolor for buttons, menubuttons, checkbuttons and menus. 2002-10-14 Hans Ronne <hronne@telia.com> Various improvements to the tcltk indepside config dialog. * tkconq.tcl (popup_indepside_config): Disable research button if numatypes == 0 and treasury button if numtreasury == 0. Remove "if possible" comments from the button labels. Add key bindings for OK and Cancel buttons. Set .indepside size to 300 x 200 pixels and pack propagate false. Make the OK button active by default. Add Escape key binding to Quit command in .newgame dialogs. * tkconq.tcl (popup_splash_screen): Add new Escape key binding. (popup_game_dialog):Add new Escape key binding. (popup_variants_dialog): Add new Escape key binding. (popup_world_size_dialog): Add new Escape key binding. (popup_real_time_dialog): Add new Escape key binding. (popup_player_dialog): Add new Escape key binding. Add MA Dunzi's auto_path (version 2) for finding BWidget. * tkconq.tcl (Iappend): Use [file join [file dirname [info script]]. 2002-10-13 Hans Ronne <hronne@telia.com> Fix bug that permanently disabled the Connect/Chat button if the Chat window was destroyed instead of dismissed. * tkconq.tcl (popup_chat): Remove code that disabled the button. Just let the button bring the Chat window to the foreground if it is already open. (dismiss_chat): Don't reenable the Connect button here. Fix bug that would prevent the New Game and Open buttons from being disabled while the Chat window is open. * tkconq.tcl (popup_chat): Test for winfo exists .newgame instead. Also test for $my_rid == 0 and do this before deiconifying a .chat window that already exists. (add_program): Test for winfo exists .newgame instead. (dismiss_chat): Test for winfo exists .newgame instead and enable New Game and Open buttons if true. Fix bug that would mess up the Chat window if it was destroyed rather than dismissed and then recreated. * tkconq.tcl (popup_chat): Test for $my_rid > 0 at the end and set all items as required. Note: should also figure out how to rebuild the player list. Don't make it possible to bring up the Chat window when a game that is not connected already is in progress (it is impossible to connect to another computer by then). * tkconq.tcl (create_map_menus): Remove "Connect" item from the File menu. (adjust_file_menu): Don't adjust the "Connect" item. Fix bug that would reenable the Open button after a game already had been selected if the Chat window was opened and then closed or if the Host Game button was clicked. * tkconq.tcl (add_program): Test for numutypes == 0 before reenabling the Open button. (dismiss_chat): Test for numutypes == 0 before reenabling the Open button. Add generic code for centering tcltk windows on the screen and use it for those pre-map windows that are still bouncing around. * tkconq.tcl (popup_splash_screen): Withdraw .newgame and call center_on_screen when done drawing. (popup_game_dialog): Withdraw .newgame and call center_on_screen when done drawing. (popup_indepside_config): Withdraw .indepside and call center_on_screen when done drawing. (popup_chat): Withdraw .chat and call center_on_screen when done drawing. (center_on_screen): New procedure. 2002-10-13 Hans Ronne <hronne@telia.com> Size the tcltk scores window better. * tkconq.tcl (popup_scores): Set frame .scores.main to 400 x 300 pixels and pack propagate false. Set the text to -wrap word. Tweak position of the tcltk New Game dialog button row. * tkconq.tcl (popup_splash_screen): Add two dummy frames to the left and right of the button row. Add separate color for tcltk listboxes, and also some of the canvases, imfsamples and text fields. * tkconq.tcl (lcolor): New global. Set it to azure. (add_new_game_dialog_items): Set listbox -bg $lcolor. Set text -bg $lcolor and -highlightbackground $lcolor. (add_variants_dialog_items): Set text -bg $lcolor and -highlightbackground $lcolor. (add_player_dialog_items): Set canvas -bg $lcolor and -highlightbackground $lcolor. Set imfsample -bg $lcolor. (popup_chat): Set listbox -bg $lcolor. Set text -bg $lcolor and -highlightbackground $lcolor. (create_map_window): Set text -bg $lcolor and -highlightbackground $lcolor. (create_agreements_window): Set text -bg $lcolor and -highlightbackground $lcolor. (popup_scores): Set text -bg $lcolor and -highlightbackground $lcolor. (popup_research_dialog): Set listbox -bg $lcolor. (popup_preferences_dialog): Set listbox -bg $lcolor. (add_fonts_prefs_items): Set text -bg $lcolor and -highlightbackground $lcolor. (popup_help_dialog): Set listbox and imfsample -bg $lcolor. Set text and canvas -bg $lcolor -highlightbackground $lcolor. (scrolled_listbox): Set listbox -bg $lcolor. (scrolled_textbox): Set text -bg $lcolor and -highlightbackground $lcolor. Add global select color for unix checkbuttons and radio buttons. * tkconq.tcl (scolor): New global. Set it to MediumBlue. (add_new_game_dialog_items): Set -selectcolor $scolor. (add_variants_dialog_items): Set -selectcolor $scolor. (popup_indepside_config): Set -selectcolor $scolor. (add_map_prefs_items): Set -selectcolor $scolor. (add_files_prefs_items): Set -selectcolor $scolor. (add_imagery_prefs_items): Set -selectcolor $scolor. (popup_designer_save): Set -selectcolor $scolor. Also set -bg $bgcolor -highlightbackground $hbcolor and -activebackground $abcolor for all items as required. (create_map_menus): Set -selectcolor $scolor for all menu check buttons and radio buttons. (add_show_all_item): Set -selectcolor $scolor for menu check button. Add global color for the tcltk map backgrounds. * tkconq.tcl (mbcolor): New global. Set to SandyBrown. (create_map_window): Use $mbcolor for map backgrounds. Make the tcltk win game dialog color less garish. * tkconq.tcl (popup_game_over_dialog): Change win game color to LightGreen instead of green. Fix so that the tcltk font sample text is not selectable. * tkconq.tcl (add_fonts_prefs_items): Disable font sample. (set_font_size_newpref): Enable and disable font sample. 2002-10-13 Hans Ronne <hronne@telia.com> Fix BWidget problems on systems where XCONQLIB is not defined. * tkconq.tcl (pathlist): Move to head of file. (lappend): Use pathlist to find XCONQLIB (or the default path). 2002-10-13 Hans Ronne <hronne@telia.com> Fix bug that inactivated some submenus in the tcltk interface. * tkconq.tcl (adjust_side_menu): Don't adjust the "AI" menu item. (adjust_more_menu): Don't adjust the "Give Unit" menu item. Add screen positioning for the tcltk design palette window. * tkconq.tcl (popup_design_palette): Withdraw .design and call center_above_curmap at the end. Fix bug that would cause tcl errors if the design window did not exist when design mode was turned off. * tkconq.tcl (dismiss_design_palette): Only withdraw .design if the window really exists. Tweak some background colors in the tcltk interface. * tkconq.tcl (tcolor): Set to LemonChiffon2. (create_map_window): Set map backgrounds to SandyBrown. 2002-10-12 Jim Kingdon <kingdon@panix.com> * kernel/autotest.c, kernel/autotest.h: Move autotester from skelconq.c to here. * kernel/Makefile.in: Update accordingly. * kernel/move.c (prep_enter_action, do_enter_action, check_enter_action): Rename unit3 to newtransport for clarity. * kernel/unit.c (type_can_occupy): Rename u2 to utransport. * kernel/autotest.c, test/auto.g: Add tests regarding occupancy: headed for reproducing the http://sources.redhat.com/ml/xconq7/2000/msg00365.html bug (in which tcltk "i" skips a bomber in a certain common case) but aren't there yet. 2002-10-12 Hans Ronne <hronne@telia.com> Implement global settings for the tcltk background colors. Add support for separate global colors for different backgrounds. * tkconq.tcl (bgcolor): New global. Set to LemmonChiffon. (hbcolor): New global. Set to LemmonChiffon. (abcolor): New global. Set to LemmonChiffon. (tcolor): New global. Set to LemmonChiffon. (create_map_window): Set background of map and world map to orange. Add extra surrounding frame for world map. (make_normal_bindings): Use new world map frame. (autoscroll): Use new world map frame. (game_over_dialog): Set $color to green if won, to pink if lost and else to $bgcolor. Use it as background color. Set background colors for all other frames and items as follows: -bg $bgcolor: everything. -highlightbackground $hbcolor: buttons, scrollbars, canvases, text fields, checkbuttons, menubuttons. -activebackground $abcolor: buttons, scrollbars, checkbuttons, menunuttons, menus. -troughcolor $tcolor: scrollbars. Clean up bgcolor use before implementing global bgcolor. * tkoconq.tcl (progress_bar_color): Remove unused global. (fill_in_side_list): Remove progress_bar_color. (popup_chat): Dont set bgcolor here. (add_player_dialog_items): Dont set bgcolor here. (create_map_window): Dont set bgcolor here. (fill_in_side_list): Dont set bgcolor here. (fill_in_unit_type_list): Dont set bgcolor here. (update_game_side_info): Dont set bgcolor here. (popup_help_dialog): Dont set bgcolor here. (make_terrain_paint_frame): Dont set bgcolor here. (make_unit_paint_frame): Dont set bgcolor here. (make_people_paint_frame): Dont set bgcolor here. (make_control_paint_frame): Dont set bgcolor here. (make_terrain_paint_frame): Dont set bgcolor here. 2002-10-11 Hans Ronne <hronne@telia.com> Fix so that make install works with the BWidget directory. Put Bwidget, tkconq.tcl and imfapp.tcl in the new directory tcltk. * Makefile.in (tcltkdir): New variable. (BWidgetdir): New variable. (BWidgetimagesdir): New variable. (BWidgetlangdir): New variable. (MAKEDIRS): Include tcltkdir, BWidgetdir, BWidgetimagesdir and BWidgetlangdir. * tcltk/Makefile.in (tcltkdir): New variable. (BWidgetdir): New variable. (BWidgetimagesdir): New variable. (BWidgetlangdir): New variable. (GAMEUID): Define as games. (GAMEGRP): Define as bin. (DIRPERM): Define as 0755. (FILEPERM): Define as 0644. (install-only): Install tkconq.tcl and imfapp.tcl in the new tcltk directory instead of in $(datatdir). Also install BWidget and its subdirectories there. Apply chown, chgrp and chmod to all the installed directories and files. 2002-10-10 Hans Ronne <hronne@pp.sbbs.se> Fix problem with lib and BWidget paths under Windows. * win32.c (XCONQDATA): Define as "." instead of "..". 2002-10-10 Hans Ronne <hronne@pp.sbbs.se> Fix problem with new or reopened windows not always gaining focus in the tcltk interface. * tkconq.tcl (popup_indepside_config): focus -force .indepside. (popup_chat): focus -force .chat. (popup_contour_interval_dialog): focus -force .contour. (popup_meridian_interval_dialog): focus -force .meridian. (popup_find_dialog): focus -force .find. (popup_research_dialog): focus -force .research. (create_agreements_window): focus -force .agreements. (popup_scores): focus -force .scores. (popup_preferences_dialog): focus -force .prefs. (popup_help_dialog): focus -force .help. (popup_design_palette): focus -force .design. (center_above_curmap): focus -force $win. Fix bug due to typo in the tcltk dismiss design dialog code. * tkcmd.c (do_design): Change map to map2 within the loop. Fix bug causing loss of focus after exiting design mode. * tkcmd.c (do_design): Always refocus on the current map. 2002-10-09 Hans Ronne <hronne@pp.sbbs.se> Fix so that the game over dialog verybigfont works as intended. * tkconq.tcl (popup_game_over_dialog): Use a list prefix for arguments when setting verybigfont. Use prefs(font_family). Fix bug that caused the bold map font to revert to normal when the font family or size was changed in the tcltk preferences. * tkconq.tcl (ok_preferences): Set the map font to $boldfont instead of $textfont. Fix so that the fonts in the date pane, side list and unit type list are updated when the font is changed in the tcltk interface. * tkconq.tcl (fill_in_side_list): Add tags for some text items. (fill_in_unit_type_list): Add tags for some text items. (ok_preferences): Add code for setting -font $textfont for all text items in the date pane, side list and unit type list. 2002-10-08 Jim Kingdon <kingdon@panix.com> * tcltk/tkconq.tcl: Remove extra trailing whitespace. 2002-10-08 Hans Ronne <hronne@pp.sbbs.se> Fix problem with finding BWidget on unix. * tkconq.tcl (Iappend): Add special case for unix. Fix bad ttype crashes due to for_all_cells_within_reach and for_all_cells_within_range search macros strolling outside the edge of the world. * macunit.c (draw_landuse_near_unit): Test for inside_area before testing unit_at. * run.c (auto_pick_new_build_task): Test for inside_area. Draw feature legends for single cell features at the same size as unit names in the mac interface. * macmap.c (draw_feature_names): Set and use size variable. 2002-10-08 MA Dunzi <tadalunch@s5.xrea.com> * kernel/help.c: Remove unwanted strstr(). 2002-10-07 Jim Kingdon <kingdon@panix.com> * lib/standard.g: Increase advantage-max from 5 to 15. Things still work if it is 15. 2002-10-03 Hans Ronne <hronne@pp.sbbs.se> Update the pre-release version date. * version.h (VERSION): Change to October 2002. Rewrite and reorganize tcltk preferences popup dialog. * tkconq.tcl (popup_preferences_dialog): Anchor -nw. (add_fonts_prefs_items): Rewrite and reorganize items. (add_files_prefs_items): Rewrite and reorganize items. (add_network_prefs_items): Rewrite and reorganize items. (add_imagery_prefs_items): Rewrite and reorganize items. (set_font_family_newpref): Change frame name. (set_font_size_newpref): Change frame name. Add empty spaces before entries in certain listboxes. * tkconq.tcl (popup_preferences_dialog): Add leading spaces. (select_prefs_topic): Add leading spaces. (add_help_topic_key): Add leading space. (select_help_topic): Remove leading space before processing. Adjust appearance of scrollbars in the tcltk interface to compensate for differences in how they are implemented on different platforms. * tkconq.tcl (scrollb): New global. Set to 2 for Unix and 0 for Mac and Windows. (add_new_game_dialog_items): Set -borderwidth $scrollb. (add_player_dialog_items): Set -borderwidth $scrollb. (popup_chat): Set -borderwidth $scrollb for scrollbar. (create_map_window): Set -borderwidth $scrollb for scrollbars. (popup_research_dialog): Set -borderwidth $scrollb. (popup_scores): Set -borderwidth $scrollb for scrollbar. (popup_help_dialog): Set -borderwidth $scrollb. (scrolled_listbox): Set -borderwidth $scrollb for scrollbar. (scrolled_textbox): Set -borderwidth $scrollb for scrollbar. Adjust appearance of listboxes in the tcltk interface. * tkconq.tcl (listb): New global. Set to 2 for all three interfaces. (add_new_game_dialog_items): Set -borderwidth $listb for listbox. (popup_chat): Set -borderwidth $listb for listbox. (popup_research_dialog): Set -borderwidth $listb for listbox. (popup_preferences_dialog): Set -borderwidth $listb for listbox. (popup_help_dialog): Set -borderwidth $listb for listbox. (scrolled_listbox): Set -borderwidth $listb for listbox. Adjust appearance of textboxes in the tcltk interface to compensate for differences in how they are implemented on different platforms. * tkconq.tcl (textb): New global. Set to 2 for Mac and 0 for Windows and Unix. (add_new_game_dialog_items): Set -borderwidth $listb for frame. (add_variants_dialog_items): Set -borderwidth $listb for frame. (popup_chat): Set -borderwidth $listb for bounding frame. (create_agreements_window): Set -borderwidth $listb for frame. (popup_scores): Set -borderwidth $listb for bounding frame. (add_fonts_prefs_items): Set -borderwidth $listb for frame. (popup_help_dialog): Set -borderwidth $listb for bounding frame. Various tcltk interface bug fixes and adjustments. * tkconq.tcl (popup_chat): Pack scrollbar before the text field. Pack bottom frame before mid frames. Set label and button colors explicitly to -fg black and -bg $bgcolor. (add_fonts_prefs_items): Set -pady 4 for popup menus. (popup_scores): Pack Close button before main frame. Rewrite without calling scrolled_textbox so that everything works as desired. (popup_help_dialog): Rewrite without calling scrolled_listbox so that everything works as desired. (popup_research_dialog): Create and pack bottom frame before the scrollbar. Change button label "Cancel" to "Close". Set listbox -expand true -fill both. (popup_game_over_dialog): Change .scores subframe name. Turn off blinking current unit in the WinTCL interface. * tkwin32.c (blinking_curunit): Initialize to false. 2002-09-30 Hans Ronne <hronne@pp.sbbs.se> Fix failure of tcltk help topics list to reinit when the help window is opened after being destroyed instead of just withdrawn. * cmd.c (map_help_node): New global HelpNode. * ui.h (map_help_node): Declare it. * tkmain.c (tk_init_help_list): New TclCmdFn and prototype. * tkconq.tcl (popup_help_dialog): Call init_help_list. Improve the appearance of the prefs window in the tcltk interface. * tkconq.tcl (popup_preferences_dialog): Set button text colors explicitly to black (necessary to prevent red color on the mac). (add_map_prefs_items): Set checkbox text colors explicitly to black (same problem as above). Make buttons bigger, use bigfont and pad them. Improve the appearance of the help window in the tcltk interface. * tkconq.tcl (popup_help_dialog): Pad the top row buttons. Add a relief border to bottom frame. Also set default selection to item 1 (the "map" node). Note: should also fix so that the selected node in the list is updated when using the clickable links. Improve the appearance of the scores window in the tcltk interface. * tkconq.tcl (popup_scores): Declare global textfont and use it for the scrolled_textbox. Pad the close button. Add a main frame with sunken relief. Disable the text box for text entry. (popup_game_over_dialog): Enable and disable the scores text box when updating it. Change its name to .scores.main.box.text. Remove defunct Agreements window from the tcltk interface (but keep its tcl code for the time being). * tkconq.tcl (create_map_menus): Comment out the Agreements menu item. 2002-09-29 Hans Ronne <hronne@pp.sbbs.se> Add BWidget directory and support for it in the tcltk interface. * tkconq.tcl (BWidget): lappend path and set package require. tcltk/BWidget: New directory. Contains BWidget-1.4.1 except the tests, BWman and demo subdirectories. Fix scrollbar problem with BWidget in the MacTCL interface. * tkconq.tcl (add_new_game_dialog_items): Set scrollbar -width 16. (add_player_dialog_items): Set scrollbar -width 16. (popup_chat): Set scrollbar -width 16. (create_map_window): Set scrollbar -width 16 (5 times). (popup_research_dialog): Set scrollbar -width 16. (popup_help_dialog): Set scrollbar -width 16. (scrolled_listbox): Set scrollbar -width 16. (scrolled_textbox): Set scrollbar -width 16. 2002-09-27 MA Dunzi <tadalunch@s5.xrea.com> * tkconq.tcl (update_help): add clickable link code. 2002-09-24 Hans Ronne <hronne@pp.sbbs.se> Make it possible to select and launch a game by double-clicking in the tcltk new game list, as in the MacPPC interface. * tkconq.tcl (add_new_game_dialog_items): Bind Double-Button-1 to { select_game; new_game } for .newgame.top.left.f.games. Fix failure to pop up problem with remapped research dialogs. * tkconq.tcl (popup_research_dialog): Call set_research_popped_up only after handling remapping of existing dialogs. Standardize and unify the code for centering tcltk dialogs above the current map and make it available to all dialogs. * tkconq.tcl (center_above_curmap): New procedure. (popup_contour_interval_dialog): Call center_above_curmap. (popup_meridian_interval_dialog): Call center_above_curmap. (popup_find_dialog): Call center_above_curmap. (popup_research_dialog): Call center_above_curmap instead. (create_agreements_window): Call center_above_curmap. (popup_scores): Call center_above_curmap. (popup_preferences_dialog): Call center_above_curmap. (popup_game_over_dialog): Call center_above_curmap instead. (popup_help_dialog): Call center_above_curmap. Fix long-standing problem with remapped tcltk windows failing to gain focus after being deiconified (note: this is a well-known bug that is described in the tcl docs). * tkconq.tcl (popup_chat): Withdraw window before deiconifying. (popup_indepside_config): Withdraw window before deiconifying. (popup_contour_interval_dialog): Withdraw before deiconifying. (popup_meridian_interval_dialog): Withdraw before deiconifying. (popup_find_dialog): Withdraw window before deiconifying. (popup_research_dialog): Withdraw window before deiconifying. (create_agreements_window): Withdraw window before deiconifying. (popup_scores): Withdraw window before deiconifying. (popup_preferences_dialog): Withdraw window before deiconifying. (popup_design_palette): Withdraw window before deiconifying. (popup_help_dialog): Withdraw window before deiconifying. Fix so that cconq compiles again under CodeWarrior on the mac and make the code C++ compatible. * cconq.c (console.h): Include ifdef MAC. (use_mac_charcodes): Initialize to true ifdef MAC. * curses.c (string.h): Include ifdef MAC. (newwin): Typecast calloc return to WINDOW * and chtype *. (subwin): Typecast calloc return to WINDOW *. (newpad): Typecast calloc return to WINDOW * and chtype *. (subpad): Typecast calloc return to WINDOW *. (memcpy): Only prototype ifndef MAC. (memmove): Only prototype ifndef MAC. * curses.h (getch): Only define ifndef MAC. * v_maccur.c (sioux.h,, Devices.h, Sound.h): Include. (maccur_scanf): Change _vsscanf to vsscanf (C89). (maccur_init): Typecast malloc return to chtype *. 2002-09-21 Hans Ronne <hronne@pp.sbbs.se> Fix update buzzing in the tcltk research dialog. Separate the research update code from the side update code. Use a special research_popped_up flag to control the research dialog in the MacPPC interface, similar to the tcltk interface. Fix several bugs in the kernel research code. * conq.h (update_research_display): New prototype. * run.c (research_popped_up): Declare and initialize to false. (run_side_research): Call update_research_display instead of update_side_display. Call update_research_display while waiting for a research task if !research_popped_up. Only proceed with updates etc. if we actually did some research this run. Don't add 1 rp per run if research is unlimited. Call run_error instead. * macconq.c (update_side_display): Move research code to the new function update_research_display. * macwins.c (research_popped_up): Declare extern int. (hit_research_dialog): Set research_popped_up to false when a research task has been assigned. Close the window also when the research has been stopped. * tkconq.tcl (popup_research_dialog): set_research_popped_up 1. * tkmain.c (research_popped_up): Declare extern instead. (tk_set_research_popped_up): New TclCmdFn. (update_side_display): Move research code to the new function update_research_display. * sdlmain.c (research_popped_up): Declare extern instead. (update_side_display): Move research code to the new function update_research_display. * cconq.c (update_side_display): Move research code to the new function update_research_display. * xtmain.c (update_research_display): Add dummy function. Fix so that skelconq compiles again. * skelconq.c (dside): Declare extern Side. (do_toolup_action): Declare extern. (use_mac_charcodes): Initialize to true ifdef MAC. (update_side_display): Move research code to the new function update_research_display and use dside in the latter. Make certain important notification messages bold style in the MacPPC interface, similar to the tcltk interface. * maccmd.c (do_quit): Add ! before notify message. (do_resign): Add ! before notify message. (do_design): Add ! before notify message. * macwins.c (append_notice): Remove leading ! and make the text bold style in that case. 2002-09-21 Hans Ronne <hronne@pp.sbbs.se> Add support for MA Dunzi's new tcltk advances help code. * tkmain.c (tk_atype_name): New TclCmdFn and prototype. (tk_advance_needed_to_research): New TclCmdFn and prototype. Fix static limit on number of items in the tcltk research window. * tkconq.tcl (fill_research_dialog): Use numatypes instead of 127. Fix failure of tcltk research window to update when already open. * tkmain.c (update_side_display): Also update the research dialog. * tkconq.tcl (fill_research_dialog): Return if .research does not exist. Turn on unit names, feature names and terrain transitions by default in the tcltk interface. * tkconq.tcl (prefs): Set prefs(unit_names), prefs(feature_names) and prefs(transitions) to 1 before reading the prefs file. Save all by default rather than nothing in the tcltk design save dialog. * tkconq.tcl (dsave): Set dsave(all) to 1. Fix failure to set saved file name correctly using the "Save Game As" menu item in the MacTCL interface. * tkconq.tcl (popup_game_save): Declare global tcl_platform. Test for macintosh and don't use -initialfile if true. Remove the quit, resign and desing popup dialogs in the tcltk interface. Always use notices instead, like in the MacPPC interface. * tkconq.tcl (handling_key): Don't set unused global. (handle_key_binding): Remove unused handle_key global. (ask_bool_mode): Remove handle_key global and popup dialog code. (ask_bool_done): Remove handle_key global and popup dialog code. Tweak the size of colored unit boxes used at small magnification in the MacPPC interface. * macdraw.c (draw_unit_image): Cut imagerect by 1 pixel. * macmap.c (legends): Declare static. 2002-09-11 Hans Ronne <hronne@pp.sbbs.se> Make the MacPPC interface use the same feature legend placing code as the other interfaces. * macmap.c (legends): New Legend. Intialize to NULL. (place_legends): New function and prototype. (create_map): Call place_legends if legends is NULL. (draw_feature_names): Rewrite using legends. * tkmap.c (draw_feature_name): Tweak y position so that overlap with unit names is minimized. Also tweak the center of the legend to accomodate the default namelength value. Distinguish between single cell and extended features, like in the MacPPC interface. Fix linefeeds in the new MacTCL resource file. * tkmac.r: Change from Mac to Unix format. Fix so that the Ancient Near East game does not use the same city name more than once. * anc-near-east.g: Comment out all side-specific unit namers. Add short-generic-names as the default namer for new tribes, villages and cities. Remove obsolete blurb comment about game size. 2002-09-08 Hans Ronne <hronne@pp.sbbs.se> Fix wrong occupant in wrong transport bug after saving games. * write.c (write_units): Test for !module->def_all before writing symbol or string data to key(K_IN). Fix errors in doxygen comments concerning written module data. * module.h (a_module): Change "default" to "define" everywhere in the doxygen comments. Center the tcltk new game dialog on the main screen. * tkconq.tcl (popup_splash_screen): Call the window manager and set the geometry for the .newgame widget. (popup_game_dialog): Call the window manager again and recenter the dialog using the new window width. Add a new file (tkmac.r) with resources needed by the mac version of the tcltk interface. Note: most of these are from Xconq.r, but the Resize cursor that is needed by MacTCL comes from the Simple Tk application framework in MacTCL 8.3.4. * tkmac.r (BNDL 128 "XCNQ"): New bundle. (CURS 1004 "Resize"): New cursor. (FREF 128 "APPL"): New file reference. (FREF 129 "TEXT"): New file reference. (icl4 128 and 129): New icons. (icl8 128 and 129): New icons. (ICN# 128 and 129): New icons. (ics#128 and 129): New icons. (ics4128 and 129): New icons. (ics8 128 and 129): New icons. (vers 1 and 2): New version resources. (XCNQ): New owner resource. Add Apple menu and About box support to the MacTCL interface. * tkconq.tcl (create_map_menus): Add global tcl_platform and create map.menubar.apple on the mac. Note: still need to add the About box itself. 2002-09-01 Hans Ronne <hronne@pp.sbbs.se> Update the pre-release version date. * version.h (VERSION): Change to September 2002. Fix bug with disappearing units at the date line in wrapped worlds. * unit.c (enter_cell): Wrap x before proceeding. Note: should go through all functions that call enter_cell and make sure that x is wrapped. Other things may go wrong if it is not. Fix update rect bug at the right end of map in the tcltk interface. * tkmap.c (update_cell): Clip the name erasing row to the area for non-wrapped maps. Note: this fixes the bug but names close to the edge now fail to redraw after scrolling. Should try to fix this as well. Fix "center on focus" bug when picking a build task for a city directly after moving another unit. * tkmap.c (mapw_configure): Don't call center_on_focus if we are just changing the cursor (i. e. from arrow to crosshair and back again). Note: this also eliminates focusing on the chosen build spot, which was triggered by the reverse cursor switch. 2002-08-31 Hans Ronne <hronne@pp.sbbs.se> Fix material consumption bug in the classical construction code. * actions.c (do_build_action): Dont consume materials twice. Also add a check that the expected material is still available in the treasury if using the latter. Return A_ANY_ERROR if it is not and clarify the run warning to make more sense. (do_create_in_action): Clarify run warning. (do_create_at_action): Clarify run warning. Fix bug in the tcltk interface that caused offset errors in redrawn regions, particularly when scrolling while using big icons. * tkmap.c (eventually_redraw): Dont adjust the update rect for big icons here. Add clipping code, but comment it out since it gave rise to mysterious scrolling problems. Also add explanation about this. (update_cell): Adjust the update rect for big icons here instead. Tweak vertical position of the text in the unit info pane. * tkconq.tcl (create_map_window): Add one pixel to top line position and two pixels to canvas heigth. Make the tcltk interface use the default side colors (blue, red etc.) to show units at small magnification (i.e. on the world map), similar to the MacPPC interface. Also fix bug that could assign the same default color to two sides if the Remove Side button was used. * init.c (remove_side_and_player): Call return_default_colorname. * side.h (Side): Add new slot side->default_color. * side.c (default_emblems): Rename to default_colornames. (default_colornames_used): New static short array. (pick_default_colorname): New function and prototype. (return_default_colorname): New function and prototype. (create_side): Use pick_default_colorname for newside->default_color. Copy newside->default_color to newside->emblemname. * tkconq.h (a_ui): Add new slots *default_colors[MAXSIDES + 1]. * tkinit.c (set_colors): Load side->default_color into default_colors. * tkmap.c (draw_unit_image): Use dside->ui->default_colors to draw the unit (with a black shade) at low magnifications. Simplify drawing at low magnifications in the MacPPC interface. Use default colors directly instead of via the emblem images. Dont use the emblem colors at low magnifications, even if they exist. * maccolors.c (default_colornames): Declare extern. (default_sideColor): New RGBColor array. (init_side_colors): Load default colors into default_sideColor. * macconq.h (default_sideColor): Declare extern. * macdraw.c (draw_unit_image): Rewrite and simplify the usebox case. Use default_sideColor instead of eimages. Draw a black shadow only at low magnifications. Always use default_sideColor unless the user-set side colors are on. Turn off name and size drawing at low resolution in the tcltk interface. * tkmap.c (draw_units): Test sw etc before calling draw_unit_name and draw_unit_size. (draw_unit_and_occs): Test sw etc before calling draw_unit_name and draw_unit_size. (draw_current): Test sw before calling draw_unit_name. Turn off feature name drawing at low resolution in the tcltk interface. * tkmap.c (draw_row): Test if mapw->vp->hw > 4 before calling draw_feature_name. Change default unit name color to agree with mask color etc. * gvar.def (unit-name-color): Set to "lemon-chiffon". Enable user-settable feature colors in the tcltk interface. * tkmap.c (draw_feature_name): Use dside->ui->feature_color. (draw_feature_boundary): Use dside->ui->feature_color. * gvar.def (feature-color): Set to "light-salmon". Dont draw feature boundaries between sea and land in the tcltk interface (similar to the MacPPC interface). * tkmap.c (draw_feature_boundary): Test for t_liquid before setting the draw bit. Also fix wrapping bug by changing x1 to wrapx(x1) everywhere. Remove obsolete feature boundary code in the MacPPC interface. * macrow.c (draw_row): Only call draw_feature_boundary. (draw_feature_boundary): Remove function and prototype. (draw_feature_boundary_simple): Rename function and prototype to draw_feature_boundary. Fix bug that caused Jolly Roger to be toggled for the indepside if two other sides exchanged players. * init.c (exchange_players): Rewrite the Jolly Roger code. Enable memory deallocation when a side is removed from the game. * init.c (remove_side_and_player): Remove #if 0 clause. 2002-08-30 Hans Ronne <hronne@pp.sbbs.se> Add code that saves and restores the current advance. * keyword.def (K_CURRENT_ADVANCE): New keyword. (K_ADVANCE): Rename to K_ADVANCES_DONE. * read.c (fill_in_side): Add case K_CURRENT_ADVANCE. Change K_ADVANCE to K_ADVANCES_DONE. * write.c (write_side_properties): Add case K_CURRENT_ADVANCE. Change K_ADVANCE to K_ADVANCES_DONE. Fix the tcltk research dialog so that it selects the current research topic and scrolls it into view. Add a text label at the top that shows what is being researched. Add a "Cancel" button. Tweak various other settings. Add code from the Game Over dialog that centers the dialog over the current map. * tkmain.c (tk_current_advance): New TclCmdFn and prototype. (tk_set_side_research): Notify "Your wise men will rest." when setting research to NONATYPE (clarifies what is meant by "Rest"). * tkconq.tcl (popup_research_dialog): Add geometry code from the Game Over dialog. All label research.current. Config listbox -relief sunken. Add button .research.cancel. (fill_research_dialog): Get current_advance and set research.current accordingly. Select and see the current advance in the listbox. Select the first advance in the list only if there is no current advance. Fix crashes in the Unix tcltk interface every time a Tcl window or dialog had been dismissed more than 5 times. * xconq.c (handle_x_error): Don't abort only because there are more than 10 x_errors. Every time a Tcl window is dismissed using the wm withdraw command two harmless x_errors are generated: BadWindow and BadDrawable. The program would therefore abort after 5 such dialogs had been dismissed. 2002-08-29 Jim Kingdon <kingdon@panix.com> * lib/standard.g: If we capture a town, set see-others-if-captured to 15% rather than 20-30%. The latter tends to give you too strong an idea of where the side's homeland is the first time you capture a town. 2002-08-28 Hans Ronne <hronne@pp.sbbs.se> Fix so that unit and feature names are redrawn as necessary when the map is scrolled in the tcltk interface (use code from the mac interface). * tkmap.c (draw_row): Redraw any named units within namelength to the left of the start of the row. (draw_feature_name): Add current namelength to the cutoff margin and simplify code by replacing sxc2 with sxc. Make autoscrolling easier to use in the tcltk interface. * tkmain.c (autoscroll_width): Increase it to 40. (autoscroll_delay): Decrease it to 200. Fix bug in autoscrolling of maps that have wrapped gworlds on the mac. * maccconq.c (adjust_cursor): Test for area.xwrap when autoscrolling. Dont use the open cross cursor in the mac GROK_MODAL input mode. * macconq.c (adjust_cursor): Dont set usual to FALSE if GROK_MODAL. Dont let the mac research dialog pop up and obscure the quit game dialog. * macconq.c (update_side_display): Test if dside->ingame is true before poping up the research dialog. Make sure the mac notice window is scrolled to the end when it is shown so that GROK_MODAL messages always are visible to the player. * macwins.c (show_notice_window): Set notice_v_scrollbar to CtlMax. Turn off names and borders by default for the mac world map. Also allow it to take somewhat more screen space if necessary. * macmap.c (create_map): Set draw_names etc to zero for worldmap. Increase worldmap max size to one third of the main screen size. Fix bug that made it impossible to quit bare base modules without units (i.e. earth-1deg.g) in some interfaces. Note: should make do_resign and do_quit work the same way in all interfaces. Should also make sure they are all well-behaved in network games (no quitting allowed for hosts if other players are still ingame etc). * ccmd.c (do_quit): Quit directly if beforestart is true. * maccmd.c (do_quit): Quit directly if beforestart is true. * tkcmd.c (do_quit): Quit directly if beforestart is true. * sdlcmd.c (do_quit): Quit directly if beforestart is true. * xcmd.c (do_quit): Quit directly if beforestart is true. Also quit directly if endofgame is true, similarly to the other interfaces. Fix bug that caused completed advances to reappear as unresearched when a saved game was restored. * side.c (create_side): Dont call update_canresearch_vector here. The side->advances data is not yet available if this was a restored game. * init.c (calculate_globals): Call update_canresearch_vector here. Fix inability to reopen the tcltk research dialog if it was dismissed using the Rest button. * tkmain.c (numatypes): New TclCmdFn. (tk_numatypes): New function and prototype. * tkconq.tcl (create_map_menus): Add "Research" item in Windows menu that calls popup_research_dialog. (adjust_windows_menu): Disable "Research" if numatypes is 0. Change names of geographical feature types to plural to avoid confusion with similarly named terrain types (e.g. seas vs. sea). * mkterr.c (name_geographical_features): Change hardcoded feature type names (peak lake sea island continent bay) to plural. * standard.g (feature-types): Change names to plural. * lhs.g (feature-types): Change names to plural. * log.g (feature-types): Change names to plural. Add "sea" and "continent" geographical feature namers and "mountain" "forest" and "desert" terrain feature namers. Use them in the standard game and its variants. * ng-features.g (generic-sea-names): New feature namer. (generic-continent-names): New feature namer. (generic-lake-names): Add French names (Lac d') similar to Ile d' in generic-island-names. (generic-mountain-names): New feature namer. (generic-forest-names): New feature namer. (generic-desert-names): New feature namer. * standard.g (feature-types): Add new feature types with namers. * log.g (feature-types): Add new feature types with namers. * lhs.g (feature-types): Add new feature types with namers. Also add islands and bays with namers and include ng-features. Dont use defaults if geographical and terrain feature type sizes are invalid. Issue an init warning instead for zero or negative maxsize. * mkterr.c (name_islands): Call init_warning if maxsize < 1. (name_continents): Call init_warning if maxsize < 1. (name_lakes): Call init_warning if maxsize < 1. (name_seas): Call init_warning if maxsize < 1. (name_terrain): Call init_warning if maxsize < 1. 2002-08-17 Hans Ronne <hronne@pp.sbbs.se> Make it possible to specify feature namers for the various terrain types used in a game. Also add support for a minimal size for named features in addition to the maximal size already supported. Separate the region layer area->regions into two layers, one that only shows land or sea (like the old area->regions) and one that shows all types of terrain. Fix the code for merging regions of the same type so that it works 100% of the time. Finally, add support for "sea" and "continent" namers for naming larger contiguous land and sea regions. * kernel.h (divide_into_regions): Add new landsea argument. * mkterr.c (terrain_region_list): Declare extern. (landsea_region_list): Declare extern. (name_terrain): New function and prototype. (name_seas): New function and prototype. (name_continents): New function and prototype. (name_geographical_features): Call name_terrain, name_seas and name_continents. (name_lakes): Change area->regions to area->landsea_regions. Add support for minsize argument in params. Remove neighbor-checking code for handling incomplete mergers (no longer needed). (name_islands): Change area->regions to area->landsea_regions. Add support for minsize argument in params. Remove neighbor-checking code for handling incomplete mergers (no longer needed). (name_feature_at_using): Remove bogus x and y arguments and rename the function to name_feature_using. (name_feature_at): Call name_feature_using instead. * world.h (Area): Remove area->regions. Add area->landsea_regions and area->terrain_regions. * world.c (region_list): Remove. (terrain_region_list, landsea_region_list): New global TRegions. (numregions): Remove. (num_terrain_regions, num_landsea_regions): New global ints. (region_value): Add landsea flag as argument and use t_liquid only if the flag is set. (divide_into_regions): Add landsea flag as argument and pass it on to region_value. Handle the two types of TRegions correctly. Fix bug in region merging by iterating the merge step 10 times. * macrow.c (draw_region): Use area->terrain_regions instead. * macmap.c (draw_feature_names): Put names of single cell features to the right of the cell instead of on top of it. Tweak starting positions for all feature name strings. Make it possible to specify a minimal separation between units during startup world synthesis (useful for cities and other advanced units). * mkunits.c (not_too_crowded): New function and prototype. (find_unit_place): Call not_too_crowded (4 times). (expand_countries): Call not_too_crowded (2 times). (make_independent_units): Call not_too_crowded. * table.def (uu_separation_min): New table. 2002-08-14 Hans Ronne <hronne@pp.sbbs.se> Fix display bug in tcltk interface due to "update cells within reach" hack in update_at_cell. Eliminate this code. Reason: The resource drawing code has been fixed so that cells with resource icons always are updated correctly. Simplify and consolidate tcltk and sdl update code into one single function, update_cell, just as in the MacPPC interface. Also, don't pass the flags on to update_cell, let update_cell_display handle them, as in the MacPPC interface. * tkconq.h (update_at_unit): Delete prototype. (update_at_cell): Rename to update_cell. * tkcmd.c (do_survey): Call update_cell instead. * tkmain.c (update_cell_display): Call update_cell instead. Check the update flags here instead of in update_cell. (tk_animate_selection): Call update_cell instead. (set_current_unit): Call update_cell instead. * tkmap.c (update_at_unit): Delete function. (update_at_cell): Rename to update_cell. (draw_unit_blast): Call update_cell instead. (draw_cell_blast): Call update_cell instead. (update_area): Remove unused function and prototype. (limitx): Remove unused function and prototype. * sdlcmd.c (do_survey): Call update_cell instead. * sdlconq.h (update_at_unit): Delete prototype. (update_at_cell): Rename to update_cell. * sdlmain.c (update_cell_display): Call update_cell instead. Check the update flags here instead of in update_cell. (set_current_unit): Call update_cell instead. * sdlscreen.c (update_at_unit): Delete function. (update_at_cell): Rename to update_cell. Fix bug in the drawing of resource icons for selected advanced units in the tcltk interface. Note: the hack in update_at_cell seems to have been an attempt to fix this. The bug was in draw_current, however, which called draw_resource_usage with the wrong arguments. We also improve the code by making sure that selection or deselection of an advanced unit updates any used cells. * tkmain.c (set_current_unit): Erase the resource usage for the old current unit and draw it for the new one, if required. * tkmap.c (draw_current): Call draw_resource_usage for the used cells rather than for the advanced unit's own cell. * sdlmain.c (set_current_unit): Add resource icon drawing code but comment it out since not yet implemented in sdlconq. * sdlmap.c (draw_current): Add resource icon drawing code but comment it out since not yet implemented in sdlconq. Copy code for update of adjacent cells from update_cell_display in the tcltk interface to its sister function in the MacPPC interface. * macmap.c (update_cell_display): Handle UPDATE_ADJ flag. Humor the compiler. * sdlmain.c (initial_ui_init): Don't declare SDL_Rect **modes on the mac. 2002-08-13 Hans Ronne <hronne@pp.sbbs.se> Fix problem with tiled appearance of terrain due to the quasirandom numbers that are used to pick terrain subimages being linear in both coordinates. Also fix apparent bug in draw_terrain_transitions (all interfaces) where a bogus quasirand2 that was always zero was used to pick subimages. * macdraw.c (draw_terrain_transitions): Use quasirand instead of quasirand2. Substitute quadratic formula. * macrow.c (draw_terrain_row): Substitute quadratic formula. * sdlmap.c (draw_terrain_transitions): Use quasirand instead of quasirand2. Substitute quadratic formula. (draw_terrain_iso): Substitute quadratic formula. (draw_terrain_row): Substitute quadratic formula. * tkmap.c (draw_terrain_transitions): Use quasirand instead of quasirand2. Substitute quadratic formula. (draw_terrain_iso): Substitute quadratic formula. (draw_terrain_row): Substitute quadratic formula. * xdraw.c (draw_terrain_row): Substitute quadratic formula. Make the Remove Side button work as expected in the tcltk and MacPPC interfaces. * conq.h (remove_side_and_player): New prototype. * kpublic.h (net_remove_side_and_player): New prototype. * init.c (nextsideid, nextplayerid): Declare extern. (remove_side_and_player): New function. * macinit.c (set_player_setup_button_states): Enable the Remove Side button for non-indepside non-display sides. (draw_player_setup_dialog): Call set_player_setup_button_states so that update_assignment_callback works correctly. Make sure we always have a valid selectedplayer. (draw_player_setup_list): Fix bug in number of sides drawn. (hit_player_setup_dialog): Call net_remove_side_and_player. Make sure the removed side is erased and select either the next available player or the last player in the list. Differentiate between clicks that change the state and clicks that do not. Only redraw directly for the latter if we are a network client. Else wait for the update_assignment_callback. Select the last player if we click in an empty box. * tp.c (net_remove_side_and_player): New function. (receive_assignment_setting): Add new case "remove". * tkconq.tcl (add_player_dialog_items): Bind the Remove Side button to the new remove_side_and_player_cmd procedure. (remove_side_and_player_cmd): New tcl procedure. (select_player): Enable/disable Remove Side button. (update_player_entry): Erase if the side no longer exists. Make sure the entry box is redrawn in black if necessary. Pick a new selected player if the old one was deleted. * tkmain.c (tk_player_displayname): New TclCmdFn. (tk_remove_side_and_player): New TclCmdFn. Fix so that the Exchange player button is disabled in the tcltk interface when no player is selected. * tkconq.tcl (select_player): Disable the button if emptysel. (update_allplayer_buttons): Remove comment about button. Fix set_indepside so that it works also for tcltk network clients. Rationale: this is a local display option which does not affect the game state, so no point in disabling it. * tkconq.tcl (set_indepside): Don't disable for network clients. Update the MacPPC player setup dialogs so that it works like its tcltk counterpart with separate player and AI columns. * macinit.c (draw_player_setup_list): Call simple_player_name instead of simple_player_title. Also get the player's aitypename and draw it as a separate column in the list. (set_player_setup_button_states): Remove spaces in advantage. (set_player_setup_button_states): Don't enable the Remove button. * XconqProj.rsrc (DITL 130 "Player Setup Items"): Rearrange all items so that they agree with the new layout. Rename Add button to Add Side, Remove Button to Remove Side, Rename Button to Rename Side, Exchange button to Exchange Players, and Computer button to Switch AI. Disable Remove Side button by default. Increase button sizes. (DITL 186 "Game Over Items"): Tweak item sizes and positions. (DITL 701 "Preferences File Items"): Rename to "Preferences Network Items" and rearrange so that network items come first. (MENU 700 "Preferences Popup"): Change first item to "Network". * Xconq.r: Update from XconqProj.rsrc. 2002-08-11 Hans Ronne <hronne@pp.sbbs.se> Fix several problems with the materials and ammo code by always separating stuff needed to fire from stuff needed to attack. Modify the GDL tables accordingly by always using fire tables and not defaulting to attack tables in their absence. Modify the few games that are affected by providing explicit fire tables if necessary. For fire-into-actions, check that we have enough ammo to fire one round of each type. * combat.c (enough_ammo): Rename to enough_ammo_to_attack_unit. (check_attack_action): Call enough_ammo_to_attack_unit. (check_overrun_action): Call enough_ammo_to_attack_unit. (attack_unit): Call enough_ammo_to_attack_unit. (enough_ammo_to_fire_at_unit): New function and prototype. (enough_ammo_to_fire_one_round): New function and prototype. (fire_on_unit): Call enough_ammo_to_fire_at_unit. (check_fire_at_action): Call enough_ammo_to_fire_at_unit instead. (check_fire_into_action): Call enough_ammo_to_fire_one_round. * help.c (describe_utype): Clarify what um_to_attack and um_to_fire stand for by adding (weapons or equipment) to explanation. Similiarly, add (ammo) to explanation of um_consumption_per_attack. Also add missing explanation for um_consumption_per_fire. * table.def (um_to_fire): Set default to 0 instead of -1. (um_consumption_per_fire): Set default to 0 instead of -1. Modify empire.g for the above changes and fix several bugs in the game that prevented non-artillery types from attacking anything, and also restricted artillery to non-fire attacks. Note: this game is still far from playable. Sides never build armed units, even if they are adjacent to each other, only engineers. * empire.g (acp-to-fire): Enable firing for artillery-types. (range): Give artillery-types the same range as fortresses (3 cells). (consumption-per-attack): Comment out table (it made it impossible for non-artillery types to attack anything since they cannot carry the shells required to attack according to this table). (consumption-per-fire): New table. Consume shells when firing. Apply this table to artillery and fortresses only. (material-to-attack): Don't require guns for artillery and fortresses when they use non-firing attacks to defend (?) themselves. (material-to-fire): New table. Require guns and mil to fire. Apply this table to artillery and fortresses only. * galaxy2.g (material-to-attack, material-to-fire): Comment out these two tables that were being used in a way that was redundant with consumption-per-fire and consumption-per-attack. * lhsunit.g (consumption-per-fire): New table. Consume 1 ammo for all unit types that can fire. * ww2-adv.g (consumption-per-attack): Rename this table to consumption-per-fire since it deals exclusively with air units that are unable to carry out normal attacks. * ww2-div-eur.g (consumption-per-attack): Rename this table to consumption-per-fire since it deals exclusively with air units that are unable to carry out normal attacks. * ww2-div-pac.g (consumption-per-attack): Rename this table to consumption-per-fire since it deals exclusively with air units that are unable to carry out normal attacks. (material-to-attack): Rename this table to material-to-fire since it deals exclusively with air units. (acp-to-attack): Set to zero for carriers and places (consistent with the designer's intention, I believe). While we are at it, also fix the ww2-div-pac game so that airfields etc. can launch air attacks, similar to carriers. * ww2-div-pac.g (free-acp): Add place-types 6. (acp-per-turn): Add place-types 24. (speed): Add place-types 0 (Port Morseby fled to Australia). (mp-to-enter-terrain): Add place-types t* 99. (acp-to-bo-fired-on): Also handle place-types. (hit-chance): Also handle hits by place-types. (damage): Also handle damage by place-types. Fix hard crashes in games with maximal number of allowed sides (currently 15 + indepside = 16) due to some arrays only being allocated MAXSIDES =15 instead of MAXSIDES + 1 = 16 elements. Note: this also fixed long-standing problem with Jolly Roger being hoisted also by brainless indepsides in the tcltk interface (this flag is supposed to warn players that the indepside is being played by an AI). * ai.h (a_strategy): Allocate MAXSIDES + 1 elements everywhere, not just for contacted and homefound. * config.h (MAXSIDES): Add warning about the maximal number of sides now being MAXSIDES + 1, indepside included. * mplayer.c (mplayer_create_strategy): Allocate strategy objects for MAXSIDES + 1 sides. * ps.c (ps_cook_imf): Allocate MAXSIDES + 1 side icons. * run.c (request_additional_side): Allocate MAXSIDES + 1 pointers in the players_requested array (this should really not be necessary but do it anyway just to be sure). * sdlconq.h (embw): Allocate MAXSIDES + 1 elements in array. (embh): Allocate MAXSIDES + 1 elements in array. * side.c (init_sides): Allocate MAXSIDES + 1 elements in the assignments array. (calc_coverage): Make visible[MAXSIDES + 1]. * tkconq.h (colors): Allocate MAXSIDES + 1 elements. (numcolors): Allocate MAXSIDES + 1 elements. (emblempics): Allocate MAXSIDES + 1 elements. (emblemmasks): Allocate MAXSIDES + 1 elements. (embw): Allocate MAXSIDES + 1 elements. (embh): Allocate MAXSIDES + 1 elements. * tkinit.c (init_display): Init MAXSIDES + 1 emblems. * xinit.c (init_display): Init MAXSIDES + 1 emblems. (popup_game): Allocate MAXSIDES + 1 assignments. Fix problem with the larger width that is now needed by the tcltk setup dialogs not being set correctly if you bypass the New Game dialog by picking Open Game instead. * tkconq.tcl (popup_variants_dialog): Resize the .newgame.top frame to -width 500 also here. 2002-08-10 Hans Ronne <hronne@pp.sbbs.se> Fix so that scrollbars are positioned correctly (at the top) from start. * tkconq.tcl (add_player_dialog_items): Scroll the player list to 0.0. (create_map_window): Scroll the side and unit lists to 0.0. Fix problem with positioning of the map window under MacOS and Windows. * tkconq.tcl (create_map_window): Add special geometry code for MacOS and Windows. Fix so that the game over window is centered over the current map. * tkmain.c (tk_curmap_number): New TclCmdFn and prototype. (update_turn_display): Save and restore dside->ui->curmap after end of game redraws of all the map windows. * tkconq.tcl (game_over_popup): Get current map window and center the game over dialog above it. Also tweak button sizes. Restore vertical offset of the side lost line to its previous value (this looks much better in case you use a small font for the map window). * tkconq.tcl (create_map_window): Add floor($lineheight * .60). 2002-08-09 Hans Ronne <hronne@2.sbbs.se> General overhaul of font usage in the tcltk startup dialogs. Pick default fonts that work on all three platforms using the tcl_platform array. * tkconq.tcl (bigfont): Set platform-specific font for use in startup dialogs. (stdfont): Set platform-specific font for use in startup dialogs. (prefs(font_family) and prefs(font_size)): Set platform-specific defaults. (joinhost): Set platform-specific default to either 127.0.0.1 or localhost. (popup_splash_screen): Don't set bigfont here. Tweak button sizes. (add_splash_screen_dialog_items): Use stdfont instead of textfont. (add_new_game_dialog_items): Don't set bigfont here. Use bigfont instead of system. Use stdfont instead of helvetica. Define special banner font in label. (add_new_game_dialog_items): Remove blurb scrollbar (no longer needed). Tweak postions of all items on the right side. (select_game): Tweak picture and module labels. (add_variants_dialog_items): Use bigfont for header, checkbuttons and buttons and stdfont for help. Disable help text field. Tweak item positions. (show_variant_help): Enable and disable help text field when updating. (clear_variant_help): Enable and disable help text field when updating. (add_player_dialog_items): Use bigfont for listheadings and stdfont for list. (add_player_dialog_items): Remove relief on list top frame. Pack the scrollbar before the top canvas. Don't set expand to true for list items. Tweak positions of all list items. Don't padx the player canvases. (add_player_dialog_items): Tweak size of advantage buttons. Make all buttons sticky ew. (set_indepside): Don't pad the canvas. Don't call set_ai_for_player here. (set_indepside): Change "No AI" to "Hide". and "Add AI" to "Reveal". (popup_chat): Use stdfont instead of textfont. Use bigfont for all labels. (create_map_window): Don't set bigfont here. Improve the player setup dialog. Increase width to make room for both player and ai entries. Split the player column into separate player and AI columns. Tweak various parameters so that the dialog looks good on all platforms. * conq.h (simple_player_name): New prototype. * nlang.c (simple_player_name): New function. * tkmain.c (simple_player_name): New TclCmdFn. (tk_simple_player_name): New function and prototype. * tkconq.tcl (popup_game_dialog): Increase width of newgame.top to 500. (add_new_game_dialog_items): Increase width of listbox to 30 chars. (add_variants_dialog_items): Increase padx of checkboxes to 10. (add_player_dialog_items): Rewrite listheadings using labels instead of a canvas. Tweak positions so that they match those of the player items. (add_player_dialog_items): Add 100 to width of stuff in the player list. (add_player_dialog_items): Add new label "Advantage". (add_player_dialog_items): Change button label "Add" to "Add Side". (add_player_dialog_items): Change button label "Computer" to "Switch AI". (add_player_dialog_items): Change button label "Side Name" to "Rename". (add_player_dialog_items): Change label "Indep Units" to "Indep Side". (add_player_dialog_items): Change button label "Add AI" to "Reveal". (add_player_dialog_items): Change button label "Config" to "Configure". (add_player_dialog_items): Move emblems outside of selection rectangle. (add_player_dialog_items): Split player column into separate player and AI columns. Call simple_player_name and player_aitypename instead of simple_player_title. Remove padding of player item canvases. Tweak all item positions so that things look good on all platforms. (select_player): Reduce width of frame for selected player from 4 to 2. (update_player_entry): Call simple_player_name & player_aitypename instead of simple_player_title. Fix bug that disabled the scrollbar in the unix tcltk player setup list. * tkconq.tcl (add_player_dialog_items): Pack the scrollbar before the player setup list content frame and canvas. 2002-08-07 Hans Ronne <hronne@2.sbbs.se> Fix so that tcltk font prefs also are read if you bypass the splash screen. tkconq.tcl (create_map_window): Also read font prefs here. 2002-08-07 Hans Ronne <hronne@2.sbbs.se> Fix problem in setting tcltk fonts from prefs in my last checkin. * tkconq.tcl (bigfont, textfont, boldfont): Move setting of these globals from prefs inside the first tcl procedure (popup_splash_screen). Fix several bugs in the AI code (thanks Lincoln Peters). * combat.c (check_fire_at_action): Don't call enough_ammo. Use the same check for required materials as do_fire_at_action does instead. Add comment about bogus m argument. * run.c (run_advanced_units): Check that we have room for any produced materials and transfer the excess to the treasury if possible. (run_advanced_units): Check that the total supply never exceeds TABHI. (run_advanced_units): Check is_active(occupant) before applying effects. (run_population): Check is_active(occupant) before applying effects. (allocate_used_cells): Check is_active(occupant) before applying effects. (allocate_used_cells): Check that the advances are available to the unit's side before using them. Fix several bugs in the action code (thanks Stanley Sutton). * actions.c (garrison_unit): remove dead branch in code. (check_build_action): Also check the treasury for needed materials. (do_build_action): Use materials from the treasury if available. (check_transfer_action): Permit um_acp_to_unload to be greater than 1 and pass the value to can_have_enough_acp. Add comment about um_acp_to_load being used only as a permission flag. Handle transfer in other direction (negative values) correctly. (do_transfer_action): Pass um_acp_to_unload to use_up_acp. Handle transfer in other direction (negative values) correctly. (check_extract_action): Add comment about bogus n argument. 2002-08-06 Jim Kingdon <kingdon@panix.com> * tcltk/tkconq.tcl (fill_in_side_list): Change loss line from red to black. It was really hard to see against the grey background (at least for my computer and my poor color vision). 2002-08-05 Jim Kingdon <kingdon@panix.com> * kernel/tp.c (receive_packet): Rename "foo" label to "look_for_data". 2002-08-05 Hans Ronne <hronne@2.sbbs.se> Add support for default buttons and key bindings in the tcltk interface. * tkconq.tcl (popup_splash_screen): Increase newgame.top height. Make New Game button default. Add key bindigs for all buttons. (add_splash_screen_dialog_items): Tweak positions of strings. (popup_game_dialog): Change key bindigs for all buttons. (popup_variants_dialog): Change or disable key bindings. (popup_world_size_dialog): Change key binding for OK button. (popup_real_time_dialog): Change key binding for OK button. (popup_player_dialog): Change key binding for OK button. (popup_game_over_dialog): Make Quit Now button default and add key binding. Increase button sizes. Improve the chat dialog layout and make it identical on all platforms. Standardize font usage in the tcltk windows by using globals. * macinit.c (draw_chat_dialog): Don't draw the Close button as a default button since Return goes to the message field. * tkconq.tcl (bigfont): Set globally. (textfont, boldfont): Set globally from prefs. (popup_splash-screen): Use global bigfont instead. (popup_chat): Use global bigfont and textfont instead. (popup_chat): Rewrite extensively. Put all three buttons at the top. Make sure all items behave correctly when the window is resized. Add "Players" and "Message :" labels. (add_program): Include prefs(joinhost) in the join message. (create_map_window): Use global bigfont and textfont instead. (add_network_prefs_items): Change "Name" to "Your Name". * XconqPrj.rsrc (DITL 139 "Chat Items"): Rearrange all items to match the tcltk chat dialog layout. * Xconq.r: Update from XconqProj.rsrc. 2002-08-04 Hans Ronne <hronne@2.sbbs.se> Improve the display of player names in network games. Don't rely on login names that lose in some interfaces. Add a player name field to chat dialogs which defaults to a name that is stored in the preference file. Also set host name and port number from preferences. Remove obsolete commtype entry. * macconq.h (put_string_into_ditem): New macro. * macdefs.h (diChatEditName): New dialog item. (diChatProtocol): Change name to diChatTextName. (diPrefsJoinhost, diPrefsJoinport, diPrefsMyname): New ditems. * macinit.c (protocol): Delete static char. (joinhost, joinport, myname): Declare extern chars. (hit_chat_dialog): Disable diChatEditName if connected. (do_key_down_chat): Update myname from diChatEditName. (draw_chat_dialog): Set diChatEditName instead of diChatProtocol. (draw_chat_dialog): Change "Name (#rid)" to "rid: Name". (make_default_player_spec): Set both default_player_spec and newperson->name to myname. (insert_chat_string): Don't display rid numbers here. (add_remote_locally): Don't display rid numbers here. * macprefs.c (joinport): Initialize to "3075". (joinhost): Initialize to "127.0.0.1". (myname): Initialize to "John Doe". (ui_update_state): Update joinhost, joinport and myname. (interp_mac_ui_data): Interpret joinhost, joinport and myname. (set_preferences): Set joinhost, joinport and myname. (add_preferences_topic_items): Add joinhost, joinport and myname. * XconqPrj.rsrc (DITL 139 "Chat Items"): Add Edit Text field for the player name. Change Static Text field from "TCP/IP" to "Name:". Make the dialog window slightly wider to accomodate the new field. (DITL 701 "Preferences File Items"): Add Edit Text fields and Static Text fileds for joinhost, joinport and myname. * Xconq.r: Update from XconqProj.rsrc. * tkinit.c (init_ui): Don't call get_preferences here (too late). * tkmain.c (default_joinhost): New prefs storage string. (default_joinport): New prefs storage string. (default_myname): New prefs storage string. (initial_ui_init): Call get_preferences here instead. (initial_ui_init): Define make_default_player_spec. (tk_save_prefs): Save joinhost, joinport and myname. (ui_update_state): Update joinhost, joinport and myname. (interp_unix_ui_data): Interpret joinhost, joinport and myname. (tk_make_default_player_spec): New TclCmdFn and prototype. * tkconq.tcl (prefs): Set new prefs(myname) to "John Doe". Set new prefs(joinhost) to 127.0.0.1. Set new prefs(joinport) to 3075. (join_game): Pass $prefs(myname) to make_default_player_spec. (host_game): Pass $prefs(myname) to make_default_player_spec. (popup_chat): Declare global prefs. Remove .chat.top.commtype. Add .chat.top.parms.namelabel and .chat.top.parms.nameentry. Set the latter textentry to $prefs(myname). Also set other two entries to $prefs(joinhost) and $prefs(joinport). (add_program): Also disable .chat.top.parms.nameentry. Change .chat.mid.left.persons from "Name (#rid)" to "rid: Name". Remove "(#rid)" in call to inser_chat_string. (insert_chat_string): Remove "(#rid)". (popup_preferences_dialog): Add "Network" to list. (init_new_prefs): Init newprefs(joinport), newprefs(joinhost) and newprefs(myname). (add_network_prefs_items): New procedure. (remove_network_prefs_items): new procedure. (select_prefs_topic): Handle cases "Network". (ok_preferences): Set the network preferences. Improve player identification in the player setup and side lists. * conq.h (simple_player_title): New prototype. * nlang.c (simple_player_title): New function. * macinit.c (draw_player_setup_list): Call simple_player_title. (add_default_player): Set player->displayname to myname. (init_ui): Pass myname as argument to find_at_key. * macwins.c (gamesidehgt): Increase to 38. (draw_game_date): Tweak string positions. (draw_game_progress): Tweak string position. (draw_game_side): Tweak icon and string positions. Add player info on a separate line by calling simple_player_title. (draw_side_status): Tweak rect and string positions. * tkmain.c (tk_long_player_title): Rename TclCmdFn to tk_simple_player_title and call simple_player_title instead. * tkconq.tcl (create_map_window): Adjust game_entry_height. (fill_in_side_list): Add line player$i. Tweak text positions accordingly. Also tweak line, rect and emblem positions. (update_game_side_info): Update the player$i text. (update_player_entry): Call simple_player_title instead of long_player_title. * sdlmain.c (update_side_display): Call simple_player_title instead of short_player_title. Fix so that the tcltk side display show finished units correctly. * tkconq.tcl (update_side_progress): Fill both left$s and resv$s with violet if $finished is true. Fix unix linefeed bug involving cross-platform chat dialogs. * tp.c (receive_chat): Don't add or remove unix linefeeds here. *tkmain.c (send_chat): Add them here instead. *macinit.c (send_chat): And remove them here. 2002-08-03 Hans Ronne <hronne@2.sbbs.se> Make it possible to view enemy closeups on the mac when debugging even if see-all is false. This is needed for debugging of ai behaviour in non-see-all games. Note: should consider setting side_sees_unit to true for debuggers instead. Pro - consistent behaviour across all platforms and also consistent with side_controls_unit being true for debuggers. Con - we may want to debug the visibility code itself, so it should still work normally while debugging. * macmouse.c (do_mouse_down_map_content): Enable control- clicking on units if debugging. Move check for frontmap->see_all here from create_unit_closeup. * macunit.c (create_unit_closeup): Remove redundant check for side_sees_unit. Move check for frontmap->see_all to macmouse.c. (draw_unit_closeup): Don't blast closeups of non-dside units if debugging. Fix bug where resigning sides with self-units would lose twice, resulting in duplicated messages etc. * unit.c (change_unit_side): Test for H_SIDE_LOST first. Note: this fixed the bug. * score.c (side_loses): Test for side->ingame before proceeding. Note: this did not fix the bug since change_unit_side is called from within side_loses, but the test makes sense anyway. Get rid of the quit, resign and design alert boxes on the mac. Use the notices window with keyboard input instead, just like in the tcltk interface. Also replace the empty aOutOfGame with a run_warning. * maccmd.c (ask_save, ask_resign, ask_design): New static ints. (do_keyboard_command): Rewrite. Add handling of (y/n) keyboard input using the new GROK_MODAL mode. (do_resign): Rewrite. Just set GROK_MODAL and ask_resign. (do_quit): Rewrite. Just set GROK_MODAL and ask_save. (do_resign): Rewrite. Just set GROK_MODAL and ask_design. * macconq.c (adjust_cursor): Handle case GROK_MODAL. (update_side_display): Use run_warning instead of aOutOfGame. * macconq.h (GROK_MODAL): Add new modal map mode. (enable_designing): Remove unused forsure argument. * macdefs.h (aQuitGame): Remove alert box and items. (aResignGame): Remove alert box and items. (aOutOfGame): Remove alert box. (aConfirmResign): Remove alert box and items. (aDesignerQuitGame): Remove alert box and items. (aConfirmDesign): Remove alert box and items. * macdesign.c (enable_designing): Don't call the alert box. * macmenus.c (quit_the_game): Remove function and prototype. (resign_the_game): Remove function and prototype. (do_menu_command): Call do_resign and do_quit instead. * macmouse.c (do_mouse_down_map_content): Handle case GROK_MODAL. * XconqProj.rsrc (ALRT 2000 "Quit Game"): Remove. (ALRT 2001 "Resign Game"): Remove. (ALRT 2002 "Out of Game"): Remove. (ALRT 2004 "Confirm Game"): Remove. (ALRT 3001 "Confirm Design"): Remove. (ALRT 3002 "Designer Quit Game"): Remove. (DITL 2000 "Quit Game Items"): Remove. (DITL 2001 "Resign Game Items"): Remove. (DITL 2002 "Out of Game Items"): Remove. (DITL 2003 "Win Game Items"): Remove unused DITL. (DITL 2004 "Confirm Game Items"): Remove. (DITL 3001 "Confirm Design Items"): Remove. (DITL 3002 "Designer Quit Game Items"): Remove. * Xconq.r: Update from XconqProj.rsrc. 2002-08-01 Hans Ronne <hronne@2.sbbs.se> Fix long-standing problem with occasional 30 sec lockups of the host in network games when playing against a tcltk client. * tp.c (receive_data): Return immediately after handling a trailing ack rather than going to foo. Update the pre-release version date. * version.h (VERSION): Change to August 2002. 2002-08-01 Jim Kingdon <kingdon@panix.com> * kernel/actions.c (garrison_unit): Rename variables for clarity: unit->builder, unit2->newunit, u->ubuild, u2->unew. 2002-07-31 Hans Ronne <hronne@2.sbbs.se> Add Stanley Sutton's Doxygen comments to the kernel includes. * (ai.h, config.h, conq.h, dir.h, game.h, history.h, help.h, kernel.h, lisp.h, misc.h, module.h, obstack.h, player.h, score.h, system.h, side.h, tp.h, unit.h, world.h): Add Doxygen style comments. Also move any macros inside struct definitions to the outside. Humor the compiler some more. * lisp.c (read_form_aux): Put the semicolon on its own line. * util.c (isqrt): Put the semicolon on its own line. * tkmap.c (draw_map_outline): Move declaration of j inside the ifndef MAC code blocks. * win32.c (game_homedir): Only declare struct password pwd ifdef CYGWIN32. 2002-07-27 Hans Ronne <hronne@2.sbbs.se> Fix the "unit view weirdness" run warning bug. Note: this is a hack. Should figure out why the code requires that enemy occupants are treated as top-level units. * ui.c (xform_unit_view): Also test for unit->side != dside in order to simulate the old situation where all non-dside units were counted as top-level units, even if being occupants. Fix yet another crash in autorepair code when resuming after save. Note: should make reinit of will_be_auto_repaired part of the resume game launch process. * plan.c (repair_if_damaged): Test for will_be_auto_repaired instead of any_auto_repair. Fix side name capitalization bug that was introduced with the new self-unit captured or killed notification messages. * unit.c (kill_unit): Allocate fresh buffers for capitalization. (change_unit_side): Allocate fresh buffers for capitalization. Change combat reports to use third person for self-units and make reports about failed capture attempts more intelligible. * nlang.c (first_person): Remove macro, no longer used. (report_combat): Remove all first_person cases. Change "throws back" to "resists capture by". 2002-07-24 Hans Ronne <hronne@2.sbbs.se> Ad Lincoln Peters' improved exploring_worth function. * ai.c (exploring_worth): Rewritten from scratch. Fix so that it becomes possible again to fire at a distance in games where see-all is not true. Note: the problem was that some of the combat code needs to access the target unit pointer directly. If it is hidden from enemy sides, do_hit_unit_task fails 100% of the time. Should decide if hiding this pointer is really a good idea and possibly rewrite the combat code in that case. * side.c (add_unit_view): Don't hide the unit pointer of the new unit view from enemy sides. Fix null pointer crash in the unit view code. (see_cell): Don't call mistake_view if newview is NULL. Humor the compiler. * mplayer.c (mplayer_finish_movement): Remove unused x1, y1. * plan.c (plan_offense_support): Remove unused x, y. (plan_random): Put the ; on its own line. (make_plausible_random_args): Put the ; on its own line. * unit.c (type_can_occupy_empty_type): Remove unused u3. 2002-07-22 Hans Ronne <hronne@2.sbbs.se> Improve performance of fire line and unit blast drawing code on the Mac. Clean up the code and move some functions to where they really belong. * macconq.c (at_all_visible): Move function and prototype here. (draw_unit_blast): Move function and prototype here. Rewrite the function so that it draws onscreen instead of offscreen. Make sure drawing is clipped to the map's contenrect. (update_fire_at_display): Rewrite so that a pre-scan is made to decide if any fire lines need to be drawn. Exclude the world map and all non-visible parts of other maps from consideration. Make sure drawing is clipped to the map's contentrect. Reduce the wait period from 32 to 20 ticks. (update_fire_into_display): Modify like update_fire_at_display. (play_movies): Exclude all non-visible cells from consideration instead of all cells not in the map's gworld. Reduce the wait period from 32 to 20 ticks. * macconq.h (cell_is_in_gworld): Remove extern prototype. (at_all_visible): Remove extern prototype. * macgworld.c (cell_is_in_gworld): Move function to macmap.c. * macmap.c (cell_is_in_gworld): Move function & prototype here. (at_all_visible): Move function and prototype to macconq.c. 2002-07-21 Hans Ronne <hronne@2.sbbs.se> Fix problem with imperial marines only being assigned defensive plans, even though they can capture planets. * mplayer.c (mplayer_decide_plan): Also pick an offensive plan if the unit's siege value is non-zero. * iplayer.c (iplayer_decide_plan): Ditto. Fix bug in the acp-independent building code that caused units to build siege units only as long as there were any enemy advanced units in the game, not just nearby. * run.c (auto_pick_new_build_task): Change ">=" to "<=" so that the enemy_city_near flag is set correctly. Also build only 50% siege units if enemy_city_near is true. Clean up the occupant-transport volume checking code and fix several bugs. Make sure pre-flight and action code use volume checks that give the same result. Reduce the number of functions that do the same thing by removing little or never used variants such as can_carry_type and can_carry from the code. Get rid of uu_occ_can_have_occs which was the only reason for having separate pre-flight and action checks (this table was not used in any game). Rename some functions so that it is more obvious what they do. * actions.c (check_create_at_action): Instead of can_occupy_type, call type_can_occupy_empty_type. * combat.c (type_can_carry): Rename to type_can_have_occs and move to unit.c where it belongs. * conq.c (type_can_carry): Remove prototype. * macunit.c (build_construction_menu): Instead of can_occupy_type call type_can_occupy_empty_type. * mplayer.c (enter_transport): Use can_occupy instead of can_carry. * plan.c (victim_here): Change type_can_carry to type_can_have_occs. (target_here): Change type_can_carry to type_can_have_occs. * table.def (uu_occ_can_have_occs): Remove unused table. * task.c (aux_resupply_here): Use can_occupy instead of can_carry. * unit.h (can_carry): Remove prototype. (can_carry_type): Remove prototype. (can_occupy_type): Remove prototype. (type_can_occupy_empty_type): New prototype. * unit.c (can_carry): Remove check for uu_occ_can_have_occs. Change args and rename function to type_can_occupy. (can_carry): Remove little used function (use can_occupy instead). (can_occupy): Call the new type_can_occupy instead. Move test for non-identity of transport and occ here. (type_can_occupy): Remove old now redundant function. (type_can_occupy_empty_type): New function, cloned from type_can_occupy, assumes that the transport is empty. (can_carry_type): Remove unused function. (can_occupy_type): Remove old function that failed to handle all restrictions. Use type_can_occupy_empty_type instead. * unit.c (enter_transport): Use can_occupy instead of can_carry. Don't use the advanced unit closeup on the Mac for ai-controlled units. Rationale: we don't need to tamper with anything then, and the info is more compact in the simple unit closeup. * maccmd.c (reinit_advanced_unit_closeup): Declare extern. (get_command_and_do): Add special handling of "ai" and "auto" long commands that reinit any closeups. * macmenus.c (do_menu_command): Reinit advanced dside closeups if we switch the side AI on or off. Call apply_to_all_selected with reinit_advanced_unit_closeup as arg if we switch aicontrol on or of for a specific unit(s). (reinit_advanced_unit_closeup): New function and prototype. * macunit.c (create_unit_closeup): Test for ai_controlled(unit) etc. (draw_unit_closeup): Test for ai_controlled(unit) etc. (do_mouse_down_unit_closeup): Test for ai_controlled(unit) etc. (hit_closeup_dialog): Reinit the closeup if we switch to AI control. 2002-07-20 Hans Ronne <hronne@2.sbbs.se> Improve handling of self units. Add code so that u_self_resurrects is supported in the kernel. Make the side lose to the capturing side if the self unit is captured. Don't assume that the self unit is a human being (it's a planet in the foundation game). Change descriptions accordingly. Also describe correctly if a unit is the self unit of another side. Don't give the independent side a self unit. Improve messages in connection with the capture or death of a self unit. * conq.h (all_capitals): New prototype. * nlang.c (all_capitals): New function. (apparent_unit_handle): Don't call the self unit "you", particularly not for other sides! Append "(leader)" or "(capital)" instead. (medium_long_unit_handle): Append "(leader)" or "(capital)". (short_unit_handle): Don't include self unit info. * side.c (init_self_unit): Don't give the indepside a self unit. (side_desig): Improve display of self unit info. * unit.c (kill_unit): Add missing code for resurrecting the self unit. (change_unit_side): Add code for handling self units. Make the old side lose to the new side unless the self unit is resurrected. 2002-07-18 Jim Kingdon <kingdon@panix.com> * kernel/run2.c: Move declarations of run_people and friends from run2.c and run.c to kernel.h * kernel/plan.c: Include ai.h instead of declaring variables explicitly. 2002-07-18 Hans Ronne <hronne@2.sbbs.se> Fix null pointer crashes when loading saved games (thanks Ed). * ai.c (ai_react_to_action): Test if will_be_auto_repaired exists instead of checking any_auto_repair. 2002-07-17 Hans Ronne <hronne@2.sbbs.se> Fix problem with acp-dependent units that can build being distracted by attack or defend tasks and then starting on a new build project instead of completing the old one. Make these units use the same resume build task code as the acp-independent units do. Improve the latter and put it in a separate function for consistency. Disable the action reaction code for non-mobile units that are building something. * ai.c (run_local_ai): Fix incorrect comment about ai_adjust_plan. (ai_react_to_action): Don't mess with cities that are building. * game.h (could_build): Define new macro. * iplayer.c (iplayer_adjust_plan): Remove never occurring case with non-build non-zero task. Check incomplete_build_target before picking a new build task. * mplayer.c (mplayer_adjust_plan): Remove never occurring case with non-build non-zero task. Check incomplete_build_target before picking a new build task. * plan.c (plan_offense_support): Check incomplete_build_target before picking a new build task. (plan_explorer_support): Check incomplete_build_target before picking a new build task. (plan_colonize_support): Check incomplete_build_target before picking a new build task. * run.c (run_construction): Check incomplete_build_target before picking a new build task. * unit.c (incomplete_build_target): New function. (unit_can_build_type): Also check for could_build. Add debug message if either could_create or could_build fails. (can_build_or_help): Use the could_build macro. * unit.h (incomplete_build_target): New prototype. Continue to clean up the AI end of turn code. * ai.c (run_local_ai): Remove comment about disabled code in ai_finish_movement. * iplayer.c (iplayer_rethink_plan): Delete function and prototype sine all the content has been commented out. (iplayer_finish_movement): Delete commented out content but keep empty shell of this function since called from run_local_ai. * mplayer.c (mplayer_rethink_plan): Delete commented out code. Move the remaining content to mplayer_finish_movement and delete the function and prototype. (mplayer_react_to_unit_loss): Delete unused function. Remove the oplayer. Rationale: this was supposed to be a next to recent version of the mplayer that should be used to test if new features in the latter would improve performance. However, this is not how things have worked. Almost all changes to the mplayer in the last two years have been bug fixes, and have therefore been applied also to the oplayer. * ai.c (register_oplayer): Don't declare extern. (init_ai_types): Don't call register_oplayer. * kernel/Makefile.in (oplayer.o): Don't list it. * kernel/oplayer.c: Remove the file. 2002-07-16 Hans Ronne <hronne@2.sbbs.se> Fix long standing problem with ai-controlled units going into reserve mode repeatedly because mplayer_decide_plan failed every time. The underlying reason was that some precomputed unit worths did not handle DICE damage correctly, resulting in negative unit worth values. * ai.c (average_damage): New function and prototype, converts DICE type damage values into a numeric average. * ai.c (offensive_worth): Call average_damage when required. (defensive_worth): Call average_damage when required. Add init warnings for negative unit worths to catch future problems. * ai.c (basic_worth, offensive_worth, defensive_worth, exploring_worth, colonizing_worth, facility_worth, siege_worth): Call init_warning when returning a negative value. Add debug message in case ai_decide_plan fails to pick a plan. * iplayer.c (iplayer_decide_plan): Call DMprintf on failure. * mplayer.c (mplayer_decide_plan): Call DMprintf on failure. Add explanatory comments for some of the precomputed AI values. * utype.def (u_bw): Add explanatory string, move to other AI worths. * table.def (uu_zz_bhw, uu_zz_bfw, uu_zz_bcw, uu_zz_btw): Ditto. Fix problem with units that cannot be repaired going into repair mode and being trapped there forever. The underlying problem was that the repair code was just checking if any kind of unit in the game could be repaired, not if the specific unit in question could be repaired. * ai.h (will_be_auto_repaired): Declare extern char array. * ai.c (ai_react_to_action): Test for will_be_auto_repaired[unit->type] instead of just any_auto_repair. * plan.c (will_be_auto_repaired): Declare extern char array. (repair_if_damaged): Test for will_be_auto_repaired[u] instead of just any_auto_repair. * run2.c (will_be_auto_repaired): Don't declare static. Don't make ai-controlled units who fail to do something sensible go into reserve. Call force_replan instead. Rationale: if plan_offense fails because there are no enemies nearby, sending the unit into reserve mode will just cause the same thing to happen next turn, when the same plan with the same goal is executed again. Calling force_replan will trigger a reassessment of the unit's theater of operations. The unit may therefore be moved to a new theater, which will not happen if we send it into reserve. * plan.c (plan_offense): Call force_replan instead of going into reserve. (plan_defense): Call force_replan instead of going into reserve. (plan_exploration): Call force_replan if there are no tasks in the queue. (plan_colonize): Call force_replan if there are no tasks in the queue. (plan_offense_support): Call force_replan if unable to build attackers. (plan_colonize_support): Call force_replan if unable to build colonizers. (plan_explorer_support): Call force_replan if unable to build explorers. (plan_improve): Call force_replan if unable to build anything. Fix problem with ai-controlled explorers constantly being forced to replan. * plan.c (plan_exploration): Don't set the unit's plan to PLAN_PASSIVE 50% of the time. Always call random_walk instead. Call force_replan if g_see_all is true (just to be consistent - this should never happen). Make the AI assign new unit plans in a more intelligent way. Don't reserve 25% of all units for defense since units are sucked into defense mode by the action reaction code. Give the unit an exploratory plan if it has zero offensive value and g_see_all is false. Only give it a defensive plan as a last resort. * iplayer.c (iplayer_decide_plan): Rewrite case PLAN_PASSIVE. * mplayer.c (mplayer_decide_plan): Rewrite case PLAN_PASSIVE. Fix problem with postmodern engineers trying to build cities at sea. * plan.c (plan_colonize): Call check_create_at_action (also test for many other possible problems. Should call check_create_at_action everywhere in the kernel where set_build_task is called). Simplify the tcltk worldmap map outline code. Use XDrawRectangle instead of XDrawLine for normal view on the mac. Keep the XDrawLine code disabled on the mac, where it loses. * tkmap.c (mapw_display): Call draw_map_outline only if we are drawing a worldmap. Remove ifndef MAC code. (draw_map_outline): Use XDrawRectangle for normal view ifdef MAC. Add detailed comment about the mac specific interface freezes. 2002-07-11 Jim Kingdon <kingdon@panix.com> * kernel/actions.c (adjust_tooling_crossover): Fix formula for computing the crossover. * kernel/skelconq.c: Add automated test for this (functions autotest, fail, and assert_true; --auto option). * test/auto.g: Added. * test/Makefile.in: Add "make check-auto" target. 2002-07-08 Hans Ronne <hronne@2.sbbs.se> Fix random freezes in the MacTcl interface due to buzzing in the map ouline drawing code. Note: should eventually fix the code instead so that it works. Should check if the more sporadic random freezes in the Unix and Windows interfaces also were due to this. * tkmap.c (mapw_display): Only execute calls to draw_map_outline ifndef MAC. Add support for blinking current unit in the tcltk interface since MacTcl and WinTcl cannot handle the crawling ants animation. * tkmap.c (blinking_curunit): Declare extern int. (draw_current): Use blinking rect instead of crawling ants animation if blinking_curunit is set. * tkmac.c (blinking_curunit): Declare int and init to TRUE. * tkwin32.c (blinking_curunit): Declare int and init to TRUE. * xconq.c (blinking_curunit): Declare int and init to FALSE. Fix so that mac high ascii char code conversion works correctly with all three mac interfaces (PPC, TCL and SDL). * lisp.c (use_mac_charcodes): Declare extern int. (strmgetc): Test for use_mac_charcodes before doing any conversions. Add support for more European characters. * macconq.c (use_mac_charcodes): Declare int and init to TRUE. * tkmac.c (use_mac_charcodes): Declare int and init to FALSE. * macsdl.c (use_mac_charcodes): Declare int and init to TRUE. Use green and magenta for tcltk side progress bar similar to the mac ppc interface. * tkconq.tcl (fill_in_side_list): Set resv$i -fill magenta and left$i -fill LawnGreen. Tweak sizes of resv$i and left$i 1 pixel so that they don't erase the frame bottom. Create frame$i after resv$i and left$i. Tweak left end of all rects to 23 pixels. (update_side_progress): Set left$i -fill LawnGreen if not $finished. Twek left end of undrawn rects to 23 pixels. Improve the visibility of tcltk unit and feature names. * tkmap.c (draw_unit_name): Use 8 shadows in 3 directions. Move start of unit name out of the grouping box if present. (draw_feature_name): Use 8 shadows in 3 directions. Improve appearance of unit size numbers in the tcltk interface. * tkmap.c (draw_unit_size): Draw like unit names. Move to position immediately left of unit or its grouping box. Adjust vertical position depending on the cell height and horizontal postion by the strlen. (update_at_cell): Add 1 cell to update rect so that the size is redrawn. (update_at_unit): Add 1 cell to update rect so that the size is redrawn. Port the name-erasing code for moving units from the mac interface to the tcltk interface. * tkmap.c (update_at_cell): Add code from macmap.c (update_cell). (update_at_unit): Add code from macmap.c (update_cell). Fix isometric update code so that the update rect has the correct height. * tkmap.c (update_at_cell): Add mapw->vp->hh / 2 to sh. (update_at_unit): Add vp->hh / 2 to sh. Comment out unused functions in tcltk map update code. * tkmap.c (limitx): Comment out function and prototype. (update_area): Comment out function and prototype. 2002-07-05 Hans Ronne <hronne@2.sbbs.se> Fix bad index crashes in the tcltk interface when the listbox selections are empty. * tkconq.tcl (new:game): Return if $j is an empty string. (select_agreement): Return if $i is an empty string. (select_prefs_topic): Return if $i is an empty string. (select_help_topic): Return if $i is an empty string. (select_game): Return if $j is an empty string. (ok_research): Return if $i is an empty string. Change sleep and reserve mode commands so that they don't recurse into occs (rationale: if a city is manually set asleep e.g. because it has nothing left to build, this should not set its occs asleep). * cmd.c (do_one_sleep): Don't set the recurse flag. Remove comment. (do_one_reserve): Don't set the recurse flag. Remove comment. Remove g_units_may_go_into_reserve gvar (this was a hack that tried to fix AI buzzing but it is questionable if it ever did any good, and is it not used in any current game). * ai.c (update_unit_plans_randomly): Don't test for gvar. * gvar.def (g_units_may_go_into_reserve): Remove gvar. * iplayer.c (iplayer_adjust_plan): Don't test for gvar. * mplayer.c (mplayer_adjust_plan): Don't test for gvar. * oplayer.c (oplayer_adjust_plan): Don't test for gvar. * plan.c (execute_plan): Don't test for gvar. (plan_offense): Don't test for gvar. (plan_defense): Don't test for gvar. (plan_exploration): Don't test for gvar. * task.c (execute_task): Don't test for gvar. Fix some (but far from all) problems in the all.g test game. * all.g (area (terrain "40a")): Comment out, causes crashes. (units-may-go-into-reserve): Remove obsolete gvar. (advanced-auto-construct): Remove obsolete gvar. (advanced-auto-research): Remove obsolete gvar. (action-narratives): Remove obsolete gvar. (feature-colors): Remove obsolete gvar. * version.h (VERSION): Update to July 2002. 2002-07-03 Jim Kingdon <kingdon@panix.com> * kernel/world.c (set_area_shape): Give a run_error if we have already allocated area.units. * doc/TODO: Remove item about all.g; this fixes it. * kernel/iplayer.c: Put newline at end of file. 2002-07-01 Hans Ronne <hronne@2.sbbs.se> Fix ai_finish_movement so that it works as originally intended, i.e. by executing as soon as the need_ai_finish_movement flag has been set. ai.c (run_local_ai): Don't test for side->finishedturn before calling ai_finish_movement. Remove hacks introduced because of the ai_finish_movement bug. ai.c (run_local_ai): Remove comment referring to these hacks. iplayer.c (iplayer_init_turn): Don't call iplayer_finish_movement here. mplayer.c (mplayer_init_turn): Don't call mplayer_finish_movement here. oplayer.c (oplayer_init_turn): Don't call oplayer_finish_movement here. Remove the calls to net_set_unit_reserve in the ai_finish_movement waiting for transport code since it is now executed at the end of turn. * mplayer.c (mplayer_rethink_plan): Don't call net_set_unit_reserve. * oplayer.c (oplayer_rethink_plan): Don't call net_set_unit_reserve. Remove non-working "build capturer to capture nearby explorer" code in the ai_finish_movement code (the code was incomplete and it is in any case questionable if we should mess with assigned build tasks here). * ai.c (run_local_ai): Remove comment referring to incomplete code. * iplayer.c (iplayer_rethink_plan): Remove incomplete code. * mplayer.c (iplayer_rethink_plan): Remove incomplete code. * oplayer.c (iplayer_rethink_plan): Remove incomplete code. Comment out "attack nearby enemy unit" code in the ai_finish_movement code (ai_react_to_action, which is much more sophisticated, is now called at the start of each turn through ai_decide_plan, and pushing new attack tasks at the end of the turn will just cause needless buzzing). * ai.c (run_local_ai): Add comment about ai_react_to_action. (ai_decide_plan): Add comment about ai_finish_movement code. * iplayer.c (iplayer_finish_movement): Comment out content. (iplayer_rethink_plan): Comment out function and prototype. * mplayer.c (mplayer_rethink_plan): Comment out attack code. * oplayer.c (oplayer_rethink_plan): Comment out attack code. Let advanced units wait until the next turn and notify the side about this if auto_pick_new_build_task fails to pick a new build task. * run.c (auto_pick_new_build_task): Call set_unit_reserve and notify if u is set to NONUTYPE. 2002-07-01 Jim Kingdon <kingdon@panix.com> * Makefile.in (check): Build skelconq before recursing into the test directory. * kernel/.cvsignore: Also list skelconq. * test/.cvsignore: Add various files generated in running tests. 2002-06-29 Hans Ronne <hronne@2.sbbs.se> Fix severe bug in acp-independent build code due to the static global *apnbt_types (see 2000-12-21) not being zeroed. * run.c (auto_pick_new_build_task): Zero *apnbt_types each time for all utypes. 2002-06-28 Hans Ronne <hronne@2.sbbs.se> Fix AI buzzing in the acp-independent build code. * (auto_pick_new_build_task): Apply the city_has_shore condition only to those naval movers that are unable to move by air or ground. 2002-06-24 Hans Ronne <hronne@2.sbbs.se> Make the tcltk research dialog behave in a more intelligent way. * tkmain.c (update_side_display): Don't pop up the research dialog if research is being run by the computer. Add notification message. Fix lockups due to pack buzzing in the help window under MacTcl. * tkconq.tcl (popup_help_dialog): Pack the text box before the scrollbar. Fix failure of the agreements window to be drawn more than once. * tkconq.tcl (create_agreements_window): Add conditional code for deiconifying any existing agreements window. Fix the chat string input field so that it works also in MacTcl. * tkconq.tcl (enable_chat): Test <Key> for "%K" == "Return" instead. Fix a bug in Mac Tcl/Tk (8.3.4) which prevents windows that have been deiconified from ever regaining focus again. * tkmac.c (XMapWindow): Hacked version of fn from tkMacSubwindows.c in which a call to SelectWindow has been added after ShowWindow. Fix failure of new tcltk windows to receive focus under Windows. * tkconq.tcl(popup_chat): Add focus .chat. (popup_indepside_config): Add focus .indepside. (create_map_window): Add focus -force $map. (popup_contour_interval_dialog): Add focus .contour. (popup_meridian_interval_dialog): Add focus .meridian. (ask_bool_mode): Add focus .bool. (popup_find_dialog): Add focus .find. (popup_research_dialog): Add focus -force .research. (create_agreements_window): Add focus .agreements. (popup_scores): Add focus .scores. (popup_preferences_dialog): Add focus .prefs. (popup_help_dialog): Add focus .help. (popup_game_over_dialog): Add focus .gameover. (popup_design_palette): Add focus .design. Fix problem with cross and top_left_arrow cursors not being defined in MacTCL and WinTCL. * tkconq.tcl (ask_position_mode): Change cross to crosshair. (ask_position_done): Change top_left_arrow to arrow. This is no longer the same xconq as in Dec 2000. * version.h (VERSION): Update the date to June 2002. 2002-06-22 Hans Ronne <hronne@2.sbbs.se> Fix bad resource crashes in the MacPPC interface. * macunit.c (plot_resource_cicns): Cap production_at to 6. Fix typo in last patch that caused tcl init_error. * tkconq.tcl (make_normal_bindings): Remove extra curly bracket. 2002-06-22 MA Dunzi <tadalunch@s5.xrea.com> * tcltk/tkconq.tcl (make_normal_bindings): Fix a bug that a lot of keys cause "zoom out". 2002-06-19 MA Dunzi <tadalunch@s5.xrea.com> * commands.texi: Fix doc of "end-turn" command. 2002-06-19 MA Dunzi <tadalunch@s5.xrea.com> * tcltk/tkconq.tcl (popup_game_over_dialog): Create .gameover.hint as a label widget instead of a text widget. 2002-06-18 Hans Ronne <hronne@2.sbbs.se> Fix problem with terrain usage for moving advanced units. * move.c (free_used_cells): Add prototype. (allocate_used_cells): Add prototype. (move_unit): Call free_used_cells before moving and allocate_used_cells when done. * run.c (allocate_used_cells): Declare extern. * unit.c (free_used_cells): Declare extern. 2002-06-17 MA Dunzi <tadalunch@s5.xrea.com> * tcltk/tkconq.tcl(select_game): Set .newgame.top.right.blurb.t configure -state disabled. (popup_game_over_dialog): Set .gameover.hint configure -state disabled. 2002-06-16 Hans Ronne <hronne@2.sbbs.se> Fix line drawing in MacTCL so that the world map outlines and fire lines are erased properly. Note: should also fix unnecessary redrawing of the world map outlines on all platforms. * tkimf.h (GXinvert): Undef it and redefine as GXxor ifdef MAC. Fix clipping of rectangles in MacTCL by rewriting XFillRectangles from TclTk 8.3.4 so that it supports the use of tk clip masks. * tkmac.c (XFillRectangles): New hacked version of function with same name from tkMacDraw.c (TclTk 8.3.4). Add support for clip masks. (gPenPat): New static PixPatHandle used by XFillRectangles. Fix invisible incomplete units in MacTCL. Note: should figure out how to stiple or gray out these units in MacTCL. * tkmap.c (draw_unit_image): Only use stiple code ifndef MAC. Fix so that occupants are drawn correctly under MacTCL with big icons. * ui.c (xform_occupant): Test for vp->wide_viewport instead of MAC. (find_unit_or_occ, find_unit_or_occ_view): Ditto. Fix justification of wrapped text in the tcl game over dialog. * tkconq.tcl (popup_game_over_dialog): Force justification by tagging each line. Increase -pady of Continue button to 16. Add gvars for colors currently defined only in the mac interface. * gvar.def (g_window_color): Add definition and set to dark-orange. (g_fore_color): Add definition and set to black. (g_mask_color): Add definition and set to lemon-chiffon. (g_text_color): Add definition and set to midnight-blue. * maccolors.c (set_default_colors): Initialize the above colors. * tkconq.h (a_ui): Add window_color, mask_color and text_color. * tkinit.c (set_optional_colors): Set fg_color, window_color, mask_color, text_color and feature_color from gvars. * tkmap.c (draw_units): Use mask_color for grouping boxes. (draw_unit_and_occs): Use mask_color for grouping boxes. 2002-06-16 Jim Kingdon <kingdon@panix.com> * kernel/help.c (describe_utype): Fix cut-and-paste error (ut_vanishes_on -> ut_wrecks_on) which led to the help wrongly describing ut_wrecks_on. 2002-06-14 Hans Ronne <hronne@2.sbbs.se> Add Juergen Ruehle's fixes to the Windows network code. * socket.c (low_send): Call send instead of write ifdef WIN32. (low_receive): Call rcvd instead of read ifdef WIN32. * sdlwin32.c (accept_all_remotes): Add function and prototype. (main): Add code for joining and hosting network games using the command line. Make TCL clients show the game name correctly in the variants dialog. * tkmain.c (interpret_variants): Add code that sets the game name. * macinit.c (create_variants_dialog): Remove quotes for consistency. Fix the default (loopback) address so that it works under MacTCL. * tkconq.tcl (joinhost): Set it to 127.0.0.1 instead of localhost. Make the default mac (PPC) name more informative. * macinit.c (init_ui): Change mac to MacPPC. (add_default_player): Change mac to MacPPC. (make_default_player_spec): Change mac to MacPPC. Fix Windows icon resource compile bug. * Xconq.RC: Add linefeed at end of file. 2002-06-12 Hans Ronne <hronne@2.sbbs.se> Fix typo that turned off clipping in the MacTcl interface. * tkmac.c (main): Set use_clip_mask to TRUE. 2002-06-05 MA Dunzi <tadalunch@s5.xrea.com> * tkconq.tcl: Disable "Plan Type". (see do_map() in tkcmd.c 1.33 -> 1.34.) 2002-06-04 MA Dunzi <tadalunch@s5.xrea.com> * doc/refman.texi: Fix typo. 2002-06-03 MA Dunzi <tadalunch@s5.xrea.com> * doc/commands.texi: Add missing @. 2002-05-23 Hans Ronne <hronne@2.sbbs.se> Finally fix clipping problem in the Mac tcltk interface by rewriting XCopyArea so that it supports the use of clip masks. * tkmac.c (tkMacInt.h): Include it. (XCopyArea): Rewrite function based on the XCopyPlane function from TclTk 8.3.4, which does support clip masks. * tkimf.h (XCopyArea): Remove macro redefinition. * tkmap.c (mapw_widget_cmd): Remove redefinition of XCopyArea. More MS Visual C++ compatibility patches. * tkwin32.c (WinMain): Remove obsolete call to SetMessageQueue. * socket.c (sleep): Define it if using MS VC++. Tweak unit placement warning message (thanks MA Dunzi). * mkunits.c (make_countries): Remove unwanted space. 2002-05-20 Hans Ronne <hronne@2.sbbs.se> Fix some Windows compile errors with MS Visual C++. * win32.c (unistd.h): Only include it when using Cygwin or Mingw. (F_OK): Define to 0. * socket.c (winsock2.h): Include it for all non-Cygwin non-CodeWarrior Win32 compilers. (unistd.h): Only include it when using Mac, Unix, Cygwin or Mingw. * util.c (timeval): Define it for all non-Cygwin non-CodeWarrior Win32 compilers. * sdlconq.h (timeval): Define it for all non-Cygwin non-CodeWarrior Win32 compilers. Fix two minor problems (thanks MA Dunzi). * cmd.def (end-turn): Add new command. * cmdline.6in: Add missing .TP twice. Fix garbage pref file name in the Mac tcltk interface. * tkmac.c (preferences_filename): Return PREFERENCESFILE. Make player info more informative in the Windows interfaces. * tkwin32.c (add_default_player): Set displayname to "WinTCL". (make_default_player_spec): Set default_player_spec to "WinTCL". * sdlwin32.c (add_default_player): Set displayname to "WinSDL". (make_default_player_spec): Set default_player_spec to "WinSDL". Don't try to put the Windows score file in a non-existent "scores" directory. Just dump it where the app lives, like on the Mac. * win32.c (scorenamebuf, score_file_pathname): Comment out. (open_scorefile_for_reading): Don't call score_file_pathname. (open_scorefile_for_writing): Don't call score_file_pathname. Tweak bottom button row so that it looks good on all platforms. * tkconq.tcl (popup_splash_screen): Resize and move buttons. Use 12 point bold Helvetica for button text. Draw a solid frame around the blurb box. * tkconq.tcl (popup_splash_screen): Add -borderwidth 1 and -relief solid to the blurb frame. Reduce height to 4 lines. Improve the text display on all platforms. * tkconq.tcl (font_family): Change to helvetica. (fill_new_game_list): Insert space before $entry. (popup_game_over_dialog): Use -font $textfont. Insert new line. (add_new_game_dialog_items): Use -font system for the list and -font helvetica for the blurb text. Tweak positions of blurb and list all games checkbutton. * tkconq.tcl (add_new_game_dialog_items): Reduce -pady to 4 for preview, version and blurb. Add -padx 40 -pady 8 to checkbutton. Make more room for button row by freeing the top right corner. * tkconq.tcl (add_player_dialog_items): Pack the plbuttons frame before packing the listheadings canvas. Specify both padx and pady for each button. Fix the tcltk widget display for checkboxes and buttons so that the highlight status is drawn correctly for those interfaces where it matters (like the Mac). * tkconq.tcl (add_variants_dialog_items): Rewrite checkbox code so that variantstate "active" (which means enabled) is converted into widgetstate "normal" (which means enabled) instead of widgetstate "active" (which means highlighted). (update_allplayer_buttons, add_program, update_player_entry set_indepside, popup_real_time_dialog, add_player_dialog_items update_feature_name_entry, select_player, dismiss_chat, popup_world_size_dialog): Change widget state "active" to "normal" everywhere in the code. 2002-05-18 Jim Kingdon <kingdon@panix.com> * kernel/run.c (run_advanced_units, allocate_used_cells): Rewrite multiplicative code to use integer arithmetic in the way that most of xconq does (returning 0 and starving could be because the old code would basically hope that ((float)100 / 100.0) was 1, but if integer 100 rounds down a bit when it becomes float, that would lose). This also should fix a bug whereby granaries and the like do nothing in advances.g (the code was taking 150% and rounding it to the integer 1). 2002-05-12 Hans Ronne <hronne@2.sbbs.se> Fix failure of advanced units to allocate used cells under Windows that caused them to starve to death. * run.c (allocate_used_cells): Comment out multiplicative code that always returns 0 under Windows. (run_advanced_units): Comment out multiplicative code for the same reason, even though it causes no apparent problems. Make the user area layer short, similar to user->id. * world.h (a_area): Make *user short instead of int. * world.c (allocate_area_users): Pass short to malloc_area_layer. Fix failure to draw color blast images in the Windows and Mac tcltk interfaces. * blasts.imf: Reenable color images for the "hit", "kill" and "miss" blasts. Why were they ever disabled? Fix failure to draw mono blast images in the Windows tcltk interface. * tkmap.c (draw_blast_image): Don't test and use tkimg->colr in the Windows-specific mono code. Use tkimg->mono instead. Prepare the mac interface for C++ compatibility. * macconq.c (print_form): K&R -> C89. * macinit.c (set_variant_item): K&R -> C89. * macimf.c (mac_interp_imf): K&R -> C89. * macmap.c (xform): K&R -> C89. (xform_fractional): K&R -> C89. (xform_flat): K&R -> C89. (xform_fractional_flat): K&R -> C89. (m_xform_unit): K&R -> C89. (m_xform_unit_self): K&R -> C89. (m_xform_occupant): K&R -> C89. (activate_map): K&R -> C89. (force_map_update): K&R -> C89. (print_map): K&R -> C89. (destroy_map): K&R -> C89. (draw_map_content): K&R -> C89. (draw_control_panel): K&R -> C89. (draw_info_text): K&R -> C89. (draw_other_maps): K&R -> C89. (draw_selected_unit): K&R -> C89. (draw_selection_animation): K&R -> C89. * macmenus.c (any_transport_here): K&R -> C89. * macwins.c (do_key_down_construction): K&R -> C89. 2002-05-11 Hans Ronne <hronne@2.sbbs.se> Fix so that the Windows tcltk app does not crash on exit. * tkmain.c (exit_xconq): Call Tcl_Exit(0) instead of exit(0). Clean out unused variables and fix various compiler warnings. * iplayer.c (iplayer_init): Remove unused unit. Also remove meaningless test for side_has_units. * mplayer.c (mplayer_init): Remove unused unit. (register_mplayer): Remove semicolon at end. * oplayer.c (oplayer_init): Remove unused unit. * mac.c (open_module_library_file): Remove unused curvrefnum. (open_module_explicit_file): Remove unused curvrefnum. (open_library_file): Remove unused curvrefnum. (open_scorefile_for_reading): Remove unused buf[255]. * run.c (run_population): Move occ inside if 0 block. * ui.c (advance_into_cell): Remove unused now. * macconq.c (event_loop): Remove unused dialog and itemhit. (handle_event): Remove unused win2. (update_fire_into_display): Remove unused sh2. (get_main_screen_size): Remove unused mainport. * macinit.c (draw_splash_dialog): Remove unused pic. (create_chat_dialog): Remove unused i and side. (draw_chat_dialog): Remove unused i, buf[32] and side. (create_newgame_dialog): Remove unused pic, viewrect and destrect. (draw_player_setup_dialog): Remove unused pic and tmpcell. (draw_player_setup_dialog): Remove unused viewrect and destrect. (draw_player_setup_dialog): Remove unused listrect and itemrect. (draw_player_setup_dialog): Remove unused itemtype and pname. (set_player_setup_button_states): Remove unused win. (do_mouse_down_player_setup): Remove unused itemtype. (init_display): Remove unused handle. * maccmd.c (do_keyboard_command): Remove unused *fn. (get_selected_units): Remove unused rslt. (do_one_attack): Remove unused i. (do_one_repair): Remove unused i. (do_up): Remove unused target. * maccolors.c (set_default_colors): Remove unused i. (init_side_colors): Remove unused cstring[96]. (set_side_colors): Remove unused ppathandle. (set_feature_color): Remove unused ppathandle. (set_terrain_color): Remove unused ppathandle. * macdesign.c (do_mouse_down_design): Remove unused i. (apply_designer_tool): Remove unused olduview. * macdraw.c (draw_unit_image): Remove unused bx, by, bh and bw. (draw_side_emblem): Remove unused ex2 and ey2. (draw_cell_block): Remove unused oldcolor. (draw_hex_region): Remove unused oldcolor. (draw_border_line_multiple): Remove unused oldcolor. (draw_connection_line_multiple): Remove unused oldcolor. (draw_feature_borders): Remove unused oldcolor and cellcolor. (draw_name): Remove unused fontinfo and maskrect. (draw_legend_text): Remove unused fontinfo and maskrect. * machelp.c (do_mouse_down_instructions): Remove unused itemhandle. (zoom_help): Remove unused gd. * macimf.c (mac_load_imf): Remove unused resname, restype and resid. (mac_load_imf): Remove unused bounds, h and w. (mac_add_cicn): Remove unused i and n. (mac_add_ppat): Remove unused pmap and n. (mac_interp_image): Remove unused subimg and subi. (mac_interp_image_1): Remove unused bitrowbytes and macrowbytes. (mac_interp_image_1): Remove unused cicnhandle. (mac_create_ppat): Remove unused iconhandle. (mac_create_cicn): Remove unused pmhandle, sicnhandle, iconhandle and i. (convert_ppat): Remove unused anynonzero. * maclist.c (set_list_scrollbars): Remove unused val. (update_unit_in_lists): Remove unused i. (redraw_unit_list_entry): Remove unused unit. (activate_list): Remove unused growRect and oldport. * macmap.c (create_map): Remove unused unit. (set_map_scrollbars): Remove unused hilite. (invert_map): Remove unused sw and sh. (activate_map): Remove unused myQElPtr and growRect. (draw_feature_names): Remove unused portrect. (draw_unit_info): Remove unused m. (draw_related_maps): Remove unused tmpRect. (draw_selections): Remove unused sh and sw. (draw_unit_names_only): Remove unused sx2, sy2, sw2, sh2 and tmprect. * macmenus.c (do_about_box): Remove unused pic. (do_find_unit_by_name_mi): Remove unused x and y. (enable_commands_for_unit): Remove unused sn. (side_rename_dialog): Remove unused *str. * macmouse.c (do_about_box): Move *thisunit inside if 0 block. * macprefs.c (set_preferences): Remove unused map, ditl and new_interval. * macrow.c (draw_cliffs): Remove unused oldcolor. (draw_gridlines): Remove unused wid. (draw_shores): Remove unused sx and sy. (draw_feature_boundary): Remove unused *feature. * macunit.c (show_unit_closeup): Remove unused map. (create_unit_closeup): Remove unused w and h. (draw_simple_closeup): Remove unused h, w, sy2, sx2 and m. (draw_advanced_closeup): Remove unused pnumber. (draw_advanced_content): Remove unused tmprect. (draw_landuse_near_unit): Remove unused pnumber. (do_mouse_down_unit_closeup): Remove unused plan and map. (hit_closeup_dialog): Remove unused m, u2, pnumber, cname[32] and buf[32]. (toggle_landuse_one_cell): Remove unused nearx and neary. (destroy_unit_closeup): Remove unused map. (draw_unit_build_dialog): Remove unused run, ditem, mitem, d, u and u2. (do_mouse_down_build): Remove unused task, plan, map, unit2 and tmprect. (hit_unit_build_dialog): Remove unused width, height, downsx and downsy. (hit_unit_build_dialog): Remove unused downx, downy, sx, sy, m and plantype. (hit_unit_build_dialog): Remove unused i, u2, a, pnumber and *unitcloseup. (hit_unit_build_dialog): Remove unused buf[32], cname[32] and sname[32]. (hit_unit_build_dialog): Remove unused *unit2, *helpnode and itemrect. * macwins.c (create_construction_window): Remove unused mainheight. (show_research_dialog): Remove unused height and mainheight. (draw_research_dialog): Remove unused itemrect. (hit_research_dialog): Remove unused cname[32], m and i. (set_history_scrollbar): Remove unused *nexthevt. (draw_history): Remove unused *hevt and n. (zoom_history): Remove unused vislinesavail and titleh. (zoom_notice): Remove unused gd and titleh. (zoom_scores): Remove unused gd and titleh. (show_alert_dialog): Remove unused height and mainheight. * sdlmain.c (handle_mouse_down): Remove unused rect. * tkmac.c (MacintoshInit): Remove unused i. 2002-05-10 Jim Kingdon <kingdon@panix.com> * x11/ximf.c (x11_load_bitmap): tcltk/tkmain.c (initial_ui_init), tcltk/tkimf.c (tk_load_bitmap), kernel/unix.c (open_library_file), kernel/win32.c (open_library_file), kernel/mac.c (open_library_file): Make the buffer we pass to make_pathname BUFSIZE bytes in length (as it turned out, all the old buffers were big enough, but it was just an accident waiting to happen). 2002-05-10 Hans Ronne <hronne@2.sbbs.se> Make the skelconq target C++ compatible. * skelconq.c (do_task_cmd): Typecast i to TaskType. Fix problem with tcltk includes on Windows. Clean up the include mess on the Mac. * tkconq.h: Don't include tkInt.h & tclInt.h ifdef MAC. * tkimf.h: Don't include tkInt.h for non-Cygwin Windows. (XFlush): Add prototype for non-Cygwin Windows. (XSynchronize): Add prototype for non-Cygwin Windows. (XSetTile): Add prototype ifdef MAC. * tkimf.c: Don't include tkInt.h & tclInt.h ifdef MAC. Move include of tcl.h & tk.h to before X11/Xlib.h. * tkisamp.c (XSetTile): Remove mac-specific prototype. * tkmac.c (XSetTile): Remove prototype. * tkmap.c (XSetTile): Remove mac-specific prototype. * tkwin32.c: Don't include tkInt.h. (XFlush, XSynchronize): Add dummy functions. 2002-05-08 Jim Kingdon <kingdon@panix.com> * x11/xshowimf.c: Include <sys/stat.h> before using struct stat. 2002-05-08 Hans Ronne <hronne@2.sbbs.se> Further fixes of C++ problems on Windows and Mac. * obstack.h (__STDC__) Define as TRUE if using C++ and CodeWarrior. * mac.c (close_scorefile_for_writing): K&R -> C89. (n_seconds_elapsed, n_ms_elapsed): K&R -> C89. * tkmap.c (mapw_cmd): Change last arg from **argv to *argv[]. * tkisamp.c (imfsample_cmd): Ditto (function body only). * task.c (compare_directions): Declare any_people_surrenders as short. * util.c (randstate, initrandstate): Declare long instead of int. * macsdl.c (MissingParameterCheck): New function. (DoOpenApp, DoQuitApp, DoOpenDocument): New wrapper functions. (init_ae): Use DoOpenApp, DoQuitApp, DoOpenDocument instead. (do_ae_open_document): Change arg to const AppleEvent. * tkmac.c (MissingParameterCheck): New function. (DoOpenApp, DoQuitApp, DoOpenDocument): New wrapper functions. (init_ae): Use DoOpenApp, DoQuitApp, DoOpenDocument instead. (do_ae_open_document): Change arg to const AppleEvent. Add Ed Oskiewicz' C++ compatibility patches. * (ants.b, attackcurs.b, attackmask.b, buildcurs.b, buildmask.b, cursbord.b, curdsbordm.b, curscell.b, curscellm.b, curscoat.b, curscoatm.b, cursconn.b, cursconnm.b, cursunit.b, cursunitm.b, delay.b, dots.b, hex16iso.b, hex32iso.b, hex64.b, hex64b.b, hex64iso.b, iso.b, laurels.b, lookglass.b, lookmask.b, reserve.b, return.b, rotl.b, rotr.b, scursdown.b, scursdownm.b, scursleft.b, scursleftm.b, scursright.b, scursrightm.b, scursup.b, scursupm.b, shootcurs.b, shootmask.b, sleep.b, wind0.b, wind1e.b, wind1ne.b, wind1nw.b, wind1se.b, wind1sw.b, wind1w.b, wind2e.b, wind2ne.b, wind2nw.b, wind2se.b, wind2sw.b, wind2w.b, wind3e.b, wind3ne.b, wind3nw.b, wind3se.b, wind3sw.b, wind3w.b, wind4e.b, wind4ne.b, wind4nw.b, wind4se.b, wind4sw.b, wind4w.b): Change unsigned char to char. * cconq.c (init_display): Typecast xmalloc returns to char *. (schedule_movie): Typecast itype to enum movie_type. * cdraw.c (cycle_list_filter): Add enum listsides typecast. (cycle_list_order): Add enum sortkeys typecast. (show_cursor): throw "snafu" ifdef cplusplus else abort. (cur_at): throw "snafu" ifdef cplusplus else abort. * macdesign.c (draw_design_window_tool): Change typename to feattype. (feature_rename_dialog): Change typename to feattype. (feature_rename_dialog): Change newtypename to newfeattype. * sdlimf.c (sdl_interp_image_1): Typecast xmalloc returns to char *. * sdlmain.c (screen_oneliner): Typecast xmalloc return to char *. (ask_side): Add char * typecast. * sdlmap.c (draw_terrain_iso): Add enum whattouse typecast. (draw_terrain_row): Add enum whattouse typecasts. (draw_terrain_transitions): Add enum whattouse typecast. * tkcmd.c (do_build): Typecast xmalloc return to char *. (aux_build): Typecast xmalloc return to char *. * tkconq.h: Declare tcltk includes extern "C" ifdef cplusplus. * tkciapp.c: Declare tcltk includes extern "C" ifdef cplusplus. (outdirname): Comment out declaration. * tkimf.c: Declare tcltk includes extern "C" ifdef cplusplus. (tk_load_imf): Typecast xmalloc return to char *. (tk_load_bitmap): K&R -> C89. (tk_interp_imf): Typecast xmalloc return to char *. (tk_interp_image_1): Typecast xmalloc returns to char *. * tkisamp.c: Declare tcltk includes extern "C" ifdef cplusplus. (imfsample_widget_cmd): K&R -> C89. (imfsample_event_proc): K&R -> C89. (imfsample_cmd_deleted_proc): K&R -> C89. * tkmain.c (tk_set_variant_value): Comment out extern declarations. (tk_feature_info): Change typename to feattype. (tk_game_info): Add char * typecast. (tk_set_design_tool): Add enum mapmode typecast. (ask_side): Add char * typecast. * tkmap.c (mapw_widget_cmd): Add int typecasts. (draw_terrain_iso): Add enum whattouse typecast. (draw_terrain_row): Add enum whattouse typecasts. (draw_terrain_transitions): Add enum whattouse typecast. * xcloseup.c: Change all functions from K&R -> C89. (draw_side_closeup): Typecast xmalloc returns to int *. (add_to_closeup_summary): Typecast xmalloc return to char *. (build_unit_list): Typecast xmalloc return to Boolean *. (build_unit_list): Typecast xmalloc return to char *. (order_etype_call): Add enum sordercond typecast. (order_eparms_call): Change typecast from void * to int *. (order_task_call): Add TaskType typecast. (order_tparms_call): Remove void * typecast. (order_tparms_call): Change typecast from void * to int *. (set_cell_from_map): Add int * typecasts. (set_unit_from_map): Remove void * typecast. * xcmd.c: Change all functions from K&R -> C89. * xconq.c (make_default_player_spec): xmalloc return -> char *. (handle_x_error): throw "snafu" ifdef cplusplus else abort. (handle_xio_error): throw "snafu" ifdef cplusplus else abort. * xcutil.c: Change all functions from K&R -> C89. Declare X11 includes extern "C" ifdef cplusplus. (read_xbm_file): Typecast xmalloc returns to char *. (write_x11_bitmaps): Typecast xmalloc returns to char *. * xdesign.c: Change all functions from K&R -> C89. * xdraw.c: Change all functions from K&R -> C89. (draw_terrain_row): Add enum whattouse typecasts. * xhelp.c: Change all functions from K&R -> C89. (interp_help_command): throw "snafu" ifdef cplusplus else abort. * ximf.c: Change all functions from K&R -> C89. Declare X11 includes extern "C" ifdef cplusplus. (x11_load_imf): Typecast xmalloc returns to char *. (x11_interp_imf): Typecast xmalloc returns to char *. (x11_interp_image_1): Typecast xmalloc returns to char *. * ximf.h: Declare X11 include extern "C" ifdef cplusplus. * ximfapp.c (main): Typecast xmalloc return to char *. * xinit.c: Change all functions from K&R -> C89. (XtResource): Add XtPointer typecasts. (init_display): Add various typecasts for xmalloc returns. (set_colors): Typecast xmalloc return to long int *. (init_bitmaps): Add cons char * typecast. (init_cursors): Add char * typecasts. (variant_default): Add char * typecast. (init_assignw_player): Add char * typecast. * xmap.c: Change all functions from K&R -> C89. (init_map): Add unsigned int * typecasts. (init_map): Add various typecasts for xmalloc returns. (ask_side): Add char * typecast. (set_tool_cursor): throw "snafu" ifdef cplusplus else abort. (get_toggle_state): Comment out prototype. * xprint.c: Change all functions from K&R -> C89. (popup_print_setup_dialog): Change class to Class. * xshowimf.c: Change all functions from K&R -> C89. Declare X11 includes extern "C" ifdef cplusplus. (struct a_family_stuff): Change delete to Delete. (struct a_family_stuff): Change export to Export. (Widget delete): Change to Delete. (XsraSelFile): Change void to (char *, char **, struct stat *). (main): Typecast xmalloc return to char *. (main): Change to Delete. (display_family): Change delete to Delete. (display_family): Change export to Export. (undisplay_family): Change delete to Delete. (undisplay_family): Change export to Export. (do_prep_delete): Change delete to Delete. (do_prep_delete): Change export to Export. (do_prep_update): Change delete to Delete. (do_prep_update): Change export to Export. (do_prep_export): Change delete to Delete. (do_prep_export): Change export to Export. (reset_prep): Change delete to Delete. (reset_prep): Change export to Export. (magnify_bitmap): Change new to neww. * xtconq.c: Change all functions from K&R -> C89. (launch_game): Add prototype. (int nargs): Comment out declaration. (Arg tmpargs[100]): Comment out declaration. (make_default_player_spec): Typecast xmalloc return to char *. (handle_x_error): throw "snafu" ifdef cplusplus else abort. (handle_xio_error): throw "snafu" ifdef cplusplus else abort. (handle_xt_error): throw "snafu" ifdef cplusplus else abort. * xtconq.h: Declare X11 includes extern "C" ifdef cplusplus. * xtmain.c: Change all functions from K&R -> C89. (handle_x_error): throw "snafu" ifdef cplusplus else abort. (handle_xio_error): throw "snafu" ifdef cplusplus else abort. (handle_xt_error): throw "snafu" ifdef cplusplus else abort. * SelFile/Dir.c: Change all functions from K&R -> C89. (qsort): Remove conditional prototype. Include stdlib.h. (SFcompareEntries): Rewrite function. Add SFEntry * typecast. (SFcompareEntries): Add SFEntry * typecast. * SelFile/Draw.c: Change all functions from K&R -> C89. (XtResource textResources): Add void * typecast. (SFchdir): Prototype here. (SFscrollTimer): Change arguments. (SFnewInvertEntry): Change new to neww. (SFenterList): Change new to neww. (SFenterList): Add int typecasts. (SFleaveList): Add int typecasts. (SFmotionList): Change new to neww. (SFmotionList): Add int typecasts. (SFvFloatSliderMovedCallback): Change new to neww. (SFvFloatSliderMovedCallback): Add int typecasts. (SFvSliderMovedCallback): Change new to neww. (SFvAreaSelectedCallback): Change new to neww. (SFvAreaSelectedCallback): Add int typecasts. (SFhSliderMovedCallback): Change new to neww. (SFhSliderMovedCallback): Add int typecasts. (SFhAreaSelectedCallback): Change new to neww. (SFhAreaSelectedCallback): Add int typecasts. (SFpathSliderMovedCallback): Change *new to (int)((*((float *)neww)). (SFpathAreaSelectedCallback): Change new to neww. (SFpathAreaSelectedCallback): Add int typecasts. (SFpathAreaSelectedCallback): Add XtPointer typecasts. * conq.h (find_ai_type): Change typename to aitype. (set_side_ai): Change typename to aitype. (next_ai_type_name): Change typename to aitype. * kernel.h (set_side_ai): Remove redundant prototype. (create_feature): Change typename to feattype. (set_feature_type_name): Change typename to feattype. * kpublic.h (net_set_side_ai): Change typename to aitype. (net_create_feature): Change typename to feattype. (net_set_feature_type_name): Change typename to feattype. * ai.c (init_ai): Change typename to aitype. (set_side_ai): Change typename to aitype. (find_ai_type): Change typename to aitype. (next_ai_type_name): Change typename to aitype. * nlang.c (feature_desc): Change typename to feattype. * read.c (interp_agreement): Change typename to agtype. * side.c (agreement_desig): Change typename to agtype. * side.h (a_agreement): Change typename to agtype. * tp.c (net_set_side_ai): Change typename to aitype. (net_create_feature): Change typename to feattype. (net_set_feature_type_name): Change typename to feattype. * world.c (create_feature): Change typename to feattype. (set_feature_type_name): Change typename to feattype. * world.h (a_feature): Change typename to feattype. * write.c (write_area_features): Change typename to feattype. (write_agreement): Change typename to agtype. * actions.c (actiondefns): Typecast -1 to ActionType. (prep_repair_action): K&R -> C89. (do_repair_action): K&R -> C89. (do_disband_action): K&R -> C89. (action_desig): Typecast xmalloc returns to char *. * ai.c (goal_desig): Typecast xmalloc returns to char *. * cmdline.c (parse_command_line): Typecast xmalloc returns to char *. * combat.c (model_1_attack): Typecase hitmovietype to char *. (maybe_hit_unit): Typecase hitmovietype to char *. (damage_unit): Typecast 0 to HistEventType. (hit_unit_with_detonation): Typecase hitmovietype to char *. * generic.c (init_globals): Change NULL to 0. (index_type_name): Typecast return to char *. * gif.c: Change all functions from K&R -> C89. (ReadImage): Typecast malloc return to char *. * gvar.def: Change NULL to 0 everywhere. * help.c (get_help_text): Typecast obstack_finish return to char *. (uu_table_row_not_default): K&R -> C89. (ut_table_row_not_default): K&R -> C89. (um_table_row_not_default): K&R -> C89. (tt_table_row_not_default): K&R -> C89. (tm_table_row_not_default): K&R -> C89. (aa_table_row_not_default): K&R -> C89. (uu_table_column_not_default): K&R -> C89. (aa_table_column_not_default): K&R -> C89. (tb_bool_desc): Typecast tbcat arg to char *. (tbcat): K&R -> C89. * history.c (past_unit_desig): Typecast xmalloc return to char *. * imf.c (add_shrunken_image): Typecast xmalloc returns to char *. (add_magnified_image): Typecast xmalloc returns to char *. (make_raw_mono_data): Typecast xmalloc returns to char *. (blacken_masked_area): Typecast xmalloc returns to char *. (find_color_name): K&R -> C89. (parse_lisp_palette_entry): K&R -> C89. * init.c (init_data_structures): Typecast xmalloc returns to char *. (set_g_synth_methods_default): Typecast synthmethods to enum keywords. * lisp.c (init_lisp): Typecast xmalloc returns to char *. (read_form): Typecast xmalloc returns to char *. (read_form_from_string): Typecast xmalloc returns to char *. (read_list): Typecast xmalloc returns to char *. (new_string): Change new to N. (new_number): Change new to N. (new_utype): Change new to N. (new_mtype): Change new to N. (new_ttype): Change new to N. (new_atype): Change new to N. (new_pointer): Change new to N. (cons): Change new to N. (push_key_binding): Typecast key to enum keywords. (push_key_cdr_binding): Typecast key to enum keywords. (push_key_int_binding): Typecast key to enum keywords. (type_warning): Change typename to errtype. (internal_type_error): Change typename to errtype. (type_warning): Change typename to errtype. * lisp.h (type_warning): Change typename to errtype. * mkterr.c: Change all functions from K&R -> C89. (name_feature_at): Change typename to feattype. (name_feature_at_using): Change typename to feattype. * module.c (module_desig): Change xmalloc return to char *. * move.c (zoc_range): K&R -> C89. * mplayer.c (mplayer_at_desig): Add typecast to char *. * nlang.c (init_nlang): Change xmalloc return to char *. (side_name): Change return to char *. (side_adjective): Change return to char *. (short_side_title): Change xmalloc return to char *. (short_side_title_with_adjective): Change xmalloc return to char *. (apparent_unit_handle): Change xmalloc return to char *. (short_unit_handle): Change xmalloc return to char *. (medium_long_unit_handle): Change xmalloc return to char *. (feature_name_at): Change xmalloc return to char *. (task_desc): Add typecasts to char *. (report_combat): Add typecasts to char *. (notify_all_of_resignation): Add typecasts to char *. (record_missing_image): Change xmalloc return to char *. (type_matches_symbol): Chnage typename to uname. (past_unit_handle): Change xmalloc return to char *. (side_name): Change return to char *. * obstack.c: Change all functions K&R -> C89. (abort): Dont prototype ifdef cpluplus. (_obstack_free): throw "snafu" ifdef cplusplus else abort. (obstack_free): throw "snafu" ifdef cplusplus else abort. * obstack.h (obstack_free): Typecast __obj to char *. * oplayer.c (oplayer_at_desig): Add typecast to char *. * plan.c (set_unit_plan_type): Add typecast to PlanType. (plan_random): Typecast xrandom return to TaskType. (plan_desig): Typecast xmalloc return to char *. (find_closest_unit): K&R -> C89. (normal_completion_time): K&R -> C89. * ps.c: Change all functions from K&R -> C89. (ps_cook_imf): Typecast xmalloc return to char *. (ps_hex_dump): Typecast xmalloc return to char *. (add_esc_string): Typecast xmalloc return to char *. (misc_init): Typecast GRAY_SCALE return to int. (misc_init): Add typecasts to int. (dump_ps_view): Typecast ps_string_width return to int. * read.c (init_constant): Typecast key to enum keywords. (init_self_eval): Typecast key to enum keywords. (start_conditional): K&R -> C89. (start_else): K&R -> C89. (end_conditional): K&R -> C89. (add_std_var): Typecast key to enum keywords. (interp_variable): throw "snafu" ifdef cplusplus else abort. (interp_action): Typecast atype to ActionType. (interp_unit_plan): Typecast lookup_plan_type return to PlanType. (interp_task): Typecast tasktype to TaskType. (interp_goal): Typecast goaltype to GoalType. (interp_history): Change typename to evttype. (interp_history): Typecast type to HistEventType. * run2.c (save_checkpoint): Typecast xmalloc return to char *. (run_auto_repair): Typecast xmalloc return to char *. (run_unit_fates): Typecast xmalloc return to char *. * run.c (move_one_unit_multiple): Typecast rslt to HistEventType. (run_advanced_units): Add typecasts to short int. (run_research): Add typecast to int. (allocate_used_cells): Add typecasts to short int. * score.c (get_scores): Typecast xmalloc return to char *. (get_scores): Add typecasts to char *. * side.c (init_view): Typecast xmalloc return to char *. (send_message): K&R -> C89. (receive_message): K&R -> C89. (side_desig): Typecast xmalloc return to char *. (player_desig): Typecast xmalloc return to char *. (new_standing_order): Typecast xmalloc return to char *. (agreement_desig): Typecast xmalloc return to char *. * supply.c: Change all functions from K&R -> C89. * tables.c: Change all functions from K&R -> C89. * task.c (parse_task): Typecast tasktype to TaskType. (task_desig): Typecast xmalloc return to char *. * tp.c (add_to_packet): Typecast xmalloc return to char *. (net_prep_repair_action): K&R -> C89. (net_add_task): K&R -> C89. (receive_data): Typecast xmalloc return to char *. (receive_packet): Typecast xmalloc return to char *. (receive_action): Add typecast to ActionType. (receive_task): Add typecast to TaskType. (receive_unit_prop): Add typecast to GoalType. (low_file_send): Typecast xmalloc return to char *. * types.c: Change all functions from K&R -> C89. * ui.c (advance_into_cell): Typecast rslt to HistEventType. (add_default_unit_image): Typecast xmalloc return to char *. (add_default_material_image): Typecast xmalloc return to char *. (add_default_terrain_image): Typecast xmalloc return to char *. (add_default_emblem_image): Typecast xmalloc return to char *. (describe_imf): Change typename to imftype. (init_ui_chars): Typecast xmalloc return to char *. * ui.h (describe_imf): Change typename to imftype. * unit.c (change_unit_type): Typecast reason to HistEventType. (change_unit_side): Typecast reason to HistEventType. (kill_unit_aux): Typecast reason to HistEventType. (unit_desig): Typecast xmalloc return to char *. (unit_desig_no_loc): Typecast xmalloc return to char *. (utype_name_n): Typecast xmalloc return to char *. (actorstate_desig): Typecast xmalloc return to char *. * unix.c (default_library_pathname): Typecast xmalloc return to char *. (default_images_pathname): Typecast xmalloc return to char *. (checkpoint_filename): Typecast xmalloc return to char *. (game_homedir): Typecast xmalloc return to char *. (game_filename): Typecast xmalloc return to char *. (score_file_pathname): Typecast xmalloc return to char *. (crash_handler): throw "snafu" ifdef cplusplus else abort. (hup_handler): throw "snafu" ifdef cplusplus else abort. * util.c: Change all functions from K&R -> C89. (copy_string): Typecast xmalloc return to char *. (pad_blanks): Typecast xmalloc return to char *. (toggle_debugging): Add typecast to char *. (log_warning): Add typecast to char *. * win32.c: Declare includes extern "C" ifdef cplusplus. (default_library_pathname): Typecast xmalloc return to char *. (default_images_pathname): Typecast xmalloc return to char *. (checkpoint_filename): Typecast xmalloc return to char * (game_homedir): Typecast xmalloc return to char *. (game_filename): Typecast xmalloc return to char *. (open_scorefile_for_reading): Insert \n in run_warning. (open_scorefile_for_writing): Insert \n in run_warning. (score_file_pathname): Typecast xmalloc return to char *. (crash_handler): throw "snafu" ifdef cplusplus else abort. (hup_handler): throw "snafu" ifdef cplusplus else abort. * world.c (xy_to_latlong): Add typecasts to int. (latlong_to_xy): Add typecasts to int. * write.c (init_write): Typecast xmalloc return to char *. (write_types): Change typename to name. (write_table): Add typecasts to char *. (write_globals): throw "snafu" ifdef cplusplus else abort. (write_one_side_view_layer): Typecast propkey to enum keywords. (write_goal): Typecast keyword to enum keywords. (add_form_to_form): Typecast xmalloc return to char *. (write_bool_prop): Add typecast to char *. (shortest_escaped_name): Change typename to internalname. 2002-04-26 Hans Ronne <hronne@2.sbbs.se> Fix so that you cannot join (and crash) a game that already started. * tp.c (bounced): New static int. (send_bugoff): New function and prototype. (receive_bugoff): New function and prototype. (try_join_game): Return DONE if bounced. (receive_data): Call send_bugoff and receive_bugoff. (receive_data): Don't rebroadcast if master_rid was reset to 0. * macinit.c (hit_chat_dialog): Handle case DONE. * tkconq.tcl (join_game): Handle case -2 (DONE). * xconq.c (main): Handle case DONE. Fix prolonged lockup when trying to join a non-responding host. * tp.c (send_join): Remove while loop and init_warning. Just return false on failure instead. Change badly chosen macro constant and argument names. * cconq.c (main): Change UNLIMITED to MAXPACKETS. * kpublic.h (UNLIMITED) Change to MAXPACKETS. (receive_data): Change maxpackets to lim. * macconq.c (event_loop): Change UNLIMITED to MAXPACKETS. (check_network): Change UNLIMITED to MAXPACKETS. * sdlmain.c (sdl_run_game): Change UNLIMITED to MAXPACKETS. (check_network): Change UNLIMITED to MAXPACKETS. * tkmain.c (tk_run_game): Change UNLIMITED to MAXPACKETS. (check_network): Change UNLIMITED to MAXPACKETS. * tp.c (try_join_game): Change UNLIMITED to MAXPACKETS. (send_packet): Change UNLIMITED to MAXPACKETS. (flush_incoming_queue): Change maxpackets to lim. (receive_data): Change maxpackets to lim. * xconq.c (main): Change UNLIMITED to MAXPACKETS. (accept_all_remotes): Change UNLIMITED to MAXPACKETS. * xtconq.c (main): Change UNLIMITED to MAXPACKETS. * xtmain.c (run_game_proc): Change UNLIMITED to MAXPACKETS. 2002-04-25 Hans Ronne <hronne@2.sbbs.se> Fix incomplete unit becomes current unit bug. * ui.c (could_be_next_unit): Check for is_active instead of alive. Also check that the busy flag is not set. Fix busy flag set by failed prep action bug. * tp.c (net_prep_none_action etc): Test result that prep action would return before proceeding to test and set the busy flag. Fix argument typo in busy flag debugging code. * run.c (compose_actionvectors): Change %d to %s in Dprintf call. 2002-04-21 Hans Ronne <hronne@2.sbbs.se> Make the tcltk interface build natively under Windows. * tkwin32.c: New file with native Windows startup code. * tkconq.h: Include time.h instead of sys/time.h for non-cygwin WIN32. * tkimf.h: Include tkInt.h if using non-cygwin WIN32. (XsetTile): Prototype if using non-cygwin WIN32. (gettimeofday): Prototype if using non-cygwin WIN32. * tkmain.c: Don't include sys/time.h redundantly here. Fix so that the -f option works on the unix command line. * unix.c (open_module_library_file): Apply MA Dunzi's patch. 2002-04-16 Hans Ronne <hronne@2.sbbs.se> Fix brief gray side names flash at start of the game. * tkconq.tcl (update_game_side_info): Pass beforestart as arg and don't set gray color if beforestart is true. * tkmain.c (update_side_display): Pass beforestart in call to update_game_side_info. Fix some problems in the WIN32 code (thanks Juergen Ruehle). * socket.c: Don't include netinet/tcp.h ifdef MINGW32. * win32.c (games_uid): Only declare ifdef CYGWIN32. (game_homedir): Use 2 args with mkdir only ifdef CYGWIN32. * sdlconq.h (timeval): Fix typo. (gettimeofday): Move prototype. Fix clearing of health bars with big icons (thanks MA Dunzi). * tkmap.c (eventually_redraw): Expand area for big icons. 2002-04-15 Jim Kingdon <kingdon@panix.com> * tcltk/tkconq.tcl: If ingame and everingame are both set, set fill to black (so a single call with everingame false doesn't make it gray forever). 2002-04-13 Jim Kingdon <kingdon@panix.com> * bitmaps/reserve.b, tcltk/tkconq.tcl, tcltk/tkinit.c: Add reserve bitmap, which is like the sleep one but only has one "z" rather than two. Previously the sleep icon had been used twice for two different things. 2002-04-09 Jim Kingdon <kingdon@panix.com> * x11/xtmain.c (draw_text): ANSIfy. * doc/.cvsignore: Add generated html files. 2002-04-08 Jim Kingdon <kingdon@panix.com> * kernel/socket.c (wait_for): Don't print debugging output (such as "waiting %d secs for input"). In some error cases, it just writes to the log at a rate of megabytes per second. 2002-04-07 Hans Ronne <hronne@2.sbbs.se> Add Juergen Ruehle's WIN32 patches. Fix various other WIN32 related problems and make sure the WIN32 code builds using either Cygwin, Mingw32 or CodeWarrior. * sdlconq.h (gettimeofday): Prototype ifdef WIN32. (sys/time.h): Include ifdef CYGWIN32 else include time.h. (struct timeval): Declare ifdef MINGW32. (popup_game_dialog): Prototype here. (launch_game): Prototype here. (interpret_variants): Prototype here. (IntersectRect): Rename to SDLIntersectRect to avoid name conflict. * sdlscreen.c (IntersectRect): Rename to SDLIntersectRect. (update_screen): Rename IntersectRect to SDLIntersectRect. * sdlwin32.c: New file with WIN32 main code for SDL app. * socket.c: Handle all includes correctly for WIN32. (ECONNREFUSED): Define as WSAECONNREFUSED idfef WIN32. (wsa_initialized): Initialize to FALSE if def WIN32. (wsa_open): New function defined ifdef WIN32. (wsa_close): New function defined ifdef WIN32. (open_remote_connection): Add WIN32 patch. (open_remote_connection): Dont use SIGPIPE ifdef WIN32. (accept_remote_connection): Dont use SIGPIPE ifdef WIN32. (accept_remote_connection): Declare tmp as int ifdef MWERKS. * win32.c: Handle all includes correctly for WIN32. (game_homedir): Comment out pwd stuff ifndef CYGWIN32. (open_scorefile_for_reading): Fix linefeed in run_warning. (open_scorefile_for_writing): Fix linefeed in run_warning. (init_signal_handlers): Test if SIGHUP and SIGQUIT are defined. (reallasttime): Define as clock_t ifndef CYGWIN32. (n_seconds_elapsed): Rewrite ifndef CYGWIN32. (n_ms_elapsed): Rewrite ifndef CYGWIN32. (record_ms): Rewrite ifndef CYGWIN32. * util.c (gettimeofday): Prototype ifdef WIN32. (sys/time.h): Include ifdef CYGWIN32 else include time.h. (struct timeval): Declare ifdef MINGW32. (gettimeofday): New function ifdef WIN32. Fix so that make clean also deletes the sdlconq binary. * x11/Makefile.in (clean): Add rm -f sdlconq to target. 2002-04-01 Hans Ronne <hronne@2.sbbs.se> Fix tcltk image drawing on the Mac so that clip masks work, by using XCopyPlane instead of XCopyArea. This is a less than perfect solution: clipping works but there are color distortions. * tkimf.h (XCopyArea): Define as XCopyPlane(foo ... , 1) ifdef MAC. * tkmap.c (mapw_widget_cmd): Undef XCopyArea while scrolling. Add Windows icon and resource files. * win/Xconq.ico: New icon file. * win/Xconq.RC: New resource file. Fix yet another problem with the tcltk key codes (thanks Ma Dunzi). * tkconq.tcl (bool_yes): Add one more argument "y". (bool_no): Add one more argument "n". (select_unit_type): Add one more argument for interp_key. 2002-04-01 Hans Ronne <hronne@2.sbbs.se> Fix keyboard input so that modifier keys work correctly on all platforms. * tkconq.tcl (make_normal_bindings): Filter out all modifier keys. Pass both %K (keysym) and %A (ascii) to handle_key_binding. (handle_key_binding): Pass both $stra and $strk to tk_interp_key. * tkmain.c (tk_interp_key): Check both keysym and ascii codes. 2002-03-30 Hans Ronne <hronne@2.sbbs.se> Make the tcltk interface build and run on the Mac using MacTcl 8.3.4. * tkmac.c: New file with Mac specific main and initialization stuff. * tkconq.h: Include tclMacCommonPch.h, tkInt.h, tkMacInt.h, tclInt.h and tclMac.h ifdef MAC. * tkisamp.c: Include tclMacCommonPch.h, tkInt.h, tkMacInt.h, tclInt.h and tclMac.h ifdef MAC. * tkimf.c: Include tclMacCommonPch.h, tkInt.h, tkMacInt.h, tclInt.h and tclMac.h ifdef MAC. Fix various compile errors under CodeWarrior 7.2. * tkisamp.c (XSetTile): Declare extern dummy ifdef MAC. * tkmain.c (tk_set_variant_value): Declare checkboxpos[16]. * tkmap.c (XSetTile): Declare extern dummy ifdef MAC. (draw_borders_iso): Typecast color to int in if clauses. (draw_connections, draw_connections_iso): Ditto. Fix keyboard string input so that the Return key works on the Mac. * tkconq.tcl (make_normal_bindings): Pass keys by %K (keysym) instead of %A (ascii) since the latter does not work on the Mac. * tkmain.c (tk_interp_key): Test explicitly for the Return keysym and convert to \n if necessary. Make path finding for tkconq.tcl work correctly on the Mac. * tkmain.c (initial_ui_init): Hardcode path using :: ifdef MAC. Make terrain and unit image drawing work on the Mac. * tkimf.c (test_image): Also declare ifdef MAC. (tk_make_color_pixmap): Also execute UNIX code ifdef MAC. (tk_make_mono_pixmap): Also execute UNIX code ifdef MAC. (tk_make_mask_pixmap): Also execute UNIX code ifdef MAC. 2002-03-29 Hans Ronne <hronne@2.sbbs.se> Make it possible to limit the number of packets that are processed each time receive_data is called in order to improve the overall responsiveness of the master's ui. * cconq.c (main): Add macpackets arg to receive_data. * kpublic.h (UNLIMITED): Define as 32767. (receive_data): Add maxpackets arg. * macconq.c (event_loop): Add macpackets arg to receive_data. (check_network): Add macpackets arg to receive_data. * sdlmain.c (sdl_run_game): Add macpackets arg to receive_data. (check_network): Add macpackets arg to receive_data. * tkmain.c (tk_run_game): Add macpackets arg to receive_data. (check_network): Add macpackets arg to receive_data. * tp.c (flush_incoming_queue): Add maxpackets arg to function and prototype. Rewrite the function and make it return the number of packets that were flushed. (try_join_game): Add macpackets arg to receive_data. (send_packet): Add macpackets arg to receive_data. (receive_data): Add maxpackets arg. Add code that limits the number of packets sent to receive_packet or flushed by flush_incoming_queue to maxpackets. * xconq.c (main): Add macpackets arg to receive_data. (accept_all_remotes): Add macpackets arg to receive_data. * xtconq.c (main): Add macpackets arg to receive_data. * xtmain.c (run_game_proc): Add macpackets arg to receive_data. 2002-03-29 Hans Ronne <hronne@2.sbbs.se> Disable packet processing and rebroadcasting during net_run_game execution by the master. * tp.c (process_packets): New global. (net_run_game): Turn process_packets off and then on. (receive_data): Check process_packets before calling receive_packet or flush_incoming_queue. Enable real-time debugging of network code by mirroring all traffic through notify_all. * tp.c (display_traffic): New global. (send_packet): Call notify_all before low_send if display_traffic. (send_packet): Compute ack response time and send it to notify_all if display_traffic. (send_packet): Remove test for timeout_warnings. (receive_data): Call notify_all before low_send if display_traffic. * macwins.c (display_traffic): Declare extern. (create_notice_window): Call zoom_notice if display_traffic. Dont force replan of every unit at turn one in see_all games. * mplayer.c (review_theaters): Test for side->see_all. * oplayer.c (review_theaters): Test for side->see_all. Simplify and speed up network replanning code. * ai.c (set_side_ai, check_current_target, defensive_reaction): Remove bogus arguments in net_force_replan. * cmd.c (do_one_auto, do_force_global_replan): Ditto. * iplayer.c (iplayer_review_units, iplayer_adjust_plan): Ditto. * kernel.h (force_replan): Ditto. * kpublic.h (net_force_replan): Ditto. * mplayer.c (review_theaters, mplayer_review_units, mplayer_adjust_plan): Ditto. * oplayer.c (review_theaters, oplayer_review_units, oplayer_adjust_plan): Ditto. * plan.c (set_unit_plan_type, plan_passive, force_replan): Ditto. (force_replan): Simplify, remove passive_only stuff. * tp.c (net_force_replan): Remove bogus arguments. (receive_unit_prop): Remove bogus argument and simplify. Pass unit instead of plan as arg in clear_task_outcome, clear_task_agenda and free_plan calls. * kernel.h (clear_task_outcome, clear_task_agenda, free_plan): Change plan to unit. * plan.c (init_unit_plan): Change clear_task_agenda and free_plan arg. (plan_passive): Change clear_task_agenda arg. (clear_task_agenda): Change plan to unit. (clear_task_outcome): Change plan to unit. (free_plan): Change plan to unit. Change clear_task_agenda arg. (force_replan): Change clear_task_agenda arg. * run.c (run_construction): Change clear_task_agenda arg. (auto_pick_new_plan): Change clear_task_agenda arg. (clear_task_outcomes): Rename to clear_aicontrolled_outcomes. (clear_aicontrolled_outcomes): Call clear_task_outcome. * task.c (add_task): Change clear_task_agenda arg. * tp.c (net_clear_task_agenda): Change clear_task_agenda arg. Change "clra" to "clragenda". (net_clear_task_outcome): Change clear_task_outcome arg. Change "clro" to "clroutcome". (receive_unit_prop): Change clear_task_outcome and clear_task_agenda args. Change "clra" and "clro" to "clragenda" and "clroutcome". * unit.c (kill_unit_aux): Change free_plan arg. Always clear the task agenda when we change the unit plan type. Remove all redundant calls to net_clear_task_agenda elsewhere in the code. * ai.c (assign_to_collection): Dont call net_clear_task_agenda. (assign_to_colonize): Dont call net_clear_task_agenda. (assign_to_improve): Dont call net_clear_task_agenda. (assign_to_defend_unit): Dont call net_clear_task_agenda. (assign_to_defend_cell): Dont call net_clear_task_agenda. (assign_to_offense): Dont call net_clear_task_agenda. (assign_to_offense_support): Dont call net_clear_task_agenda. (assign_to_colonization_support): Dont call net_clear_task_agenda. (assign_to_defense_support): Dont call net_clear_task_agenda. (assign_to_develop_on): Dont call net_clear_task_agenda. * cmd.c (do_one_clear_plan): Dont call net_clear_task_agenda. * macmenus.c (do_one_plan_type): Check if we are changing the plan type before calling net_set_unit_plan_type. * macunit.c (hit_closeup_dialog, unit_plan_dialog): Call the various net_set_unit_property functions only if we are changing the values. * mplayer.c (mplayer_review_units): Dont call net_clear_task_agenda. (mplayer_decide_plan): Dont call net_clear_task_agenda. (search_for_available_transport): Dont call net_clear_task_agenda. * oplayer.c (oplayer_review_units): Dont call net_clear_task_agenda. (oplayer_decide_plan): Dont call net_clear_task_agenda. (search_for_available_transport): Dont call net_clear_task_agenda. * plan.c (set_unit_plan_type): Call clear_task_agenda. * run.c (auto_pick_new_plan): Dont call net_clear_task_agenda. * XconqProj.rsrc (DITL 131 "Variant Items"): Tweak positions. * Xconq.r: Update from XconqProj.rsrc. 2002-03-27 Jim Kingdon <kingdon@panix.com> * tcltk/tkconq.tcl (create_map_menus): Have the menu for "Disembark" show Ctrl-e as accelerator (suggested by Rafal Ziobro). 2002-03-25 Jim Kingdon <kingdon@panix.com> * tcltk/tkconq.tcl (insert_chat_string): Scroll to bottom after inserting text. 2002-03-24 Hans Ronne <hronne@2.sbbs.se> Make it possible for Mac clients to exit if the master already quit. * macconq.c (exit_macconq): Test for numremotes > 1 instead. Fix sync error in the new double-click filter. * tp.c (broadcast_action): Don't test and set the busy flag here. (net_prep_none_action etc.): Do it here instead. 2002-03-23 Hans Ronne <hronne@2.sbbs.se> Implement a better double-click filter at the broadcast_action level. Remove the old filter in advance_into_cell. * run.c (move_one_unit_multiple): Clear the unit->busy flag. (compose_actionvectors): Clear any busy flag and issue a warning. * tp.c (broadcast_action): Test and set the unit->busy flag. * ui.c (lasttime, lastunit, lastother, lastx, lasty): Remove. (advance_into_cell): Remove double-click filter. * unit.c (create_unit): Set unit->busy to false. * unit.h (Unit): Add unit->busy flag. Add Rafal Ziobro's new panzer game with PG unit images. Include both PG images and advanced terrain images in imf.dir. * advterr.g: Move image data to terrain.imf. * imf.dir: Include PG and advterr image families. * dukla.g: New game module based on pgu.g. * pg.imf: New image family file. * pgu.g: New base module. * terrain.imf: Move image data for advanced terrain here. * pgu001-090.gif: New file. * pgu091-180.gif: New file. * pgu181-270.gif: New file. 2002-03-23 Jim Kingdon <kingdon@panix.com> * tcltk/tkconq.tcl (add_program): Remove unused variable cbuf. (popup_chat, insert_chat_string): Keep .chat.mid.right.t disabled when not in use. Don't special-case the case before we connect (the old code would disable it and never re-enable it). 2002-03-19 Jim Kingdon <kingdon@panix.com> * misc/xconq.el: Add a xconq-c-style for working on xconq itself. * kernel/tp.c (broadcast_action): New function, replaces broadcast_next_action but works like the rest of the networking code (avoids a bug in which broadcast_next_action removed a different action than the one it should have). (net_prep_enter_action and all other net_prep_*_action functions): if not master, just send the action to the server, rather than trying to temporarily put it in local state. * kernel/actions.c: K&R->C89. 2002-03-18 Jim Kingdon <kingdon@panix.com> * kernel/util.c (idifftime): Just assume we have difftime (it is in C89). * doc/.cvsignore: Add TeX droppings (hacking.fn and many more). 2002-03-17 Hans Ronne <hronne@2.sbbs.se> Fix problem with host lockups during launch of some games. * tp.c (receive_data): Also test for flushing when handling trailing acks. 2002-03-17 Hans Ronne <hronne@2.sbbs.se> Fix failure of lists to reflect changes in the small font. * maclist.c (create_list): Don't call TextFont & TextSize here. (draw_list): Call TextFont & TextSize here instead. Fix sporadic corruption of mac preferences popup menus. * maccolors.c (build_sides_menu, build_features_menu): Clean out old menu items before rebuilding the menus. Speed up redrawing of front map after the game quit dialogs. * macmenus.c (resign_the_game, quit_the_game): Call update_all_map_windows before force_overall_update. Improve font support and name drawing in the mac interface. * macconq.h (small_font_style, large_font_style, title_font_style, name_font_id, name_font_size, name_font_size, name_line_spacing): Declare globals. (Chicago, Courier, Gadget, Geneva, Helvetica, Monaco, NewYork, Symbol, Times): Declare globals. (draw_name): New prototype. * macconq.c (small_font_style, large_font_style, title_font_style, name_font_id, name_font_size, name_font_size, name_line_spacing): Declare globals. (Chicago, Courier, Gadget, Geneva, Helvetica, Monaco, NewYork, Symbol, Times): Declare globals. (init_fonts): Use GetFnum to set new globals. Handle name fonts. * macdefs.h (diPrefsTitleFontPopup, diPrefsTitleSize, diPrefsTitleSizeText, diPrefsTitleSizePopup, diPrefsTitleFontSample, diPrefsNameFontPopup, diPrefsNameSize, diPrefsNameSizeText, diPrefsNameSizePopup, diPrefsNameFontSample): New dialog items. (miGadget): Add new menu item & renumber items. * macdraw.c (draw_name): New function. (draw_unit_name): Call draw_name. (draw_temperature): Fix degree sign. * macmap.c (draw_feature_names): Call draw_name. * macprefs.c (tmp_title_font_id, tmp_title_font_size, tmp_name_font_id, tmp_name_font_size): New static ints. (interp_mac_ui_data, ui_update_state): Add title_font_id, title_font_size, name_font_id and name_font_size. (draw_font_sample): Add cases diPrefsTitleFontSample and diPrefsNameFontSample. (set_preferences): Set tmp_title_font_id, tmp_title_font_size, tmp_name_font_id and tmp_name_font_size. Add cases diPrefsTitleFontPopup, diPrefsNameFontPopup, diPrefsTitleSizeText and diPrefsNameSizeText. (set_preferences): Add the Gadget font to popup menus. Use new globals instead of fixed font numbers. (add_preferences_topic_items): Add cases diPrefsTitleFontPopup, diPrefsNameFontPopup, diPrefsTitleSizeText, diPrefsNameSizeText, diPrefsTitleFontSample and diPrefsNameFontSample. (add_preferences_topic_items): Add the Gadget font to menus. Use new globals instead of fixed font numbers. * XconqProj.rsrc (CNTL 716 "Title Font Popup"): New control. (CNTL 717 "Title Size Popup"): New control. (CNTL 718 "Name Font Popup"): New control. (CNTL 719 "Name Size Popup"): New control. (DITL 703 "Preferences Font Items"): Add items 11-20 for the Title and Name fonts. (MENU 701 "Small Font Popup"): Add the Gadget font. (MENU 703 "Large Font Popup"): Add the Gadget font. (MENU 716 "Title Font Popup"): New menu. (MENU 717 "Title Size Popup"): New menu. (MENU 718 "Name Font Popup"): New menu. (MENU 719 "Name Size Popup"): New menu. * Xconq.r: Update from XconqProj.rsrc. Remove obsolete name masks and font scaling options in the mac interface. Always used optimized fonts instead. Always use the simple borders option. * maccolors.c (default_textmasks, default_simple_borders, default_optimize_fonts): Remove globals. * macconq.h (default_textmasks, default_simple_borders, default_optimize_fonts): Remove globals. (a_map): Remove textmasks, simple_borders & optimize_fonts. (draw_unit_name): Remove masks and optimize args. (draw_legend_text): Remove masks and optimize args. * macdefs.h (miSimpleBorders): Remove menu item. (miTextOptimizeFonts): Remove and renumber menu items. (miTextMasks): Remove and renumber menu items. (diPrefsSimpleBorders, diPrefsComplexBorders, diPrefsTextMasks): Remove dialog items and renumber. (diPrefsOptimFonts, diPrefsScaledFonts): Ditto. * macdraw.c (draw_legend_text): Remove masks and optimize args. Also remove the code that uses them. (draw_unit_name): Remove masks and optimize args. * macmap.c (create_map): Remove textmasks, simple_borders and optimize_fonts. (draw_feature_names): Remove args in draw_legend_text call. (draw_unit_names_only): Remove args in draw_unit_name calls. (draw_temperature, draw_coverage, draw_meridians, ): remove unused args in draw_legend_text call. * macmenus.c (toggle_textmasks, toggle_optimize_fonts, toggle_simple_borders): Remove functions and prototypes. (do_menu_command, adjust_menus): remove case miTextMasks, case miTextOptimizeFonts and case miSimpleBorders. * macmouse.c (do_mouse_down_map_control_panel): Remove setting of textmasks. * macprefs.c (interp_mac_ui_data): Remove default_textmasks, default_simple_borders and default_optimize_fonts. (ui_update_state, set_preferences): Ditto. (add_preferences_topic_items): Ditto. (set_preferences): Remove case diPrefsTextMasks, case diPrefsSimpleBorders, case diPrefsComplexBorders, case diPrefsOptimFonts and case diPrefsScaledFonts. * macrow.c (draw_units): Remove args in draw_unit_name call. (draw_unit_and_occs): Ditto. (draw_row): Always use draw_feature_boundary_simple. (draw_people_row): Comment out shady border code. * macunit.c (draw_unit_size): remove optimize_font option and use it always instead. Use name_font_id instead of system font. * XconqProj.rsrc (DITL 702 "Preferences Map Items"): Remove text mask and simple borders items. (DITL 703 "Preferences Font Items"): Remove optimize font items. (DLOG 200 "Preferences"): Adjust button positions. (MENU 215 "Text Popup"): Remove optimize item. (MENU 217 "Colors & Masks Popup"): Remove textmask item. (MENU 218 "Borderlines Popup"): Remove simple borders item. * Xconq.r: Update from XconqProj.rsrc. Tweak default interface preference settings. * macconq.c (playsounds): Initialize to false. * maccolors.c (default_draw_topunit): Initialize to false. (default_drawothermaps): Initialize to false. (set_default_colors): Set default_featColorName[2] to lemon-chiffon. Switch fore and back colors in default_colorscheme[4]. * history.c (statistics_wanted): Initialize to false. Further minor tweaks to notification messages. * nlang.c (report_combat): Add a space before each dash. * task.c (do_move_to_task): Tweak unit is resting message. (do_approach_subtask): Tweak unit is resting message. Fix page up and down scrolling in the mac New Game window. * macinit.c (do_key_down_newgame): Increase page jump to 24 lines. * XconqProj.rsrc (DITL 129 "New Game Items"): Shorten list 1 mm. * Xconq.r: Update from XconqProj.rsrc. 2002-03-16 Hans Ronne <hronne@2.sbbs.se> Finally (?) fix all synch errors in the network game. * tp.c (flushing): New static int. Initialize to false. (net_run_game): Comment out checksum broadcast between the master's and client's run_game executions that caused synch errors. (flush_incoming_queue): Set flushing to true, and to false when done. (receive_data): Flush the incoming queue immediately when we receive an expected ack, whether normal or trailing. Check flushing first to avoid endless recursion by the master. Handle leading acks better by checking if packetbuf is empty before setting retry to zero. Remove old join packet truncating hack. Change certain harmless run warnings to notifications in order to avoid hanging the network game. * tp.c (receive_action): Change run warnings to notifications. (receive_task): Ditto. (receive_unit_prop): Ditto. 2002-03-13 Jim Kingdon <kingdon@panix.com> * doc/refman.texi (Combat Actions): In lieu of full documentation of combat model 1, say that we don't document it fully and point people at the source code (and comments in the source code). 2002-03-10 Jim Kingdon <kingdon@panix.com> * x11/xdraw.c (draw_terrain_row): Turn terrain images back off. The code was buggy - see comment. 2002-03-10 Bob Carragher * lib/ng-european.g (ukrainian-place-names): Add Chernobyl. 2002-03-10 Hans Ronne <hronne@2.sbbs.se> Fix Reference to Dead Unit bug. Should check all use of for_all_units and for_all_side_units that only props of live units are broadcasted within the loop. * ai.c (set_side_ai): Test for is_active before calling force_replan. Fix enemy unit becomes current unit bug on the mac. * macconq.c (select_next_unit): Test for side_controls_unit. (maybe_select_next_unit): Ditto. Fix string corruption bug in broadcasting of world properties. * tp.c (receive_world_prop): Copy the input string, which should be rebroadcasted later by the master, before messing with it. Fix extremely slow construction in the advances game. * advances.g (cp): Set to 10 for most units and 20 for facilities. Fix advanced closeup display of hex users in network games. * macconq.h (draw_city_map): New prototype. * macmap.c (update_cell_display): Call draw_city_map for closeups. * macunit.c (draw_advanced_closeup): Comment out call to see_exact. (draw_advanced_closeup): Move part of content to draw_city_map. (draw_city_map): New function. Make toggling of hex users work in network games. * kernel.h (toggle_user_at): Prototype. * kpublic.h (net_toggle_user_at): New prototype. * macunit.c (toggle_landuse_one_cell): Remove redundant checks. (toggle_landuse_one_cell): Call net_toggle_user_at instead. * tp.c (net_toggle_user_at): New function. (receive_world_prop): Handle "user" case. * ui.c (toggle_user_at): Move to world.c (where it belongs). (advance_into_cell): Call net_toggle_user instead. (advance_into_cell): Handle advanced units that toggle their own cell. * world.c (toggle_user_at): Move here from ui.c. Make indepside hoist the Jolly Roger when played by a human or ai. * flags16x16.gif: Add the Jolly Roger. * flags8x8.gif: Add the Jolly Roger. * flags.imf (flag-pirate): New image family. * imf.dir (flag-pirate): New image family. * init.c (set_ai_for_player): Set correct flag for indepside. (exchange_players): Set correct flag for indepside. (make_trial_assignments): Set correct flag for indepside. Fix network lockups due to unnecessary bad location warnings. * mkunits.c (make_countries): Comment out init_warning. Simplify combat notification output somewhat. * nlang.c (report_combat): Change (occupant) to - occupant. (apparent_unit_handle): Comment out formerly owned by stuff. * task.c (do_approach_subtask): Shorten next turn notification. Various tweaks to the mac startup and end of game dialogs. * macconq.c (update_turn_display): Simplify end game updates. * macdefs.h (diVariantsFrame): New dialog item. * macinit.c: Add pragma mark - before each new dialog. * macinit.c (hit_chat_dialog): Disable splash window New Game and Open buttons for network clients. (draw_newgame_dialog): Don't frame newgametext. (draw_player_setup_dialog): Disable OK button for clients. (draw_player_setup_list): Tweak emblem position. (draw_player_setup_list): Tweak playertitle position. (draw_player_setup_advantage): Tweak inset of itemrect. (create_variants_dialog): Dont print "Unused" for unused boxes. (draw_variants_dialog): Call FrameRect for diVariantsFrame. (draw_variant_slider): Don't frame unimplemented sliders. * macmenus.c (resign_the_game): Call force_overall_update. (quit_the_game): Call force_overall_update. * XconqProj.rsrc (DITL 128 "Splash"): Tweak dialog items. (DITL 129 "New Game"): Tweak dialog items. (DITL 129 "New Game"): Enable diNewGameList. (DITL 130 "Player Setup"): Tweak dialog items. (DITL 131 "Variants"): Tweak dialog items. (DITL 131 "Variants"): Add new user item diVariantsFrame. (DITL 139 "Chat"): Enable diChatJoinButton. (DLOG 128 "Splash"): Tweak size. (DLOG 129 "New Game"): Tweak size. (DLOG 130 "Player Setup"): Tweak size. (DLOG 131 "Variants"): Tweak size. (PICT 2002 "New Game Decor"): Crop to fit new item size. * Xconq.r: Update from XconqProj.rsrc. More work on the non-modal mac alert dialogs. * XconqProj.rsrc (DLOG 4000 "Two Button Alert"): New dialog. (DLOG 4001 "One Button Alert"): New dialog. (DITL 4000 "Two Button Alert"): New dialog item list. (DITL 4001 "One Button Alert"): New dialog item list. * Xconq.r: Update from XconqProj.rsrc. Fix problem with disabled items in customized mac dialog code that bypasses the Dialog Manager. * macinit.c (hit_splash_dialog): Return if ditem is disabled. (hit_chat_dialog): Return if ditem is disabled. (hit_newgame_dialog): Return if ditem is disabled. (hit_variants_dialog): Return if ditem is disabled. (hit_player_setup_dialog): Return if ditem is disabled. * macunit.c (hit_closeup_dialog): Return if ditem is disabled. (hit_unit_build_dialog): Return if ditem is disabled. * macwins.c (hit_research_dialog): Return if ditem is disabled. (hit_gameover_dialog): Return if ditem is disabled. (hit_alert_dialog): Return if ditem is disabled. 2002-03-07 Hans Ronne <hronne@2.sbbs.se> Update Erik Sigra's Swedish name generator. * ng-swedish.g: New rewritten module. Fix segfaults with too many images in the game. * imf.c (MAXIMAGEFAMILIES): Boost it to 2048. Make zooming of small mac windows more well behaved. * macwins.c (zoom_history): Only zoom vertically. (zoom_scores, zoom_notice): Ditto. Sort up window handling functions in the mac code. * macwins.c: Add pragma mark - before each new window. (show_gameover_dialog): Delete unused variables. Make the mac event loop more similar to that in tcltk etc. * macconq.c (event_loop): Eliminate all else if branching. Test for current_stage instead of last_stage. Add generic floating non-modal alert dialog on the mac. * macconq.h (alertwin): New global. (show_alert_dialog): New prototype. (draw_alert_dialog): New prototype. (do_mouse_down_alert): New prototype. (do_key_down_alert): New prototype. * macconq.c (handle_keystroke): Handle alertwin. (do_mouse_down): Handle alertwin. (update_window): Handle alertwin. * macwins.c (alertwin): Initialize. (hit_alert_dialog): New prototype. (show_alert_dialog): New function. (draw_alert_dialog): New function. (do_mouse_down_alert): New function. (do_key_down_alert): New function. (hit_alert_dialog): New function. Cleanup mistake after latest checkin. * tp.c (beforestart): Remove extern int. 2002-03-06 Hans Ronne <hronne@2.sbbs.se> Finally fix network lockups and host timeouts on unix. * tp.c (shuddup): Remove static int, no longer needed. (flush_outgoing_queue): Remove test for shuddup. (receive_run_game): Don't set shuddup. (send_packet): Add Debug code for timeout warning. (receive_data): Add correct handling of trailing acks (THE fix). (receive_data): Remove mac-specific ack handling code. (receive_game_checksum): Don't set shuddup. 2002-03-06 mniw@sol.dti.ne.jp and Jim Kingdon <kingdon@panix.com> * tcltk/tkconq.tcl: Set notices configure -state disabled except when we are updating that window. Fixes an annoying bug - things got confused if you clicked in the notices window. 2002-03-03 Hans Ronne <hronne@2.sbbs.se> Fix sporadic crashes on the mac due to gworld corruption. * macgworld.c (update_gworld): Set the port to the current map window before calling UpdateGWorld. Fix new line error in debug output. * tp.c (receive_game_checksum): Add linefeed to Dprintf message. 2002-03-03 Hans Ronne <hronne@2.sbbs.se> Fix synch errors when a client starts under ai control. * macinit.c (launch_game_2): Call net_run_game instead of run_game, and only for the host or single player. * sdlmain.c (launch_game): Ditto. * tkmain.c (launch_game): Ditto. * xtconq.c (launch_game): Ditto. * cconq.c (main): Ditto. * iplayer.c (iplayer_init): Don't call net_force_replan here. * mplayer.c (mplayer_init): Ditto. * oplayer.c (mplayer_init): Ditto. Fix two minor problems with the last commit. * macsdl.c (using_sdl): Declare global so that XconqSDL compiles. * xconq.c (main): Clean up tabulator mess left by kdevelop. 2002-03-02 Hans Ronne <hronne@2.sbbs.se> Fix sdlconq crashes with an empty command line. * xconq.c (using_sdl): Declare new global. (main): Set option_popup_new_game_dialog to FALSE if using_sdl. * sdlmain.c (using_sdl): Declare extern. (initial_ui_init): Set using_sdl to TRUE. 2002-03-02 Hans Ronne <hronne@2.sbbs.se> Fix synch errors when switching a side's ai on or off. * ai.c (set_side_ai): Rewrite function so that it works. * iplayer.c (iplayer_init): Remove redundant ai dumping code. * mplayer.c (mplayer_init): Ditto. * oplayer.c (oplayer_init): Ditto. Fix the xtconq startup code so that it handles indepside correctly. * xinit.c (popup_game): Iterate from 1 to <= numsides instead. (go_dialog, valid_gamepop, verify_dialog): Ditto. (add_player_dialog): Test for numsides > g_sides_nax() instead. (add_player_dialog): Iterate from 1 + oldnumsides to <= numsides. Further fixes to the mac end game code. * macconq.c (event_loop): Test host exit for numremotes == 1. (check_network): Decrement numremotes when side is quitting. * macwins.c (show_gameover_dialog): Call MakeDialogFloat. (hit_gameover_dialog): Initialize done to false. 2002-03-01 Jim Kingdon <kingdon@panix.com> * curses/.cvsignore: Add cconq cconq.6. * tkmain.c (launch_game): Reindent. * sdlmain.c (launch_game): Ditto. * xtconq.c (launch_game): Ditto. * cconq.c (main): Ditto. * curses/cconq.c (main): player needs to be Player * not Player. * Makefile.in (info dvi install-info clean-info): Only recurse into doc directory (seems easier than adding these targets everywhere). * doc/kwic.c: Assume C89. (main): When printing "Symbol too long", say which symbol. 2002-02-28 Hans Ronne <hronne@2.sbbs.se> Finally fix the failure of ais to work properly in non-mac network games. * tkmain.c (launch_game): Add code from macinit.c that gives all unassigned players to the master program in network games. * sdlmain.c (launch_game): Ditto. * xtconq.c (launch_game): Ditto. * cconq.c (main): Ditto. Fix windows code so that it works again. * wconq.c (main): Remove call to launch_game_2 and its prototype. (WinMainCRTStartup): Add Jakob Ilves' definition. Fix quitting of mac hosts when the game is over. * macconq.c (event_loop): Don't test for numremotes. 2002-02-25 Jim Kingdon <kingdon@panix.com> * SelFile/SelFile.c: Get rid of getwd declaration too. 2002-02-27 Hans Ronne <hronne@2.sbbs.se> Back out of trailing ack patch on unix. * tp.c (receive_data): Apply #ifdef MAC also at trailing acks. 2002-02-25 Hans Ronne <hronne@2.sbbs.se> Fix problem with hang on exit in Mac network games by consolidating end of game dialogs into a single non-modal window. * macconq.h (gameoverwin): New global WindowPtr. (show_gameover_dialog): New prototype. (draw_gameover_dialog): New prototype. (do_key_down_gameover): New prototype. (do_mouse_down_gameover): New prototype. * macconq.c (want_to_exit): Declare extern instead. (event_loop): Rewrite game exit code. Move profiler calls. (handle_event): Call force_overall_update when going in front. (handle_keystroke): Handle gameoverwin. (do_mouse_down): Handle gameoverwin. (update_window): Handle gameoverwin. (won_game_dialog): Delete function and prototype. (lost_game_dialog): Delete function and prototype. (game_over_dialog): Delete function and prototype. (update_turn_display): Also test for side_lost. (update_turn_display): Call show_gameover_dialog instead. (exit_macconq): Reenable send_quit. * macdefs.h (dWinGame): Remove dialog and items. (dLoseGame): Remove dialog and items. (dGameOver): Define as 900. (diGameOverWon): Define as 3. (diGameOverLost): Define as 4. (diGameOverDraw): Define as 5. * macwins.c (gameoverwin): Initialize to nil. (want_to_exit): Declare extern. (hit_gameover_dialog): New prototype. (show_gameover_dialog): New function. (draw_gameover_dialog): New function. (do_key_down_gameover): New function. (do_mouse_down_gameover): New function. (hit_gameover_dialog): New function. * XconqProj.rsrc (DITL 900 "Win Game Items"): Rename to "Game Over Items". Add two new dialog items for Lose Game Pict and Game Over Text. Renumber items. (DITL 901 "Lose Game Items"): Delete. (DITL 902 "Game Over Items"): Delete. (DLOG 900 "Win Game"): Rename to "Game Over". Make window floating and fixed. (DLOG 901 "Lose Game"): Delete. (DLOG 902 "Game Over"): Delete. * Xconq.r: Update from XconqProj.rsrc. Fix so that adding a new computer side and changing its ai or name works correctly in network games on both Unix and Mac. Also fix emblem displays on the Mac. * init.c (add_side_and_player): Call next_ai_type_name here instead. * macinit.c (draw_player_setup_list): Init emblems for any added sides. (draw_player_setup_list): Reinit emblems for sides that changed their name. (hit_player_setup_dialog): Don't call next_ai_type_name at diPlayerSetupAdd. (hit_player_setup_dialog): Call net_set_ai_for_player at diPlayerSetupAI. (hit_player_setup_dialog): Don't init side colors and emblems here. Humor CodeWarrior and GCC respectively. * socket.c (low_receive): Declare now and start_time as longs. * tp.c (host_the_game): Declare remote_player_specs and online correctly. * ui.c (lasttime): Initialize to 0 instead of NULL. 2002-02-23 Jim Kingdon <kingdon@panix.com> * README: Update for removal of MAXUTYPES, MAXTTYPES, MAXMTYPES, and MAXATYPES (they were removed on 2000-12-18). 2002-02-16 Hans Ronne <hronne@2.sbbs.se> Fix synch errors due to the client sending data after checksum. tp.c (shuddup): New static int. (flush_outgoing_queue): Test for shuddup. (receive_run_game): Set shuddup to FALSE. (receive_game_checksum): Set shuddup to TRUE. Fix synch errors due to multiple rapid clicks on the same unit. * ui.c (lasttime, lastunit, lastother, lastx, lasty): New statics. (advance_into_cell): Filter out doubleclicks on units. Fix AI buzzing due to failure to clear task outcomes after pushing a new task. * ai.c (run_local_ai): Only call ai_decide_plan if a TASK_MOVE_TO or TASK_RESUPPLY failed. Call net_clear_task_outcome when done. * kernel.h (clear_task_outcome): New prototype. * kpublic.h (net_clear_task_outcome): New prototype. * plan.c (clear_task_outcome): New function. * tp.c (net_clear_task_outcome): New function. * tp.c (receive_unit_prop): Call clear_task_outcome. Fix AI buzzing due to replanning each time run_game is executed. * run.c (move_one_unit_multiple): Don't set need_ai_planning. Fix synch errors due to simultaneous flushing of host and client incoming queues.Partly mac-specific fix. * tp.c (receive_data): Add special code for packets with leading or trailing acks. Fix error in task execution code for ai-controlled units. * run.c (move_one_unit_multiple): Use ai_controlled macro. * task.c (execute_task): Use ai_controlled macro. Turn off state output files by default when debugging. * run.c (save_run_states): Set to 0 instead of 1. Add more debugging output at various places in the kernel. * ai.c (set_side_ai): Add DMprintf output at net_force_replan calls. (check_current_target): Add DMprintf output at net_force_replan call. (defensive_reaction): Clarify DMprintf output at net_force_replan call. (attack_blockage): Add DMprintf output at net_push_hit_unit_task call. * mplayer.c (review_theaters): Add DMprintf output at net_force_replan call. (mplayer_review_units): Clarify DMprintf output at net_force_replan calls. (mplayer_adjust_plan): Add DMprintf output at net_force_replan calls. (mplayer_adjust_plan): Add DMprintf output at net_set_unit_reserve call. (mplayer_react_to_task_result): Add DMprintf output at push_move_to_task call. (mplayer_react_to_task_result): Clarify DMprintf output at push_hit_unit_task call. * plan.c (set_unit_plan_type): Add DMprintf output at net_force_replan call. (plan_passive): Add DMprintf output at net_force_replan call. * task.c (do_repair_task): Add DMprintf output after push_move_to_task call. (do_resupply_task): Add DMprintf output after push_move_to_task call. * tp.c (flush_incoming_queue): Add Dprintf outputs at start and end. (receive_game_checksum): Add Dprintf for out of sync warning. 2002-02-10 Hans Ronne <hronne@2.sbbs.se> Add Lincoln Peters' Cave of Amazement game to the library. * lib/cave2.g: New file. 2002-02-09 Hans Ronne <hronne@2.sbbs.se> Fix three bugs that caused network games to hang on exit. * macconq.c (exit_macconq): Comment out call to send_quit. * macwins.c (draw_side_status): Comment out infinite loop code. * tp.c (net_run_game): Don't broadcast checksums after end of game. Move the 2001 changes to a separate log file. * ChangeLog: Move old stuff to ChangeLog-2001. * ChangeLog-2001: New file. 2002-02-03 Jim Kingdon <kingdon@panix.com> * x11/xdraw.c (draw_terrain_row): Add code to use terrain images (more or less taken from tkmap.c). 2002-02-02 Jim Kingdon <kingdon@panix.com> * SelFile/SelFile.c: Just use getcwd (the POSIX way); the defines we used to pick between getcwd and getwd weren't defined. getwd is prone to buffer overflows (at least if there is any trouble defining MAXPATHLEN) and GNU gives a warning on attempts to use getwd. This fixes the bug whereby emblems (flags) showed as black: * x11/ximf.c (x11_interp_image_1): New function. (x11_interp_image): Rework to handle sub-images (and more closely resemble tk_interp_image in a few cosmetic ways). * kernel/mkunits.c (make_countries): Free local arrays which we allocate (canbeinopen, numtodo, numindeptodo, numleft, numindepleft). 2002-02-01 Jim Kingdon <kingdon@panix.com> First cut at bringing back the Xt interface (goal is a way to play multiplayer games until networking is debugged): * Makefile.in: Add back all-xtconq and install-xtconq. * x11/Makefile.in: Add back X_H, XTOBJS, all-xtconq, xtconq, xtconqad.h, Xtconq, Xtconq-color, xtconq.6, and install-xtconq. * kernel/misc.h, kernel/utils.c (xmalloc): Now returns void* not char*. * x11/Xtconq-co.ad, x11/Xtconq.ad, x11/closeup.notes, x11/xcloseup.c, x11/xcmd.c, x11/xdesign.c, x11/xdraw.c, x11/xhelp.c, x11/xinit.c, x11/xmap.c, x11/xprint.c, x11/xtconq.6in, x11/xtconq.c, x11/xtconq.h, x11/xtconqad.h, x11/xtmain.c: Restore these files. Eliminate use of NUMUTYPES and NUMTTYPES in favor of dynamic allocation (or tmp_u_array or tmp_t_array). * x11/xcmd.c: Update various random routines to match tkcmd.c. Remove do_auto and other commands which were made generic on 2000-08-13 and 2000-08-15. Remove obsolete functions side_research_dialog, unit_build_dialog, and unit_plan_dialog. (get_selected_units): New function. * x11/.cvsignore: Add Xtconq Xtconq-color XShowimf XShowimf-color xtconq.6 xtconq. * kernel/unix.c (make_pathname): Don't put more than BUFSIZE bytes into pathbuf. Slightly modified version of a patch from Pete Ryland; thanks. See http://bugs.debian.org/80576 and thanks to Martin Quinson for reporting it to the xconq list. * kernel/mplayer.c (decide_resignation), kernel/oplayer.c (decide_resignation): Don't use chance1 without initializing it. Thanks to Martin Quinson for reporting this. * SelFile/SelFile.c (SFopenFile): Use strerror and assume that errno.h declares errno. Xconq requires C89. Thanks to Martin Quinson and http://bugs.debian.org/107313 for the bulk of this patch. I'm not sure where/if this code is actually used so I couldn't test it, but it built for me. * config.guess, config.sub: Update to latest from http://subversions.gnu.org/cgi-bin/viewcvs/config/config/ (thanks to http://bugs.debian.org/78672 and Martin Quinson for reporting this). 2002-01-30 Jim Kingdon <kingdon@panix.com> * lib/russian-rev.g: Increase the number of railroads.