Skip to content

Commit

Permalink
this never ends
Browse files Browse the repository at this point in the history
  • Loading branch information
majcosta committed Dec 15, 2024
1 parent c4fd0a1 commit e719930
Show file tree
Hide file tree
Showing 24 changed files with 71 additions and 73 deletions.
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ if(ADDRESS_SANITIZER)
add_compile_options($<IF:$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>,-fsanitize=address,>)
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wno-error=c++11-narrowing -Wno-error=non-pod-varargs -Wno-error=invalid-token-paste -Wno-error=out-of-line-declaration -Wno-everything)
endif()

# whether we are using MSBuild as a generator
set(usingMsBuild $<STREQUAL:${CMAKE_VS_PLATFORM_NAME},Win32>)

Expand Down
5 changes: 4 additions & 1 deletion Strategic/Facilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,10 @@ void HandleRisksForSoldierFacilityAssignment( SOLDIERTYPE *pSoldier, UINT8 ubFac
}
else
{
INT16 sItemId = riskDrugItems[std::uniform_int_distribution<>(0, riskDrugItems.size() - 1)(std::mt19937{ std::random_device{}() })];
std::random_device rd;
std::mt19937 gen{rd()};
std::uniform_int_distribution<> distrib{0, riskDrugItems.size() - 1};
INT16 sItemId = riskDrugItems[distrib(gen)];

CreateItem(sItemId, Item[sItemId].usPortionSize, &gTempObject);

Expand Down
20 changes: 10 additions & 10 deletions Strategic/Map Screen Interface Map Inventory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5558,7 +5558,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 0 ] );
// Add option: "SHOW ALL"
uiFlags = IC_MAPFILTER_ALL;
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterSet, uiFlags ) );
pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterSet, uiFlags ) );
if (guiMapInventoryFilter == IC_MAPFILTER_ALL)
{
// Set this option off.
Expand All @@ -5578,7 +5578,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 1 ] );
}
uiFlags = IC_MAPFILTER_GUN;
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
gMapInventoryFilterPopup->addOption( *pOption );

if (guiMapInventoryFilter & IC_MAPFILTER_AMMO)
Expand All @@ -5592,7 +5592,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 2 ] );
}
uiFlags = IC_MAPFILTER_AMMO;
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
gMapInventoryFilterPopup->addOption( *pOption );

if (guiMapInventoryFilter & IC_MAPFILTER_EXPLOSV)
Expand All @@ -5606,7 +5606,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 3 ] );
}
uiFlags = IC_MAPFILTER_EXPLOSV;
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
gMapInventoryFilterPopup->addOption( *pOption );

if (guiMapInventoryFilter & IC_MAPFILTER_MELEE)
Expand All @@ -5620,7 +5620,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 4 ] );
}
uiFlags = IC_MAPFILTER_MELEE;
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
gMapInventoryFilterPopup->addOption( *pOption );

if (guiMapInventoryFilter & IC_MAPFILTER_ARMOR)
Expand All @@ -5634,7 +5634,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 5 ] );
}
uiFlags = IC_MAPFILTER_ARMOR;
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
gMapInventoryFilterPopup->addOption( *pOption );

if (guiMapInventoryFilter & IC_MAPFILTER_LBE)
Expand All @@ -5648,7 +5648,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 6 ] );
}
uiFlags = IC_MAPFILTER_LBE;
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
gMapInventoryFilterPopup->addOption( *pOption );

if (guiMapInventoryFilter & IC_MAPFILTER_KIT)
Expand All @@ -5662,7 +5662,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 7 ] );
}
uiFlags = IC_MAPFILTER_KIT;
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
gMapInventoryFilterPopup->addOption( *pOption );

if (guiMapInventoryFilter & IC_MAPFILTER_MISC)
Expand All @@ -5676,13 +5676,13 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 8 ] );
}
uiFlags = IC_MAPFILTER_MISC;
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterToggle, uiFlags ) );
gMapInventoryFilterPopup->addOption( *pOption );

