Changeset - r13309:dd77f28e4f9f
[Not reviewed]
master
0 1 0
alberth - 15 years ago 2009-10-20 20:06:25
alberth@openttd.org
(svn r17828) -Codechange: Variable declaration code style, and a few comment typo-ish fixes.
1 file changed with 7 insertions and 9 deletions:
0 comments (0 inline, 0 general)
src/industry_gui.cpp
Show inline comments
 
@@ -140,27 +140,25 @@ static const WindowDesc _build_industry_
 
	WDP_AUTO, WDP_AUTO, 170, 212, 170, 212,
 
	WC_BUILD_INDUSTRY, WC_NONE,
 
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE | WDF_CONSTRUCTION,
 
	_build_industry_widgets, _nested_build_industry_widgets, lengthof(_nested_build_industry_widgets)
 
);
 

	
 
/** Build (fund or prospect) a new industry, */
 
class BuildIndustryWindow : public Window {
 
	int selected_index;                         ///< index of the element in the matrix
 
	IndustryType selected_type;                 ///< industry corresponding to the above index
 
	uint16 callback_timer;                      ///< timer counter for callback eventual verification
 
	bool timer_enabled;                         ///< timer can be used
 
	uint16 count;                               ///< How many industries are loaded
 
	IndustryType index[NUM_INDUSTRYTYPES + 1];  ///< Type of industry, in the order it was loaded
 
	StringID text[NUM_INDUSTRYTYPES + 1];       ///< Text coming from CBM_IND_FUND_MORE_TEXT (if ever)
 
	bool enabled[NUM_INDUSTRYTYPES + 1];        ///< availability state, coming from CBID_INDUSTRY_AVAILABLE (if ever)
 

	
 
	void SetupArrays()
 
	{
 
		IndustryType ind;
 
		const IndustrySpec *indsp;
 

	
 
		this->count = 0;
 

	
 
		for (uint i = 0; i < lengthof(this->index); i++) {
 
			this->index[i]   = INVALID_INDUSTRYTYPE;
 
			this->text[i]    = STR_NULL;
 
			this->enabled[i] = false;
 
@@ -172,14 +170,14 @@ class BuildIndustryWindow : public Windo
 
			this->timer_enabled = false;
 
		}
 
		/* Fill the arrays with industries.
 
		 * The tests performed after the enabled allow to load the industries
 
		 * In the same way they are inserted by grf (if any)
 
		 */
 
		for (ind = 0; ind < NUM_INDUSTRYTYPES; ind++) {
 
			indsp = GetIndustrySpec(ind);
 
		for (IndustryType ind = 0; ind < NUM_INDUSTRYTYPES; ind++) {
 
			const IndustrySpec *indsp = GetIndustrySpec(ind);
 
			if (indsp->enabled) {
 
				/* Rule is that editor mode loads all industries.
 
				 * In game mode, all non raw industries are loaded too
 
				 * and raw ones are loaded only when setting allows it */
 
				if (_game_mode != GM_EDITOR && indsp->IsRawIndustry() && _settings_game.construction.raw_industry_construction == 0) {
 
					/* Unselect if the industry is no longer in the list */
 
@@ -203,13 +201,13 @@ class BuildIndustryWindow : public Windo
 
	}
 

	
 
public:
 
	BuildIndustryWindow() : Window(&_build_industry_desc)
 
	{
 
		/* Shorten the window to the equivalant of the additionnal purchase
 
		 * info coming from the callback.  SO it will only be available to its full
 
		 * info coming from the callback.  So it will only be available to its full
 
		 * height when newindistries are loaded */
 
		if (!_loaded_newgrf_features.has_newindustries) {
 
			this->widget[DPIW_INFOPANEL].bottom -= 44;
 
			this->widget[DPIW_FUND_WIDGET].bottom -= 44;
 
			this->widget[DPIW_FUND_WIDGET].top -= 44;
 
			this->widget[DPIW_RESIZE_WIDGET].bottom -= 44;
 
@@ -315,17 +313,17 @@ public:
 
			SetDParam(p++, CargoSpec::Get(indsp->produced_cargo[j])->name);
 
			SetDParamStr(p++, cargo_suffix[j]);
 
		}
 
		DrawString(x_str, right, y_str, str);
 
		y_str += 11;
 

	
 
		/* Get the additional purchase info text, if it has not already been */
 
		if (this->text[this->selected_index] == STR_NULL) {   // Have i been called already?
 
		/* Get the additional purchase info text, if it has not already been queried. */
 
		if (this->text[this->selected_index] == STR_NULL) {   // Have I been called already?
 
			if (HasBit(indsp->callback_mask, CBM_IND_FUND_MORE_TEXT)) {          // No. Can it be called?
 
				uint16 callback_res = GetIndustryCallback(CBID_INDUSTRY_FUND_MORE_TEXT, 0, 0, NULL, this->selected_type, INVALID_TILE);
 
				if (callback_res != CALLBACK_FAILED) {  // Did it failed?
 
				if (callback_res != CALLBACK_FAILED) {  // Did it fail?
 
					StringID newtxt = GetGRFStringID(indsp->grf_prop.grffile->grfid, 0xD000 + callback_res);  // No. here's the new string
 
					this->text[this->selected_index] = newtxt;   // Store it for further usage
 
				}
 
			}
 
		}
 

	
0 comments (0 inline, 0 general)