From 2d01f3a64978a193b5a233e70578532a5a2bf81b Mon Sep 17 00:00:00 2001 From: Kp Date: Sun, 17 Nov 2013 00:50:32 +0000 Subject: [PATCH] Optimize references to player ship --- common/main/bm.h | 3 +++ common/main/player.h | 1 - similar/main/bm.cpp | 2 +- similar/main/controls.cpp | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/common/main/bm.h b/common/main/bm.h index 5fbace4cd..9e98d6ba3 100644 --- a/common/main/bm.h +++ b/common/main/bm.h @@ -74,7 +74,10 @@ typedef struct { extern int Num_object_types; struct player_ship; +//right now there's only one player ship, but we can have another by +//adding an array and setting the pointer to the active ship. extern struct player_ship only_player_ship; +static struct player_ship *const Player_ship=&only_player_ship; extern int Num_cockpits; extern bitmap_index cockpit_bitmap[N_COCKPIT_BITMAPS]; extern short tmap_xlate_table[MAX_TEXTURES]; diff --git a/common/main/player.h b/common/main/player.h index 75bee9cab..150989405 100644 --- a/common/main/player.h +++ b/common/main/player.h @@ -240,7 +240,6 @@ extern int Player_num; // The player number who is on the console. extern player Players[MAX_PLAYERS + DXX_PLAYER_HEADER_ADD_EXTRA_PLAYERS]; // Misc player info void player_rw_swap(player_rw *p, int swap); #endif -extern player_ship *Player_ship; extern struct object *Guided_missile[MAX_PLAYERS]; extern int Guided_missile_sig[MAX_PLAYERS]; diff --git a/similar/main/bm.cpp b/similar/main/bm.cpp index 24657fff3..f255d47bf 100644 --- a/similar/main/bm.cpp +++ b/similar/main/bm.cpp @@ -83,7 +83,7 @@ int Dead_modelnums[MAX_POLYGON_MODELS]; //right now there's only one player ship, but we can have another by //adding an array and setting the pointer to the active ship. -player_ship only_player_ship,*Player_ship=&only_player_ship; +player_ship only_player_ship; //----------------- Miscellaneous bitmap pointers --------------- int Num_cockpits = 0; diff --git a/similar/main/controls.cpp b/similar/main/controls.cpp index 225236515..4efe2980c 100644 --- a/similar/main/controls.cpp +++ b/similar/main/controls.cpp @@ -28,6 +28,7 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "game.h" #include "object.h" #include "player.h" +#include "bm.h" #include "controls.h" #include "render.h" #include "args.h"