mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
New feature: factories allows facilities to create items
For more info, see http://thepit.ja-galaxy-forum.com/index.php?t=msg&goto=360075&#msg_360075 Requires GameDir >= r2534 git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8804 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -0,0 +1,576 @@
|
||||
/**
|
||||
* @file
|
||||
* @author Flugente (bears-pit.com)
|
||||
*/
|
||||
|
||||
#ifdef PRECOMPILEDHEADERS
|
||||
#include "Laptop All.h"
|
||||
#else
|
||||
#include "laptop.h"
|
||||
#include "insurance.h"
|
||||
#include "WCheck.h"
|
||||
#include "Utilities.h"
|
||||
#include "WordWrap.h"
|
||||
#include "Line.h"
|
||||
#include "Text.h"
|
||||
#include "FacilityProduction.h"
|
||||
#include "Map Screen Interface.h"
|
||||
#include "Quests.h"
|
||||
#include "finances.h"
|
||||
#include "Strategic Town Loyalty.h"
|
||||
#include "strategic.h"
|
||||
#include "BaseTable.h"
|
||||
#endif
|
||||
|
||||
/*#define MERCOMP_FONT_COLOR 2
|
||||
#define CAMPHIS_FONT_BIG FONT14ARIAL
|
||||
#define CAMPHIS_FONT_MED FONT12ARIAL
|
||||
#define CAMPHIS_FONT_SMALL FONT10ARIAL*/
|
||||
|
||||
#define MERCOMP_FONT_SHADOW FONT_MCOLOR_WHITE
|
||||
|
||||
/*#define CAMPAIGN_HISTORY_LINK_START_X LAPTOP_SCREEN_UL_X
|
||||
#define CAMPAIGN_HISTORY_LINK_START_Y LAPTOP_SCREEN_WEB_UL_Y + 5
|
||||
#define CAMPAIGN_HISTORY_LINK_TEXT_WIDTH 107
|
||||
#define CAMPAIGN_HISTORY_LINK_STEP_Y 14
|
||||
|
||||
#define BACKGROUND_WIDTH 125
|
||||
#define CAMPAIGN_HISTORY_BACKGROUND_HEIGHT 100
|
||||
|
||||
#define CAMPAIGN_HISTORY_BIG_TITLE_X 115 + LAPTOP_SCREEN_UL_X
|
||||
#define CAMPAIGN_HISTORY_BIG_TITLE_Y 10 + LAPTOP_SCREEN_WEB_UL_Y*/
|
||||
|
||||
#define NUM_LINKS 0
|
||||
#define MCA_START_CONTENT_Y (LAPTOP_SCREEN_WEB_UL_Y + NUM_LINKS * 17)
|
||||
|
||||
//extern UINT32 guiInsuranceBackGround;
|
||||
//extern UINT32 guiInsuranceBigRedLineImage;
|
||||
//extern UINT32 guiMercCompareBulletImage;
|
||||
//extern UINT32 guiMercCompareLogoImage;
|
||||
|
||||
//link to the various pages
|
||||
//MOUSE_REGION gLinkRegion_Production[NUM_LINKS];
|
||||
|
||||
UINT32 gCHECKBOXLib = 0;
|
||||
|
||||
/*void SelectLinkRegionCallBack_Production( MOUSE_REGION * pRegion, INT32 iReason )
|
||||
{
|
||||
if ( iReason & MSYS_CALLBACK_REASON_INIT )
|
||||
{
|
||||
}
|
||||
else if ( iReason & MSYS_CALLBACK_REASON_LBUTTON_UP )
|
||||
{
|
||||
UINT32 uiLink = MSYS_GetRegionUserData( pRegion, 0 );
|
||||
|
||||
if ( uiLink == 0 )
|
||||
guiCurrentLaptopMode = LAPTOP_MODE_PMC_MAIN;
|
||||
else if ( uiLink == 1 )
|
||||
guiCurrentLaptopMode = LAPTOP_MODE_PMC_CONTRACT_MILITIA;
|
||||
else if ( uiLink == 2 )
|
||||
guiCurrentLaptopMode = LAPTOP_MODE_BROKEN_LINK;
|
||||
}
|
||||
else if ( iReason & MSYS_CALLBACK_REASON_RBUTTON_UP )
|
||||
{
|
||||
}
|
||||
}*/
|
||||
|
||||
void InitDefaults_Production()
|
||||
{
|
||||
VOBJECT_DESC VObjectDesc;
|
||||
|
||||
/*// load the Insurance bullet graphic and add it
|
||||
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
FilenameForBPP( "LAPTOP\\bullet.sti", VObjectDesc.ImageFile );
|
||||
CHECKV( AddVideoObject( &VObjectDesc, &guiMercCompareBulletImage ) );*/
|
||||
|
||||
/*// load the Flower Account Box graphic and add it
|
||||
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
FilenameForBPP( "LAPTOP\\BackGroundTile.sti", VObjectDesc.ImageFile );
|
||||
CHECKV( AddVideoObject( &VObjectDesc, &guiInsuranceBackGround ) );*/
|
||||
|
||||
/*// load the red bar on the side of the page and add it
|
||||
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
FilenameForBPP( "LAPTOP\\LargeBar.sti", VObjectDesc.ImageFile );
|
||||
CHECKV( AddVideoObject( &VObjectDesc, &guiInsuranceBigRedLineImage ) );*/
|
||||
|
||||
/*VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
FilenameForBPP( "LAPTOP\\PressLogos.sti", VObjectDesc.ImageFile );
|
||||
CHECKV( AddVideoObject( &VObjectDesc, &guiMercCompareLogoImage ) );*/
|
||||
|
||||
VObjectDesc.fCreateFlags = VOBJECT_CREATE_FROMFILE;
|
||||
FilenameForBPP( "Interface\\OptionsCheckBoxes.sti", VObjectDesc.ImageFile );
|
||||
CHECKV( AddVideoObject( &VObjectDesc, &gCHECKBOXLib ) );
|
||||
|
||||
/*UINT16 usPosX = CAMPAIGN_HISTORY_LINK_START_X;
|
||||
UINT16 usPosY = CAMPAIGN_HISTORY_LINK_START_Y;
|
||||
for ( int i = 0; i<NUM_LINKS; ++i )
|
||||
{
|
||||
MSYS_DefineRegion( &gLinkRegion_Production[i], usPosX, usPosY, (UINT16)( usPosX + CAMPAIGN_HISTORY_LINK_TEXT_WIDTH ), usPosY + CAMPAIGN_HISTORY_LINK_STEP_Y, MSYS_PRIORITY_HIGH,
|
||||
CURSOR_WWW, MSYS_NO_CALLBACK, SelectLinkRegionCallBack_Production );
|
||||
MSYS_AddRegion( &gLinkRegion_Production[i] );
|
||||
MSYS_SetRegionUserData( &gLinkRegion_Production[i], 0, i );
|
||||
|
||||
usPosY += CAMPAIGN_HISTORY_LINK_STEP_Y;
|
||||
}*/
|
||||
}
|
||||
|
||||
void DisplayDefaults_Production()
|
||||
{
|
||||
SetFontShadow( MERCOMP_FONT_SHADOW );
|
||||
|
||||
// we don't have any links atm, so end here
|
||||
|
||||
/*WebPageTileBackground( 4, 4, BACKGROUND_WIDTH, CAMPAIGN_HISTORY_BACKGROUND_HEIGHT, guiInsuranceBackGround );
|
||||
|
||||
CHAR16 sText[800];
|
||||
UINT16 usPosX = CAMPAIGN_HISTORY_LINK_START_X;
|
||||
UINT16 usPosY = CAMPAIGN_HISTORY_LINK_START_Y;
|
||||
|
||||
//Display the title slogan
|
||||
swprintf( sText, L"bla" );
|
||||
DrawTextToScreen( sText, CAMPAIGN_HISTORY_BIG_TITLE_X, CAMPAIGN_HISTORY_BIG_TITLE_Y, LAPTOP_SCREEN_LR_X - LAPTOP_SCREEN_UL_X, CAMPHIS_FONT_BIG, MERCOMP_FONT_COLOR, FONT_MCOLOR_BLACK, FALSE, 0 );
|
||||
|
||||
usPosX = CAMPAIGN_HISTORY_LINK_START_X;
|
||||
usPosY = CAMPAIGN_HISTORY_LINK_START_Y;
|
||||
for ( int i = 0; i<NUM_LINKS; ++i )
|
||||
{
|
||||
swprintf( sText, L"TODO link" );
|
||||
DisplayWrappedString( usPosX, usPosY, CAMPAIGN_HISTORY_LINK_TEXT_WIDTH, 2, CAMPHIS_FONT_MED, MERCOMP_FONT_COLOR, sText, FONT_MCOLOR_BLACK, FALSE, 0 );
|
||||
|
||||
usPosY += CAMPAIGN_HISTORY_LINK_STEP_Y;
|
||||
|
||||
//Display the red bar under the link at the bottom. and the text
|
||||
DisplaySmallColouredLineWithShadow( usPosX, usPosY - 2, LAPTOP_SCREEN_UL_X + CAMPAIGN_HISTORY_LINK_TEXT_WIDTH, usPosY - 2, FROMRGB( 240, 240, 20 ) );
|
||||
}
|
||||
|
||||
// closing line that separates header from individual page
|
||||
DisplaySmallColouredLineWithShadow( usPosX, usPosY - 2, LAPTOP_SCREEN_LR_X, usPosY - 2, FROMRGB( 240, 240, 20 ) );
|
||||
|
||||
usPosX = LAPTOP_SCREEN_LR_X - 110;
|
||||
usPosY = CAMPAIGN_HISTORY_LINK_START_Y;
|
||||
|
||||
HVOBJECT hPixHandle;
|
||||
GetVideoObject( &hPixHandle, guiMercCompareLogoImage );
|
||||
BltVideoObject( FRAME_BUFFER, hPixHandle, 3, usPosX, usPosY, VO_BLT_SRCTRANSPARENCY, NULL );
|
||||
|
||||
SetFontShadow( DEFAULT_SHADOW );*/
|
||||
}
|
||||
|
||||
void RemoveDefaults_Production()
|
||||
{
|
||||
//DeleteVideoObjectFromIndex( guiInsuranceBackGround );
|
||||
//DeleteVideoObjectFromIndex( guiInsuranceBigRedLineImage );
|
||||
//DeleteVideoObjectFromIndex( guiMercCompareBulletImage );
|
||||
//DeleteVideoObjectFromIndex( guiMercCompareLogoImage );
|
||||
DeleteVideoObjectFromIndex( gCHECKBOXLib );
|
||||
|
||||
//for ( int i = 0; i<NUM_LINKS; ++i )
|
||||
//MSYS_RemoveRegion( &gLinkRegion_Production[i] );
|
||||
}
|
||||
|
||||
////////////////////////// MAIN PAGE ////////////////////////////////
|
||||
struct PRODUCTIONLINE_DATA
|
||||
{
|
||||
UINT16 sector;
|
||||
int facilitytype;
|
||||
int productionline;
|
||||
|
||||
PRODUCTION_LINE xmldata;
|
||||
|
||||
bool active;
|
||||
bool old_state;
|
||||
bool can_turnon;
|
||||
};
|
||||
|
||||
std::vector<PRODUCTIONLINE_DATA> gProductionVector;
|
||||
|
||||
extern INT32 GetFactoryLeftoverProgress( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber );
|
||||
extern void SetFacilityProductionState( INT16 sSectorX, INT16 sSectorY, INT8 bSectorZ, UINT16 usFacilityType, UINT16 usProductionNumber, BOOLEAN aOn );
|
||||
|
||||
void FilterProductionData()
|
||||
{
|
||||
gProductionVector.clear();
|
||||
|
||||
for ( UINT16 sector = 0; sector < 256; ++sector )
|
||||
{
|
||||
if ( !StrategicMap[SECTOR_INFO_TO_STRATEGIC_INDEX( sector )].fEnemyControlled )
|
||||
{
|
||||
UINT8 ubTownID = GetTownIdForSector( SECTORX( sector ), SECTORY( sector ) );
|
||||
|
||||
for ( UINT16 cnt = 0; cnt < NUM_FACILITY_TYPES; ++cnt )
|
||||
{
|
||||
// Is this facility here?
|
||||
if ( gFacilityLocations[sector][cnt].fFacilityHere )
|
||||
{
|
||||
UINT16 productioncnt = 0;
|
||||
for ( std::vector<PRODUCTION_LINE>::iterator prodit = gFacilityTypes[cnt].ProductionData.begin(), proditend = gFacilityTypes[cnt].ProductionData.end(); prodit != proditend;
|
||||
++prodit, ++productioncnt )
|
||||
{
|
||||
PRODUCTIONLINE_DATA data;
|
||||
data.sector = sector;
|
||||
data.facilitytype = cnt;
|
||||
data.productionline = productioncnt;
|
||||
data.xmldata = ( *prodit );
|
||||
|
||||
INT32 progress = GetFactoryLeftoverProgress( SECTORX( sector ), SECTORY( sector ), 0, cnt, productioncnt );
|
||||
|
||||
// despite what is set, several other things can turn a factory off, like loyalty or lua-defined quest checks
|
||||
if ( progress < -10
|
||||
|| (ubTownID != BLANK_SECTOR
|
||||
&& gTownLoyalty[ubTownID].ubRating < prodit->usOptional_LoyaltyRequired ) )
|
||||
{
|
||||
data.active = false;
|
||||
data.can_turnon = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
data.active = ( progress > -1 );
|
||||
data.can_turnon = true;
|
||||
}
|
||||
|
||||
data.old_state = data.active;
|
||||
|
||||
gProductionVector.push_back( data );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WriteAlteredProductionData()
|
||||
{
|
||||
for ( std::vector<PRODUCTIONLINE_DATA>::iterator it = gProductionVector.begin(), itend = gProductionVector.end(); it != itend; ++it )
|
||||
{
|
||||
if ( (*it).active != ( *it ).old_state )
|
||||
{
|
||||
SetFacilityProductionState( SECTORX( ( *it ).sector ), SECTORY( ( *it ).sector ), 0, ( *it ).facilitytype, ( *it ).productionline, ( *it ).active );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOLEAN gfFacilityProductionRedraw = FALSE;
|
||||
|
||||
BOOLEAN EnterFacilityProduction()
|
||||
{
|
||||
InitDefaults_Production();
|
||||
|
||||
FilterProductionData();
|
||||
|
||||
gTestPanel3.Create( LAPTOP_SCREEN_UL_X, MCA_START_CONTENT_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y );
|
||||
gTestPanel3.SetColorLine( Get16BPPColor( FROMRGB( 128, 128, 128 ) ) );
|
||||
gTestPanel3.SetColorLineShadow( Get16BPPColor( FROMRGB( 255, 255, 255 ) ) );
|
||||
gTestPanel3.SetColorMarked( Get16BPPColor( FROMRGB( 230, 230, 230 ) ) );
|
||||
|
||||
TestTableTemplate<4>::getInstance().Create( LAPTOP_SCREEN_UL_X + 4, MCA_START_CONTENT_Y + 4, LAPTOP_SCREEN_LR_X - 4, LAPTOP_SCREEN_WEB_LR_Y - 4 );
|
||||
TestTableTemplate<4>::getInstance().SetColorSeparator( Get16BPPColor( FROMRGB( 30, 30, 30 ) ) );
|
||||
|
||||
gTestPanel3.RegisterMemberThingy( &TestTableTemplate<4>::getInstance() );
|
||||
|
||||
TestTableTemplate<4>::getInstance().SetMouseRegionActive( TRUE );
|
||||
|
||||
RenderFacilityProduction();
|
||||
|
||||
return( TRUE );
|
||||
}
|
||||
|
||||
void ExitFacilityProduction()
|
||||
{
|
||||
gTestPanel3.Destroy();
|
||||
|
||||
WriteAlteredProductionData();
|
||||
|
||||
RemoveDefaults_Production();
|
||||
}
|
||||
|
||||
void HandleFacilityProduction()
|
||||
{
|
||||
if ( gfFacilityProductionRedraw )
|
||||
{
|
||||
TestTableTemplate<4>::getInstance().Create( TestTableTemplate<4>::getInstance().GetX(), TestTableTemplate<4>::getInstance().GetY(),
|
||||
TestTableTemplate<4>::getInstance().GetX() + TestTableTemplate<4>::getInstance().GetWidth(),
|
||||
TestTableTemplate<4>::getInstance().GetY() + TestTableTemplate<4>::getInstance().GetHeight() );
|
||||
|
||||
RenderFacilityProduction();
|
||||
|
||||
gfFacilityProductionRedraw = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
void RenderFacilityProduction()
|
||||
{
|
||||
DisplayDefaults_Production();
|
||||
|
||||
SetFontShadow( MERCOMP_FONT_SHADOW );
|
||||
|
||||
gTestPanel3.Display();
|
||||
|
||||
SetFontShadow( DEFAULT_SHADOW );
|
||||
|
||||
MarkButtonsDirty();
|
||||
RenderWWWProgramTitleBar();
|
||||
InvalidateRegion( LAPTOP_SCREEN_UL_X, LAPTOP_SCREEN_WEB_UL_Y, LAPTOP_SCREEN_LR_X, LAPTOP_SCREEN_WEB_LR_Y );
|
||||
}
|
||||
|
||||
static CHAR16 gProductionHelpText[100];
|
||||
|
||||
STR16 Sectornamegetter_Production( UINT32 aNum )
|
||||
{
|
||||
swprintf( gProductionHelpText, L"NAME NOT FOUND" );
|
||||
|
||||
if ( aNum < gProductionVector.size() )
|
||||
{
|
||||
GetShortSectorString( SECTORX( gProductionVector[aNum].sector ), SECTORY( gProductionVector[aNum].sector ), gProductionHelpText );
|
||||
}
|
||||
|
||||
return gProductionHelpText;
|
||||
}
|
||||
|
||||
STR16 Product_Production( UINT32 aNum )
|
||||
{
|
||||
swprintf( gProductionHelpText, L"NOTHING" );
|
||||
|
||||
if ( aNum < gProductionVector.size() )
|
||||
{
|
||||
if ( wcslen( gProductionVector[aNum].xmldata.szProductionName ) > 0 )
|
||||
swprintf( gProductionHelpText, L"%s", gProductionVector[aNum].xmldata.szProductionName );
|
||||
else if ( gProductionVector[aNum].xmldata.usItemToCreate != NOTHING )
|
||||
swprintf( gProductionHelpText, L"%s", Item[gProductionVector[aNum].xmldata.usItemToCreate].szItemName );
|
||||
}
|
||||
|
||||
return gProductionHelpText;
|
||||
}
|
||||
|
||||
STR16 PreProduct_Production( UINT32 aNum )
|
||||
{
|
||||
swprintf( gProductionHelpText, L"--" );
|
||||
|
||||
if ( aNum < gProductionVector.size() )
|
||||
{
|
||||
bool first = true;
|
||||
for ( std::vector<PRODUCTION_LINE_PREPRODUCT>::iterator it = gProductionVector[aNum].xmldata.usOptional_PreProducts.begin(), itend = gProductionVector[aNum].xmldata.usOptional_PreProducts.end(); it != itend; ++it )
|
||||
{
|
||||
if ( it->requiredforonecreation > 1 )
|
||||
{
|
||||
if ( first )
|
||||
{
|
||||
swprintf( gProductionHelpText, L"%s (%d)", Item[it->item].szItemName, it->requiredforonecreation );
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( gProductionHelpText, L"%s, %s (%d)", gProductionHelpText, Item[it->item].szItemName, it->requiredforonecreation );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( first )
|
||||
{
|
||||
swprintf( gProductionHelpText, L"%s", Item[it->item].szItemName );
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf( gProductionHelpText, L"%s, %s", gProductionHelpText, Item[it->item].szItemName );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return gProductionHelpText;
|
||||
}
|
||||
|
||||
UINT8 ColourGetter_Production( UINT32 aNum )
|
||||
{
|
||||
if ( aNum < gProductionVector.size() )
|
||||
{
|
||||
UINT8 ubTownID = GetTownIdForSector( SECTORX( gProductionVector[aNum].sector ), SECTORY( gProductionVector[aNum].sector ) );
|
||||
|
||||
if ( ubTownID != BLANK_SECTOR
|
||||
&& gTownLoyalty[ubTownID].ubRating < gProductionVector[aNum].xmldata.usOptional_LoyaltyRequired )
|
||||
{
|
||||
return 164;
|
||||
}
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
STR16 Loyalty_Production( UINT32 aNum )
|
||||
{
|
||||
swprintf( gProductionHelpText, L"--" );
|
||||
|
||||
if ( aNum < gProductionVector.size() && gProductionVector[aNum].xmldata.usOptional_LoyaltyRequired > 0 )
|
||||
{
|
||||
swprintf( gProductionHelpText, L"%d+", gProductionVector[aNum].xmldata.usOptional_LoyaltyRequired );
|
||||
}
|
||||
|
||||
return gProductionHelpText;
|
||||
}
|
||||
|
||||
STR16 Costgetter_Production( UINT32 aNum )
|
||||
{
|
||||
swprintf( gProductionHelpText, L"--" );
|
||||
|
||||
if ( aNum < gProductionVector.size() && gProductionVector[aNum].xmldata.sHourlyCost )
|
||||
{
|
||||
swprintf( gProductionHelpText, L"%d$", gProductionVector[aNum].xmldata.sHourlyCost );
|
||||
}
|
||||
|
||||
return gProductionHelpText;
|
||||
}
|
||||
|
||||
STR16 Minutesgetter_Production( UINT32 aNum )
|
||||
{
|
||||
swprintf( gProductionHelpText, L"--:--" );
|
||||
|
||||
if ( aNum < gProductionVector.size() )
|
||||
{
|
||||
swprintf( gProductionHelpText, L"%02d:%02d", gProductionVector[aNum].xmldata.sMinutesRequired / 60, gProductionVector[aNum].xmldata.sMinutesRequired % 60 );
|
||||
}
|
||||
|
||||
return gProductionHelpText;
|
||||
}
|
||||
|
||||
BOOLEAN Activegetter_Production( UINT32 aNum )
|
||||
{
|
||||
if ( aNum < gProductionVector.size() )
|
||||
{
|
||||
return gProductionVector[aNum].active;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CheckboxImagegetter_Production( UINT32 aNum, UINT32& arImageLib, UINT16& arImage )
|
||||
{
|
||||
arImageLib = gCHECKBOXLib;
|
||||
arImage = 0;
|
||||
|
||||
if ( aNum < gProductionVector.size() )
|
||||
{
|
||||
if ( !gProductionVector[aNum].can_turnon )
|
||||
arImage = 4;
|
||||
else if ( gProductionVector[aNum].active )
|
||||
arImage = 2;
|
||||
}
|
||||
}
|
||||
|
||||
void Factory_ProgressBar( UINT32 aId, UINT16& arCol1, UINT16& arVal1, UINT16& arCol2, UINT16& arVal2, UINT16& arCol3, UINT16& arVal3, UINT16& arCol4, UINT16& arVal4 )
|
||||
{
|
||||
if ( aId < gProductionVector.size() )
|
||||
{
|
||||
INT32 productiontime = GetFactoryLeftoverProgress( SECTORX( gProductionVector[aId].sector ), SECTORY( gProductionVector[aId].sector ), 0, gProductionVector[aId].facilitytype, gProductionVector[aId].productionline );
|
||||
|
||||
// use stat bar colours, because why not
|
||||
arCol1 = Get16BPPColor( FROMRGB( gGameExternalOptions.ubStatProgressBarsRed, gGameExternalOptions.ubStatProgressBarsGreen, gGameExternalOptions.ubStatProgressBarsBlue ) );
|
||||
|
||||
if ( productiontime > -1 && gProductionVector[aId].xmldata.sMinutesRequired > 0 )
|
||||
arVal1 = min( 100, 100 * productiontime / gProductionVector[aId].xmldata.sMinutesRequired );
|
||||
else
|
||||
arVal1 = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void callbacktoggle( INT32 usId )
|
||||
{
|
||||
if ( usId < gProductionVector.size() && gProductionVector[usId].can_turnon )
|
||||
{
|
||||
gProductionVector[usId].active = !gProductionVector[usId].active;
|
||||
|
||||
TestTableTemplate<4>::getInstance().SetRefresh();
|
||||
}
|
||||
}
|
||||
|
||||
template<> void TestTableTemplate<4>::SetRefresh() { gfFacilityProductionRedraw = TRUE; }
|
||||
|
||||
template<> void TestTableTemplate<4>::Init( UINT16 sX, UINT16 sY, UINT16 sX_End, UINT16 sY_End )
|
||||
{
|
||||
ClearColumnDataProvider();
|
||||
|
||||
// on/off toggle
|
||||
{
|
||||
ColumnDataProvider col( L"" );
|
||||
col.SetRequiredHeigth( 12 );
|
||||
col.SetRequiredLength( 24 );
|
||||
col.SetMethodImage( CheckboxImagegetter_Production );
|
||||
col.SetNumberOfEntries( gProductionVector.size() );
|
||||
col.SetCallBackType( ColumnDataProvider::CDP_TOGGLE );
|
||||
|
||||
AddColumnDataProvider( col );
|
||||
}
|
||||
|
||||
// sector
|
||||
{
|
||||
ColumnDataProvider col( pUpdateMapInfoText[15] );
|
||||
col.SetMethodString( Sectornamegetter_Production );
|
||||
col.SetNumberOfEntries( gProductionVector.size() );
|
||||
col.SetCallBackType( ColumnDataProvider::CDP_MILITIA_LIST );
|
||||
|
||||
AddColumnDataProvider( col );
|
||||
}
|
||||
|
||||
// name
|
||||
{
|
||||
ColumnDataProvider col( szFactoryText[4] );
|
||||
col.SetMethodString( Product_Production );
|
||||
col.SetNumberOfEntries( gProductionVector.size() );
|
||||
col.SetCallBackType( ColumnDataProvider::CDP_MILITIA_LIST );
|
||||
|
||||
AddColumnDataProvider( col );
|
||||
}
|
||||
|
||||
// required items to use up
|
||||
{
|
||||
ColumnDataProvider col( szFactoryText[5] );
|
||||
col.SetMethodString( PreProduct_Production );
|
||||
col.SetNumberOfEntries( gProductionVector.size() );
|
||||
col.SetCallBackType( ColumnDataProvider::CDP_MILITIA_LIST );
|
||||
|
||||
AddColumnDataProvider( col );
|
||||
}
|
||||
|
||||
// loyalty
|
||||
{
|
||||
ColumnDataProvider col( pwTownInfoStrings[5] );
|
||||
col.SetMethodString( Loyalty_Production );
|
||||
col.SetMethodTextColour( ColourGetter_Production );
|
||||
col.SetNumberOfEntries( gProductionVector.size() );
|
||||
col.SetCallBackType( ColumnDataProvider::CDP_MILITIA_LIST );
|
||||
|
||||
AddColumnDataProvider( col );
|
||||
}
|
||||
|
||||
// cost
|
||||
{
|
||||
ColumnDataProvider col( L"$/h" );
|
||||
col.SetMethodString( Costgetter_Production );
|
||||
col.SetNumberOfEntries( gProductionVector.size() );
|
||||
col.SetCallBackType( ColumnDataProvider::CDP_MILITIA_LIST );
|
||||
|
||||
AddColumnDataProvider( col );
|
||||
}
|
||||
|
||||
// current progress
|
||||
{
|
||||
ColumnDataProvider col( L"" );
|
||||
col.SetMethodStatusBar( Factory_ProgressBar );
|
||||
col.SetNumberOfEntries( gProductionVector.size() );
|
||||
col.SetCallBackType( ColumnDataProvider::CDP_MILITIA_LIST );
|
||||
|
||||
AddColumnDataProvider( col );
|
||||
}
|
||||
|
||||
// time required
|
||||
{
|
||||
ColumnDataProvider col( szFactoryText[6] );
|
||||
col.SetMethodString( Minutesgetter_Production );
|
||||
col.SetNumberOfEntries( gProductionVector.size() );
|
||||
col.SetCallBackType( ColumnDataProvider::CDP_MILITIA_LIST );
|
||||
|
||||
AddColumnDataProvider( col );
|
||||
}
|
||||
|
||||
TestTable::Init( sX, sY, sX_End, sY_End );
|
||||
}
|
||||
////////////////////////// MAIN PAGE ////////////////////////////////
|
||||
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#ifndef __FACILITY_PRODUCTION_WEBSITE_H
|
||||
#define __FACILITY_PRODUCTION_WEBSITE_H
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @author Flugente (bears-pit.com)
|
||||
*/
|
||||
|
||||
// main page (explains what this is all about)
|
||||
BOOLEAN EnterFacilityProduction();
|
||||
void ExitFacilityProduction();
|
||||
void HandleFacilityProduction();
|
||||
void RenderFacilityProduction();
|
||||
|
||||
#endif //__FACILITY_PRODUCTION_WEBSITE_H
|
||||
@@ -462,6 +462,10 @@
|
||||
RelativePath=".\Encyclopedia_new.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FacilityProduction.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\files.h"
|
||||
>
|
||||
@@ -824,6 +828,10 @@
|
||||
RelativePath=".\Encyclopedia_new.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FacilityProduction.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\files.cpp"
|
||||
>
|
||||
|
||||
@@ -462,6 +462,10 @@
|
||||
RelativePath=".\Encyclopedia_new.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FacilityProduction.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="files.h"
|
||||
>
|
||||
@@ -822,6 +826,10 @@
|
||||
RelativePath=".\Encyclopedia_new.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\FacilityProduction.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="files.cpp"
|
||||
>
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<ClInclude Include="email.h" />
|
||||
<ClInclude Include="Encyclopedia_Data_new.h" />
|
||||
<ClInclude Include="Encyclopedia_new.h" />
|
||||
<ClInclude Include="FacilityProduction.h" />
|
||||
<ClInclude Include="files.h" />
|
||||
<ClInclude Include="finances.h" />
|
||||
<ClInclude Include="florist Cards.h" />
|
||||
@@ -145,6 +146,7 @@
|
||||
<ClCompile Include="email.cpp" />
|
||||
<ClCompile Include="Encyclopedia_Data_new.cpp" />
|
||||
<ClCompile Include="Encyclopedia_new.cpp" />
|
||||
<ClCompile Include="FacilityProduction.cpp" />
|
||||
<ClCompile Include="files.cpp" />
|
||||
<ClCompile Include="finances.cpp" />
|
||||
<ClCompile Include="florist Cards.cpp" />
|
||||
|
||||
@@ -257,6 +257,9 @@
|
||||
</ClInclude>
|
||||
<ClInclude Include="Encyclopedia_Data_new.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FacilityProduction.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BriefingRoom_Data.h">
|
||||
<Filter>Header Files</Filter>
|
||||
@@ -548,6 +551,9 @@
|
||||
<ClCompile Include="Encyclopedia_Data_new.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FacilityProduction.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BriefingRoom_Data.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<ClInclude Include="email.h" />
|
||||
<ClInclude Include="Encyclopedia_Data_new.h" />
|
||||
<ClInclude Include="Encyclopedia_new.h" />
|
||||
<ClInclude Include="FacilityProduction.h" />
|
||||
<ClInclude Include="files.h" />
|
||||
<ClInclude Include="finances.h" />
|
||||
<ClInclude Include="florist Cards.h" />
|
||||
@@ -145,6 +146,7 @@
|
||||
<ClCompile Include="email.cpp" />
|
||||
<ClCompile Include="Encyclopedia_Data_new.cpp" />
|
||||
<ClCompile Include="Encyclopedia_new.cpp" />
|
||||
<ClCompile Include="FacilityProduction.cpp" />
|
||||
<ClCompile Include="files.cpp" />
|
||||
<ClCompile Include="finances.cpp" />
|
||||
<ClCompile Include="florist Cards.cpp" />
|
||||
|
||||
@@ -237,6 +237,9 @@
|
||||
<ClInclude Include="Encyclopedia_Data_new.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FacilityProduction.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BriefingRoom_Data.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
@@ -523,6 +526,9 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="Encyclopedia_Data_new.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FacilityProduction.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BriefingRoom_Data.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<ClInclude Include="email.h" />
|
||||
<ClInclude Include="Encyclopedia_Data_new.h" />
|
||||
<ClInclude Include="Encyclopedia_new.h" />
|
||||
<ClInclude Include="FacilityProduction.h" />
|
||||
<ClInclude Include="files.h" />
|
||||
<ClInclude Include="finances.h" />
|
||||
<ClInclude Include="florist Cards.h" />
|
||||
@@ -145,6 +146,7 @@
|
||||
<ClCompile Include="email.cpp" />
|
||||
<ClCompile Include="Encyclopedia_Data_new.cpp" />
|
||||
<ClCompile Include="Encyclopedia_new.cpp" />
|
||||
<ClCompile Include="FacilityProduction.cpp" />
|
||||
<ClCompile Include="files.cpp" />
|
||||
<ClCompile Include="finances.cpp" />
|
||||
<ClCompile Include="florist Cards.cpp" />
|
||||
|
||||
@@ -74,6 +74,7 @@
|
||||
<ClInclude Include="email.h" />
|
||||
<ClInclude Include="Encyclopedia_Data_new.h" />
|
||||
<ClInclude Include="Encyclopedia_new.h" />
|
||||
<ClInclude Include="FacilityProduction.h" />
|
||||
<ClInclude Include="files.h" />
|
||||
<ClInclude Include="finances.h" />
|
||||
<ClInclude Include="florist Cards.h" />
|
||||
@@ -165,6 +166,7 @@
|
||||
<ClCompile Include="email.cpp" />
|
||||
<ClCompile Include="Encyclopedia_Data_new.cpp" />
|
||||
<ClCompile Include="Encyclopedia_new.cpp" />
|
||||
<ClCompile Include="FacilityProduction.cpp" />
|
||||
<ClCompile Include="files.cpp" />
|
||||
<ClCompile Include="finances.cpp" />
|
||||
<ClCompile Include="florist Cards.cpp" />
|
||||
|
||||
@@ -92,6 +92,7 @@
|
||||
#include "PMC.h" // added by Flugente
|
||||
#include "MilitiaWebsite.h" // added by Flugente
|
||||
#include "Intelmarket.h" // added by Flugente
|
||||
#include "FacilityProduction.h" // added by Flugente
|
||||
#endif
|
||||
|
||||
#include "connect.h"
|
||||
@@ -1075,6 +1076,11 @@ INT32 EnterLaptop()
|
||||
|
||||
if ( !gGameExternalOptions.fIntelResource )
|
||||
RemoveBookmark( INTELMARKET_BOOKMARK );
|
||||
|
||||
if ( gGameExternalOptions.fFactories )
|
||||
SetBookMark( PRODUCTION_BOOKMARK );
|
||||
else
|
||||
RemoveBookmark( PRODUCTION_BOOKMARK );
|
||||
}
|
||||
|
||||
LoadLoadPending( );
|
||||
@@ -1521,6 +1527,10 @@ void RenderLaptop()
|
||||
case LAPTOP_MODE_INTELMARKET_ABOUT:
|
||||
RenderIntelmarket_About();
|
||||
break;
|
||||
|
||||
case LAPTOP_MODE_FACILITY_PRODUCTION:
|
||||
RenderFacilityProduction();
|
||||
break;
|
||||
}
|
||||
|
||||
if( guiCurrentLaptopMode >= LAPTOP_MODE_WWW )
|
||||
@@ -1997,6 +2007,10 @@ void EnterNewLaptopMode()
|
||||
case LAPTOP_MODE_INTELMARKET_ABOUT:
|
||||
EnterIntelmarket_About();
|
||||
break;
|
||||
|
||||
case LAPTOP_MODE_FACILITY_PRODUCTION:
|
||||
EnterFacilityProduction();
|
||||
break;
|
||||
}
|
||||
|
||||
// first time using webbrowser in this laptop session
|
||||
@@ -2288,6 +2302,10 @@ void HandleLapTopHandles()
|
||||
case LAPTOP_MODE_INTELMARKET_ABOUT:
|
||||
HandleIntelmarket_About();
|
||||
break;
|
||||
|
||||
case LAPTOP_MODE_FACILITY_PRODUCTION:
|
||||
HandleFacilityProduction();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2886,6 +2904,10 @@ UINT32 ExitLaptopMode(UINT32 uiMode)
|
||||
case LAPTOP_MODE_INTELMARKET_ABOUT:
|
||||
ExitIntelmarket_About();
|
||||
break;
|
||||
|
||||
case LAPTOP_MODE_FACILITY_PRODUCTION:
|
||||
ExitFacilityProduction();
|
||||
break;
|
||||
}
|
||||
|
||||
if( ( uiMode != LAPTOP_MODE_NONE )&&( uiMode < LAPTOP_MODE_WWW ) )
|
||||
@@ -4551,6 +4573,27 @@ void GoToWebPage(INT32 iPageId )
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case PRODUCTION_BOOKMARK:
|
||||
{
|
||||
guiCurrentWWWMode = LAPTOP_MODE_FACILITY_PRODUCTION;
|
||||
guiCurrentLaptopMode = LAPTOP_MODE_FACILITY_PRODUCTION;
|
||||
|
||||
// do we have to have a World Wide Wait
|
||||
if ( LaptopSaveInfo.fVisitedBookmarkAlready[PRODUCTION_BOOKMARK] == FALSE )
|
||||
{
|
||||
// reset flag and set load pending flag
|
||||
LaptopSaveInfo.fVisitedBookmarkAlready[PRODUCTION_BOOKMARK] = TRUE;
|
||||
fLoadPendingFlag = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
// fast reload
|
||||
fLoadPendingFlag = TRUE;
|
||||
fFastLoadFlag = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef JA2UB
|
||||
@@ -6346,6 +6389,7 @@ void HandleKeyBoardShortCutsForLapTop( UINT16 usEvent, UINT32 usParam, UINT16 us
|
||||
SetBookMark( PMC_BOOKMARK );
|
||||
SetBookMark( MILITIAROSTER_BOOKMARK );
|
||||
SetBookMark( INTELMARKET_BOOKMARK );
|
||||
SetBookMark( PRODUCTION_BOOKMARK );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -169,6 +169,9 @@ enum
|
||||
LAPTOP_MODE_INTELMARKET_BUYINFO,
|
||||
LAPTOP_MODE_INTELMARKET_SELLINFO,
|
||||
LAPTOP_MODE_INTELMARKET_ABOUT,
|
||||
|
||||
// Flugente: facility production
|
||||
LAPTOP_MODE_FACILITY_PRODUCTION,
|
||||
|
||||
LAPTOP_MODE_BOBBYR_SHIPMENTS,
|
||||
|
||||
@@ -251,6 +254,7 @@ enum{
|
||||
PMC_BOOKMARK, // added by Flugente
|
||||
MILITIAROSTER_BOOKMARK, // added by Flugente
|
||||
INTELMARKET_BOOKMARK, // added by Flugente
|
||||
PRODUCTION_BOOKMARK, // added by Flugente
|
||||
TEXT_NUM_LAPTOP_BOOKMARKS
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user