Exemplo n.º 1
0
//--------- Begin of function FirmHarbor::disp_main_menu ---------//
//
void FirmHarbor::disp_main_menu(int refreshFlag)
{
	firm_harbor_ptr = this;

	disp_basic_info(INFO_Y1, refreshFlag);

	if( !should_show_harbor_info() )
		return;

	//-------- display browser -----------//

	if( refreshFlag == INFO_REPAINT )
	{
		browse_ship.init( SHIP_BROWSE_X1, SHIP_BROWSE_Y1, SHIP_BROWSE_X2, SHIP_BROWSE_Y2,
								0, 25, ship_count, put_ship_rec );

		browse_ship.open(1);

		put_det(INFO_REPAINT);
	}
	else
	{
		if( last_ship_count != ship_count )
		{
			last_ship_count = ship_count;
			info.disp();
		}
		else
			browse_ship.update();          // update only
	}

	last_ship_count = ship_count;

   //-------------------------------//

	if( !own_firm() )
		return;

	//-------- display buttons ---------//

	if( refreshFlag == INFO_REPAINT )
	{
		button_build.paint( SHIP_DET_X1, SHIP_DET_Y2+4, 'A', "MAKESHIP" );
		button_sail.paint ( SHIP_DET_X1+BUTTON_ACTION_WIDTH, SHIP_DET_Y2+4, 'A', "SAILOUT" );
	}

	if( ship_count > 0 )
		button_sail.enable();
	else
		button_sail.disable();

	//------ display the info of the ship under construction ------//

	disp_build_info(refreshFlag);
}
Exemplo n.º 2
0
//--------- Begin of function FirmInn::put_info ---------//
//
void FirmInn::put_info(int refreshFlag)
{
	firm_inn_ptr = this;

	disp_basic_info(INFO_Y1, refreshFlag);

	if( !should_show_info() )
		return;

	//----------- display browser -----------//

	if( refreshFlag == INFO_REPAINT )
	{
		browse_hire.init( HIRE_BROWSE_X1, HIRE_BROWSE_Y1, HIRE_BROWSE_X2, HIRE_BROWSE_Y2,
								0, 25, inn_unit_count, put_hire_rec );

		browse_hire.open(1);
	}
	else
	{
		if( last_hire_count != inn_unit_count )
		{
			if( last_hire_count==0 || inn_unit_count==0 )		// repaint the whole area as the detail area needs to disappear
			{
				last_hire_count = inn_unit_count;
				info.disp();
				return;
			}

			last_hire_count = inn_unit_count;

			browse_hire.refresh(-1, inn_unit_count);

			if( last_hire_count==0 || inn_unit_count==0 )
				refreshFlag = INFO_REPAINT;
		}
		else
			browse_hire.update();          // update only
	}

	last_hire_count = inn_unit_count;

	put_det(refreshFlag);

	//---------- display spy button ----------//

	disp_spy_button(INFO_X1+BUTTON_ACTION_WIDTH, HIRE_DET_Y2+4, refreshFlag);
}
Exemplo n.º 3
0
//--------- Begin of function FirmHarbor::detect_main_menu ---------//
//
void FirmHarbor::detect_main_menu()
{
	firm_harbor_ptr = this;

	if( detect_basic_info() )
		return;

	if( !own_firm() )
		return;

	if( browse_ship.detect() )
		put_det(INFO_UPDATE);

	if( detect_det() )
		return;

	//------- detect the build button ---------//

	if( button_build.detect() )
	{
		harbor_menu_mode = HARBOR_MENU_BUILD;
		disable_refresh = 1;    // static var for disp_info() only
		info.disp();
		disable_refresh = 0;
	}

	//-------- detect the sail button ---------//

	if( button_sail.detect() && browse_ship.recno() > 0 )
		sail_ship( ship_recno_array[browse_ship.recno()-1], COMMAND_PLAYER );

	//---------- detect cancel build button -----------//
	if(build_unit_id)
	{
		if(button_cancel_build.detect())
		{
			if( !remote.is_enable() )
				cancel_build_unit();
			else
			{
				short *shortPtr = (short *)remote.new_send_queue_msg(MSG_F_HARBOR_SKIP_SHIP, sizeof(short));
				shortPtr[0] = firm_recno;
			}
		}
	}
}
Exemplo n.º 4
0
//--------- Begin of function FirmInn::detect_info ---------//
//
void FirmInn::detect_info()
{
	firm_inn_ptr = this;

	if( detect_basic_info() )
		return;

	//-------- detect spy button ----------//

	if( !own_firm() )
	{
		detect_spy_button();
		return;
	}

	//-------------------------------------//

	if( browse_hire.detect() )
	{
		put_det(INFO_UPDATE);
	}

	if( button_hire.detect('R') && inn_unit_count > 0 )
	{
		// ###### begin Gilbert 31/7 #######//
		se_res.far_sound(center_x, center_y, 1, 'S', 
			unit_res[inn_unit_array[browse_hire.recno()-1].unit_id]->sprite_id,
			"RDY" );
		// ###### end Gilbert 31/7 #######//
		if(remote.is_enable())
		{
			// packet structure : <firm recno>, <hire Id> <nation no>
			short *shortPtr=(short *)remote.new_send_queue_msg(MSG_F_INN_HIRE, 3*sizeof(short));
			shortPtr[0] = firm_recno;
			shortPtr[1] = browse_hire.recno();
			shortPtr[2] = nation_recno;
		}
		else
		{
			hire(browse_hire.recno());
		}
	}
}
Exemplo n.º 5
0
//--------- Begin of function FirmHarbor::detect_det ---------//
//
int FirmHarbor::detect_det()
{
	if( browse_ship.none_record )
		return 0;

	UnitMarine* shipUnitPtr  = (UnitMarine*) unit_array[ ship_recno_array[browse_ship.recno()-1] ];
	UnitInfo*   shipUnitInfo = unit_res[shipUnitPtr->unit_id];

	if( shipUnitInfo->carry_goods_capacity > 0 &&
		 shipUnitInfo->carry_unit_capacity > 0 )
	{
		if( button_mode.detect() >= 0 )
		{
			ship_disp_mode = button_mode.button_pressed;
			vga_util.blt_buf( SHIP_DET_X1, SHIP_DET_Y1+22, SHIP_DET_X2, SHIP_DET_Y2, 0 );
			put_det(INFO_UPDATE);
			return 1;
		}
	}

	return 0;
}