Player::Revenue added, click on TownHall to see...
This commit is contained in:
parent
01b42a5464
commit
13cf738e89
4 changed files with 39 additions and 16 deletions
|
@ -58,7 +58,7 @@ DEBUG= -DDEBUG #-DFLAG_DEBUG
|
|||
DFLAGS= $(THREAD) $(CCL) $(VERSION) \
|
||||
$(VIDEO) $(ZDEFS) $(DSOUND) \
|
||||
$(DEBUG) -DHAVE_EXPANSION
|
||||
CFLAGS=-g -O1 -Wall -Werror $(IFLAGS) $(DFLAGS) -DUNIT_ON_MAP -DNEW_AI -DUSE_LIBMODPLUG -DUSE_HP_FOR_XP -DNEW_FOW2
|
||||
CFLAGS=-g -O1 -Wall -Werror $(IFLAGS) $(DFLAGS) -DUNIT_ON_MAP -DNEW_AI -DUSE_LIBMODPLUG -DUSE_HP_FOR_XP
|
||||
CTAGSFLAGS=-i defptvS -a -f
|
||||
|
||||
# Locks versions with a symbolic name
|
||||
|
|
|
@ -132,6 +132,16 @@
|
|||
** Income of the resources, when they are delivered at a store.
|
||||
** @see _costs_, TimeCost, GoldCost, WoodCost, OilCost, MaxCosts.
|
||||
**
|
||||
** Player::LastResources[::MaxCosts]
|
||||
**
|
||||
** Keeps track of resources in time (used for calculating
|
||||
** Player::Revenue, see below)
|
||||
**
|
||||
** Player::Revenue[::MaxCosts]
|
||||
**
|
||||
** Production of resources per minute (or estimates)
|
||||
** Used just as information (statistics) for the player...
|
||||
**
|
||||
** Player::UnitTypesCount[::UnitTypeMax]
|
||||
**
|
||||
** Total count for each different unit type. Used by the AI and
|
||||
|
@ -282,7 +292,9 @@ struct _player_ {
|
|||
unsigned Y; /// map tile start Y position
|
||||
|
||||
unsigned Resources[MaxCosts]; /// resources in store
|
||||
unsigned LastResources[MaxCosts]; /// last values for revenue
|
||||
int Incomes[MaxCosts]; /// income of the resources
|
||||
int Revenue[MaxCosts]; /// income rate of the resources
|
||||
|
||||
// FIXME: needed again? if not remove
|
||||
// unsigned UnitFlags[
|
||||
|
|
|
@ -755,8 +755,16 @@ global void PlayersEachFrame(void)
|
|||
global void PlayersEachSecond(void)
|
||||
{
|
||||
int player;
|
||||
int res;
|
||||
|
||||
for( player=0; player<NumPlayers; ++player ) {
|
||||
if ( (FrameCounter / FRAMES_PER_SECOND) % 10 == 0 ) {
|
||||
for( res = 0; res < MaxCosts; res++ ) {
|
||||
Players[player].Revenue[res] = Players[player].Resources[res] - Players[player].LastResources[res];
|
||||
Players[player].Revenue[res] *= 6; // estimate per minute
|
||||
Players[player].LastResources[res] = Players[player].Resources[res];
|
||||
}
|
||||
}
|
||||
if( Players[player].AiEnabled ) {
|
||||
AiEachSecond(&Players[player]);
|
||||
}
|
||||
|
|
|
@ -369,28 +369,31 @@ global void DrawUnitInfo(const Unit* unit)
|
|||
|
||||
} else if( type->StoresGold ) {
|
||||
VideoDrawText(x+20,y+8+61,GameFont,"Production");
|
||||
VideoDrawText(x+73,y+8+77,GameFont,"Gold:");
|
||||
VideoDrawNumber(x+108,y+8+77,GameFont,DEFAULT_INCOMES[GoldCost]);
|
||||
VideoDrawText(x+43,y+8+77,GameFont,"Gold:");
|
||||
VideoDrawNumber(x+78,y+8+77,GameFont,DEFAULT_INCOMES[GoldCost]);
|
||||
// Keep/Stronghold, Castle/Fortress
|
||||
if( unit->Player->Incomes[GoldCost] != DEFAULT_INCOMES[GoldCost] ) {
|
||||
sprintf(buf, "~<+%i~>",
|
||||
unit->Player->Incomes[GoldCost]-DEFAULT_INCOMES[GoldCost]);
|
||||
VideoDrawText(x+126,y+8+77,GameFont,buf);
|
||||
sprintf(buf, "~<+%i~> (%+.1f)",
|
||||
unit->Player->Incomes[GoldCost]-DEFAULT_INCOMES[GoldCost],
|
||||
unit->Player->Revenue[GoldCost] / 1000.0);
|
||||
VideoDrawText(x+96,y+8+77,GameFont,buf);
|
||||
}
|
||||
VideoDrawText(x+52,y+8+93,GameFont,"Lumber:");
|
||||
VideoDrawNumber(x+108,y+8+93,GameFont,DEFAULT_INCOMES[WoodCost]);
|
||||
VideoDrawText(x+22,y+8+93,GameFont,"Lumber:");
|
||||
VideoDrawNumber(x+78,y+8+93,GameFont,DEFAULT_INCOMES[WoodCost]);
|
||||
// Lumber mill
|
||||
if( unit->Player->Incomes[WoodCost]!=DEFAULT_INCOMES[WoodCost] ) {
|
||||
sprintf(buf, "~<+%i~>",
|
||||
unit->Player->Incomes[WoodCost]-DEFAULT_INCOMES[WoodCost]);
|
||||
VideoDrawText(x+126,y+8+93,GameFont,buf);
|
||||
sprintf(buf, "~<+%i~> (%+.1f)",
|
||||
unit->Player->Incomes[WoodCost]-DEFAULT_INCOMES[WoodCost],
|
||||
unit->Player->Revenue[WoodCost] / 1000.0);
|
||||
VideoDrawText(x+96,y+8+93,GameFont,buf);
|
||||
}
|
||||
VideoDrawText(x+84,y+8+109,GameFont,"Oil:");
|
||||
VideoDrawNumber(x+108,y+8+109,GameFont,DEFAULT_INCOMES[OilCost]);
|
||||
VideoDrawText(x+54,y+8+109,GameFont,"Oil:");
|
||||
VideoDrawNumber(x+78,y+8+109,GameFont,DEFAULT_INCOMES[OilCost]);
|
||||
if( unit->Player->Incomes[OilCost]!=DEFAULT_INCOMES[OilCost] ) {
|
||||
sprintf(buf, "~<+%i~>",
|
||||
unit->Player->Incomes[OilCost]-DEFAULT_INCOMES[OilCost]);
|
||||
VideoDrawText(x+126,y+8+109,GameFont,buf);
|
||||
sprintf(buf, "~<+%i~> (%+.1f)",
|
||||
unit->Player->Incomes[OilCost]-DEFAULT_INCOMES[OilCost],
|
||||
unit->Player->Revenue[OilCost] / 1000.0);
|
||||
VideoDrawText(x+96,y+8+109,GameFont,buf);
|
||||
}
|
||||
return;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue