Exemplo n.º 1
0
//--------- Begin of function Unit::init_sprite ---------//
//
// <int> startXLoc, startYLoc - the starting location of the unit
//
void Unit::init_sprite(int startXLoc, int startYLoc)
{
	Sprite::init( unit_res[unit_id]->sprite_id, startXLoc, startYLoc );			// BUGHERE use unit_id temporarily

	//-------- set loc_width and loc_height ------//

	loc_width  = (char) sprite_info->loc_width;
	loc_height = (char) sprite_info->loc_height;		// copy the vars for fast access

	// ###### begin Gilbert 30/4 ##########//
	move_to_loc_x = startXLoc; // * LOCATE_WIDTH;
	move_to_loc_y = startYLoc; // * LOCATE_HEIGHT; 
	// ###### end Gilbert 30/4 ##########//

	//-------- set the cargo_recno -------------//

	int w, h, x, y;

	err_if(!sprite_recno)      // sprite_recno must be initialized first before calling UnitB::init()
		err_here();

	for(h=0, y=startYLoc; h<loc_height; h++, y++)
	{
		for(w=0, x=startXLoc; w<loc_width; w++, x++)
		{
			err_if( !world.get_loc(x, y)->can_move(mobile_type) )    // it must be 0 to put the sprite in this location
				err_here();

			world.get_loc(x, y)->set_unit(sprite_recno, mobile_type);
		}
	}

	explore_area();
}
Exemplo n.º 2
0
//----------- Begin of function LinAlg::deinit --------//
//!
bool LinearAlgebra::quadratic_prog_not_converged(const Vector &v_x, const Vector &v_y, const Vector &v_Road, const Vector &v_Sigma, REAL gamma) {
    //const int MAX			= 100000;
    //const	REAL EPSILON	= 1.0/(10000000000);		// 10^-10
    const int MAX     = 1000000;
    const REAL EPSILON  = 1.0/(1000000);            // 10^-10

    if ( v_x.MaximumValue() > MAX ) {
#ifdef DEBUG_CONSOLE
	cout << ("LinAlg: Problem is primal unbounded:");
#endif

	err_here();
    }

    if ( v_y.MaximumValue() > MAX ) {
#ifdef DEBUG_CONSOLE
	cout << ("LinAlg: Problem is dual unbounded");
#endif
	err_here();
    }

    if ( v_Road.Sum() < EPSILON && v_Sigma.Sum() < EPSILON
	 && gamma < EPSILON
	)
	return false;
    else
	return true;
}
Exemplo n.º 3
0
//-------- Begin of function SeekPathReuse::move_outside_map ---------//
// location (preX, preY) is inside the map while location (curX, curY)
// is outside the map
//
// add one/two points
//
void SeekPathReuse::move_outside_map(int preX, int preY, int curX, int curY)
{
	err_when(preX<0 || preX>=MAX_WORLD_X_LOC || preY<0 || preY>=MAX_WORLD_Y_LOC);
	err_when(curX>=0 && curX<MAX_WORLD_X_LOC && curY>=0 && curY<MAX_WORLD_Y_LOC);

	int vecX = curX-preX;
	int vecY = curY-preY;
	if(vecX!=0) vecX /= abs(vecX);
	if(vecY!=0) vecY /= abs(vecY);

	int vertical=0;		// 1 for upper edge, 2 for lower edge
	int horizontal=0;		// 1 for left edge, 2 for right edge
	int xStep, yStep;
	if(curX<0)
	{
		xStep = preX;
		horizontal = 1;
	}
	else if(curX>=MAX_WORLD_X_LOC)
	{
		xStep = MAX_WORLD_X_LOC-preX-1;
		horizontal = 2;
	}
	else
		err_here();

	if(curY<0)
	{
		yStep = preY;
		vertical = 1;
	}
	else if(curY>=MAX_WORLD_Y_LOC)
	{
		yStep = MAX_WORLD_Y_LOC-preY-1;
		vertical = 2;
	}
	else
		err_here();

	err_when(xStep!=yStep);
	int addXLoc = preX+xStep*vecX;
	int addYLoc = preY+yStep*vecY;
	add_result(addXLoc, addYLoc); // add the first point

	//-*************** codes here ***************-//
	//---------------------------------------------------------------//
	// may add the second point if exit at the edge of the map
	//---------------------------------------------------------------//
	/*if((addXLoc==0 && addYLoc==0) ||
		(addXLoc==0 && addYLoc==MAX_WORLD_Y_LOC-1) ||
		(addXLoc==MAX_WORLD_X_LOC-1 && addYLoc==0) ||
		(addXLoc==MAX_WORLD_X_LOC-1 && addYLoc==MAX_WORLD_Y_LOC-1))
	{
		err_when(!vertical || !horizontal);
		return; // exit at corner
	}*/
}
Exemplo n.º 4
0
void FirmOffensive::detect_main_menu()
{
	Firm::detect_info();

	if( !is_own() )
		return;

	String str;

	if( button_cast.detect() )
	{
		menu_mode_para = magic_id_upper_limit;
		se_ctrl.immediate_sound("TURN_ON");
		switch(magic_id_upper_limit) //bug
		{
			case MAGIC_FREEZE_LASER:
				cast_magic( MAGIC_FREEZE_LASER, center_x, center_y, 0, COMMAND_PLAYER );
				break;

			case MAGIC_GOD_POWER:
				menu_mode = FIRM_MAGIC_MENU_CAST;
				power.issue_command(COMMAND_FIRM_MAGIC, firm_recno, menu_mode_para);
				break;

			case MAGIC_LASER:
				cast_magic( MAGIC_LASER, center_x, center_y, 0, COMMAND_PLAYER );
				break;

			default:
				err_here();
		}
	}

	switch(magic_id_upper_limit) //bug
	{
		case MAGIC_FREEZE_LASER:
			help.set_help( INFO_X1+13, INFO_Y1+261, INFO_X1+13+44, INFO_Y1+280+48, "MAGIC7" );
			break;

		case MAGIC_GOD_POWER:
			help.set_help( INFO_X1+13, INFO_Y1+261, INFO_X1+13+44, INFO_Y1+280+48, "MAGIC6" );
			break;

		case MAGIC_LASER:
			help.set_help( INFO_X1+13, INFO_Y1+261, INFO_X1+13+44, INFO_Y1+280+48, "MAGIC5" );
			break;

		default:
			err_here();
	}
}
Exemplo n.º 5
0
//------------ Begin of function Tutor::get_intro -------------//
//
// <int> tutorId - id. of the tutorial
//
// return: <char*> return the introduction text of the tutorial.
//
char* Tutor::get_intro(int tutorId)
{
	//------- get the tutor msgs from the resource file -------//

	int   dataSize;
	File* filePtr = res_tutor_intro.get_file( tutor[tutorId]->code, dataSize);

	if( !filePtr )       // if error getting the tutor resource
	{
		err_here();
		return NULL;
	}

	//------ Open the file and allocate buffer -----//

	FileTxt fileTxt( filePtr, dataSize );  // initialize fileTxt with an existing file stream

	if( dataSize > tutor_intro_buf_size )
	{
		tutor_intro_buf      = mem_resize( tutor_intro_buf, dataSize );       // allocate a buffer larger than we need for the largest size possible
		tutor_intro_buf_size = dataSize;
	}

	// #### begin Gilbert 23/9 #######//
	fileTxt.read_paragraph(tutor_intro_buf, tutor_intro_buf_size);
	// #### end Gilbert 23/9 #######//

	return tutor_intro_buf;
}
Exemplo n.º 6
0
// ------- Begin of function Effect::update_abs_pos -------//
void Effect::update_abs_pos(SpriteFrame *spriteFrame)
{
	switch (program_effect_id)
	{
	case 0:
		Sprite::update_abs_pos(spriteFrame);
		break;

	case 1:
		abs_x1 = ZoomMatrix::calc_abs_x(cur_x, cur_y, get_z()) - 100;		// absolute position 
		abs_y1 = ZoomMatrix::calc_abs_y(cur_x, cur_y, get_z()) - 100;
		abs_x2 = abs_x1 + 200;
		abs_y2 = abs_y1 + 200;
		break;

	case 2:
		abs_x1 = ZoomMatrix::calc_abs_x(cur_x, cur_y, get_z()) - 50;		// absolute position 
		abs_y1 = ZoomMatrix::calc_abs_y(cur_x, cur_y, get_z()) - 25;
		abs_x2 = abs_x1 + 100;
		abs_y2 = abs_y1 + 50;
		break;

	case 3:
		abs_x1 = ZoomMatrix::calc_abs_x(cur_x, cur_y, get_z()) - 100;		// absolute position 
		abs_y1 = ZoomMatrix::calc_abs_y(cur_x, cur_y, get_z()) - 100;
		abs_x2 = abs_x1 + 200;
		abs_y2 = abs_y1 + 200;
		break;
	
	default:
		err_here();
		break;
	}
}
Exemplo n.º 7
0
// ------- Begin of function Effect::program_effect_draw -------//
void Effect::program_effect_draw()
{
	switch (program_effect_id)
	{
	case 1:
		magic.draw_magic_firm_die(&vga_back, 
			world.zoom_matrix->calc_zoom_x(cur_x, cur_y, get_z()),
			world.zoom_matrix->calc_zoom_y(cur_x, cur_y, get_z()), 
			cur_frame);
		break;

	case 2:
		magic.draw_magic_forteen(&vga_back, 
			world.zoom_matrix->calc_zoom_x(cur_x, cur_y, get_z()),
			world.zoom_matrix->calc_zoom_y(cur_x, cur_y, get_z()), 
			cur_frame, cur_dir);
		break;

	case 3:
		magic.draw_magic_fifteen(&vga_back, 
			world.zoom_matrix->calc_zoom_x(cur_x, cur_y, get_z()),
			world.zoom_matrix->calc_zoom_y(cur_x, cur_y, get_z()), 
			cur_frame);
		break;
	
	default:
		err_here();
		break;
	}
}
Exemplo n.º 8
0
//--------- Begin of function UnitGod::cast_on_worker ---------//
//
// <Worker*> workerPtr - pointer to the worker to be affected by the effect.
//
void UnitGod::cast_on_worker(Worker* workerPtr, int nationRecno, int divider)
{
	switch(god_id)
	{
		case GOD_PERSIAN:
			persian_cast_power( workerPtr, nationRecno, divider );
			break;

		case GOD_JAPANESE:
			japanese_cast_power( workerPtr, nationRecno, divider );
			break;

		case GOD_MAYA:
			maya_cast_power( workerPtr, nationRecno, divider );
			break;

		case GOD_EGYPTIAN:
			egyptian_cast_power(workerPtr, nationRecno, divider);
			break;

		case GOD_INDIAN:
			indian_cast_power(workerPtr, nationRecno, divider);
			break;
	
		case GOD_ZULU:
			zulu_cast_power(workerPtr, nationRecno, divider);
			break;

		default:
			err_here();
	}
}
Exemplo n.º 9
0
// -------- begin of function ItemRes::turn_off ----------//
//
void ItemRes::turn_off( Item &item )
{
	if( !item.id )
		return;
	err_when( item.id > ITEM_TYPE_COUNT );

	ItemInfo *itemInfo = item_info_array + item.id - 1;
	err_when( itemInfo->item_id != item.id );

	switch( itemInfo->para_type )
	{
	case ITEM_PARA_NONE:
	case ITEM_PARA_ENHANCE:
	case ITEM_PARA_USE:
	case ITEM_PARA_USE_MANUAL:
	case ITEM_PARA_CHARGE:
		break;

	case ITEM_PARA_USE_TIMED:
	case ITEM_PARA_CHARGE_TIMED:
		if( item.para < 0 )
			item.para = -item.para;
		break;

	default:
		err_here();
	}
}
Exemplo n.º 10
0
//----- Begin of function Nation::ai_process_talk_msg -----//
//
// action_para - recno of the message in talk_res.talk_msg_array.
//
int Nation::ai_process_talk_msg(ActionNode* actionNode)
{
	if( talk_res.is_talk_msg_deleted(actionNode->action_para) )		// if the talk message has been deleted
		return -1;

	TalkMsg* talkMsg = talk_res.get_talk_msg(actionNode->action_para);

	err_when( talkMsg->talk_id < 1 || talkMsg->talk_id > MAX_TALK_TYPE );

	err_when( talkMsg->from_nation_recno == nation_recno );
	err_when( talkMsg->to_nation_recno   != nation_recno );

	if( !talkMsg->is_valid_to_reply() )		// if it is no longer valid
		return -1;

	//----- call the consider function -------//

	if( talkMsg->reply_type == REPLY_WAITING )
	{
		int rc = consider_talk_msg(talkMsg);

		if( rc==1 )		// if rc is not 1 or 0, than the consider function have processed itself, no need to call reply_talk_msg() here
			talk_res.reply_talk_msg( actionNode->action_para, REPLY_ACCEPT, COMMAND_AI );

		else if( rc==0 )
			talk_res.reply_talk_msg( actionNode->action_para, REPLY_REJECT, COMMAND_AI );

		// don't reply if rc is neither 0 or 1
	}
	else
		err_here();

	return -1;		// always return -1 to remove the action from action_array. 
}
Exemplo n.º 11
0
int OptionMenu::slide_to_percent_volume(int slideVolume)
{
	switch( slideVolume / 10)
	{
	case 0:
		return slideVolume * 5;
	case 1:
	case 2:
	case 3:
		return slideVolume+40;
		break;

	case 4:
	case 5:
		return slideVolume/2 + 60;
		break;

	case 6:
	case 7:
	case 8:
	case 9:
	case 10:
		return slideVolume/4+75;
		break;

	default:
		err_here();
		return slideVolume;
	}
}
Exemplo n.º 12
0
int OptionMenu::percent_to_slide_volume(int percentVolume)
{
	switch(percentVolume/10)
	{
	case 0:
	case 1:
	case 2:
	case 3:
	case 4:
		return percentVolume/5;

	case 5:
	case 6:
	case 7:
		return percentVolume - 40;

	case 8:
		return (percentVolume-60) * 2;

	case 9:
	case 10:
		return (percentVolume-75) * 4;

	default:
		err_here();
		return percentVolume;
	}
}
Exemplo n.º 13
0
//-------- Begin of function Place::create_unit ---------//
//
// Create a unit on a given location.
//
// return: <int> recno of the unit created.
//
int Place::create_unit(int unitId)
{
	int xLoc, yLoc;

	if( !create_unit_locate_space(unitId, xLoc, yLoc) )
		return 0;

	//------------ add the unit now ----------------//

	int unitNationRecno;

	switch( obj_type )
	{
		case OBJ_TOWN:
			unitNationRecno = town_array[obj_extern_recno]->nation_recno;
			break;

		case OBJ_FIRM:
			unitNationRecno = firm_array[obj_extern_recno]->nation_recno;
			break;

		default:
			err_here();
	}

	int unitRecno = unit_array.add_unit( unitId, unitNationRecno, RANK_SOLDIER, 0, xLoc, yLoc );

	return unitRecno;
}
Exemplo n.º 14
0
//---------- Begin of function Student::update_history -----------//
//!
//! update history arrays
//!
//! update_flag		= UPDATE_TRIMESTER, UPDATE_MONTH, UPDATE_YEAR; (ooffice.h)
//!
void Student::update_history(char update_flag) {
    switch (update_flag) {
    case UPDATE_MONTH:
	calc_satisfaction_student_life();
	calc_satisfaction_athletics();
	calc_satisfaction_overall();
	calc_faculty_workweek();
	break;
    case UPDATE_TRIMESTER:
	calc_satisfaction_academic();

	// called when value is needed
	//calc_probability_change_major();
	//calc_multiplier_on_dropout_prob();
	break;
    case UPDATE_YEAR:
	reaction_summer_course_last = reaction_summer_course;
	break;
    case UPDATE_ALL:
	update_history(UPDATE_MONTH);
	update_history(UPDATE_TRIMESTER);
	update_history(UPDATE_YEAR);
	break;
    default:
	err_here();
	break;
    }
}
Exemplo n.º 15
0
//--------- Begin of function Sprite::init ---------//
void Sprite::init(short spriteId, short startXLoc, short startYLoc, char startSubXLoc, char startSubYLoc) {
    sprite_id = spriteId;

    go_x = next_x = cur_x = startXLoc;
    go_y = next_y = cur_y = startYLoc;

    /*
      cur_attack = 0;
      cur_action = SPRITE_IDLE;
      cur_dir 	  = m.random(GameDef::MAX_SPRITE_DIR_TYPE);	// facing any of the eight directions
      cur_frame  = 1;
      final_dir  = cur_dir;
    */

    //----- clone vars from sprite_res for fast access -----//
    sprite_id = 1;                                  //temp
    err_here();
    //990511		sprite_info = sprite_res[sprite_id];

    sprite_info->load_bitmap_res();

    //----- set the sprite's location & absolute positions on the map -----//

    set_abs(ZOOM_SMALL , MAP_LOC_WIDTH   , MAP_LOC_HEIGHT);
    set_abs(ZOOM_MEDIUM, ZOOM1_LOC_WIDTH, ZOOM1_LOC_HEIGHT);
    set_abs(ZOOM_LARGE , ZOOM2_LOC_WIDTH, ZOOM2_LOC_HEIGHT);

    will_not_move_next_process = 0;
}
Exemplo n.º 16
0
// -------- begin of function ItemRes::is_turn_on  ----------//
//
int ItemRes::is_turn_on( Item &item )
{
	if( !item.id )
		return 0;
	err_when( item.id > ITEM_TYPE_COUNT );

	ItemInfo *itemInfo = item_info_array + item.id - 1;
	err_when( itemInfo->item_id != item.id );

	switch( itemInfo->para_type )
	{
	case ITEM_PARA_NONE:
	case ITEM_PARA_ENHANCE:
	case ITEM_PARA_USE:
	case ITEM_PARA_USE_MANUAL:
	case ITEM_PARA_CHARGE:
		return 0;
		break;

	case ITEM_PARA_USE_TIMED:
	case ITEM_PARA_CHARGE_TIMED:
		return item.para < 0;

	default:
		err_here();
		return 0;
	}
}
Exemplo n.º 17
0
// -------- begin of function ItemRes::can_use_manually ----------//
//
// return 0, cannot use manually
// return -1, can use manually no need to pass parameter
// return COMMAND_USE_ITEM_ON_UNIT, if cast on unit
//	return COMMAND_USE_ITEM_ON_TOWN, if cast on town
//
int ItemRes::can_use_manually( Item &item)
{
	if( !item.id )
		return 0;
	err_when( item.id > ITEM_TYPE_COUNT );

	ItemInfo *itemInfo = item_info_array + item.id - 1;
	err_when( itemInfo->item_id != item.id );
	err_when( COMMAND_USE_ITEM_ON_UNIT == 1 );
	err_when( COMMAND_USE_ITEM_ON_TOWN == 1 );

	if( itemInfo->para_type == ITEM_PARA_USE_MANUAL )
	{
		switch( itemInfo->magic_para )
		{
		case 0:			// parameter
			return -1;
		case 1:
			return COMMAND_USE_ITEM_ON_UNIT;
		case 2:
			return COMMAND_USE_ITEM_ON_TOWN;
		case 3:
			return COMMAND_USE_ITEM_ON_SPACE;
		default:
			err_here();
		}
	}

	return 0;
}
Exemplo n.º 18
0
// -------- begin of function ItemRes::can_turn_on  ----------//
//
int ItemRes::can_turn_on( Item &item )
{
	if( !item.id )
		return 0;
	err_when( item.id > ITEM_TYPE_COUNT );

	ItemInfo *itemInfo = item_info_array + item.id - 1;
	err_when( itemInfo->item_id != item.id );

	switch( itemInfo->para_type )
	{
	case ITEM_PARA_NONE:
	case ITEM_PARA_ENHANCE:
	case ITEM_PARA_USE:
	case ITEM_PARA_USE_MANUAL:
	case ITEM_PARA_CHARGE:
		return 0;

	case ITEM_PARA_USE_TIMED:
	case ITEM_PARA_CHARGE_TIMED:
		return item.para >= itemInfo->para_use_limit;	// +ve mean charging

	default:
		err_here();
		return 0;
	}
}
Exemplo n.º 19
0
//---------- Begin of function PlayerSchool::init_sub_score_weight -----------//
//!
//! subScoreGroup between 0 and SCORE_SUBGROUP_COUNT
//! or -1 means update all sub_score_weight
//!
void PlayerSchool::init_sub_score_weight(int subScoreGroup) {
    int i;
    if( subScoreGroup < 0 ) {
	for( i = 0; i < SCORE_VAR_COUNT; ++i )
	    sub_score_weight[i] = default_sub_score_weight[i] * 100;
    }
    else if( subScoreGroup == 0 ) {
	for( i = GROUP1_BEGIN_ID; i < GROUP2_BEGIN_ID; ++i )
	    sub_score_weight[i] = default_sub_score_weight[i] * 100;
    }
    else if( subScoreGroup == 1 ) {
	for( i = GROUP2_BEGIN_ID; i < GROUP3_BEGIN_ID; ++i )
	    sub_score_weight[i] = default_sub_score_weight[i] * 100;
    }
    else if( subScoreGroup == 2 ) {
	for( i = GROUP3_BEGIN_ID; i < GROUP4_BEGIN_ID; ++i )
	    sub_score_weight[i] = default_sub_score_weight[i] * 100;
    }
    else if( subScoreGroup == 3 ) {
	for( i = GROUP4_BEGIN_ID; i < SCORE_VAR_COUNT; ++i )
	    sub_score_weight[i] = default_sub_score_weight[i] * 100;
    }
    else {
	err_here();
    }
}
Exemplo n.º 20
0
//----- Begin of function TalkMsg::end_treaty ------//
//
// talk_para1 - treaty type, RELATION_FRIENDLY or RELATION_ALLIANCE.
//
void TalkMsg::end_treaty(const char* treatyTypeStr)
{
	//---------------------------------------------//
	//
	// Send:
	// <King>'s Kingdom terminates its friendly/alliance treaty with you.
	// You terminate your friendly/alliance treaty with <King>'s Kingdom.
	//
	//---------------------------------------------//

/*
	if( viewing_nation_recno == from_nation_recno )
	{
		str  = "You terminate your ";
		str += treatyTypeStr;
		str += " treaty with ";
		str +=  to_nation_name();
		str += ".";
	}
	else
	{
		str  = from_nation_name();
		str += " terminates its ";
		str += treatyTypeStr;
		str += " treaty with you.";
	}
*/
	switch( talk_id )
	{
	case TALK_END_TRADE_TREATY:
		if( viewing_nation_recno == from_nation_recno )
			str = text_talk.process( text_talk.get_format_str( 29, "YETT" ),
				to_nation_name() );
		else
			str = text_talk.process( text_talk.get_format_str( 30, "NETT" ),
				from_nation_name() );
		break;
	case TALK_END_FRIENDLY_TREATY:
		if( viewing_nation_recno == from_nation_recno )
			str = text_talk.process( text_talk.get_format_str( 31, "YEFT" ),
				to_nation_name() );
		else
			str = text_talk.process( text_talk.get_format_str( 32, "NEFT" ),
				from_nation_name() );
		break;
	case TALK_END_ALLIANCE_TREATY:
		if( viewing_nation_recno == from_nation_recno )
			str = text_talk.process( text_talk.get_format_str( 33, "YEAT" ),
				to_nation_name() );
		else
			str = text_talk.process( text_talk.get_format_str( 34, "NEAT" ),
				from_nation_name() );
		break;
	default:
		err_here();
		str = "";
	}
}
Exemplo n.º 21
0
//--------- Begin of function CaravanStop::mp_pick_up_toggle ---------//
void CaravanStop::mp_pick_up_toggle(int pos)
{
	err_when(firm_array.is_deleted(firm_recno));
	//------------------------------------------------------------//
	// verify for cargo button
	// if not exist then return else call pick_up_toggle(int pos)
	//------------------------------------------------------------//

	Firm *firmPtr = firm_array[firm_recno];
	MarketGoods *marketGoodsPtr;
	int	cargoExist = 0;
	int	id, i;

	switch(firmPtr->firm_id)
	{
		case FIRM_MINE:
				id = ((FirmMine*)firmPtr)->raw_id+PICK_UP_RAW_FIRST-1;
				if(id==pos)
					cargoExist = 1;
				break;

		case FIRM_FACTORY:
				id = ((FirmFactory*)firmPtr)->product_raw_id+PICK_UP_PRODUCT_FIRST-1;
				if(id==pos)
					cargoExist = 1;
				break;

		case FIRM_MARKET:
				marketGoodsPtr = ((FirmMarket*) firmPtr)->market_goods_array;
				for(i=1; i<=MAX_MARKET_GOODS; i++, marketGoodsPtr++)
				{
					if((id = marketGoodsPtr->raw_id)) // 1-3
					{
						if(id==pos)
						{
							cargoExist = 1;
							break;
						}
					}
					else if((id = marketGoodsPtr->product_raw_id)) // 1-3
					{
						id += MAX_PRODUCT;	// 4-6
						if(id==pos)
						{
							cargoExist = 1;
							break;
						}
					}
				}
				break;

		default:	err_here();
					break;
	}

	if(cargoExist)
		pick_up_toggle(pos);
}
Exemplo n.º 22
0
//--------- Begin of function Sprite::set_next --------//
//
int Sprite::set_next(int nextX, int nextY, int para, int blockedChecked)
{
	err_here();		//**BUGHERE, for now, we don't have any pure Sprites, all functions should call Unit::set_next() instead of Sprite::set_next()

	next_x = nextX;
	next_y = nextY;

	return 1;
}
Exemplo n.º 23
0
// ------ begin of function ScenarioEditor::disp_view -------//
//
// disp zoom area
//
void ScenarioEditor::disp_view()
{
	char useBack = vga.use_back_buf;
	vga.use_back();

	switch( edit_mode )
	{
	case SEDIT_MODE_NONE:
		break;

//	case SEDIT_MODE_TERRAIN:
//		disp_terrain_view();
//		break;

	case SEDIT_MODE_HUMAN:
		disp_human_view();
		break;

	case SEDIT_MODE_MONSTER:
		disp_monster_view();
		break;

	case SEDIT_MODE_MISC:
		disp_misc_view();
		break;

	case SEDIT_MODE_EDIT:
		disp_edit_view();
		break;

//	case SEDIT_MODE_DEFINE:
//		disp_define_view();
//		break;

	case SEDIT_MODE_PLAYER:
		disp_players_view();
		break;

	case SEDIT_MODE_DIPLOMACY:
		disp_diplomacy_view();
		break;

	case SEDIT_MODE_VICTORY:
		disp_victory_view();
		break;

	case SEDIT_MODE_HERO:
		disp_hero_view();
		break;

	default:
		err_here();
	}

	if( !useBack )
		vga.use_front();
}
Exemplo n.º 24
0
//------------ function debug_check_smode_node() -------------//
void SeekPathReuse::debug_check_smode_node(int x, int y)
{
	if(reuse_search_sub_mode!=SEARCH_SUB_MODE_PASSABLE)
		return;

	Location *locPtr = world.get_loc(x, y);
	if(locPtr->power_nation_recno && !reuse_nation_passable[locPtr->power_nation_recno])
		err_here();
}
Exemplo n.º 25
0
// ------ begin of function ScenarioEditor::disp -------//
//
// display interface area
//
void ScenarioEditor::disp( int refreshFlag )
{
	if( edit_mode != SEDIT_MODE_NONE )
		vga.active_buf->put_bitmap( INFO_X1, INFO_Y1, image_gameif.read("SCEN-ED") );

	switch( edit_mode )
	{
	case SEDIT_MODE_NONE:
		break;

//	case SEDIT_MODE_TERRAIN:
//		disp_terrain_main(refreshFlag);
//		break;

	case SEDIT_MODE_HUMAN:
		disp_human_main(refreshFlag);
		break;

	case SEDIT_MODE_MONSTER:
		disp_monster_main(refreshFlag);
		break;

	case SEDIT_MODE_MISC:
		disp_misc_main(refreshFlag);
		break;

	case SEDIT_MODE_EDIT:
		disp_edit_main(refreshFlag);
		break;

//	case SEDIT_MODE_DEFINE:
//		disp_define_main(refreshFlag);
//		break;

	case SEDIT_MODE_PLAYER:
		disp_players_main(refreshFlag);
		break;

	case SEDIT_MODE_DIPLOMACY:
		disp_diplomacy_main(refreshFlag);
		break;

	case SEDIT_MODE_VICTORY:
		disp_victory_main(refreshFlag);
		break;

	case SEDIT_MODE_HERO:
		disp_hero_main(refreshFlag);
		break;

	default:
		err_here();
	}
}
Exemplo n.º 26
0
Arquivo: ofont.cpp Projeto: mecirt/7k2
//--------- Begin of function Font::put_char_to_buffer ---------//
void Font::put_char_to_buffer(char* dest, int destPitch, int x, int y, unsigned short textChar)
{
	if( textChar >= first_char && textChar <= last_char )
	{
		FontInfo* fontInfo = font_info_array+textChar-first_char;
		char *fontBitmap = font_bitmap_buf + fontInfo->bitmap_offset;

		err_here();		// 8-8 bit not supported
		// IMGbltTrans( dest, destPitch, x, y + fontInfo->offset_y, fontBitmap );
	}
}
Exemplo n.º 27
0
//-------- Begin of function Remote::set_alternating_send ---------//
void Remote::set_alternating_send(int rate)
{
	if( rate <= 0 || rate > 100 || (sync_test_level != 0 && rate != 1) )
	{
		err_here();
		// must not have any sync testing to enable alternating send
		// tell_random_seed and crc checking must send data every frame
	}
	else
		alternating_send_rate = rate;
}
Exemplo n.º 28
0
// ----- begin of function ScenarioEditor::collect_human_unit ------//
//
void ScenarioEditor::collect_human_unit( int raceId )
{
	// save old selected unitId
	int oldSelectedUnitId = 0;
	if( human_unit_id_browse_recno >= 1 && human_unit_id_browse_recno <= human_unit_id_count )
	{
		oldSelectedUnitId = human_unit_id_array[human_unit_id_browse_recno-1];
	}
	human_unit_id_browse_recno = 1;		// reset browser recno

	human_unit_id_count = 0;
	for(int i = 1; i <= unit_res.unit_info_count; ++i )
	{
		UnitInfo *unitInfo = unit_res[i];

		// human only
		if( unitInfo->class_info.monster_side )
			continue;

		switch( unitInfo->unit_class )
		{
		case UNIT_CLASS_HUMAN:
		case UNIT_CLASS_CARAVAN:
		case UNIT_CLASS_WEAPON:
		case UNIT_CLASS_SHIP:
			if( !raceId || unitInfo->race_id == raceId )
			{
				human_unit_id_array[human_unit_id_count++] = i;

				if( i == oldSelectedUnitId )
					human_unit_id_browse_recno = human_unit_id_count;	// after human_unit_id_count incremented
			}
			break;

		case UNIT_CLASS_WAGON:
			if( raceId )
			{
				human_unit_id_array[human_unit_id_count++] = i;

				if( i == oldSelectedUnitId )
					human_unit_id_browse_recno = human_unit_id_count;	// after human_unit_id_count incremented
			}
			break;

		case UNIT_CLASS_GOD:
			// don't add god, as it disappear immediately
			break;

		default:
			err_here();
		}
	}
}
Exemplo n.º 29
0
//-------- Begin of function Game::campaign_class_size --------//
//
int Game::campaign_class_size(int campaignId)
{
	switch( campaignId )
	{
		case CAMPAIGN_EAST_WEST:
			return sizeof(CampaignEastWest);

		default:
			err_here();
			return 0;
	}
}
Exemplo n.º 30
0
void TornadoArray::process()
{
	int 	  i;
	Tornado* tornadoPtr;

	for (i=1; i <=size() ; i++)
	{
		tornadoPtr = (Tornado*)get_ptr(i);

		if( !tornadoPtr)
			continue;

		//-------- system yield ---------//

		if( i%20==1 )
			sys.yield();

		//------- process tornado --------//

		tornadoPtr->pre_process();

		switch(tornadoPtr->cur_action)
		{
			case SPRITE_IDLE:
			case SPRITE_READY_TO_MOVE:
				tornadoPtr->process_idle();
				break;

			case SPRITE_MOVE:
				tornadoPtr->process_move();
				break;

			//### begin alex 7/3 ###//
			case SPRITE_TURN:
				err_here();
				break;
			//#### end alex 7/3 ####//

			case SPRITE_WAIT:
				tornadoPtr->process_wait();
				break;

			case SPRITE_ATTACK:
				tornadoPtr->process_attack();
				break;

			case SPRITE_DIE:
				if( tornadoPtr->process_die() )
					del(i);
				break;
		}
	}
}