swprintf( pStr, gzMapInventoryFilterOptions[ 9 ] );
// Add option: "HIDE ALL"
uiFlags = 0;
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterSet, uiFlags ) );
pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &MapInventoryFilterMenuPopup_FilterSet, uiFlags ) );
if (guiMapInventoryFilter == 0)
{
// Set this option off.
Expand Down
2 changes: 0 additions & 2 deletions Strategic/QuestText.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
#define _QUEST_TEXT_H_


STR16 QuestDescText[];
STR16 FactDescText[];


#endif
Expand Down
2 changes: 1 addition & 1 deletion TileEngine/Render Dirty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ BOOLEAN CopyExternBackgroundRect( INT16 sLeft, INT16 sTop, INT16 sWidth, INT16 s
// to the video buffer.
//
//*****************************************************************************
UINT16 gprintfdirty(INT16 x, INT16 y, STR16 pFontString, ...)
UINT16 gprintfdirty(INT16 x, INT16 y, const wchar_t * pFontString, ...)
{
va_list argptr;
CHAR16 string[512];
Expand Down
2 changes: 1 addition & 1 deletion TileEngine/Render Dirty.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ BOOLEAN EmptyBackgroundRects( void );


// GPRINTF DIRTY STUFF
UINT16 gprintfdirty(INT16 x, INT16 y, STR16 pFontString, ...);
UINT16 gprintfdirty(INT16 x, INT16 y, const wchar_t * pFontString, ...);
UINT16 gprintfinvalidate(INT16 x, INT16 y, STR16 pFontString, ...);
UINT16 gprintfRestore(INT16 x, INT16 y, STR16 pFontString, ...);

Expand Down
1 change: 0 additions & 1 deletion TileEngine/tiledef.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ typedef struct
// Globals used
extern TILE_ELEMENT gTileDatabase[ NUMBEROFTILES ];
extern UINT16 gTileDatabaseSize;
UINT8 gFullBaseTileValues[];
extern UINT16 gNumTilesPerType[ NUMBEROFTILETYPES ];
extern UINT16 gTileTypeStartIndex[ NUMBEROFTILETYPES ];
extern STR gTileSurfaceName[NUMBEROFTILETYPES];
Expand Down
2 changes: 1 addition & 1 deletion Utils/Font Control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ UINT16 WFGetFontHeight( INT32 FontNum )
}


INT16 WFStringPixLength( STR16 string,INT32 UseFont )
INT16 WFStringPixLength( const wchar_t * string,INT32 UseFont )
{
return( StringPixLength( string, UseFont ) );
}
Expand Down
2 changes: 1 addition & 1 deletion Utils/Font Control.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ extern INT32 giCurWinFont;

// ATE: A few winfont wrappers..
UINT16 WFGetFontHeight( INT32 FontNum );
INT16 WFStringPixLength( STR16 string,INT32 UseFont );
INT16 WFStringPixLength( const wchar_t * string,INT32 UseFont );



Expand Down
2 changes: 1 addition & 1 deletion Utils/STIConvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ void WriteSTIFile( INT8 *pData, SGPPaletteEntry *pPalette, INT16 sWidth, INT16 s
{
if(Header.uiAppDataSize > 0)
for(uiLoop=0; uiLoop<Header.uiAppDataSize; uiLoop++)
FileWrite(hFile, "", 1, NULL);
FileWrite(hFile, NULL, 1, NULL);
}
else
FileWrite(hFile, Image.pAppData, Header.uiAppDataSize, NULL);
Expand Down
3 changes: 0 additions & 3 deletions Utils/Text.h
Original file line number Diff line number Diff line change
Expand Up @@ -2469,9 +2469,6 @@ enum
NUM_PEOPLE_IN_CREDITS,
};

STR16 gzCreditNames[];
STR16 gzCreditNameTitle[];
STR16 gzCreditNameFunny[];


extern STR16 GetWeightUnitString( void );
Expand Down
4 changes: 2 additions & 2 deletions Utils/WordWrap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ UINT16 DeleteWrappedString(WRAPPED_STRING *pWrappedString)
// do you want to display it using dirty rects, TRUE or FALSE
// flags for either LEFT_JUSTIFIED, CENTER_JUSTIFIED, RIGHT_JUSTIFIED

BOOLEAN DrawTextToScreen(STR16 pStr, UINT16 usLocX, UINT16 usLocY, UINT16 usWidth, INT32 iFont, UINT8 ubColor, UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 ulFlags)
BOOLEAN DrawTextToScreen(const wchar_t * pStr, UINT16 usLocX, UINT16 usLocY, UINT16 usWidth, INT32 iFont, UINT8 ubColor, UINT8 ubBackGroundColor, BOOLEAN fDirty, UINT32 ulFlags)
{
UINT16 usPosX = 0, usPosY = 0;
UINT16 usFontHeight=0;
Expand Down Expand Up @@ -1868,7 +1868,7 @@ INT32 GetNewTotalYPositionOfThisString( INT32 iTotalYPosition, INT32 iPageSize,
return( iNewYPosition );
}

void ShadowText(UINT32 uiDestVSurface, STR16 pString, INT32 iFont, UINT16 usPosX, UINT16 usPosY )
void ShadowText(UINT32 uiDestVSurface, const wchar_t * pString, INT32 iFont, UINT16 usPosX, UINT16 usPosY )
{
UINT32 uiLength = StringPixLength( pString, iFont);
UINT16 usFontHeight = WFGetFontHeight( iFont );
Expand Down
2 changes: 1 addition & 1 deletion Utils/WordWrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ RecordPtr GetFirstRecordOnThisPage( RecordPtr RecordList, INT32 iFont, UINT16 us
FileStringPtr GetFirstStringOnThisPage( FileStringPtr RecordList, INT32 iFont, UINT16 usWidth, UINT8 ubGap, INT32 iPage, INT32 iPageSize, FileRecordWidthPtr iWidthArray );

// Places a shadow the width an height of the string, to PosX, posY
void ShadowText(UINT32 uiDestVSurface, STR16 pString, INT32 iFont, UINT16 usPosX, UINT16 usPosY );
void ShadowText(UINT32 uiDestVSurface, const wchar_t * pString, INT32 iFont, UINT16 usPosX, UINT16 usPosY );


BOOLEAN ReduceStringLength( STR16 pString, UINT32 uiWidthToFitIn, INT32 iFont );
Expand Down
4 changes: 2 additions & 2 deletions Utils/XMLProperties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ vfs::String const& vfs::PropertyContainer::TagMap::keyID(vfs::String::char_t* ke
return _map[L"KeyID"];
}

bool vfs::PropertyContainer::writeToXMLFile(vfs::Path const& sFileName, vfs::PropertyContainer::TagMap& tagmap)
bool vfs::PropertyContainer::writeToXMLFile(vfs::Path const& sFileName, vfs::PropertyContainer::TagMap tagmap)
{
XMLWriter xmlw;

Expand Down Expand Up @@ -170,7 +170,7 @@ void CPropertyXMLParser::onTextElement(const XML_Char *str, int len)
}
}

bool vfs::PropertyContainer::initFromXMLFile(vfs::Path const& sFileName, vfs::PropertyContainer::TagMap& tagmap)
bool vfs::PropertyContainer::initFromXMLFile(vfs::Path const& sFileName, vfs::PropertyContainer::TagMap tagmap)
{
vfs::ReadableFile_t *file = NULL;
bool delete_file = false;
Expand Down
2 changes: 1 addition & 1 deletion Utils/XMLWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ bool XMLWriter::writeToFile(vfs::WritableFile_t* pFile)
try
{
vfs::OpenWriteFile file(pFile);
std::string &str = m_ssBuffer.str();
std::string str = m_ssBuffer.str();
pFile->write(str.c_str(), str.length() * sizeof(std::string::value_type));
return true;
}
Expand Down
18 changes: 9 additions & 9 deletions Utils/popup_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,9 @@ POPUP_OPTION::~POPUP_OPTION(void)
}


POPUP_OPTION::POPUP_OPTION(std::wstring *newName, popupCallback * newFunction)
POPUP_OPTION::POPUP_OPTION(std::wstring newName, popupCallback * newFunction)
{
this->name = *newName;
this->name = newName;

this->action = newFunction;
this->avail = 0;
Expand All @@ -162,9 +162,9 @@ POPUP_OPTION::POPUP_OPTION(std::wstring *newName, popupCallback * newFunction)
this->color_shade = FONT_GRAY7 ;
}

BOOLEAN POPUP_OPTION::setName( std::wstring * newName )
BOOLEAN POPUP_OPTION::setName( std::wstring newName )
{
this->name = *newName;
name = newName;
return TRUE;
}

Expand Down Expand Up @@ -237,19 +237,19 @@ BOOLEAN POPUP_OPTION::forceRun()
//////////////////////////////////////////////////////////////////

// constructor
POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(void) : POPUP_OPTION(new wstring(L"Unnamed subPopup"),NULL) //TODO: possible memmory leak!
POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(void) : POPUP_OPTION(wstring(L"Unnamed subPopup"),NULL) //TODO: possible memmory leak!
{
this->parent = NULL;
this->initSubPopup();
}

POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(wstring* name) : POPUP_OPTION(name, NULL)
POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(wstring name) : POPUP_OPTION(name, NULL)
{
this->parent = NULL;
this->initSubPopup();
}

POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(wstring* newName, const POPUP * parent) : POPUP_OPTION(newName, NULL)
POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(wstring newName, const POPUP * parent) : POPUP_OPTION(newName, NULL)
{
this->parent = parent;
this->initSubPopup();
Expand Down Expand Up @@ -563,7 +563,7 @@ void POPUP::setInitialValues(void)

// setup functions

POPUP_OPTION * POPUP::addOption(wstring * name, popupCallback* action)
POPUP_OPTION * POPUP::addOption(wstring name, popupCallback* action)
{
if (this->optionCount < POPUP_MAX_OPTIONS)
{
Expand Down Expand Up @@ -606,7 +606,7 @@ POPUP_OPTION * POPUP::getOption(UINT16 n)
return NULL;
}

POPUP * POPUP::addSubMenuOption(wstring * name)
POPUP * POPUP::addSubMenuOption(wstring name)
{
if (this->subPopupOptionCount < POPUP_MAX_SUB_POPUPS)
{
Expand Down
12 changes: 6 additions & 6 deletions Utils/popup_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@
{
public:
POPUP_OPTION::POPUP_OPTION(void); // default constructor
POPUP_OPTION(std::wstring* name, popupCallback* newFunction); // constructor
POPUP_OPTION(std::wstring name, popupCallback* newFunction); // constructor
~POPUP_OPTION(); // destructor
// setup
BOOLEAN setName(std::wstring * name);
BOOLEAN setName(std::wstring name);
BOOLEAN setAction(popupCallback*fun);
BOOLEAN setAvail(popupCallback *fun);
BOOLEAN setHover(popupCallback *fun);
Expand Down Expand Up @@ -105,8 +105,8 @@
public:
// constructor/destructor
POPUP_SUB_POPUP_OPTION(void);
POPUP_SUB_POPUP_OPTION(std::wstring* name);
POPUP_SUB_POPUP_OPTION(std::wstring* newName, const POPUP * parent);
POPUP_SUB_POPUP_OPTION(std::wstring name);
POPUP_SUB_POPUP_OPTION(std::wstring newName, const POPUP * parent);
~POPUP_SUB_POPUP_OPTION();

void showPopup();
Expand Down Expand Up @@ -139,15 +139,15 @@
POPUP(CHAR* name); // constructor
~POPUP(void); // destructor
// setup
POPUP_OPTION * addOption(std::wstring * name, popupCallback * action);
POPUP_OPTION * addOption(std::wstring name, popupCallback * action);
/*INT16 findFreeOptionIndex();*/
BOOLEAN addOption(POPUP_OPTION &option);
POPUP_OPTION * getOption(UINT16 n);

BOOLEAN delOption(CHAR* name); // Another index to through and clean, aargh
BOOLEAN delOption(UINT8 optIndex);

POPUP* addSubMenuOption(std::wstring * name);
POPUP* addSubMenuOption(std::wstring name);
BOOL addSubMenuOption(POPUP_SUB_POPUP_OPTION* sub);
/*INT16 findFreeSubMenuOptionIndex();*/
POPUP_SUB_POPUP_OPTION * getSubPopupOption(UINT8 n);
Expand Down
8 changes: 4 additions & 4 deletions Utils/popup_definition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
return TRUE;
}

BOOL popupDef::addOption(std::wstring* name, UINT16 callbackId, UINT16 availId){
BOOL popupDef::addOption(std::wstring name, UINT16 callbackId, UINT16 availId){
// TODO: check for vaid callbacl/avail ID

this->content.push_back( new popupDefOption(name,callbackId,availId) );

return TRUE;
}

popupDef * popupDef::addSubPopup(std::wstring* name){
popupDef * popupDef::addSubPopup(std::wstring name){

popupDefSubPopupOption * sub = new popupDefSubPopupOption(name);

Expand Down Expand Up @@ -108,7 +108,7 @@

POPUP_OPTION * opt = new POPUP_OPTION();

opt->setName( this->name );
opt->setName( name );
if ( !setPopupDefCallback(opt, this->callbackId)
|| !setPopupDefAvail(opt, this->availId) )
{
Expand Down Expand Up @@ -169,7 +169,7 @@

switch(generatorId){
case popupGenerators::dummy:
popup->addOption(new std::wstring( L"Dummy generator" ),NULL);
popup->addOption(std::wstring( L"Dummy generator" ),NULL);
break;

case popupGenerators::addArmor:
Expand Down
Loading

0 comments on commit e719930

Please sign in to comment.