town_cmd.c
changeset 121 c2f18f4d8be1
parent 39 d177340ed556
child 159 139cf78bfb28
equal deleted inserted replaced
120:78705eeb98e6 121:c2f18f4d8be1
   861 
   861 
   862 	for(i = 0; i != MAX_PLAYERS; i++)
   862 	for(i = 0; i != MAX_PLAYERS; i++)
   863 		t->ratings[i] = 500;
   863 		t->ratings[i] = 500;
   864 
   864 
   865 	t->have_ratings = 0;
   865 	t->have_ratings = 0;
       
   866 	t->exclusivity = (byte)-1;
       
   867 	t->exclusive_counter = 0;
   866 	t->statues = 0;
   868 	t->statues = 0;
   867 
   869 
   868 	CreateTownName(t);
   870 	CreateTownName(t);
   869 		
   871 		
   870 	UpdateTownVirtCoord(t);
   872 	UpdateTownVirtCoord(t);
  1469 	t->fund_buildings_months = 3;
  1471 	t->fund_buildings_months = 3;
  1470 }
  1472 }
  1471 
  1473 
  1472 static void TownActionBuyRights(Town *t, int action)
  1474 static void TownActionBuyRights(Town *t, int action)
  1473 {
  1475 {
  1474 	Station *st;
  1476 	t->exclusive_counter = 12;
  1475 
  1477 	t->exclusivity = _current_player;
  1476 	FOR_ALL_STATIONS(st) {
       
  1477 		if (st->xy && st->town == t && st->owner < 8 && 
       
  1478 				st->owner != _current_player)
       
  1479 			st->blocked_months = 12;
       
  1480 	}
       
  1481 
  1478 
  1482 	ModifyStationRatingAround(t->xy, _current_player, 130, 17);
  1479 	ModifyStationRatingAround(t->xy, _current_player, 130, 17);
  1483 }
  1480 }
  1484 
  1481 
  1485 static void TownActionBribe(Town *t, int action)
  1482 static void TownActionBribe(Town *t, int action)
  1736 	Town *t;
  1733 	Town *t;
  1737 
  1734 
  1738 	FOR_ALL_TOWNS(t) if (t->xy != 0) {
  1735 	FOR_ALL_TOWNS(t) if (t->xy != 0) {
  1739 		if (t->road_build_months != 0)
  1736 		if (t->road_build_months != 0)
  1740 			t->road_build_months--;
  1737 			t->road_build_months--;
       
  1738 
       
  1739 		if (t->exclusive_counter != 0)
       
  1740 			if(--t->exclusive_counter==0)
       
  1741 				t->exclusivity = (byte)-1;
  1741 
  1742 
  1742 		UpdateTownGrowRate(t);
  1743 		UpdateTownGrowRate(t);
  1743 		UpdateTownAmounts(t);
  1744 		UpdateTownAmounts(t);
  1744 		UpdateTownUnwanted(t);
  1745 		UpdateTownUnwanted(t);
  1745 	}
  1746 	}
  1825 	SLE_VAR(Town,grow_counter,					SLE_UINT8),
  1826 	SLE_VAR(Town,grow_counter,					SLE_UINT8),
  1826 	SLE_VAR(Town,growth_rate,						SLE_UINT8),
  1827 	SLE_VAR(Town,growth_rate,						SLE_UINT8),
  1827 	SLE_VAR(Town,fund_buildings_months,	SLE_UINT8),
  1828 	SLE_VAR(Town,fund_buildings_months,	SLE_UINT8),
  1828 	SLE_VAR(Town,road_build_months,			SLE_UINT8),
  1829 	SLE_VAR(Town,road_build_months,			SLE_UINT8),
  1829 
  1830 
  1830 	// reserve extra space in savegame here. (currently 32 bytes)
  1831 	SLE_VAR(Town,exclusivity,						SLE_UINT8),
  1831 	SLE_CONDARR(NullStruct,null,SLE_FILE_U64 | SLE_VAR_NULL, 4, 2, 255),
  1832 	SLE_VAR(Town,exclusive_counter,			SLE_UINT8),
       
  1833 	// reserve extra space in savegame here. (currently 30 bytes)
       
  1834 	SLE_CONDARR(NullStruct,null,SLE_FILE_U8 | SLE_VAR_NULL, 30, 2, 255),
  1832 
  1835 
  1833 	SLE_END()
  1836 	SLE_END()
  1834 };
  1837 };
  1835 
  1838 
  1836 static void Save_TOWN()
  1839 static void Save_TOWN()