mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-09 17:52:08 -10:00
Trunk sync r9082
This commit is contained in:
1 parent
49ba4f86ff
commit
b6bdffd23a
20 files changed
+174
-155
No files matched your search
+22
-5
@@ -47,6 +47,8 @@
|
||||
#include "sound/ds.h"
|
||||
#include "weapon/weapon.h"
|
||||
#include "weapon/beam.h"
|
||||
#define BMPMAN_INTERNAL
|
||||
#include "bmpman/bm_internal.h"
|
||||
|
||||
//*************************Lua globals*************************
|
||||
SCP_vector<ade_table_entry> Ade_table_entries;
|
||||
@@ -203,6 +205,8 @@ int ade_get_operator(char *tablename)
|
||||
return -1;
|
||||
}
|
||||
|
||||
const size_t INVALID_ID = (size_t) -1; // Use -1 to get highest possible unsigned number
|
||||
|
||||
//*************************Lua helpers*************************
|
||||
//Function macro
|
||||
//This is what you call to make new functions
|
||||
@@ -3144,7 +3148,11 @@ ADE_FUNC(__gc, l_Texture, NULL, "Auto-deletes texture", NULL, NULL)
|
||||
if(!ade_get_args(L, "o", l_Texture.Get(&idx)))
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
if(idx > -1 && bm_is_valid(idx))
|
||||
// Note: due to some unknown reason, in some circumstances this function
|
||||
// might get called even for handles to bitmaps which are actually still in
|
||||
// use, and in order to prevent that we want to double-check the load count
|
||||
// here before unloading the bitmap. -zookeeper
|
||||
if(idx > -1 && bm_is_valid(idx) && bm_bitmaps[bm_get_cache_slot(idx, 0)].load_count < 1)
|
||||
bm_unload(idx);
|
||||
|
||||
return ADE_RETURN_NIL;
|
||||
@@ -4831,7 +4839,7 @@ private:
|
||||
size_t display_num;
|
||||
|
||||
public:
|
||||
cockpit_disp_info_h() : sip( NULL ), display_num( UINT_MAX ) {}
|
||||
cockpit_disp_info_h() : sip( NULL ), display_num( INVALID_ID ) {}
|
||||
cockpit_disp_info_h(ship_info *sip, size_t display_num)
|
||||
{
|
||||
this->sip = sip;
|
||||
@@ -4853,6 +4861,11 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (display_num == INVALID_ID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( display_num >= sip->displays.size())
|
||||
{
|
||||
return false;
|
||||
@@ -5002,7 +5015,7 @@ private:
|
||||
size_t display_num;
|
||||
|
||||
public:
|
||||
cockpit_display_h() : obj_num( -1 ), objp( NULL ), display_num( UINT_MAX ) {}
|
||||
cockpit_display_h() : obj_num( -1 ), objp( NULL ), display_num( INVALID_ID ) {}
|
||||
cockpit_display_h(object *objp, size_t display_num)
|
||||
{
|
||||
this->obj_num = OBJ_INDEX(objp);
|
||||
@@ -5025,7 +5038,7 @@ public:
|
||||
{
|
||||
if (!isValid())
|
||||
{
|
||||
return UINT_MAX;
|
||||
return INVALID_ID;
|
||||
}
|
||||
|
||||
return display_num;
|
||||
@@ -5049,11 +5062,15 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
if (display_num >= Player_displays.size())
|
||||
if (display_num == INVALID_ID)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (display_num >= Player_displays.size())
|
||||
{
|
||||
return false; }
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user