src/misc.cpp
branchcpp_gui
changeset 6285 187e3ef04cc9
parent 6268 4b5241e5dd10
child 6298 c30fe89622df
child 6557 8381016f71f3
child 9881 fbb3eab0e186
equal deleted inserted replaced
6284:45d0233e7d79 6285:187e3ef04cc9
     1 /* $Id$ */
     1 /* $Id$ */
       
     2 
       
     3 /** @file misc.cpp */
     2 
     4 
     3 #include "stdafx.h"
     5 #include "stdafx.h"
     4 #include "openttd.h"
     6 #include "openttd.h"
     5 #include "currency.h"
     7 #include "currency.h"
     6 #include "functions.h"
     8 #include "functions.h"
   232 		*strto = '\0';
   234 		*strto = '\0';
   233 		memcpy(_name_array[i], tmp, sizeof(*_name_array));
   235 		memcpy(_name_array[i], tmp, sizeof(*_name_array));
   234 	}
   236 	}
   235 }
   237 }
   236 
   238 
   237 // Calculate constants that depend on the landscape type.
   239 /* Calculate constants that depend on the landscape type. */
   238 void InitializeLandscapeVariables(bool only_constants)
   240 void InitializeLandscapeVariables(bool only_constants)
   239 {
   241 {
   240 	if (only_constants) return;
   242 	if (only_constants) return;
   241 
   243 
   242 	for (CargoID i = 0; i != NUM_CARGO; i++) {
   244 	for (CargoID i = 0; i != NUM_CARGO; i++) {
   247 
   249 
   248 
   250 
   249 
   251 
   250 int FindFirstBit(uint32 value)
   252 int FindFirstBit(uint32 value)
   251 {
   253 {
   252 	// The macro FIND_FIRST_BIT is better to use when your value is
   254 	/* The macro FIND_FIRST_BIT is better to use when your value is
   253 	// not more than 128.
   255 	  not more than 128. */
   254 	byte i = 0;
   256 	byte i = 0;
   255 
   257 
   256 	if (value == 0) return 0;
   258 	if (value == 0) return 0;
   257 
   259 
   258 	if ((value & 0x0000ffff) == 0) { value >>= 16; i += 16; }
   260 	if ((value & 0x0000ffff) == 0) { value >>= 16; i += 16; }
   308 	SLEG_CONDVAR(_pause,                  SLE_UINT8,                   4, SL_MAX_VERSION),
   310 	SLEG_CONDVAR(_pause,                  SLE_UINT8,                   4, SL_MAX_VERSION),
   309 	SLEG_CONDVAR(_cur_town_iter,          SLE_UINT32,                 11, SL_MAX_VERSION),
   311 	SLEG_CONDVAR(_cur_town_iter,          SLE_UINT32,                 11, SL_MAX_VERSION),
   310 	    SLEG_END()
   312 	    SLEG_END()
   311 };
   313 };
   312 
   314 
   313 // Save load date related variables as well as persistent tick counters
   315 /* Save load date related variables as well as persistent tick counters
   314 // XXX: currently some unrelated stuff is just put here
   316  * XXX: currently some unrelated stuff is just put here */
   315 static void SaveLoad_DATE(void)
   317 static void SaveLoad_DATE(void)
   316 {
   318 {
   317 	SlGlobList(_date_desc);
   319 	SlGlobList(_date_desc);
   318 }
   320 }
   319 
   321