nuke all the #if 0's

scripted commit:

find . -not -path '*/.*' -and -not -path '*/ext*' -type d -exec coan source -R -E {} ';'

https://coan2.sourceforge.net/coan_man_1.html
This commit is contained in:
Marco Antonio Jaguaribe Costa
2023-01-19 00:13:08 +02:00
committed by Asdow
parent 6afe785f4b
commit 8b1c4effa0
72 changed files with 0 additions and 6657 deletions
-11
View File
@@ -2205,17 +2205,6 @@ void CreateAutoResolveInterface()
ubGreenMilitia += bonusGreenMilitia;
// This block should be unnecessary. If the counts do not line up, there is a bug.
#if 0
while( ubEliteMilitia + ubRegMilitia + ubGreenMilitia < gpAR->ubCivs )
{
switch( PreRandom( 3 ) )
{
case 0: ubEliteMilitia++; break;
case 1: ubRegMilitia++; break;
case 2: ubGreenMilitia++; break;
}
}
#endif
cnt = 0;
// Add the militia in this sector
-11
View File
@@ -102,17 +102,6 @@ BOOLEAN ExecuteStrategicEvent( STRATEGICEVENT *pEvent )
BOOLEAN bMercDayOne = FALSE;
// BF : file access is bad, especially if a function is called so often.
#if 0
// Kaiden: Opening the INI File
CIniReader iniReader("..\\Ja2_Options.ini");
if(is_networked) memset(&iniReader, 0, sizeof (CIniReader) );//disable ini in mp (taking default values)
//Kaiden: Getting Value for MERC Available on Day one?
// for some reason, this can't be in gamesettings.cpp
// or it won't work.
bMercDayOne = iniReader.ReadBoolean("Options","MERC_DAY_ONE",FALSE);
#endif
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ExecuteStrategicEvent");
if( gGameExternalOptions.gfEnableEmergencyButton_SkipStrategicEvents && _KeyDown( NUM_LOCK ) )
-30
View File
@@ -12786,22 +12786,7 @@ static bool locationStringToCoordinates_AltSector(std::string loc, UINT8* x, UIN
}
// gather column
#if 0
loc = loc.substr(1);
stringstream ss = stringstream();
if (loc[0] >= '0' && loc[0] <= '9')
{
ss << loc[0];
loc = loc.substr(1);
}
if (loc[0] >= '0' && loc[0] <= '9')
{
ss << loc[0];
loc = loc.substr(1);
}
#else
stringstream ss(loc.substr(1));
#endif
int col = 0;
ss >> col;
if (col >= 1 && col <= 16)
@@ -12840,22 +12825,7 @@ static bool locationStringToCoordinates(std::string loc, UINT8* x, UINT8* y, UIN
}
// gather column
#if 0
loc = loc.substr(1);
stringstream ss = stringstream();
if (loc[0] >= '0' && loc[0] <= '9')
{
ss << loc[0];
loc = loc.substr(1);
}
if (loc[0] >= '0' && loc[0] <= '9')
{
ss << loc[0];
loc = loc.substr(1);
}
#else
stringstream ss(loc);
#endif
int col = 0;
ss >> col;
if (col >= 1 && col <= 16)
@@ -1091,24 +1091,8 @@ void SaveSeenAndUnseenItems( void )
//make list of seen items
for ( UINT32 i = 0; i < pInventoryPoolList.size(); i++ )
{
#if 0
if ( pInventoryPoolList[ i ].object.exists() )
{
pInventoryPoolList[ i ].fExists = TRUE;
pInventoryPoolList[ i ].bVisible = TRUE;
//Check
if(TileIsOutOfBounds( pInventoryPoolList[ i ].sGridNo) && !( pInventoryPoolList[ i ].usFlags & WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT ) )
{
pInventoryPoolList[ i ].usFlags |= WORLD_ITEM_GRIDNO_NOT_SET_USE_ENTRY_POINT;
// Display warning.....
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_BETAVERSION, L"Error: Trying to add item ( %d: %s ) to invalid gridno in unloaded sector. Please Report.", pInventoryPoolList[ i ].object.usItem, ItemNames[ pInventoryPoolList[ i ].object.usItem] );
}
#else
if ( pInventoryPoolList[i].fExists )
{
#endif
worldItemsSaveList.push_back(pInventoryPoolList[i]);
iExistingItems++;
}
@@ -3625,45 +3609,6 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot )
{
SOLDIERTYPE *pSoldier = NULL;
static BOOLEAN fItemWasHighLighted = FALSE;
#if 0
if( iCurrentSlot == -1 )
{
giCompatibleItemBaseTime = 0;
}
if( fChangedInventorySlots == TRUE )
{
giCompatibleItemBaseTime = 0;
fChangedInventorySlots = FALSE;
}
// reset the base time to the current game clock
if( giCompatibleItemBaseTime == 0 )
{
giCompatibleItemBaseTime = GetJA2Clock( );
if( fItemWasHighLighted == TRUE )
{
fTeamPanelDirty = TRUE;
fMapPanelDirty = TRUE;
fItemWasHighLighted = FALSE;
}
}
ResetCompatibleItemArray( );
ResetMapSectorInventoryPoolHighLights( );
if( iCurrentSlot == -1 )
{
return;
}
// Check also that we're not beyond the resize.
if (pInventoryPoolList.size() < (UINT32)(iCurrentSlot + ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) ))
{
return;
}
#else
//if same slot then before dont recalculate
if ( !fChangedInventorySlots ) return;
@@ -3689,36 +3634,10 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot )
}
return;
}
#endif
// given this slot value, check if anything in the displayed sector inventory or on the mercs inventory is compatable
if( fShowInventoryFlag )
{
#if 0
// check if any compatable items in the soldier inventory matches with this item
if( gfCheckForCursorOverMapSectorInventoryItem )
{
pSoldier = &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ];
if( pSoldier )
{
if( HandleCompatibleAmmoUIForMapScreen( pSoldier, iCurrentSlot + ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ), TRUE, FALSE ) )
{
if( GetJA2Clock( ) - giCompatibleItemBaseTime > 100 )
{
if( fItemWasHighLighted == FALSE )
{
fTeamPanelDirty = TRUE;
fItemWasHighLighted = TRUE;
}
}
}
}
}
else
{
giCompatibleItemBaseTime = 0;
}
#else
//Soldier inventory is shown, highlight those items
pSoldier = &Menptr[ gCharactersList[ bSelectedInfoChar ].usSolID ];
if( pSoldier )
@@ -3729,40 +3648,17 @@ void HandleMouseInCompatableItemForMapSectorInventory( INT32 iCurrentSlot )
}
fTeamPanelDirty = TRUE;
}
#endif
}
// now handle for the sector inventory
if( fShowMapInventoryPool )
{
#if 0
// check if any compatable items in the soldier inventory matches with this item
if( gfCheckForCursorOverMapSectorInventoryItem )
{
if( HandleCompatibleAmmoUIForMapInventory( pSoldier, iCurrentSlot, ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) , TRUE, FALSE ) )
{
if( GetJA2Clock( ) - giCompatibleItemBaseTime > 100 )
{
if( fItemWasHighLighted == FALSE )
{
fItemWasHighLighted = TRUE;
fMapPanelDirty = TRUE;
}
}
}
}
else
{
giCompatibleItemBaseTime = 0;
}
#else
if( HandleCompatibleAmmoUIForMapInventory( pSoldier, iCurrentSlot, ( iCurrentInventoryPoolPage * MAP_INVENTORY_POOL_SLOT_COUNT ) , TRUE, FALSE ) )
{
fItemWasHighLighted = TRUE;//remember that something is highlighted
}
fMapPanelDirty = TRUE;
#endif
}
fChangedInventorySlots = FALSE;
@@ -3870,79 +3766,11 @@ void CheckGridNoOfItemsInMapScreenMapInventory()
void SortSectorInventory( std::vector<WORLDITEM>& pInventory, UINT32 uiSizeOfArray )
{
#if 0//dnl ch75 011113 return code from v1.12 as current one is terrible slow
//first, compress the inventory by stacking like items that are reachable, while moving empty items towards the back
for (std::vector<WORLDITEM>::iterator iter = pInventory.begin(); iter != pInventory.end(); ++iter) {
//if object exists, we want to try to stack it
if (iter->fExists && iter->object.exists() == true) {
//ADB TODO if it is active and reachable etc, alternatively if it's on the same gridNo
#if 0
if (iter->object.ubNumberOfObjects < ItemSlotLimit( iter->object.usItem, STACK_SIZE_LIMIT )) {
std::vector<WORLDITEM>::iterator second = iter;
for (++second; second != pInventory.end(); ++second) {
if (second->object.usItem == iter->object.usItem
&& second->object.exists() == true) {
iter->object.AddObjectsToStack(second->object, second->object.ubNumberOfObjects);
if (iter->object.ubNumberOfObjects >= ItemSlotLimit( iter->object.usItem, STACK_SIZE_LIMIT )) {
break;
}
}
}
}
#endif
}
else {
//object does not exist, so compress the list
std::vector<WORLDITEM>::iterator second = iter;
for (++second; second != pInventory.end(); ++second) {
if (second->fExists && second->object.exists() == true) {
*iter = *second;
second->initialize();
break;
}
}
if (second == pInventory.end()) {
//we reached the end of the list without finding any active item, so we can break out of this loop too!
break;
}
}
}
//once compressed, we need only sort the existing items
//all empty items should be at the back!!!
std::vector<WORLDITEM>::iterator endSort = pInventory.begin();
for (unsigned int x = 1; x < pInventory.size(); ++x) {
if (pInventory[x].fExists && pInventory[x].object.exists() == true) {
++endSort;
}
else {
break;
}
}
++endSort;
//ADB I'm not sure qsort will work with OO data, so replace it with stl sort, which is faster anyways
std::sort(pInventory.begin(), endSort);
//then compress it by removing the empty objects, we know they are at the back
//we want the size to equal x * MAP_INVENTORY_POOL_SLOT_COUNT
for (unsigned int x = 1; x <= pInventory.size() / MAP_INVENTORY_POOL_SLOT_COUNT && pInventory.size() > x * MAP_INVENTORY_POOL_SLOT_COUNT; ++x) {
if (pInventory[x * MAP_INVENTORY_POOL_SLOT_COUNT].fExists == false
&& pInventory[x * MAP_INVENTORY_POOL_SLOT_COUNT].object.exists() == false) {
//we have found a page where the first item on the page does not exist, resize to this
//we may have just cut off a blank page leaving the previous page full with no place to put
//any new objects, but ResizeInventoryList after this will take care of that.
pInventory.resize(x * MAP_INVENTORY_POOL_SLOT_COUNT);
}
}
#else
#if _ITERATOR_DEBUG_LEVEL > 1//dnl ch75 061113 under debug VS2010 throws exceptions after qsort but not under VS2005 and VS2008, all release version seems to work fine
std::sort(pInventory.begin(), pInventory.begin() + uiSizeOfArray);
#else
qsort((LPVOID)&pInventory.front(), (size_t)uiSizeOfArray, sizeof(WORLDITEM), MapScreenSectorInventoryCompare);
#endif
#endif
}
INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2)
@@ -3955,31 +3783,10 @@ INT32 MapScreenSectorInventoryCompare( const void *pNum1, const void *pNum2)
UINT16 ubItem2Quality;
//dnl ch75 071113 without below fix sort will create mess when use empty slots because fExists remain TRUE after item is removed from inventory so decide to rather check ubNumberOfObjects
#if 0
if(!(pFirst->fExists && pFirst->object.ubNumberOfObjects && pFirst->object.usItem) && (pFirst->fExists | pFirst->object.ubNumberOfObjects | pFirst->object.usItem))
{
pFirst->fExists = FALSE;
pFirst->object.ubNumberOfObjects = 0;
pFirst->object.usItem = NONE;
return(1);
}
if(!(pSecond->fExists && pSecond->object.ubNumberOfObjects && pSecond->object.usItem) && (pSecond->fExists | pSecond->object.ubNumberOfObjects | pSecond->object.usItem))
{
pSecond->fExists = FALSE;
pSecond->object.ubNumberOfObjects = 0;
pSecond->object.usItem = NONE;
return(-1);
}
if(!pFirst->fExists)
return(1);
if(!pSecond->fExists)
return(-1);
#else
if(!pFirst->object.ubNumberOfObjects)
return(1);
if(!pSecond->object.ubNumberOfObjects)
return(-1);
#endif
usItem1Index = pFirst->object.usItem;
usItem2Index = pSecond->object.usItem;
@@ -4157,20 +3964,7 @@ BOOLEAN SortInventoryPoolQ(void)
{
if(pInventoryPoolList.size() > 0)
{
#if 0//dnl ch75 311013
for(INT32 iSlotCounter=0; iSlotCounter<(INT32)pInventoryPoolList.size(); iSlotCounter++)
if(pInventoryPoolList[iSlotCounter].object.usItem == NOTHING && pInventoryPoolList[iSlotCounter].object.exists() == false)
{
pInventoryPoolList[iSlotCounter].fExists = FALSE;
pInventoryPoolList[iSlotCounter].bVisible = FALSE;
}
SortSectorInventory(pInventoryPoolList, pInventoryPoolList.size());
iLastInventoryPoolPage = (pInventoryPoolList.size() - 1) / MAP_INVENTORY_POOL_SLOT_COUNT;
if(iCurrentInventoryPoolPage > iLastInventoryPoolPage)
iCurrentInventoryPoolPage = iLastInventoryPoolPage;
#else
SortSectorInventory(pInventoryPoolList, pInventoryPoolList.size());
#endif
}
fMapPanelDirty = TRUE;
return(TRUE);
@@ -6227,9 +6021,6 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO
FLOAT newguntemperature = max(0.0f, guntemperature - tickspassed * cooldownfactor ); // ... calculate new temperature ...
#if 0//def JA2TESTVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"World: Item temperature lowered from %4.2f to %4.2f", guntemperature, newguntemperature );
#endif
(*itemStack)[i]->data.bTemperature = newguntemperature; // ... set new temperature
@@ -6247,9 +6038,6 @@ void HandleItemCooldownFunctions( OBJECTTYPE* itemStack, INT32 deltaSeconds, BOO
(*iter)[i]->data.bTemperature = newtemperature; // ... set new temperature
#if 0//def JA2TESTVERSION
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_INTERFACE, L"World: Item temperature lowered from %4.2f to %4.2f", temperature, newtemperature );
#endif
// we assume that there can exist only 1 underbarrel weapon per gun
break;
-36
View File
@@ -1373,42 +1373,6 @@ BOOLEAN HandleFiredDeadMerc( SOLDIERTYPE *pSoldier )
{
AddCharacterToDeadList( pSoldier );
#if 0
//if the dead merc is in the current sector
if( pSoldier->sSectorX == gWorldSectorX &&
pSoldier->sSectorY == gWorldSectorY &&
pSoldier->bSectorZ == gbWorldSectorZ )
{
TurnSoldierIntoCorpse( pSoldier, FALSE, FALSE );
}
else
{
ROTTING_CORPSE_DEFINITION Corpse;
// Setup some values!
Corpse.ubBodyType = pSoldier->ubBodyType;
Corpse.sGridNo = pSoldier->sInsertionGridNo;
Corpse.dXPos = pSoldier->dXPos;
Corpse.dYPos = pSoldier->dYPos;
Corpse.sHeightAdjustment = pSoldier->sHeightAdjustment;
SET_PALETTEREP_ID ( Corpse.HeadPal, pSoldier->HeadPal );
SET_PALETTEREP_ID ( Corpse.VestPal, pSoldier->VestPal );
SET_PALETTEREP_ID ( Corpse.SkinPal, pSoldier->SkinPal );
SET_PALETTEREP_ID ( Corpse.PantsPal, pSoldier->PantsPal );
Corpse.bDirection = pSoldier->ubDirection;
// Set time of death
Corpse.uiTimeOfDeath = GetWorldTotalMin( );
// Set type
Corpse.ubType = (UINT8)gubAnimSurfaceCorpseID[ pSoldier->ubBodyType][ pSoldier->usAnimState ];
//Add the rotting corpse info to the sectors unloaded rotting corpse file
AddRottingCorpseToUnloadedSectorsRottingCorpseFile( pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ, &Corpse);
}
#endif
return( TRUE );
}
-6
View File
@@ -1596,9 +1596,7 @@ void CheckForQuests( UINT32 uiDay )
{
// This function gets called at 8:00 AM time of the day
#ifdef TESTQUESTS
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Checking For Quests, Day %d", uiDay );
#endif
#ifdef JA2UB
// -------------------------------------------------------------------------------
@@ -1609,9 +1607,7 @@ void CheckForQuests( UINT32 uiDay )
if( gubQuest[ QUEST_DESTROY_MISSLES ] == QUESTNOTSTARTED )
{
StartQuest( QUEST_DESTROY_MISSLES, -1, -1 );
#ifdef TESTQUESTS
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DESTORY MISSLES quest");
#endif
}
//Ja25: No deliver letter quest, dont start it
#else
@@ -1623,11 +1619,9 @@ void CheckForQuests( UINT32 uiDay )
if (gubQuest[QUEST_DELIVER_LETTER] == QUESTNOTSTARTED)
{
StartQuest( QUEST_DELIVER_LETTER, -1, -1 );
#ifdef TESTQUESTS
if (!is_networked)
ScreenMsg( MSG_FONT_RED, MSG_DEBUG, L"Started DELIVER LETTER quest");
#endif
}
#endif
// This quest gets turned OFF through conversation with Miguel - when user hands