take popup option names by const reference, not by pointer

POPUP_OPTION copies the name it is given -- `this->name = *newName` into a
std::wstring member -- but its constructor took a std::wstring*, so 64 call
sites spelled the argument `&std::wstring( pStr )`. Taking the address of a
temporary is ill-formed, and clang refuses it outright:

    error: taking the address of a temporary object of type 'std::wstring'

It happens to work under MSVC because the temporary outlives the call, dying
at the end of the full expression rather than before the copy. Nothing was
corrupt; the code was just spelling "pass me a string" in a way the language
does not allow.

A const reference says what these functions actually want, so the call sites
lose the &, and the two places that allocated a string purely to have an
address to pass -- POPUP_SUB_POPUP_OPTION's default constructor, which carried
a "TODO: possible memmory leak!" saying as much, and a "Dummy generator"
option -- stop leaking one.

Converted: POPUP_OPTION's constructor and setName, POPUP::addOption and
addSubMenuOption, and both POPUP_SUB_POPUP_OPTION constructors. The popupDef
family in popup_definition.* keeps its std::wstring* because it owns what it
is handed and stores the pointer; that is a different design and a different
change. The three calls it makes into the converted API now dereference.

Verification:
    grep -rn '&std::wstring' --include=*.cpp --include=*.h .   # nothing
    ninja -C build parse             # no popup_* or SkillMenu sites remain
    ninja -C build -k 0              # Release, four applications, green
    ninja -C build-debug -k 0        # Debug, four applications, green

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marco Antonio J. Costa
2026-07-23 19:29:55 -03:00
committed by majcosta
co-authored by Claude Opus 4.8
parent 83b637aa73
commit 5e2982c509
7 changed files with 96 additions and 96 deletions
@@ -5563,7 +5563,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 0 ] ); swprintf( pStr, gzMapInventoryFilterOptions[ 0 ] );
// Add option: "SHOW ALL" // Add option: "SHOW ALL"
uiFlags = IC_MAPFILTER_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) if (guiMapInventoryFilter == IC_MAPFILTER_ALL)
{ {
// Set this option off. // Set this option off.
@@ -5583,7 +5583,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 1 ] ); swprintf( pStr, gzMapInventoryFilterOptions[ 1 ] );
} }
uiFlags = IC_MAPFILTER_GUN; 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 ); gMapInventoryFilterPopup->addOption( *pOption );
if (guiMapInventoryFilter & IC_MAPFILTER_AMMO) if (guiMapInventoryFilter & IC_MAPFILTER_AMMO)
@@ -5597,7 +5597,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 2 ] ); swprintf( pStr, gzMapInventoryFilterOptions[ 2 ] );
} }
uiFlags = IC_MAPFILTER_AMMO; 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 ); gMapInventoryFilterPopup->addOption( *pOption );
if (guiMapInventoryFilter & IC_MAPFILTER_EXPLOSV) if (guiMapInventoryFilter & IC_MAPFILTER_EXPLOSV)
@@ -5611,7 +5611,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 3 ] ); swprintf( pStr, gzMapInventoryFilterOptions[ 3 ] );
} }
uiFlags = IC_MAPFILTER_EXPLOSV; 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 ); gMapInventoryFilterPopup->addOption( *pOption );
if (guiMapInventoryFilter & IC_MAPFILTER_MELEE) if (guiMapInventoryFilter & IC_MAPFILTER_MELEE)
@@ -5625,7 +5625,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 4 ] ); swprintf( pStr, gzMapInventoryFilterOptions[ 4 ] );
} }
uiFlags = IC_MAPFILTER_MELEE; 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 ); gMapInventoryFilterPopup->addOption( *pOption );
if (guiMapInventoryFilter & IC_MAPFILTER_ARMOR) if (guiMapInventoryFilter & IC_MAPFILTER_ARMOR)
@@ -5639,7 +5639,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 5 ] ); swprintf( pStr, gzMapInventoryFilterOptions[ 5 ] );
} }
uiFlags = IC_MAPFILTER_ARMOR; 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 ); gMapInventoryFilterPopup->addOption( *pOption );
if (guiMapInventoryFilter & IC_MAPFILTER_LBE) if (guiMapInventoryFilter & IC_MAPFILTER_LBE)
@@ -5653,7 +5653,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 6 ] ); swprintf( pStr, gzMapInventoryFilterOptions[ 6 ] );
} }
uiFlags = IC_MAPFILTER_LBE; 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 ); gMapInventoryFilterPopup->addOption( *pOption );
if (guiMapInventoryFilter & IC_MAPFILTER_KIT) if (guiMapInventoryFilter & IC_MAPFILTER_KIT)
@@ -5667,7 +5667,7 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 7 ] ); swprintf( pStr, gzMapInventoryFilterOptions[ 7 ] );
} }
uiFlags = IC_MAPFILTER_KIT; 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 ); gMapInventoryFilterPopup->addOption( *pOption );
if (guiMapInventoryFilter & IC_MAPFILTER_MISC) if (guiMapInventoryFilter & IC_MAPFILTER_MISC)
@@ -5681,13 +5681,13 @@ void CreateMapInventoryFilterMenu( )
swprintf( pStr, gzMapInventoryFilterOptions[ 8 ] ); swprintf( pStr, gzMapInventoryFilterOptions[ 8 ] );
} }
uiFlags = IC_MAPFILTER_MISC; 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 ); gMapInventoryFilterPopup->addOption( *pOption );
swprintf( pStr, gzMapInventoryFilterOptions[ 9 ] ); swprintf( pStr, gzMapInventoryFilterOptions[ 9 ] );
// Add option: "HIDE ALL" // Add option: "HIDE ALL"
uiFlags = 0; 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) if (guiMapInventoryFilter == 0)
{ {
// Set this option off. // Set this option off.
+31 -31
View File
@@ -2103,7 +2103,7 @@ void addItemsToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup,
if( optsTotal > 0 && optsTotal%15 == 0 ){ // divide to subBoxes every 10 items if( optsTotal > 0 && optsTotal%15 == 0 ){ // divide to subBoxes every 10 items
POPUP * currPopupTmp = currPopup->addSubMenuOption( new std::wstring( gszPocketPopupText[POCKET_POPUP_MOAR] ) ); // the new popup POPUP * currPopupTmp = currPopup->addSubMenuOption( std::wstring( gszPocketPopupText[POCKET_POPUP_MOAR] ) ); // the new popup
POPUP_SUB_POPUP_OPTION * currSubPopupTmp = currPopup->getSubPopupOption( currPopup->subPopupOptionCount-1 ); // the sub-popup option in prev popup POPUP_SUB_POPUP_OPTION * currSubPopupTmp = currPopup->getSubPopupOption( currPopup->subPopupOptionCount-1 ); // the sub-popup option in prev popup
@@ -2139,13 +2139,13 @@ void addItemsToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup,
swprintf( pStr, L"%s (%d)", Item[ itr->first ].szItemName, numObjectsToPlace ); swprintf( pStr, L"%s (%d)", Item[ itr->first ].szItemName, numObjectsToPlace );
currPopup->addOption( currPopup->addOption(
&std::wstring( pStr ), std::wstring( pStr ),
new popupCallbackFunction3<void,OBJECTTYPE*,UINT16,SOLDIERTYPE*>(&popupCallbackPlaceLeastDamagedFromStack,itr->second,sPocket,pSoldier) new popupCallbackFunction3<void,OBJECTTYPE*,UINT16,SOLDIERTYPE*>(&popupCallbackPlaceLeastDamagedFromStack,itr->second,sPocket,pSoldier)
); );
} else { } else {
currPopup->addOption( currPopup->addOption(
&std::wstring( Item[ itr->first ].szItemName ), std::wstring( Item[ itr->first ].szItemName ),
new popupCallbackFunction3<void,OBJECTTYPE*,UINT16,SOLDIERTYPE*>(&popupCallbackPlaceLeastDamagedFromStack,itr->second,sPocket,pSoldier) new popupCallbackFunction3<void,OBJECTTYPE*,UINT16,SOLDIERTYPE*>(&popupCallbackPlaceLeastDamagedFromStack,itr->second,sPocket,pSoldier)
); );
} }
@@ -2178,7 +2178,7 @@ void addWeaponGroupsToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP*
POPUP * subPopup = NULL; POPUP * subPopup = NULL;
subPopup = popup->addSubMenuOption( new std::wstring(BobbyRFilter[17]/*Guns*/) ); subPopup = popup->addSubMenuOption( std::wstring(BobbyRFilter[17]/*Guns*/) );
popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10, popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,
10, 10,
POPUP_POSITION_RELATIVE ); POPUP_POSITION_RELATIVE );
@@ -2193,33 +2193,33 @@ void addWeaponGroupsToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP*
UINT8 weaponTypeCtr; UINT8 weaponTypeCtr;
for( weaponTypeCtr = 1; weaponTypeCtr <= 8; weaponTypeCtr++ ){ for( weaponTypeCtr = 1; weaponTypeCtr <= 8; weaponTypeCtr++ ){
weaponTypePopup = subPopup->addSubMenuOption( new std::wstring( WeaponType[weaponTypeCtr] ) ); weaponTypePopup = subPopup->addSubMenuOption( std::wstring( WeaponType[weaponTypeCtr] ) );
for(std::map<UINT32,OBJECTTYPE*>::iterator itr = bestItems.begin(); itr != bestItems.end(); ++itr){ for(std::map<UINT32,OBJECTTYPE*>::iterator itr = bestItems.begin(); itr != bestItems.end(); ++itr){
if ( Weapon[ itr->first ].ubWeaponType == weaponTypeCtr ) if ( Weapon[ itr->first ].ubWeaponType == weaponTypeCtr )
weaponTypePopup->addOption( weaponTypePopup->addOption(
&std::wstring( Item[ itr->first ].szItemName ), std::wstring( Item[ itr->first ].szItemName ),
new popupCallbackFunction3<void,OBJECTTYPE*,UINT16,SOLDIERTYPE*>(&popupCallbackPlaceLeastDamagedFromStack,itr->second,sPocket,pSoldier) new popupCallbackFunction3<void,OBJECTTYPE*,UINT16,SOLDIERTYPE*>(&popupCallbackPlaceLeastDamagedFromStack,itr->second,sPocket,pSoldier)
); );
} }
} }
subPopup = popup->addSubMenuOption( new std::wstring( gszPocketPopupText[POCKET_POPUP_GRENADE_LAUNCHERS] ) ); subPopup = popup->addSubMenuOption( std::wstring( gszPocketPopupText[POCKET_POPUP_GRENADE_LAUNCHERS] ) );
popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10, popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,
10, 10,
POPUP_POSITION_RELATIVE ); POPUP_POSITION_RELATIVE );
addItemsToPocketPopup( pSoldier, sPocket, subPopup, IC_LAUNCHER, -1, -1, 0 ); addItemsToPocketPopup( pSoldier, sPocket, subPopup, IC_LAUNCHER, -1, -1, 0 );
subPopup = popup->addSubMenuOption( new std::wstring( gszPocketPopupText[POCKET_POPUP_ROCKET_LAUNCHERS] ) ); subPopup = popup->addSubMenuOption( std::wstring( gszPocketPopupText[POCKET_POPUP_ROCKET_LAUNCHERS] ) );
popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10, popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,
10, 10,
POPUP_POSITION_RELATIVE ); POPUP_POSITION_RELATIVE );
addItemsToPocketPopup( pSoldier, sPocket, subPopup, IC_GUN, -1, 0, 0); addItemsToPocketPopup( pSoldier, sPocket, subPopup, IC_GUN, -1, 0, 0);
subPopup = popup->addSubMenuOption( new std::wstring( gszPocketPopupText[POCKET_POPUP_MEELE_AND_THROWN] ) ); subPopup = popup->addSubMenuOption( std::wstring( gszPocketPopupText[POCKET_POPUP_MEELE_AND_THROWN] ) );
popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10, popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,
10, 10,
POPUP_POSITION_RELATIVE ); POPUP_POSITION_RELATIVE );
@@ -2286,7 +2286,7 @@ void addAmmoToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup )
{ {
UINT8 ammoFound = 0; UINT8 ammoFound = 0;
POPUP_OPTION * o = popup->addOption( &std::wstring( Item[ (*gun)->usItem ].szItemName ), NULL ); POPUP_OPTION * o = popup->addOption( std::wstring( Item[ (*gun)->usItem ].szItemName ), NULL );
o->color_shade = COLOR_LTGREY; o->color_shade = COLOR_LTGREY;
//o->color_background = COLOR_LTGREY; //o->color_background = COLOR_LTGREY;
@@ -2335,7 +2335,7 @@ void addAmmoToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup )
static CHAR16 pStr[ 100 ]; static CHAR16 pStr[ 100 ];
swprintf( pStr, L"%s (%d)", Item[loop].szItemName,capacity ); swprintf( pStr, L"%s (%d)", Item[loop].szItemName,capacity );
popup->addOption( &std::wstring( pStr ), new popupCallbackFunction3<void,UINT16,UINT16,SOLDIERTYPE*>(&popupCallbackAmmo,loop,sPocket,pSoldier) ); popup->addOption( std::wstring( pStr ), new popupCallbackFunction3<void,UINT16,UINT16,SOLDIERTYPE*>(&popupCallbackAmmo,loop,sPocket,pSoldier) );
} // found ammo crate, crate matches mag } // found ammo crate, crate matches mag
} // inv loop } // inv loop
@@ -2344,7 +2344,7 @@ void addAmmoToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup )
} // mag loop } // mag loop
if (!ammoFound){ if (!ammoFound){
POPUP_OPTION * o = popup->addOption( &std::wstring( gszPocketPopupText[POCKET_POPUP_NO_AMMO] ), NULL ); POPUP_OPTION * o = popup->addOption( std::wstring( gszPocketPopupText[POCKET_POPUP_NO_AMMO] ), NULL );
o->color_shade = COLOR_RED; o->color_shade = COLOR_RED;
} }
@@ -2354,7 +2354,7 @@ void addAmmoToPocketPopup( SOLDIERTYPE *pSoldier, INT16 sPocket, POPUP* popup )
} // found guns } // found guns
else else
{ {
POPUP_OPTION * o = popup->addOption( &std::wstring( gszPocketPopupText[POCKET_POPUP_NO_GUNS] ), NULL ); POPUP_OPTION * o = popup->addOption( std::wstring( gszPocketPopupText[POCKET_POPUP_NO_GUNS] ), NULL );
o->color_shade = COLOR_RED; o->color_shade = COLOR_RED;
} }
} }
@@ -2427,31 +2427,31 @@ void PocketPopupFull( SOLDIERTYPE *pSoldier, INT16 sPocket ){
POPUP * subPopup = NULL; POPUP * subPopup = NULL;
subPopup = popup->addSubMenuOption( new std::wstring( iEditorItemsToolbarText[0]/*Weapons*/ ) ); subPopup = popup->addSubMenuOption( std::wstring( iEditorItemsToolbarText[0]/*Weapons*/ ) );
popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE ); popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE );
addWeaponGroupsToPocketPopup( pSoldier, sPocket, subPopup ); addWeaponGroupsToPocketPopup( pSoldier, sPocket, subPopup );
subPopup = popup->addSubMenuOption( new std::wstring( BobbyRText[BOBBYR_GUNS_AMMO]/*Ammo*/ ) ); subPopup = popup->addSubMenuOption( std::wstring( BobbyRText[BOBBYR_GUNS_AMMO]/*Ammo*/ ) );
popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE ); popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE );
addAmmoToPocketPopup( pSoldier, sPocket, subPopup ); addAmmoToPocketPopup( pSoldier, sPocket, subPopup );
subPopup = popup->addSubMenuOption( new std::wstring( BobbyRText[BOBBYR_GUNS_ARMOR]/*Amour*/ ) ); subPopup = popup->addSubMenuOption( std::wstring( BobbyRText[BOBBYR_GUNS_ARMOR]/*Amour*/ ) );
popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE ); popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE );
addArmorToPocketPopup( pSoldier, sPocket, subPopup ); addArmorToPocketPopup( pSoldier, sPocket, subPopup );
subPopup = popup->addSubMenuOption( new std::wstring( BobbyRFilter[BOBBYR_FILTER_USED_LBEGEAR] /*"LBE"*/) ); subPopup = popup->addSubMenuOption( std::wstring( BobbyRFilter[BOBBYR_FILTER_USED_LBEGEAR] /*"LBE"*/) );
popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE ); popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE );
addLBEToPocketPopup( pSoldier, sPocket, subPopup ); addLBEToPocketPopup( pSoldier, sPocket, subPopup );
subPopup = popup->addSubMenuOption( new std::wstring( BobbyRFilter[BOBBYR_FILTER_MISC_GRENADE]/*Grenades*/ ) ); subPopup = popup->addSubMenuOption( std::wstring( BobbyRFilter[BOBBYR_FILTER_MISC_GRENADE]/*Grenades*/ ) );
popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE ); popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE );
addGrenadesToPocketPopup( pSoldier, sPocket, subPopup ); addGrenadesToPocketPopup( pSoldier, sPocket, subPopup );
subPopup = popup->addSubMenuOption( new std::wstring( BobbyRFilter[BOBBYR_FILTER_MISC_BOMB] ) ); subPopup = popup->addSubMenuOption( std::wstring( BobbyRFilter[BOBBYR_FILTER_MISC_BOMB] ) );
popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE ); popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE );
addBombsToPocketPopup( pSoldier, sPocket, subPopup ); addBombsToPocketPopup( pSoldier, sPocket, subPopup );
subPopup = popup->addSubMenuOption( new std::wstring( BobbyRFilter[BOBBYR_FILTER_MISC_FACE] ) ); subPopup = popup->addSubMenuOption( std::wstring( BobbyRFilter[BOBBYR_FILTER_MISC_FACE] ) );
popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE ); popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE );
addFaceGearToPocketPopup( pSoldier, sPocket, subPopup ); addFaceGearToPocketPopup( pSoldier, sPocket, subPopup );
@@ -2529,7 +2529,7 @@ void PocketPopupDefault( SOLDIERTYPE *pSoldier, INT16 sPocket ){
// default for LBE slots - grenades + ammo for merc's guns // default for LBE slots - grenades + ammo for merc's guns
addAmmoToPocketPopup( pSoldier, sPocket, popup ); addAmmoToPocketPopup( pSoldier, sPocket, popup );
POPUP * subPopup = popup->addSubMenuOption( new std::wstring( BobbyRFilter[28]/*Grenades*/ ) ); POPUP * subPopup = popup->addSubMenuOption( std::wstring( BobbyRFilter[28]/*Grenades*/ ) );
popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE ); popup->getSubPopupOption( popup->subPopupOptionCount-1 )->setPopupPosition( 10,10,POPUP_POSITION_RELATIVE );
addGrenadesToPocketPopup( pSoldier, sPocket, subPopup ); addGrenadesToPocketPopup( pSoldier, sPocket, subPopup );
} else { } else {
@@ -5912,7 +5912,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex)
if (showAttachmentPopups) if (showAttachmentPopups)
{ // add the current attachment to the popup assigned to this attachment slot { // add the current attachment to the popup assigned to this attachment slot
POPUP_OPTION * o = new POPUP_OPTION( &std::wstring( Item[ usAttachment ].szItemName ), POPUP_OPTION * o = new POPUP_OPTION( std::wstring( Item[ usAttachment ].szItemName ),
new popupCallbackFunction<void,UINT16>(&popupCallbackItem,usAttachment)); new popupCallbackFunction<void,UINT16>(&popupCallbackItem,usAttachment));
gPopupAttachmentInfos.push_back(new PopupAttachmentInfo(usAttachment, pObject, ubStatusIndex, slotCount, o, gItemDescAttachmentPopups[slotCount])); gPopupAttachmentInfos.push_back(new PopupAttachmentInfo(usAttachment, pObject, ubStatusIndex, slotCount, o, gItemDescAttachmentPopups[slotCount]));
@@ -5921,7 +5921,7 @@ void UpdateAttachmentTooltips(OBJECTTYPE *pObject, UINT8 ubStatusIndex)
o->setAvail(new popupCallbackFunction<bool, PopupAttachmentInfo*>(&popupCallbackItemInSector, (gPopupAttachmentInfos.back()))); o->setAvail(new popupCallbackFunction<bool, PopupAttachmentInfo*>(&popupCallbackItemInSector, (gPopupAttachmentInfos.back())));
if (loop == 11 && attachList.size() > 11){ // if there's too much stuff to list, we create a subpopup for the rest if (loop == 11 && attachList.size() > 11){ // if there's too much stuff to list, we create a subpopup for the rest
gItemDescAttachmentPopups[slotCount]->addSubMenuOption( &std::wstring(L"More...") ); gItemDescAttachmentPopups[slotCount]->addSubMenuOption( std::wstring(L"More...") );
POPUP_SUB_POPUP_OPTION * tmp = gItemDescAttachmentPopups[slotCount]->getSubPopupOption(0); POPUP_SUB_POPUP_OPTION * tmp = gItemDescAttachmentPopups[slotCount]->getSubPopupOption(0);
// positioning sub popups is handled through the option that holds them // positioning sub popups is handled through the option that holds them
@@ -13410,7 +13410,7 @@ void ItemDescTransformRegionCallback( MOUSE_REGION *pRegion, INT32 reason )
if ((*gpItemDescObject)[0]->data.gun.bGunAmmoStatus < 0) if ((*gpItemDescObject)[0]->data.gun.bGunAmmoStatus < 0)
{ {
// Add option // Add option
POPUP_OPTION *pOption = new POPUP_OPTION(&std::wstring( L"Unjam" ), new popupCallbackFunction<void,void>( &TransformationMenuPopup_Unjam )); POPUP_OPTION *pOption = new POPUP_OPTION(std::wstring( L"Unjam" ), new popupCallbackFunction<void,void>( &TransformationMenuPopup_Unjam ));
gItemDescTransformPopup->addOption( *pOption ); gItemDescTransformPopup->addOption( *pOption );
fFoundTransformations = true; fFoundTransformations = true;
} }
@@ -13463,7 +13463,7 @@ void ItemDescTransformRegionCallback( MOUSE_REGION *pRegion, INT32 reason )
CHAR16 MenuRowText[300]; CHAR16 MenuRowText[300];
swprintf( MenuRowText, gzTransformationMessage[ 7 ], usMagSize ); swprintf( MenuRowText, gzTransformationMessage[ 7 ], usMagSize );
// Generate a new option for the menu // Generate a new option for the menu
POPUP_OPTION *pOption = new POPUP_OPTION(&std::wstring( MenuRowText ), new popupCallbackFunction<void,UINT16>( TransformationMenuPopup_SplitCrate, x ) ); POPUP_OPTION *pOption = new POPUP_OPTION(std::wstring( MenuRowText ), new popupCallbackFunction<void,UINT16>( TransformationMenuPopup_SplitCrate, x ) );
// Add the option to the menu. // Add the option to the menu.
gItemDescTransformPopup->addOption( *pOption ); gItemDescTransformPopup->addOption( *pOption );
// Set this flag so we know we have at least one Transformation available. // Set this flag so we know we have at least one Transformation available.
@@ -13474,7 +13474,7 @@ void ItemDescTransformRegionCallback( MOUSE_REGION *pRegion, INT32 reason )
} }
else else
{ {
POPUP_OPTION *pOption = new POPUP_OPTION(&std::wstring( gzTransformationMessage[ 6 ] ), new popupCallbackFunction<void,void>( TransformationMenuPopup_SplitCrateInInventory ) ); POPUP_OPTION *pOption = new POPUP_OPTION(std::wstring( gzTransformationMessage[ 6 ] ), new popupCallbackFunction<void,void>( TransformationMenuPopup_SplitCrateInInventory ) );
gItemDescTransformPopup->addOption( *pOption ); gItemDescTransformPopup->addOption( *pOption );
fFoundTransformations = true; fFoundTransformations = true;
} }
@@ -13527,7 +13527,7 @@ void ItemDescTransformRegionCallback( MOUSE_REGION *pRegion, INT32 reason )
} }
// Generate a new option for the menu // Generate a new option for the menu
POPUP_OPTION *pOption = new POPUP_OPTION(&std::wstring( MenuRowText ), new popupCallbackFunction<void, OBJECTTYPE*>( &TransformationMenuPopup_Arm, gpItemDescObject ) ); POPUP_OPTION *pOption = new POPUP_OPTION(std::wstring( MenuRowText ), new popupCallbackFunction<void, OBJECTTYPE*>( &TransformationMenuPopup_Arm, gpItemDescObject ) );
// Set the function that tests whether it's valid at the moment. // Set the function that tests whether it's valid at the moment.
pOption->setAvail(new popupCallbackFunction<bool,OBJECTTYPE*>( &TransformationMenuPopup_Arm_TestValid, gpItemDescObject )); pOption->setAvail(new popupCallbackFunction<bool,OBJECTTYPE*>( &TransformationMenuPopup_Arm_TestValid, gpItemDescObject ));
// Add the option to the menu. // Add the option to the menu.
@@ -13553,7 +13553,7 @@ void ItemDescTransformRegionCallback( MOUSE_REGION *pRegion, INT32 reason )
} }
// Generate a new option for the menu // Generate a new option for the menu
POPUP_OPTION *pOption = new POPUP_OPTION(&std::wstring( MenuRowText ), new popupCallbackFunction<void, OBJECTTYPE*>( &TransformationMenuPopup_Arm, gpItemDescObject ) ); POPUP_OPTION *pOption = new POPUP_OPTION(std::wstring( MenuRowText ), new popupCallbackFunction<void, OBJECTTYPE*>( &TransformationMenuPopup_Arm, gpItemDescObject ) );
// Set the function that tests whether it's valid at the moment. // Set the function that tests whether it's valid at the moment.
pOption->setAvail(new popupCallbackFunction<bool,OBJECTTYPE*>( &TransformationMenuPopup_Arm_TestValid, gpItemDescObject )); pOption->setAvail(new popupCallbackFunction<bool,OBJECTTYPE*>( &TransformationMenuPopup_Arm_TestValid, gpItemDescObject ));
// Add the option to the menu. // Add the option to the menu.
@@ -13591,7 +13591,7 @@ void ItemDescTransformRegionCallback( MOUSE_REGION *pRegion, INT32 reason )
} }
// Add option // Add option
POPUP_OPTION *pOption = new POPUP_OPTION(&std::wstring( MenuRowText ), new popupCallbackFunction<void,void>( &TransformationMenuPopup_DelayedGrenadeExplosion )); POPUP_OPTION *pOption = new POPUP_OPTION(std::wstring( MenuRowText ), new popupCallbackFunction<void,void>( &TransformationMenuPopup_DelayedGrenadeExplosion ));
pOption->setAvail(new popupCallbackFunction<bool,OBJECTTYPE*>( &TransformationMenuPopup_DelayedGrenadeExplosion_TestValid, gpItemDescObject )); pOption->setAvail(new popupCallbackFunction<bool,OBJECTTYPE*>( &TransformationMenuPopup_DelayedGrenadeExplosion_TestValid, gpItemDescObject ));
gItemDescTransformPopup->addOption( *pOption ); gItemDescTransformPopup->addOption( *pOption );
fFoundTransformations = true; fFoundTransformations = true;
@@ -13618,7 +13618,7 @@ void ItemDescTransformRegionCallback( MOUSE_REGION *pRegion, INT32 reason )
} }
// Generate a new option for the menu // Generate a new option for the menu
POPUP_OPTION *pOption = new POPUP_OPTION(&std::wstring( MenuRowText ), new popupCallbackFunction<void,TransformInfoStruct*>( &TransformationMenuPopup_Transform, &Transform[x] ) ); POPUP_OPTION *pOption = new POPUP_OPTION(std::wstring( MenuRowText ), new popupCallbackFunction<void,TransformInfoStruct*>( &TransformationMenuPopup_Transform, &Transform[x] ) );
// Set the function that tests whether it's valid at the moment. // Set the function that tests whether it's valid at the moment.
pOption->setAvail(new popupCallbackFunction<bool,TransformInfoStruct*>( &TransformationMenuPopup_TestValid, &Transform[x] )); pOption->setAvail(new popupCallbackFunction<bool,TransformInfoStruct*>( &TransformationMenuPopup_TestValid, &Transform[x] ));
// Add the option to the menu. // Add the option to the menu.
@@ -13632,7 +13632,7 @@ void ItemDescTransformRegionCallback( MOUSE_REGION *pRegion, INT32 reason )
if (!fFoundTransformations) if (!fFoundTransformations)
{ {
POPUP_OPTION * pOption = new POPUP_OPTION( &std::wstring( gzTransformationMessage[ 0 ] ), new popupCallbackFunction<void,TransformInfoStruct*>( &TransformationMenuPopup_Transform, NULL ) ); POPUP_OPTION * pOption = new POPUP_OPTION( std::wstring( gzTransformationMessage[ 0 ] ), new popupCallbackFunction<void,TransformInfoStruct*>( &TransformationMenuPopup_Transform, NULL ) );
pOption->setAvail(new popupCallbackFunction<bool,TransformInfoStruct*>( &TransformationMenuPopup_TestValid, NULL )); pOption->setAvail(new popupCallbackFunction<bool,TransformInfoStruct*>( &TransformationMenuPopup_TestValid, NULL ));
gItemDescTransformPopup->addOption( *pOption ); gItemDescTransformPopup->addOption( *pOption );
} }
+35 -35
View File
@@ -164,11 +164,11 @@ TraitSelection::Setup( UINT32 aVal )
if (traitarray[i] == AUTOBANDAGESKILLS) if (traitarray[i] == AUTOBANDAGESKILLS)
{ {
pOption = new POPUP_OPTION(&std::wstring(pStr), new popupCallbackFunction<void, UINT32>(&Wrapper_Setup_AutobandageSelection, traitarray[i])); pOption = new POPUP_OPTION(std::wstring(pStr), new popupCallbackFunction<void, UINT32>(&Wrapper_Setup_AutobandageSelection, traitarray[i]));
} }
else else
{ {
pOption = new POPUP_OPTION(&std::wstring(pStr), new popupCallbackFunction<void, UINT32>(&Wrapper_Setup_SkillSelection, traitarray[i])); pOption = new POPUP_OPTION(std::wstring(pStr), new popupCallbackFunction<void, UINT32>(&Wrapper_Setup_SkillSelection, traitarray[i]));
} }
// if we cannot perform this skill, grey it out // if we cannot perform this skill, grey it out
@@ -183,7 +183,7 @@ TraitSelection::Setup( UINT32 aVal )
// cancel option // cancel option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_TraitSelection, 0 ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_TraitSelection, 0 ) );
GetPopup()->addOption( *pOption ); GetPopup()->addOption( *pOption );
// grab soldier's x,y screen position // grab soldier's x,y screen position
@@ -243,11 +243,11 @@ SkillSelection::Setup( UINT32 aVal )
swprintf( pStr, pTraitSkillsMenuStrings[uiCounter] ); swprintf( pStr, pTraitSkillsMenuStrings[uiCounter] );
if ( uiCounter == SKILLS_RADIO_ARTILLERY) if ( uiCounter == SKILLS_RADIO_ARTILLERY)
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Setup_ArtillerySector, uiCounter ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Setup_ArtillerySector, uiCounter ) );
else if ( uiCounter == SKILLS_RADIO_CALLREINFORCEMENTS) else if ( uiCounter == SKILLS_RADIO_CALLREINFORCEMENTS)
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Setup_ReinforcementSector, uiCounter ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Setup_ReinforcementSector, uiCounter ) );
else else
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Function_SkillSelection, uiCounter ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Function_SkillSelection, uiCounter ) );
// if we cannot perform this skill, grey it out // if we cannot perform this skill, grey it out
if ( !(pSoldier->CanUseSkill(uiCounter, TRUE)) ) if ( !(pSoldier->CanUseSkill(uiCounter, TRUE)) )
@@ -267,7 +267,7 @@ SkillSelection::Setup( UINT32 aVal )
{ {
swprintf( pStr, pTraitSkillsMenuStrings[uiCounter] ); swprintf( pStr, pTraitSkillsMenuStrings[uiCounter] );
pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_SkillSelection, uiCounter ) ); pOption = new POPUP_OPTION( std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_SkillSelection, uiCounter ) );
// if we cannot perform this skill, grey it out // if we cannot perform this skill, grey it out
if ( !( pSoldier->CanUseSkill( uiCounter, TRUE, sTraitsMenuTargetGridNo ) ) ) if ( !( pSoldier->CanUseSkill( uiCounter, TRUE, sTraitsMenuTargetGridNo ) ) )
@@ -287,7 +287,7 @@ SkillSelection::Setup( UINT32 aVal )
{ {
swprintf( pStr, pTraitSkillsMenuStrings[uiCounter] ); swprintf( pStr, pTraitSkillsMenuStrings[uiCounter] );
pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_SkillSelection, uiCounter ) ); pOption = new POPUP_OPTION( std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_SkillSelection, uiCounter ) );
// if we cannot perform this skill, grey it out // if we cannot perform this skill, grey it out
if ( !( pSoldier->CanUseSkill( uiCounter, TRUE, sTraitsMenuTargetGridNo ) ) ) if ( !( pSoldier->CanUseSkill( uiCounter, TRUE, sTraitsMenuTargetGridNo ) ) )
@@ -308,9 +308,9 @@ SkillSelection::Setup( UINT32 aVal )
swprintf( pStr, pTraitSkillsMenuStrings[uiCounter] ); swprintf( pStr, pTraitSkillsMenuStrings[uiCounter] );
if ( uiCounter == SKILLS_DRAG ) if ( uiCounter == SKILLS_DRAG )
pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Setup_DragSelection, uiCounter ) ); pOption = new POPUP_OPTION( std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Setup_DragSelection, uiCounter ) );
else else
pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_SkillSelection, uiCounter ) ); pOption = new POPUP_OPTION( std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_SkillSelection, uiCounter ) );
// if we cannot perform this skill, grey it out // if we cannot perform this skill, grey it out
if ( !(pSoldier->CanUseSkill( uiCounter, TRUE, sTraitsMenuTargetGridNo )) ) if ( !(pSoldier->CanUseSkill( uiCounter, TRUE, sTraitsMenuTargetGridNo )) )
@@ -334,7 +334,7 @@ SkillSelection::Setup( UINT32 aVal )
// cancel option // cancel option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_SkillSelection, 0 ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_SkillSelection, 0 ) );
GetPopup()->addOption( *pOption ); GetPopup()->addOption( *pOption );
} }
@@ -446,7 +446,7 @@ ArtillerySector::Setup( UINT32 aVal )
swprintf( pStr, L"%c%d", loopY + 'A' - 1, loopX ); swprintf( pStr, L"%c%d", loopY + 'A' - 1, loopX );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Setup_ArtilleryTeam, sectornr ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Setup_ArtilleryTeam, sectornr ) );
// grey out if no artillery can be called from this sector // grey out if no artillery can be called from this sector
if ( !IsValidArtilleryOrderSector( loopX, loopY, pSoldier->bSectorZ, pSoldier->bTeam ) && !IsValidArtilleryOrderSector( loopX, loopY, pSoldier->bSectorZ, MILITIA_TEAM ) ) if ( !IsValidArtilleryOrderSector( loopX, loopY, pSoldier->bSectorZ, pSoldier->bTeam ) && !IsValidArtilleryOrderSector( loopX, loopY, pSoldier->bSectorZ, MILITIA_TEAM ) )
@@ -459,7 +459,7 @@ ArtillerySector::Setup( UINT32 aVal )
// cancel option // cancel option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_ArtillerySector, 0 ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_ArtillerySector, 0 ) );
GetPopup()->addOption( *pOption ); GetPopup()->addOption( *pOption );
// certain traits have skills whose effects depend on wether someone is near to us (squadleader, commissar). We therefore display our radius of effect while this display is open // certain traits have skills whose effects depend on wether someone is near to us (squadleader, commissar). We therefore display our radius of effect while this display is open
@@ -503,7 +503,7 @@ ArtilleryTeam::Setup( UINT32 aVal )
// order artillery from militia // order artillery from militia
swprintf( pStr, pSkillMenuStrings[SKILLMENU_MILITIA] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_MILITIA] );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ArtilleryTeam, MILITIA_TEAM ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ArtilleryTeam, MILITIA_TEAM ) );
// grey out if no ArtilleryTeam can be called from this sector // grey out if no ArtilleryTeam can be called from this sector
if ( !IsValidArtilleryOrderSector( sSectorX, sSectorY, pSoldier->bSectorZ, MILITIA_TEAM ) ) if ( !IsValidArtilleryOrderSector( sSectorX, sSectorY, pSoldier->bSectorZ, MILITIA_TEAM ) )
@@ -516,7 +516,7 @@ ArtilleryTeam::Setup( UINT32 aVal )
// order artillery from our mercs // order artillery from our mercs
swprintf( pStr, pSkillMenuStrings[SKILLMENU_OTHERSQUADS] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_OTHERSQUADS] );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, INT8>( &Wrapper_Function_ArtilleryTeam, pSoldier->bTeam ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void, INT8>( &Wrapper_Function_ArtilleryTeam, pSoldier->bTeam ) );
// grey out if no ArtilleryTeam can be called from this sector // grey out if no ArtilleryTeam can be called from this sector
if ( !IsValidArtilleryOrderSector( sSectorX, sSectorY, pSoldier->bSectorZ, pSoldier->bTeam ) ) if ( !IsValidArtilleryOrderSector( sSectorX, sSectorY, pSoldier->bSectorZ, pSoldier->bTeam ) )
@@ -528,7 +528,7 @@ ArtilleryTeam::Setup( UINT32 aVal )
// cancel option // cancel option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_ArtilleryTeam, 0 ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_ArtilleryTeam, 0 ) );
GetPopup()->addOption( *pOption ); GetPopup()->addOption( *pOption );
// certain traits have skills whose effects depend on wether someone is near to us (squadleader, commissar). We therefore display our radius of effect while this display is open // certain traits have skills whose effects depend on wether someone is near to us (squadleader, commissar). We therefore display our radius of effect while this display is open
@@ -604,7 +604,7 @@ ReinforcementSector::Setup( UINT32 aVal )
swprintf( pStr, L"%c%d", loopY + 'A' - 1, loopX ); swprintf( pStr, L"%c%d", loopY + 'A' - 1, loopX );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Setup_ReinforcementNumber, sectornr ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Setup_ReinforcementNumber, sectornr ) );
// grey out if no reinforcements can be called from this sector // grey out if no reinforcements can be called from this sector
if ( !CanRequestMilitiaReinforcements( pSoldier->sSectorX, pSoldier->sSectorY, loopX, loopY ) ) if ( !CanRequestMilitiaReinforcements( pSoldier->sSectorX, pSoldier->sSectorY, loopX, loopY ) )
@@ -617,7 +617,7 @@ ReinforcementSector::Setup( UINT32 aVal )
// cancel option // cancel option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Cancel_ReinforcementSector, 0 ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Cancel_ReinforcementSector, 0 ) );
GetPopup()->addOption( *pOption ); GetPopup()->addOption( *pOption );
} }
@@ -653,7 +653,7 @@ ReinforcementNumber::Setup( UINT32 aVal )
// 5 militia option // 5 militia option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 5 ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 5 );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, 5 ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, 5 ) );
if ( numberofmilitia < 5 ) if ( numberofmilitia < 5 )
{ {
@@ -665,7 +665,7 @@ ReinforcementNumber::Setup( UINT32 aVal )
// 10 militia option // 10 militia option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 10 ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 10 );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, 10 ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, 10 ) );
if ( numberofmilitia < 10 ) if ( numberofmilitia < 10 )
{ {
@@ -677,7 +677,7 @@ ReinforcementNumber::Setup( UINT32 aVal )
// 15 militia option // 15 militia option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 15 ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 15 );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, 15 ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, 15 ) );
if ( numberofmilitia < 15 ) if ( numberofmilitia < 15 )
{ {
@@ -689,7 +689,7 @@ ReinforcementNumber::Setup( UINT32 aVal )
// 20 militia option // 20 militia option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 20 ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 20 );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, 20 ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, 20 ) );
if ( numberofmilitia < 20 ) if ( numberofmilitia < 20 )
{ {
@@ -699,7 +699,7 @@ ReinforcementNumber::Setup( UINT32 aVal )
// 30 militia option // 30 militia option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 30 ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 30 );
pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, 30 ) ); pOption = new POPUP_OPTION( std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, 30 ) );
if ( numberofmilitia < 30 ) if ( numberofmilitia < 30 )
{ {
@@ -709,7 +709,7 @@ ReinforcementNumber::Setup( UINT32 aVal )
// 40 militia option // 40 militia option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 40 ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_X_MILITIA], 40 );
pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, 40 ) ); pOption = new POPUP_OPTION( std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, 40 ) );
if ( numberofmilitia < 40 ) if ( numberofmilitia < 40 )
{ {
@@ -722,12 +722,12 @@ ReinforcementNumber::Setup( UINT32 aVal )
// all militia option // all militia option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_ALL_MILITIA] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_ALL_MILITIA] );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, numberofmilitia ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_ReinforcementNumber, numberofmilitia ) );
GetPopup()->addOption( *pOption ); GetPopup()->addOption( *pOption );
// cancel option // cancel option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Cancel_ReinforcementNumber, 0 ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Cancel_ReinforcementNumber, 0 ) );
GetPopup()->addOption( *pOption ); GetPopup()->addOption( *pOption );
} }
@@ -794,7 +794,7 @@ SoldierSelection::Setup( UINT32 aVal )
{ {
swprintf( pStr, L"%s", id->GetName() ); swprintf( pStr, L"%s", id->GetName() );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void, UINT16>( &Wrapper_Function_SoldierSelection, id ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void, UINT16>( &Wrapper_Function_SoldierSelection, id ) );
// grey out if no artillery can be called from this sector // grey out if no artillery can be called from this sector
if ( 0 ) if ( 0 )
@@ -809,7 +809,7 @@ SoldierSelection::Setup( UINT32 aVal )
// cancel option // cancel option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_SoldierSelection, 0 ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_SoldierSelection, 0 ) );
GetPopup()->addOption( *pOption ); GetPopup()->addOption( *pOption );
} }
@@ -871,7 +871,7 @@ DragSelection::Setup( UINT32 aVal )
{ {
swprintf( pStr, L"%s", cnt->GetName( ) ); swprintf( pStr, L"%s", cnt->GetName( ) );
pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_DragSelection, cnt ) ); pOption = new POPUP_OPTION( std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_DragSelection, cnt ) );
GetPopup( )->addOption( *pOption ); GetPopup( )->addOption( *pOption );
} }
@@ -887,7 +887,7 @@ DragSelection::Setup( UINT32 aVal )
swprintf( pStr, pSkillMenuStrings[SKILLMENU_CORPSES], pCorpse->name ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_CORPSES], pCorpse->name );
// we have to use an offset of NOBODY in order to differentiate between person and corpse // we have to use an offset of NOBODY in order to differentiate between person and corpse
pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_DragSelection, (*it) + NOBODY ) ); pOption = new POPUP_OPTION( std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_DragSelection, (*it) + NOBODY ) );
GetPopup( )->addOption( *pOption ); GetPopup( )->addOption( *pOption );
} }
@@ -914,7 +914,7 @@ DragSelection::Setup( UINT32 aVal )
swprintf(pStr, L"%s (%s)", buf, FaceDirs[gOneCDirection[ubDirection]]); swprintf(pStr, L"%s (%s)", buf, FaceDirs[gOneCDirection[ubDirection]]);
// we have to use an offset of NOBODY in order to differentiate between person and corpse // we have to use an offset of NOBODY in order to differentiate between person and corpse
pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_DragSelection_GridNo, sTempGridNo ) ); pOption = new POPUP_OPTION( std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_DragSelection_GridNo, sTempGridNo ) );
GetPopup()->addOption( *pOption ); GetPopup()->addOption( *pOption );
} }
@@ -923,7 +923,7 @@ DragSelection::Setup( UINT32 aVal )
// cancel option // cancel option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] );
pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Cancel_DragSelection, 0 ) ); pOption = new POPUP_OPTION( std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Cancel_DragSelection, 0 ) );
GetPopup( )->addOption( *pOption ); GetPopup( )->addOption( *pOption );
} }
@@ -1052,7 +1052,7 @@ EquipmentSelection::Setup(UINT32 aVal)
int nChars = MultiByteToWideChar( CP_ACP, 0, coca, -1, NULL, 0 ); int nChars = MultiByteToWideChar( CP_ACP, 0, coca, -1, NULL, 0 );
MultiByteToWideChar( CP_UTF8, 0, coca, -1, tmpchar, nChars ); MultiByteToWideChar( CP_UTF8, 0, coca, -1, tmpchar, nChars );
pOption = new POPUP_OPTION( &std::wstring( tmpchar ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_EquipmentSelection, i ) ); pOption = new POPUP_OPTION( std::wstring( tmpchar ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_EquipmentSelection, i ) );
pOption->color_foreground = FONT_GREEN; pOption->color_foreground = FONT_GREEN;
@@ -1063,13 +1063,13 @@ EquipmentSelection::Setup(UINT32 aVal)
if ( gEquipmentSelectionMaxEntriesShown < gTemplateVector.size( ) ) if ( gEquipmentSelectionMaxEntriesShown < gTemplateVector.size( ) )
{ {
swprintf( pStr, pSkillMenuStrings[SKILLMENU_MORE] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_MORE] );
pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_EquipmentSelection, 99999 ) ); pOption = new POPUP_OPTION( std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_EquipmentSelection, 99999 ) );
GetPopup( )->addOption( *pOption ); GetPopup( )->addOption( *pOption );
} }
// cancel option // cancel option
swprintf(pStr, pSkillMenuStrings[SKILLMENU_CANCEL]); swprintf(pStr, pSkillMenuStrings[SKILLMENU_CANCEL]);
pOption = new POPUP_OPTION( &std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_EquipmentSelection, 99998 ) ); pOption = new POPUP_OPTION( std::wstring( pStr ), new popupCallbackFunction<void, UINT32>( &Wrapper_Function_EquipmentSelection, 99998 ) );
GetPopup()->addOption(*pOption); GetPopup()->addOption(*pOption);
SetPos(usTraitMenuPosX, usTraitMenuPosY); SetPos(usTraitMenuPosX, usTraitMenuPosY);
+2 -2
View File
@@ -81,7 +81,7 @@ VehicleSelection::Setup( UINT32 aVal )
{ {
swprintf( pStr, gNewVehicle[ pVehicleList[ bVehicleID ].ubVehicleType ].VehicleSeats[i].zSeatName ); swprintf( pStr, gNewVehicle[ pVehicleList[ bVehicleID ].ubVehicleType ].VehicleSeats[i].zSeatName );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Function_VehicleSelection, i )); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Function_VehicleSelection, i ));
// if seat is already taken, grey it out // if seat is already taken, grey it out
if ( pVehicleList[ bVehicleID ].pPassengers[ i ] != NULL ) if ( pVehicleList[ bVehicleID ].pPassengers[ i ] != NULL )
@@ -125,7 +125,7 @@ VehicleSelection::Setup( UINT32 aVal )
// cancel option // cancel option
swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] ); swprintf( pStr, pSkillMenuStrings[SKILLMENU_CANCEL] );
pOption = new POPUP_OPTION(&std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_VehicleSelection, 0 ) ); pOption = new POPUP_OPTION(std::wstring( pStr ), new popupCallbackFunction<void,UINT32>( &Wrapper_Cancel_VehicleSelection, 0 ) );
GetPopup()->addOption( *pOption ); GetPopup()->addOption( *pOption );
// grab soldier's x,y screen position // grab soldier's x,y screen position
+9 -9
View File
@@ -140,9 +140,9 @@ POPUP_OPTION::~POPUP_OPTION(void)
} }
POPUP_OPTION::POPUP_OPTION(std::wstring *newName, popupCallback * newFunction) POPUP_OPTION::POPUP_OPTION(const std::wstring& newName, popupCallback * newFunction)
{ {
this->name = *newName; this->name = newName;
this->action = newFunction; this->action = newFunction;
this->avail = 0; this->avail = 0;
@@ -161,9 +161,9 @@ POPUP_OPTION::POPUP_OPTION(std::wstring *newName, popupCallback * newFunction)
this->color_shade = FONT_GRAY7 ; this->color_shade = FONT_GRAY7 ;
} }
BOOLEAN POPUP_OPTION::setName( std::wstring * newName ) BOOLEAN POPUP_OPTION::setName( const std::wstring& newName )
{ {
this->name = *newName; this->name = newName;
return TRUE; return TRUE;
} }
@@ -236,19 +236,19 @@ BOOLEAN POPUP_OPTION::forceRun()
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
// constructor // constructor
POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(void) : POPUP_OPTION(new std::wstring(L"Unnamed subPopup"),NULL) //TODO: possible memmory leak! POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(void) : POPUP_OPTION(L"Unnamed subPopup", NULL)
{ {
this->parent = NULL; this->parent = NULL;
this->initSubPopup(); this->initSubPopup();
} }
POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(std::wstring* name) : POPUP_OPTION(name, NULL) POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(const std::wstring& name) : POPUP_OPTION(name, NULL)
{ {
this->parent = NULL; this->parent = NULL;
this->initSubPopup(); this->initSubPopup();
} }
POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(std::wstring* newName, const POPUP * parent) : POPUP_OPTION(newName, NULL) POPUP_SUB_POPUP_OPTION::POPUP_SUB_POPUP_OPTION(const std::wstring& newName, const POPUP * parent) : POPUP_OPTION(newName, NULL)
{ {
this->parent = parent; this->parent = parent;
this->initSubPopup(); this->initSubPopup();
@@ -562,7 +562,7 @@ void POPUP::setInitialValues(void)
// setup functions // setup functions
POPUP_OPTION * POPUP::addOption(std::wstring * name, popupCallback* action) POPUP_OPTION * POPUP::addOption(const std::wstring& name, popupCallback* action)
{ {
if (this->optionCount < POPUP_MAX_OPTIONS) if (this->optionCount < POPUP_MAX_OPTIONS)
{ {
@@ -605,7 +605,7 @@ POPUP_OPTION * POPUP::getOption(UINT16 n)
return NULL; return NULL;
} }
POPUP * POPUP::addSubMenuOption(std::wstring * name) POPUP * POPUP::addSubMenuOption(const std::wstring& name)
{ {
if (this->subPopupOptionCount < POPUP_MAX_SUB_POPUPS) if (this->subPopupOptionCount < POPUP_MAX_SUB_POPUPS)
{ {
+6 -6
View File
@@ -67,10 +67,10 @@
{ {
public: public:
POPUP_OPTION::POPUP_OPTION(void); // default constructor POPUP_OPTION::POPUP_OPTION(void); // default constructor
POPUP_OPTION(std::wstring* name, popupCallback* newFunction); // constructor POPUP_OPTION(const std::wstring& name, popupCallback* newFunction); // constructor
~POPUP_OPTION(); // destructor ~POPUP_OPTION(); // destructor
// setup // setup
BOOLEAN setName(std::wstring * name); BOOLEAN setName(const std::wstring& name);
BOOLEAN setAction(popupCallback*fun); BOOLEAN setAction(popupCallback*fun);
BOOLEAN setAvail(popupCallback *fun); BOOLEAN setAvail(popupCallback *fun);
BOOLEAN setHover(popupCallback *fun); BOOLEAN setHover(popupCallback *fun);
@@ -105,8 +105,8 @@
public: public:
// constructor/destructor // constructor/destructor
POPUP_SUB_POPUP_OPTION(void); POPUP_SUB_POPUP_OPTION(void);
POPUP_SUB_POPUP_OPTION(std::wstring* name); POPUP_SUB_POPUP_OPTION(const std::wstring& name);
POPUP_SUB_POPUP_OPTION(std::wstring* newName, const POPUP * parent); POPUP_SUB_POPUP_OPTION(const std::wstring& newName, const POPUP * parent);
~POPUP_SUB_POPUP_OPTION(); ~POPUP_SUB_POPUP_OPTION();
void showPopup(); void showPopup();
@@ -139,7 +139,7 @@
POPUP(CHAR* name); // constructor POPUP(CHAR* name); // constructor
~POPUP(void); // destructor ~POPUP(void); // destructor
// setup // setup
POPUP_OPTION * addOption(std::wstring * name, popupCallback * action); POPUP_OPTION * addOption(const std::wstring& name, popupCallback * action);
/*INT16 findFreeOptionIndex();*/ /*INT16 findFreeOptionIndex();*/
BOOLEAN addOption(POPUP_OPTION &option); BOOLEAN addOption(POPUP_OPTION &option);
POPUP_OPTION * getOption(UINT16 n); POPUP_OPTION * getOption(UINT16 n);
@@ -147,7 +147,7 @@
BOOLEAN delOption(CHAR* name); // Another index to through and clean, aargh BOOLEAN delOption(CHAR* name); // Another index to through and clean, aargh
BOOLEAN delOption(UINT8 optIndex); BOOLEAN delOption(UINT8 optIndex);
POPUP* addSubMenuOption(std::wstring * name); POPUP* addSubMenuOption(const std::wstring& name);
BOOL addSubMenuOption(POPUP_SUB_POPUP_OPTION* sub); BOOL addSubMenuOption(POPUP_SUB_POPUP_OPTION* sub);
/*INT16 findFreeSubMenuOptionIndex();*/ /*INT16 findFreeSubMenuOptionIndex();*/
POPUP_SUB_POPUP_OPTION * getSubPopupOption(UINT8 n); POPUP_SUB_POPUP_OPTION * getSubPopupOption(UINT8 n);
+3 -3
View File
@@ -108,7 +108,7 @@
POPUP_OPTION * opt = new POPUP_OPTION(); POPUP_OPTION * opt = new POPUP_OPTION();
opt->setName( this->name ); opt->setName( *this->name );
if ( !setPopupDefCallback(opt, this->callbackId) if ( !setPopupDefCallback(opt, this->callbackId)
|| !setPopupDefAvail(opt, this->availId) ) || !setPopupDefAvail(opt, this->availId) )
{ {
@@ -132,7 +132,7 @@
*/ */
BOOL popupDefSubPopupOption::addToBox(POPUP * popup){ BOOL popupDefSubPopupOption::addToBox(POPUP * popup){
POPUP_SUB_POPUP_OPTION * sub = new POPUP_SUB_POPUP_OPTION( this->name ); POPUP_SUB_POPUP_OPTION * sub = new POPUP_SUB_POPUP_OPTION( *this->name );
if( !this->content->applyToBox( sub->subPopup ) ){ if( !this->content->applyToBox( sub->subPopup ) ){
delete sub; delete sub;
@@ -169,7 +169,7 @@
switch(generatorId){ switch(generatorId){
case popupGenerators::dummy: case popupGenerators::dummy:
popup->addOption(new std::wstring( L"Dummy generator" ),NULL); popup->addOption(L"Dummy generator", NULL);
break; break;
case popupGenerators::addArmor: case popupGenerators::addArmor: