src/industry_cmd.cpp
changeset 6467 7bce7e0c9937
parent 6442 1bab3df59b91
child 6468 ab54a3aeeacd
equal deleted inserted replaced
6466:674d898f2997 6467:7bce7e0c9937
  1691 
  1691 
  1692 
  1692 
  1693 static void UpdateIndustryStatistics(Industry *i)
  1693 static void UpdateIndustryStatistics(Industry *i)
  1694 {
  1694 {
  1695 	byte pct;
  1695 	byte pct;
       
  1696 	bool refresh = false;
  1696 
  1697 
  1697 	if (i->produced_cargo[0] != CT_INVALID) {
  1698 	if (i->produced_cargo[0] != CT_INVALID) {
  1698 		pct = 0;
  1699 		pct = 0;
  1699 		if (i->last_mo_production[0] != 0) {
  1700 		if (i->last_mo_production[0] != 0) {
  1700 			i->last_prod_year = _cur_year;
  1701 			i->last_prod_year = _cur_year;
  1705 		i->total_production[0] = i->last_mo_production[0];
  1706 		i->total_production[0] = i->last_mo_production[0];
  1706 		i->last_mo_production[0] = 0;
  1707 		i->last_mo_production[0] = 0;
  1707 
  1708 
  1708 		i->total_transported[0] = i->last_mo_transported[0];
  1709 		i->total_transported[0] = i->last_mo_transported[0];
  1709 		i->last_mo_transported[0] = 0;
  1710 		i->last_mo_transported[0] = 0;
       
  1711 		refresh = true;
  1710 	}
  1712 	}
  1711 
  1713 
  1712 	if (i->produced_cargo[1] != CT_INVALID) {
  1714 	if (i->produced_cargo[1] != CT_INVALID) {
  1713 		pct = 0;
  1715 		pct = 0;
  1714 		if (i->last_mo_production[1] != 0) {
  1716 		if (i->last_mo_production[1] != 0) {
  1720 		i->total_production[1] = i->last_mo_production[1];
  1722 		i->total_production[1] = i->last_mo_production[1];
  1721 		i->last_mo_production[1] = 0;
  1723 		i->last_mo_production[1] = 0;
  1722 
  1724 
  1723 		i->total_transported[1] = i->last_mo_transported[1];
  1725 		i->total_transported[1] = i->last_mo_transported[1];
  1724 		i->last_mo_transported[1] = 0;
  1726 		i->last_mo_transported[1] = 0;
  1725 	}
  1727 		refresh = true;
  1726 
  1728 	}
  1727 
  1729 
  1728 	if (i->produced_cargo[0] != CT_INVALID || i->produced_cargo[1] != CT_INVALID)
  1730 
       
  1731 	if (refresh)
  1729 		InvalidateWindow(WC_INDUSTRY_VIEW, i->index);
  1732 		InvalidateWindow(WC_INDUSTRY_VIEW, i->index);
  1730 
  1733 
  1731 	if (i->prod_level == 0) {
  1734 	if (i->prod_level == 0) {
  1732 		DeleteIndustry(i);
  1735 		DeleteIndustry(i);
  1733 	} else if (_patches.smooth_economy) {
  1736 	} else if (_patches.smooth_economy) {