fix prtview init crash in linux (for unknown reason, PRTVIEW_PATH_MAX was 4096)
This commit is contained in:
parent
e445a2635a
commit
b23d84ad6c
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#include "stream/stringstream.h"
|
||||
#include "convert.h"
|
||||
#include "os/path.h"
|
||||
|
||||
#include "qerplugin.h"
|
||||
|
||||
|
|
@ -51,7 +52,6 @@ bool DoLoadPortalFileDialog(){
|
|||
auto vbox = new QVBoxLayout( &dialog );
|
||||
{
|
||||
vbox->addWidget( line = new QLineEdit );
|
||||
line->setMaxLength( std::size( portals.fn ) - 1 );
|
||||
auto button = line->addAction( QApplication::style()->standardIcon( QStyle::SP_FileDialogStart ), QLineEdit::ActionPosition::TrailingPosition );
|
||||
QObject::connect( button, &QAction::triggered, [line](){
|
||||
if ( const char* filename = GlobalRadiant().m_pfnFileDialog( g_pRadiantWnd, true, "Locate portal (.prt) file", line->text().toLatin1().constData(), 0, true, false, false ) )
|
||||
|
|
@ -71,18 +71,14 @@ bool DoLoadPortalFileDialog(){
|
|||
}
|
||||
|
||||
|
||||
strcpy( portals.fn, GlobalRadiant().getMapName() );
|
||||
char* fn = strrchr( portals.fn, '.' );
|
||||
if ( fn != NULL ) {
|
||||
strcpy( fn, ".prt" );
|
||||
}
|
||||
portals.fn = StringOutputStream( 256 )( PathExtensionless( GlobalRadiant().getMapName() ), ".prt" );
|
||||
|
||||
line->setText( portals.fn );
|
||||
line->setText( portals.fn.c_str() );
|
||||
check3d->setChecked( portals.show_3d );
|
||||
check2d->setChecked( portals.show_2d );
|
||||
|
||||
if ( dialog.exec() ) {
|
||||
strcpy( portals.fn, line->text().toLatin1().constData() );
|
||||
portals.fn = line->text().toLatin1().constData();
|
||||
|
||||
portals.Purge();
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ void CPortals::Load(){
|
|||
|
||||
FILE *in;
|
||||
|
||||
in = fopen( fn, "rt" );
|
||||
in = fopen( fn.c_str(), "rt" );
|
||||
|
||||
if ( in == NULL ) {
|
||||
globalErrorStream() << " ERROR - could not open file.\n";
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
#include "irender.h"
|
||||
#include "renderable.h"
|
||||
#include "math/vector.h"
|
||||
#include "string/string.h"
|
||||
#include <vector>
|
||||
|
||||
|
||||
|
|
@ -45,12 +46,6 @@ public:
|
|||
bool Build( char *def );
|
||||
};
|
||||
|
||||
#ifdef PATH_MAX
|
||||
#define PRTVIEW_PATH_MAX PATH_MAX
|
||||
#else
|
||||
#define PRTVIEW_PATH_MAX 260
|
||||
#endif
|
||||
|
||||
using PackedColour = std::uint32_t;
|
||||
#define RGB_PACK( r, g, b ) ( (std::uint32_t)( ( (std::uint8_t)( r ) | ( (std::uint16_t)( (std::uint8_t)( g ) ) << 8 ) ) | ( ( (std::uint32_t)(std::uint8_t)( b ) ) << 16 ) ) )
|
||||
#define RGB_UNPACK_R( rgb ) ( (std::uint8_t)( rgb ) )
|
||||
|
|
@ -75,7 +70,7 @@ public:
|
|||
|
||||
void FixColors();
|
||||
|
||||
char fn[PRTVIEW_PATH_MAX];
|
||||
CopiedString fn;
|
||||
|
||||
int zbuffer;
|
||||
bool polygons;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user