Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 39 additions & 13 deletions Build/Strategic/Map Screen Interface Map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5364,9 +5364,6 @@ void DisplayLevelString( void )
// function to manipulate the number of towns people on the cursor
BOOLEAN PickUpATownPersonFromSector( UINT8 ubType, INT16 sX, INT16 sY )
{



// see if there are any militia of this type in this sector
if( !SectorInfo[ SECTOR( sX, sY ) ].ubNumberOfCivsAtLevel[ ubType ] )
{
Expand All @@ -5390,22 +5387,26 @@ BOOLEAN PickUpATownPersonFromSector( UINT8 ubType, INT16 sX, INT16 sY )
gfStrategicMilitiaChangesMade = TRUE;
}

// the number of units transferred
INT16 countMovedCivs = 1;
if (_KeyDown(SHIFT)) countMovedCivs = SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ ubType ];

// otherwise pick this guy up
switch( ubType )
{
case( GREEN_MILITIA ):
sGreensOnCursor++;
sGreensOnCursor += countMovedCivs;
break;
case( REGULAR_MILITIA ):
sRegularsOnCursor++;
sRegularsOnCursor += countMovedCivs;
break;
case( ELITE_MILITIA ):
sElitesOnCursor++;
sElitesOnCursor += countMovedCivs;
break;
}

// reduce number in this sector
SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ ubType ]--;
SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ ubType ] -= countMovedCivs;

fMapPanelDirty = TRUE;

Expand All @@ -5422,8 +5423,11 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen2");
return( FALSE );
}

if( SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ GREEN_MILITIA ] + SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ]
+ SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ ELITE_MILITIA ] >= iMaxMilitiaPerSector )
// to move a group of militia
INT32 countFreeCivPlace = iMaxMilitiaPerSector - SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ GREEN_MILITIA ]
- SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ REGULAR_MILITIA ] - SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ ELITE_MILITIA ];

if( countFreeCivPlace <= 0 )
{
return( FALSE );
}
Expand All @@ -5438,6 +5442,9 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen2");
gfStrategicMilitiaChangesMade = TRUE;
}

// the number of units transferred
INT16 countMovedCivs = 1;

// drop the guy into this sector
switch( ubType )
{
Expand All @@ -5448,27 +5455,46 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"Map Screen2");
return( FALSE );
}

sGreensOnCursor--;
if (_KeyDown(SHIFT))
{
if (countFreeCivPlace <= sGreensOnCursor) countMovedCivs = countFreeCivPlace;
else countMovedCivs = sGreensOnCursor;
}

sGreensOnCursor -= countMovedCivs;
break;
case( REGULAR_MILITIA ):
if( !sRegularsOnCursor )
{
return( FALSE );
}
sRegularsOnCursor--;

if (_KeyDown(SHIFT))
{
if (countFreeCivPlace <= sRegularsOnCursor) countMovedCivs = countFreeCivPlace;
else countMovedCivs = sRegularsOnCursor;
}

sRegularsOnCursor -= countMovedCivs;
break;
case( ELITE_MILITIA ):
if( !sElitesOnCursor )
{
return( FALSE );
}

sElitesOnCursor--;
if (_KeyDown(SHIFT))
{
if (countFreeCivPlace <= sElitesOnCursor) countMovedCivs = countFreeCivPlace;
else countMovedCivs = sElitesOnCursor;
}

sElitesOnCursor -= countMovedCivs;
break;
}

// up the number in this sector of this type of militia
SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ ubType ]++;
SectorInfo[ SECTOR( sX, sY )].ubNumberOfCivsAtLevel[ ubType ] += countMovedCivs;

fMapPanelDirty = TRUE;

Expand Down