From 17b1943c5e9174a9c124e9f6c57779c0c5196fbe Mon Sep 17 00:00:00 2001 From: Kp Date: Wed, 12 Aug 2015 03:11:46 +0000 Subject: [PATCH] Mark various per-file structures as static --- common/2d/rle.cpp | 4 ++++ common/3d/instance.cpp | 4 ++++ common/3d/rod.cpp | 4 ++++ common/arch/sdl/joy.cpp | 4 ++++ common/arch/sdl/key.cpp | 4 ++++ common/ui/gadget.cpp | 4 ++++ common/ui/menu.cpp | 4 ++++ common/ui/menubar.cpp | 4 ++++ common/ui/message.cpp | 4 ++++ d1x-rebirth/editor/ehostage.cpp | 4 ++++ d1x-rebirth/main/custom.cpp | 8 ++++++++ d2x-rebirth/main/escort.cpp | 4 ++++ d2x-rebirth/main/movie.cpp | 11 +++++++++++ similar/2d/font.cpp | 4 ++++ similar/arch/sdl/digi.cpp | 4 ++-- similar/arch/sdl/digi_mixer.cpp | 4 ++++ similar/editor/centers.cpp | 4 ++++ similar/editor/eswitch.cpp | 4 ++++ similar/editor/meddraw.cpp | 4 ++++ similar/editor/medrobot.cpp | 8 ++++++++ similar/editor/medwall.cpp | 8 ++++++-- similar/main/ai.cpp | 4 ++++ similar/main/automap.cpp | 4 ++++ similar/main/collide.cpp | 4 ++++ similar/main/credits.cpp | 4 ++++ similar/main/fvi.cpp | 9 +++++++++ similar/main/gameseg.cpp | 4 ++++ similar/main/hud.cpp | 4 ++++ similar/main/kconfig.cpp | 4 ++++ similar/main/kmatrix.cpp | 4 ++++ similar/main/mission.cpp | 4 ++++ similar/main/render.cpp | 5 +++++ similar/main/state.cpp | 4 ++++ similar/main/texmerge.cpp | 4 ++++ similar/main/titles.cpp | 4 ++++ 35 files changed, 161 insertions(+), 4 deletions(-) diff --git a/common/2d/rle.cpp b/common/2d/rle.cpp index e7a4cbfcb..1b18277b4 100644 --- a/common/2d/rle.cpp +++ b/common/2d/rle.cpp @@ -341,6 +341,8 @@ int gr_bitmap_rle_compress(grs_bitmap &bmp) #define MAX_CACHE_BITMAPS 32 +namespace { + struct rle_cache_element { const grs_bitmap *rle_bitmap; @@ -348,6 +350,8 @@ struct rle_cache_element int last_used; }; +} + static int rle_cache_initialized; static int rle_counter; static int rle_next; diff --git a/common/3d/instance.cpp b/common/3d/instance.cpp index 7153e26b4..1a43d4b4d 100644 --- a/common/3d/instance.cpp +++ b/common/3d/instance.cpp @@ -18,11 +18,15 @@ #define MAX_INSTANCE_DEPTH 5 +namespace { + struct instance_context { vms_matrix m; vms_vector p; }; +} + static array instance_stack; int instance_depth = 0; diff --git a/common/3d/rod.cpp b/common/3d/rod.cpp index 6b3ffec47..962c58cc7 100644 --- a/common/3d/rod.cpp +++ b/common/3d/rod.cpp @@ -20,12 +20,16 @@ #include "compiler-range_for.h" +namespace { + struct rod_4point { array point_list; array points; }; +} + //compute the corners of a rod. fills in vertbuf. static int calc_rod_corners(rod_4point &rod_point_group, const g3s_point &bot_point,fix bot_width,const g3s_point &top_point,fix top_width) { diff --git a/common/arch/sdl/joy.cpp b/common/arch/sdl/joy.cpp index 4f27bf49e..a3f7a7c78 100644 --- a/common/arch/sdl/joy.cpp +++ b/common/arch/sdl/joy.cpp @@ -19,6 +19,8 @@ #include "playsave.h" #include "kconfig.h" +namespace { + int num_joysticks = 0; /* This struct is a "virtual" joystick, which includes all the axes @@ -56,6 +58,8 @@ struct d_physical_joystick { int button_map[MAX_BUTTONS_PER_JOYSTICK]; }; +} + static array SDL_Joysticks; void joy_button_handler(SDL_JoyButtonEvent *jbe) diff --git a/common/arch/sdl/key.cpp b/common/arch/sdl/key.cpp index 656e1e40e..baf89fbcf 100644 --- a/common/arch/sdl/key.cpp +++ b/common/arch/sdl/key.cpp @@ -295,11 +295,15 @@ const array key_properties = {{ { "W95", 255, SDLK_WORLD_95 }, // 255 }}; +namespace { + struct d_event_keycommand : d_event { int keycode; }; +} + static int key_ismodlck(int keycode) { switch (keycode) diff --git a/common/ui/gadget.cpp b/common/ui/gadget.cpp index 87f9a7008..c98a4034e 100644 --- a/common/ui/gadget.cpp +++ b/common/ui/gadget.cpp @@ -44,11 +44,15 @@ constexpr tt::integral_constant UI_GADGET_INPUTBOX::s_kind; constexpr tt::integral_constant UI_GADGET_USERBOX::s_kind; constexpr tt::integral_constant UI_GADGET_ICON::s_kind; +namespace { + struct event_gadget : d_event { UI_GADGET *gadget; }; +} + void ui_gadget_add(UI_DIALOG * dlg, short x1, short y1, short x2, short y2, UI_GADGET *gadget) { if (dlg->gadget == NULL ) diff --git a/common/ui/menu.cpp b/common/ui/menu.cpp index 7c658ca0a..ee70ab499 100644 --- a/common/ui/menu.cpp +++ b/common/ui/menu.cpp @@ -34,6 +34,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define MENU_BORDER 2 #define MENU_VERT_SPACING 2 +namespace { + struct menu { std::unique_ptr[]> button_g; @@ -42,6 +44,8 @@ struct menu int num_buttons; }; +} + static int menu_handler(UI_DIALOG *,const d_event &event, menu *m) { for (int i=0; inum_buttons; i++ ) diff --git a/common/ui/menubar.cpp b/common/ui/menubar.cpp index 81e7d0710..bb88194e4 100644 --- a/common/ui/menubar.cpp +++ b/common/ui/menubar.cpp @@ -41,6 +41,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define MAXMENUS 30 #define MAXITEMS 32 +namespace { + struct ITEM { short x, y, w, h; RAIIdmem Text; @@ -59,6 +61,8 @@ struct MENU : embed_window_pointer_t { array Item; }; +} + static array Menu; static unsigned num_menus; diff --git a/common/ui/message.cpp b/common/ui/message.cpp index 32331687e..c71887b05 100644 --- a/common/ui/message.cpp +++ b/common/ui/message.cpp @@ -43,6 +43,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define BUTTON_HORZ_SPACING 20 #define TEXT_EXTRA_HEIGHT 5 +namespace { + struct messagebox { const ui_messagebox_tie *button; @@ -54,6 +56,8 @@ struct messagebox int line_y; }; +} + static int messagebox_handler(UI_DIALOG *dlg,const d_event &event, messagebox *m) { if (event.type == EVENT_UI_DIALOG_DRAW) diff --git a/d1x-rebirth/editor/ehostage.cpp b/d1x-rebirth/editor/ehostage.cpp index 86395bc92..6ad515a06 100644 --- a/d1x-rebirth/editor/ehostage.cpp +++ b/d1x-rebirth/editor/ehostage.cpp @@ -61,6 +61,8 @@ static UI_DIALOG *MainWindow = NULL; static int CurrentHostageIndex = -1; static int LastHostageIndex = -1; +namespace { + struct hostage_dialog { std::unique_ptr hostageViewBox; @@ -72,6 +74,8 @@ struct hostage_dialog fix vclip_playback_speed; // Calculated internally. Frames/second of vclip. }; +} + static int SelectPrevHostage() { int start=0; diff --git a/d1x-rebirth/main/custom.cpp b/d1x-rebirth/main/custom.cpp index 51a6eaaad..34d52d562 100644 --- a/d1x-rebirth/main/custom.cpp +++ b/d1x-rebirth/main/custom.cpp @@ -29,12 +29,16 @@ //#define D2TMAP_CONV // used for testing +namespace { + struct snd_info { unsigned int length; ubyte *data; }; +} + struct DiskBitmapHeader2 { char name[8]; @@ -66,6 +70,8 @@ struct DiskSoundHeader int offset; } __pack__; +namespace { + struct custom_info { int offset; @@ -74,6 +80,8 @@ struct custom_info int width, height; }; +} + static array BitmapOriginal; static array SoundOriginal; diff --git a/d2x-rebirth/main/escort.cpp b/d2x-rebirth/main/escort.cpp index c4e2441e4..6d295a3f4 100644 --- a/d2x-rebirth/main/escort.cpp +++ b/d2x-rebirth/main/escort.cpp @@ -1581,11 +1581,15 @@ void drop_stolen_items(const vcobjptr_t objp) } // -------------------------------------------------------------------------------------------------------------- +namespace { + struct escort_menu : ignore_window_pointer_t { array msg; }; +} + static window_event_result escort_menu_keycommand(window *, const d_event &event, escort_menu *) { int key; diff --git a/d2x-rebirth/main/movie.cpp b/d2x-rebirth/main/movie.cpp index 74b092f85..49f41f82c 100644 --- a/d2x-rebirth/main/movie.cpp +++ b/d2x-rebirth/main/movie.cpp @@ -63,12 +63,16 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "compiler-range_for.h" +namespace { + // Subtitle data struct subtitle { short first_frame,last_frame; char *msg; }; +} + static int init_subtitles(const char *filename); #define MAX_SUBTITLES 500 @@ -99,10 +103,14 @@ public: // Movielib data static const array, 3> movielib_files{{{"intro"}, {"other"}, {"robots"}}}; +namespace { + struct loaded_movie_t { array filename; }; + +} static loaded_movie_t extra_robot_movie_mission; static RWops_ptr RoboFile; @@ -253,6 +261,7 @@ static void MovieSetPalette(const unsigned char *p, unsigned start, unsigned cou memcpy(&gr_palette[start],p+start*3,count*3); } +namespace { struct movie : ignore_window_pointer_t { @@ -262,6 +271,8 @@ struct movie : ignore_window_pointer_t MVESTREAM_ptr_t pMovie; }; +} + static window_event_result show_pause_message(window *, const d_event &event, const unused_window_userdata_t *) { switch (event.type) diff --git a/similar/2d/font.cpp b/similar/2d/font.cpp index 91454ab97..f13f93257 100644 --- a/similar/2d/font.cpp +++ b/similar/2d/font.cpp @@ -59,6 +59,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define MAX_OPEN_FONTS 50 +namespace { + struct openfont { array filename; @@ -67,6 +69,8 @@ struct openfont std::unique_ptr dataptr; }; +} + //list of open fonts, for use (for now) for palette remapping static array open_font; diff --git a/similar/arch/sdl/digi.cpp b/similar/arch/sdl/digi.cpp index bf8bf9db0..2cfc8f6ec 100644 --- a/similar/arch/sdl/digi.cpp +++ b/similar/arch/sdl/digi.cpp @@ -41,6 +41,8 @@ /* Sound system function pointers */ +namespace { + struct sound_function_table_t { int (*init)(); @@ -92,8 +94,6 @@ static const sound_function_table_t digi_audio_table{ &digi_audio_set_digi_volume, }; -namespace { - class sound_function_pointers_t { #ifdef USE_SDLMIXER diff --git a/similar/arch/sdl/digi_mixer.cpp b/similar/arch/sdl/digi_mixer.cpp index 1cf83242c..743232da1 100644 --- a/similar/arch/sdl/digi_mixer.cpp +++ b/similar/arch/sdl/digi_mixer.cpp @@ -50,6 +50,8 @@ #endif #define MIN_VOLUME 10 +namespace { + struct RAIIMix_Chunk : public Mix_Chunk { ~RAIIMix_Chunk() @@ -58,6 +60,8 @@ struct RAIIMix_Chunk : public Mix_Chunk } }; +} + static int digi_initialised = 0; static int digi_mixer_max_channels = MAX_SOUND_SLOTS; static inline int fix2byte(fix f) { return (f / 256) % 256; } diff --git a/similar/editor/centers.cpp b/similar/editor/centers.cpp index 8bd62bae7..e6ae8ef2b 100644 --- a/similar/editor/centers.cpp +++ b/similar/editor/centers.cpp @@ -63,6 +63,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. //------------------------------------------------------------------------- static UI_DIALOG *MainWindow = NULL; +namespace { + struct centers_dialog { std::unique_ptr quitButton; @@ -71,6 +73,8 @@ struct centers_dialog int old_seg_num; }; +} + static int centers_dialog_handler(UI_DIALOG *dlg,const d_event &event, centers_dialog *c); //------------------------------------------------------------------------- diff --git a/similar/editor/eswitch.cpp b/similar/editor/eswitch.cpp index b597247ac..132873564 100644 --- a/similar/editor/eswitch.cpp +++ b/similar/editor/eswitch.cpp @@ -60,6 +60,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. static UI_DIALOG *MainWindow = NULL; +namespace { + struct trigger_dialog { std::unique_ptr wallViewBox; @@ -68,6 +70,8 @@ struct trigger_dialog int old_trigger_num; }; +} + //----------------------------------------------------------------- // Adds a trigger to wall, and returns the trigger number. diff --git a/similar/editor/meddraw.cpp b/similar/editor/meddraw.cpp index 913aa31ac..9f49e89e7 100644 --- a/similar/editor/meddraw.cpp +++ b/similar/editor/meddraw.cpp @@ -210,6 +210,8 @@ const #endif array edge_colors{{54, 59, 64}}; +namespace { + struct seg_edge { union { @@ -220,6 +222,8 @@ struct seg_edge ubyte face_count, backface_count; }; +} + static array edge_list; static array used_list; //which entries in edge_list have been used int n_used; diff --git a/similar/editor/medrobot.cpp b/similar/editor/medrobot.cpp index dcfaaa95b..794a16985 100644 --- a/similar/editor/medrobot.cpp +++ b/similar/editor/medrobot.cpp @@ -68,6 +68,8 @@ static int GoodyPrevID(); //------------------------------------------------------------------------- static UI_DIALOG *MainWindow = NULL; +namespace { + struct robot_dialog { std::unique_ptr robotViewBox, containsViewBox; @@ -78,6 +80,8 @@ struct robot_dialog int old_object; }; +} + static int robot_dialog_handler(UI_DIALOG *dlg,const d_event &event, robot_dialog *r); static void call_init_ai_object(const vobjptr_t objp, ai_behavior behavior) @@ -715,6 +719,8 @@ int robot_dialog_handler(UI_DIALOG *dlg,const d_event &event, robot_dialog *r) static UI_DIALOG *MattWindow = NULL; +namespace { + struct object_dialog { struct creation_context @@ -730,6 +736,8 @@ struct object_dialog std::unique_ptr quitButton; }; +} + static int object_dialog_handler(UI_DIALOG *dlg,const d_event &event, object_dialog *o); void object_close_window() diff --git a/similar/editor/medwall.cpp b/similar/editor/medwall.cpp index f39721151..a1662183e 100644 --- a/similar/editor/medwall.cpp +++ b/similar/editor/medwall.cpp @@ -65,6 +65,8 @@ static int wall_remove_door_flag(sbyte flag); //------------------------------------------------------------------------- static UI_DIALOG *MainWindow = NULL; +namespace { + struct wall_dialog { std::unique_ptr wallViewBox; @@ -76,8 +78,6 @@ struct wall_dialog int framenum; }; -static int wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wall_dialog *wd); - static int Current_door_type=1; struct count_wall @@ -87,6 +87,10 @@ struct count_wall short sidenum; }; +} + +static int wall_dialog_handler(UI_DIALOG *dlg,const d_event &event, wall_dialog *wd); + //--------------------------------------------------------------------- // Add a wall (removable 2 sided) static int add_wall(const vsegptridx_t seg, short side) diff --git a/similar/main/ai.cpp b/similar/main/ai.cpp index 76e6897f5..76d8e7f6c 100644 --- a/similar/main/ai.cpp +++ b/similar/main/ai.cpp @@ -4169,10 +4169,14 @@ void create_awareness_event(const vobjptr_t objp, player_awareness_type_t type) } } +namespace { + struct awareness_t : array { }; +} + // ---------------------------------------------------------------------------------- static void pae_aux(segnum_t segnum, player_awareness_type_t type, int level, awareness_t &New_awareness) { diff --git a/similar/main/automap.cpp b/similar/main/automap.cpp index 8addd475e..61bc77ba1 100644 --- a/similar/main/automap.cpp +++ b/similar/main/automap.cpp @@ -96,6 +96,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define EF_NO_FADE 32 // An edge that doesn't fade with distance #define EF_TOO_FAR 64 // An edge that is too far away +namespace { + struct Edge_info { array verts; // 8 bytes @@ -154,6 +156,8 @@ struct automap : ignore_window_pointer_t segment_depth_array_t depth_array; }; +} + #define MAX_EDGES_FROM_VERTS(v) ((v)*4) #define K_WALL_NORMAL_COLOR BM_XRGB(29, 29, 29 ) diff --git a/similar/main/collide.cpp b/similar/main/collide.cpp index b4bac733d..95adf2621 100644 --- a/similar/main/collide.cpp +++ b/similar/main/collide.cpp @@ -2514,6 +2514,8 @@ void collide_two_objects(vobjptridx_t A, vobjptridx_t B, vms_vector &collision_p #define ENABLE_SAME_COLLISION(type,f) COLLISION_RESULT(type,type,RESULT_CHECK); #define DISABLE_SAME_COLLISION(type) COLLISION_RESULT(type,type,RESULT_NOTHING); +namespace { + template struct collision_result_t : public tt::conditional<(B < A), collision_result_t, tt::integral_constant>::type {}; @@ -2523,6 +2525,8 @@ struct collision_result_t : public tt::conditional<(B < A), collision_result_t static inline constexpr collision_inner_array_t collide_init(index_sequence) { diff --git a/similar/main/credits.cpp b/similar/main/credits.cpp index fc7753a97..8b0a380e4 100644 --- a/similar/main/credits.cpp +++ b/similar/main/credits.cpp @@ -68,6 +68,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define ALLOWED_CHAR (!Current_mission ? 'R' : (is_SHAREWARE ? 'S' : 'R')) #endif +namespace { + struct credits : ignore_window_pointer_t { RAIIPHYSFS_File file; @@ -81,6 +83,8 @@ struct credits : ignore_window_pointer_t grs_bitmap backdrop; }; +} + static window_event_result credits_handler(window *, const d_event &event, credits *cr) { int l, y; diff --git a/similar/main/fvi.cpp b/similar/main/fvi.cpp index 66411cb2e..2e8a0d883 100644 --- a/similar/main/fvi.cpp +++ b/similar/main/fvi.cpp @@ -81,6 +81,8 @@ static int find_plane_line_intersection(vms_vector &new_pnt,const vms_vector &pl } +namespace { + struct vec2d { fix i,j; }; @@ -98,6 +100,8 @@ struct ij_pair fix vms_vector::*j; }; +} + __attribute_warn_unused_result static ij_pair find_largest_normal(vms_vector t) { @@ -592,6 +596,8 @@ static vm_distance_squared check_vector_to_object(vms_vector &intp,const vms_vec } +namespace { + #define MAX_SEGS_VISITED 100 struct fvi_segment_visit_count_t { @@ -600,10 +606,13 @@ struct fvi_segment_visit_count_t { } }; + struct fvi_segments_visited_t : public fvi_segment_visit_count_t, public visited_segment_bitarray_t { }; +} + int fvi_nest_count; //these vars are used to pass vars from fvi_sub() to find_vector_intersection() diff --git a/similar/main/gameseg.cpp b/similar/main/gameseg.cpp index 1bc2b0743..b396c1f94 100644 --- a/similar/main/gameseg.cpp +++ b/similar/main/gameseg.cpp @@ -745,12 +745,16 @@ static inline void add_to_fcd_cache(int seg0, int seg1, int depth, vm_distance d #define MIN_CACHE_FCD_DIST (F1_0*80) // Must be this far apart for cache lookup to succeed. Recognizes small changes in distance matter at small distances. #define MAX_FCD_CACHE 8 +namespace { + struct fcd_data { segnum_t seg0, seg1; int csd; vm_distance dist; }; +} + int Fcd_index = 0; static array Fcd_cache; fix64 Last_fcd_flush_time; diff --git a/similar/main/hud.cpp b/similar/main/hud.cpp index ef830ddc5..914d721c0 100644 --- a/similar/main/hud.cpp +++ b/similar/main/hud.cpp @@ -38,6 +38,8 @@ #include "playsave.h" #include "countarray.h" +namespace { + struct hudmsg { fix time; @@ -50,6 +52,8 @@ struct hudmsg } }; +} + struct hudmsg_array_t : public count_array_t {}; static hudmsg_array_t HUD_messages; diff --git a/similar/main/kconfig.cpp b/similar/main/kconfig.cpp index b88bb702e..ca7e8a3c1 100644 --- a/similar/main/kconfig.cpp +++ b/similar/main/kconfig.cpp @@ -120,6 +120,8 @@ fix Cruise_speed=0; #define INFO_Y (188) +namespace { + struct kc_item { const short x, y; // x, y pos of label @@ -153,6 +155,8 @@ struct kc_menu : embed_window_pointer_t ubyte mouse_state; }; +} + const array, 3> DefaultKeySettings{{ #if defined(DXX_BUILD_DESCENT_I) {{0xc8,0x48,0xd0,0x50,0xcb,0x4b,0xcd,0x4d,0x38,0xff,0xff,0x4f,0xff,0x51,0xff,0x4a,0xff,0x4e,0xff,0xff,0x10,0x47,0x12,0x49,0x1d,0x9d,0x39,0xff,0x21,0xff,0x1e,0xff,0x2c,0xff,0x30,0xff,0x13,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xf,0xff,0x33,0x0,0x34,0x0}}, diff --git a/similar/main/kmatrix.cpp b/similar/main/kmatrix.cpp index f871a9ae0..c669184f3 100644 --- a/similar/main/kmatrix.cpp +++ b/similar/main/kmatrix.cpp @@ -181,6 +181,8 @@ static void kmatrix_status_msg (fix time, int reactor) gr_printf(0x8000, SHEIGHT-LINE_SPACING, "Level finished. Wait (%d) to proceed or ESC to Quit.", time); } +namespace { + struct kmatrix_screen : ignore_window_pointer_t { grs_bitmap background; @@ -190,6 +192,8 @@ struct kmatrix_screen : ignore_window_pointer_t int aborted; }; +} + static void kmatrix_redraw(kmatrix_screen *km) { playernum_array_t sorted; diff --git a/similar/main/mission.cpp b/similar/main/mission.cpp index 717f0c226..10566807b 100644 --- a/similar/main/mission.cpp +++ b/similar/main/mission.cpp @@ -68,6 +68,8 @@ enum mle_loc ML_MISSIONDIR = 1 }; +namespace { + //mission list entry struct mle : Mission_path { @@ -80,6 +82,8 @@ struct mle : Mission_path enum mle_loc location; // where the mission is }; +} + typedef std::vector mission_list; Mission_ptr Current_mission; // currently loaded mission diff --git a/similar/main/render.cpp b/similar/main/render.cpp index 9f47ad53c..f97e987aa 100644 --- a/similar/main/render.cpp +++ b/similar/main/render.cpp @@ -873,7 +873,12 @@ static ubyte code_window_point(fix x,fix y,const rect &w) char visited2[MAX_SEGMENTS]; #endif +namespace { + struct visited_twobit_array_t : visited_segment_multibit_array_t<2> {}; + +} + int lcnt_save,scnt_save; //Given two sides of segment, tell the two verts which form the diff --git a/similar/main/state.cpp b/similar/main/state.cpp index e845b5f47..7f0bb79c2 100644 --- a/similar/main/state.cpp +++ b/similar/main/state.cpp @@ -574,6 +574,8 @@ static void state_read_player(PHYSFS_file *fp, player &pl, int swap) state_player_rw_to_player(&pl_rw, &pl); } +namespace { + //------------------------------------------------------------------- struct state_userdata { @@ -581,6 +583,8 @@ struct state_userdata array sc_bmp; }; +} + static int state_callback(newmenu *menu,const d_event &event, state_userdata *const userdata) { array &sc_bmp = userdata->sc_bmp; diff --git a/similar/main/texmerge.cpp b/similar/main/texmerge.cpp index 51ce94806..de8a7f6cf 100644 --- a/similar/main/texmerge.cpp +++ b/similar/main/texmerge.cpp @@ -46,6 +46,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. //static grs_bitmap * cache_bitmaps[MAX_NUM_CACHE_BITMAPS]; +namespace { + struct TEXTURE_CACHE { grs_bitmap_ptr bitmap; grs_bitmap * bottom_bmp; @@ -54,6 +56,8 @@ struct TEXTURE_CACHE { fix64 last_time_used; }; +} + static array Cache; static unsigned num_cache_entries; diff --git a/similar/main/titles.cpp b/similar/main/titles.cpp index 3365c2917..c62c47fa9 100644 --- a/similar/main/titles.cpp +++ b/similar/main/titles.cpp @@ -97,6 +97,8 @@ static int rescale_y(int y) return y * GHEIGHT / 200; } +namespace { + struct title_screen : ignore_window_pointer_t { grs_bitmap title_bm; @@ -104,6 +106,8 @@ struct title_screen : ignore_window_pointer_t int allow_keys; }; +} + static window_event_result title_handler(window *, const d_event &event, title_screen *ts) { switch (event.type)