src/misc.cpp
branchNewGRF_ports
changeset 6720 35756db7e577
parent 6719 4cc327ad39d5
child 6868 7eb395287b3d
equal deleted inserted replaced
6719:4cc327ad39d5 6720:35756db7e577
    91 void InitializeMainGui();
    91 void InitializeMainGui();
    92 void InitializeTowns();
    92 void InitializeTowns();
    93 void InitializeTrees();
    93 void InitializeTrees();
    94 void InitializeSigns();
    94 void InitializeSigns();
    95 void InitializeStations();
    95 void InitializeStations();
       
    96 void InitializeCargoPackets();
    96 static void InitializeNameMgr();
    97 static void InitializeNameMgr();
    97 void InitializePlayers();
    98 void InitializePlayers();
    98 static void InitializeCheats();
    99 static void InitializeCheats();
    99 void InitializeNPF();
   100 void InitializeNPF();
   100 
   101 
   107 	SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, 0, WC_MAIN_WINDOW, 0);
   108 	SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, 0, WC_MAIN_WINDOW, 0);
   108 
   109 
   109 	_pause_game = 0;
   110 	_pause_game = 0;
   110 	_fast_forward = 0;
   111 	_fast_forward = 0;
   111 	_tick_counter = 0;
   112 	_tick_counter = 0;
       
   113 	_realtime_tick = 0;
   112 	_date_fract = 0;
   114 	_date_fract = 0;
   113 	_cur_tileloop_tile = 0;
   115 	_cur_tileloop_tile = 0;
   114 
   116 
   115 	if ((mode & IG_DATE_RESET) == IG_DATE_RESET) {
   117 	if ((mode & IG_DATE_RESET) == IG_DATE_RESET) {
   116 		SetDate(ConvertYMDToDate(_patches.starting_year, 0, 1));
   118 		SetDate(ConvertYMDToDate(_patches.starting_year, 0, 1));
   132 	InitializeDockGui();
   134 	InitializeDockGui();
   133 	InitializeTowns();
   135 	InitializeTowns();
   134 	InitializeTrees();
   136 	InitializeTrees();
   135 	InitializeSigns();
   137 	InitializeSigns();
   136 	InitializeStations();
   138 	InitializeStations();
       
   139 	InitializeCargoPackets();
   137 	InitializeIndustries();
   140 	InitializeIndustries();
   138 	InitializeBuildingCounts();
   141 	InitializeBuildingCounts();
   139 	InitializeMainGui();
   142 	InitializeMainGui();
   140 
   143 
   141 	InitializeNameMgr();
   144 	InitializeNameMgr();
   268 	if ((value & 0x00000001) == 0) { i += 1; }
   271 	if ((value & 0x00000001) == 0) { i += 1; }
   269 
   272 
   270 	return i;
   273 	return i;
   271 }
   274 }
   272 
   275 
       
   276 int CountBitsSet(uint32 value)
       
   277 {
       
   278 	int num;
       
   279 
       
   280 	/* This loop is only called once for every bit set by clearing the lowest
       
   281 	 * bit in each loop. The number of bits is therefore equal to the number of
       
   282 	 * times the loop was called. It was found at the following website:
       
   283 	 * http://graphics.stanford.edu/~seander/bithacks.html */
       
   284 
       
   285 	for (num = 0; value != 0; num++) {
       
   286 		value &= value - 1;
       
   287 	}
       
   288 
       
   289 	return num;
       
   290 }
   273 
   291 
   274 static void Save_NAME()
   292 static void Save_NAME()
   275 {
   293 {
   276 	int i;
   294 	int i;
   277 
   295