Esempio n. 1
0
//--------- Begin of function Info::detect_military ---------//
//
void Info::detect_military()
{
	//------- detect the troop report -------//

	if( browse_troop.detect() )
	{
		browse_troop_recno = browse_troop.recno();

		if( browse_troop.double_click )
		{
			Unit* unitPtr = unit_array[ troop_filter(browse_troop_recno) ];
			short xLoc, yLoc;

			if( unitPtr->get_cur_loc(xLoc, yLoc) )
			{
				world.go_loc(xLoc, yLoc, 1);
			}
		}
	}

	//------- detect the unit report -------//

	if( browse_unit.detect() )
	{
		browse_unit_recno = browse_unit.recno();
	}
}
Esempio n. 2
0
//--------- Begin of function Info::detect_economy ---------//
//
void Info::detect_economy()
{
	if( browse_income.detect() )
		browse_income_recno = browse_income.recno();

	if( browse_expense.detect() )
		browse_expense_recno = browse_expense.recno();
}
Esempio n. 3
0
//--------- Begin of function Info::detect_ai_action ---------//
//
void Info::detect_ai_action()
{
	if( browse_action.detect() )
		browse_ai_action_recno = browse_action.recno();

	if( browse_attack.detect() )
		browse_ai_attack_recno = browse_attack.recno();
}
Esempio n. 4
0
//--------- Begin of function Info::detect_trade ---------//
//
void Info::detect_trade()
{
	//-------- detect the caravan browser ---------//

	if( browse_caravan.detect() )
	{
		browse_caravan_recno = browse_caravan.recno();

		if( browse_caravan.double_click )
		{
			Unit* unitPtr = unit_array[ get_report_data(browse_caravan_recno) ];

			world.go_loc(unitPtr->next_x_loc(), unitPtr->next_y_loc(), 1);
		}
	}

	//-------- detect the ship browser ---------//

/*
	if( browse_ship.detect() )
	{
		browse_ship_recno = browse_ship.recno();

		if( browse_ship.double_click )
		{
			Unit* unitPtr = unit_array[ get_report_data2(browse_ship_recno) ];

			world.go_loc(unitPtr->next_x_loc(), unitPtr->next_y_loc(), 1);
		}
	}
*/
}
Esempio n. 5
0
// ----- begin of function ScenarioEditor::detect_monster_main ------//
//
void ScenarioEditor::detect_monster_main()
{
	// detect interface area
	int rc;

	if (!spinner_race_group.vbrowse_enable_flag)
	{
		rc = button_unit_or_struct.detect();
		if( rc >= 0 )
			unit_or_struct = rc;

		rc = button_player_recno.detect();
		if( rc >= 0 )
			brush_player_recno = rc;

		if( !unit_or_struct )
		{
			rc = vbrowse_unit_id.detect();
			// ###### begin gilbert 22/2 ########//
			//if( rc > 0 )
			//	monster_unit_id_browse_recno = rc;
			monster_unit_id_browse_recno = vbrowse_unit_id.recno();
			// ###### end gilbert 22/2 ########//
		}
		else
		{
			rc = vbrowse_firm_build.detect();
			// ###### begin Gilbert 22/2 #########//
			// if( rc > 0 )
			//		monster_firm_group_browse_recno = rc;
			monster_firm_group_browse_recno = vbrowse_firm_build.recno();
			// ###### end Gilbert 22/2 #########//
		}
	}

	//	rc = button_race_group.detect();
	rc = spinner_race_group.detect();
	if( rc >= 0 )
	{
		monster_race_filter = -rc;
		return;
	}
}
Esempio n. 6
0
//--------- Begin of function Info::detect_news_log ---------//
//
void Info::detect_news_log()
{
	if( browse_news.detect() )
		browse_news_recno = browse_news.recno();

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

	if( mouse.single_click( ZOOM_X2-27, ZOOM_Y2-23, ZOOM_X2-27+14, ZOOM_Y2-23+14 ) )
		sys.set_view_mode(MODE_NORMAL);
}
Esempio n. 7
0
//--------- Begin of function Info::detect_rank ---------//
//
void Info::detect_rank()
{
	//------- detect nation browser ------//

	if( browse_nation.detect() )
	{
		browse_nation_recno = browse_nation.recno();
		return;
	}
}
Esempio n. 8
0
//--------- Begin of function Info::detect_town ---------//
//
void Info::detect_town()
{
   //------- detect the town browser -------//

	if( browse_town.detect() )
	{
		browse_town_recno = browse_town.recno();

		if( browse_town.double_click )
		{
			Town* townPtr = town_array[ town_filter(browse_town_recno) ];

			world.go_loc(townPtr->center_x, townPtr->center_y, 1);
		}
	}

	//------- detect the firm browser -------//

	if( browse_firm.detect() )
		browse_firm_recno = browse_firm.recno();
}
Esempio n. 9
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;
			}
		}
	}
}
Esempio n. 10
0
//--------- Begin of function Info::detect_spy ---------//
//
void Info::detect_spy()
{
	//------- detect the spy browser -------//

	if( browse_spy.detect() )
	{
		browse_spy_recno = browse_spy.recno();

		if( browse_spy.double_click )
		{
			Spy* spyPtr = spy_array[ spy_filter(browse_spy_recno) ];
			int  xLoc, yLoc;

			if( spyPtr->get_loc(xLoc, yLoc) )
				world.go_loc( xLoc, yLoc, 1 );
		}
	}
}
Esempio n. 11
0
//--------- Begin of function Info::detect_nation ---------//
//
void Info::detect_nation()
{
	//------- detect nation browser ------//

	if( browse_nation.detect() )
	{
		browse_nation_recno = browse_nation.recno();
		return;
	}

	//------- detect report buttons --------//

	if( detect_button() )
		return;

	//--------- detect detail info -------//

	detect_detail();
}
Esempio n. 12
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());
		}
	}
}
Esempio n. 13
0
//--------- Begin of static function detect_detail ---------//
//
static void detect_detail()
{
	switch( info.nation_report_mode )
	{
		case NATION_REPORT_INFO:
			detect_nation_info();
			break;

		case NATION_REPORT_TALK:
			detect_nation_talk();
			break;

		case NATION_REPORT_CHAT:
			detect_nation_chat();
			break;

		case NATION_REPORT_TALK_LOG:
			if( browse_talk_msg.detect() )
				info.browse_talk_msg_recno = browse_talk_msg.recno();
			break;
	}
}
Esempio n. 14
0
//--------- Begin of function Info::detect_nation ---------//
//
void Info::detect_nation()
{
	int hideNationBrowse = nation_report_mode == NATION_REPORT_CHAT
		&& hide_nation_browse;

	//------- detect nation browser ------//

	if( !hideNationBrowse && browse_nation.detect() )
	{
		browse_nation_recno = browse_nation.recno();
		return;
	}

	//------- detect report buttons --------//

	if( detect_button() )
		return;

	//--------- detect detail info -------//

	detect_detail();
}
Esempio n. 15
0
//--------- Begin of function Firm::detect_spy_menu ---------//
//
void Firm::detect_spy_menu()
{
	firm_ptr = this;

	if( spy_filter()==0 )
		return;

	browse_spy.detect();

	Spy* spyPtr = spy_array[ spy_filter( browse_spy.recno() ) ];

	//--------- detect buttons --------//

	//--------- spy menu mode -----------//

	if( firm_menu_mode == FIRM_MENU_SPY )
	{
		//------ mobilize spy ---------//

		if( button_spy_mobilize.detect() )
		{
			if( !remote.is_enable() )
			{
				if( spyPtr->mobilize_firm_spy() )
				{
					spyPtr->notify_cloaked_nation_flag = 0;		// reset it so the player can control it
					info.disp();
					return;
				}
			}
			else
			{
				// packet structure <spy recno>
				short *shortPtr = (short *)remote.new_send_queue_msg(MSG_SPY_LEAVE_FIRM, sizeof(short) );
				*shortPtr = spyPtr->spy_recno;
			}
		}

		//------ reward spy ---------//

		else if( button_spy_reward.detect() )
		{
			spyPtr->reward(COMMAND_PLAYER);
		}

		//------- change spy action ---------//

		else if( button_spy_action.detect() )		// set action mode
		{
			if( !remote.is_enable() )
			{
				spyPtr->set_next_action_mode();
				disp_spy_menu( INFO_UPDATE );
			}
			else
			{
				// packet structure <spy recno>
				short *shortPtr = (short *)remote.new_send_queue_msg(MSG_SPY_CYCLE_ACTION, sizeof(short) );
				*shortPtr = spyPtr->spy_recno;
			}
		}

		//------ capture firm ---------//

		else if( button_capture.detect() )
		{
			int spyRecno = can_player_spy_capture();

			if( spyRecno )
			{
				Spy* capturerSpy = spy_array[spyRecno];

				if( !remote.is_enable() )
				{
					capturerSpy->capture_firm();
				}
				else
				{
					// packet structure <spy recno>
					short *shortPtr = (short *)remote.new_send_queue_msg(MSG_SPY_CAPTURE_FIRM, sizeof(short) );
					*shortPtr = capturerSpy->spy_recno;
				}
			}
		}

		//------ view secret ---------//

		else if( button_view_secret.detect() )
		{
			action_spy_recno = spyPtr->spy_recno;
			firm_menu_mode   = FIRM_MENU_VIEW_SECRET;
			info.disp();
		}

		//-------- assassinate ------//

		else if( button_assassinate.detect() )
		{
			spyPtr->assassinate( overseer_recno, COMMAND_PLAYER );
		}
	}

	//--------- select briber mode --------//

	else if( firm_menu_mode == FIRM_MENU_SELECT_BRIBER )
	{
		if( button_bribe.detect() )
		{
			action_spy_recno = spyPtr->spy_recno;
			firm_menu_mode   = FIRM_MENU_SET_BRIBE_AMOUNT;
			info.disp();
		}
	}
	else
	{
		err_here();
	}

	//--------- detect cancel button --------//

	if( button_cancel.detect() )
	{
		firm_menu_mode = FIRM_MENU_MAIN;
		info.disp();
	}
}
Esempio n. 16
0
// ----- begin of function ScenarioEditor::detect_players_main ------//
//
void ScenarioEditor::detect_players_main()
{
	int rc;

	// ------- detect scroll area ----------//

	if( (rc = browse_nation.detect()) > 0 )
	{
		// ###### begin Gilbert 22/2 #######//
		// brush_player_recno = rc;
		// ###### end Gilbert 22/2 #######//
	}
	brush_player_recno = browse_nation.recno();

	if( nation_array.is_deleted(brush_player_recno) )
		return;

	Nation *nationPtr = nation_array[brush_player_recno];

	int y = INFO_Y1+170;

	if( mouse.single_click( INFO_X1+5, y, INFO_X2-5, y+8+font_cara_w.max_font_height ) )
	{
		// create geta to edit nation name

		const int yOffs = 4;
		const int lrMargin = 5;
		const unsigned int FIELD_LEN = 30;

		// paint the background again
		int y2 = y+8+font_cara_w.max_font_height;
		vga_buffer.d3_panel_up( INFO_X1+5, y, INFO_X2-5, y2 );
		Blob2DW backGroundBuf;
		backGroundBuf.resize( 0, 0, (INFO_X2-5)-(INFO_X1+5+lrMargin)+1, y2-(y+yOffs)+1 );
		vga_buffer.read_bitmapW( INFO_X1+5+lrMargin, y+yOffs, INFO_X2-5, y2, 
			backGroundBuf.bitmap_ptr() );		// get a wider background

		char nationStr[FIELD_LEN+1];
		strncpy( nationStr, nationPtr->nation_name(), FIELD_LEN );
		nationStr[FIELD_LEN] = '\0';

		GetA nation_name_field;
		nation_name_field.init( INFO_X1+5+lrMargin, y+yOffs, INFO_X2-5-lrMargin, nationStr, 
			FIELD_LEN, &font_cara_w, 1, 1 );
		nation_name_field.set_background( backGroundBuf.ptr );
		nation_name_field.paint();

		while(1)
		{
			sys.yield();
			mouse.get_event();
			music.yield();
                        vga.flip();

			int rc = nation_name_field.detect();
			if( rc == KEY_RETURN )
			{
				nation_array.set_custom_nation_name( brush_player_recno, nationStr );
				break;
			}
			else if( rc == KEY_ESC )
			{
				break;		// cancel
			}

			if( rc )
				nation_name_field.paint(1);
		}
	}

	int cashAdjustment[3] = { 100, 1000, 10000 };
	if( button_cash_up.detect() )
	{
		nationPtr->cash += cashAdjustment[button_adjustment()];
	}
	if( button_cash_down.detect() )
	{
		nationPtr->cash -= cashAdjustment[button_adjustment()];
	}

	int foodAdjustment[3] = { 100, 1000, 10000 };
	if( button_food_up.detect() )
	{
		nationPtr->food += foodAdjustment[button_adjustment()];
	}
	if( button_food_down.detect() )
	{
		nationPtr->food -= foodAdjustment[button_adjustment()];
	}

	int reputationAdjustment[3] = { 1, 10, 100 };
	if( button_reput_up.detect() )
	{
		nationPtr->reputation += reputationAdjustment[button_adjustment()];
		if( nationPtr->reputation > 100 )
			nationPtr->reputation = 100;
	}
	if( button_reput_down.detect() )
	{
		nationPtr->reputation -= reputationAdjustment[button_adjustment()];
		if( nationPtr->reputation < -100 )
			nationPtr->reputation = -100;
	}

	if( nationPtr->is_monster() )
	{
		int lifeAdjustment[3] = { 100, 1000, 10000 };
		if( button_live_up.detect() )
		{
			nationPtr->live_points += lifeAdjustment[button_adjustment()];
		}
		if( button_live_down.detect() )
		{
			nationPtr->live_points -= lifeAdjustment[button_adjustment()];
		}
	}

	button_adjustment.detect();

//	if( (rc = button_player_type.detect()) >= 0 )
//	{
//		nation_array[brush_player_recno]->nation_type = rc ? NATION_AI : NATION_REMOTE;
//	}
}