当前位置: 首页>>代码示例>>C++>>正文


C++ err_here函数代码示例

本文整理汇总了C++中err_here函数的典型用法代码示例。如果您正苦于以下问题:C++ err_here函数的具体用法?C++ err_here怎么用?C++ err_here使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了err_here函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: err_if

//--------- 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();
}
开发者ID:112212,项目名称:7k2,代码行数:38,代码来源:oun_init.cpp

示例2: err_here

//----------- 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;
}
开发者ID:ndilday,项目名称:virtualu,代码行数:30,代码来源:Olinalg.cpp

示例3: err_when

//-------- 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
	}*/
}
开发者ID:AMDmi3,项目名称:7kaa,代码行数:63,代码来源:OSPREUSE.cpp

示例4: switch

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();
	}
}
开发者ID:mecirt,项目名称:7k2,代码行数:51,代码来源:of_offi.cpp

示例5: err_here

//------------ 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;
}
开发者ID:Stummi,项目名称:7kaa,代码行数:35,代码来源:OTUTOR.cpp

示例6: switch

// ------- 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;
	}
}
开发者ID:mecirt,项目名称:7k2,代码行数:35,代码来源:oeffect.cpp

示例7: switch

//--------- 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();
	}
}
开发者ID:AMDmi3,项目名称:7kaa,代码行数:36,代码来源:OU_GOD.cpp

示例8: err_when

// -------- 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();
	}
}
开发者ID:112212,项目名称:7k2,代码行数:30,代码来源:oitemres.cpp

示例9: err_when

//----- 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. 
}
开发者ID:mecirt,项目名称:7k2,代码行数:38,代码来源:oai_talk.cpp

示例10: switch

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;
	}
}
开发者ID:112212,项目名称:7k2,代码行数:30,代码来源:ooptmenu.cpp

示例11: switch

//-------- 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;
}
开发者ID:112212,项目名称:7k2,代码行数:35,代码来源:oplace.cpp

示例12: switch

//---------- 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;
    }
}
开发者ID:ndilday,项目名称:virtualu,代码行数:34,代码来源:Ostud_pi.cpp

示例13: err_here

//--------- 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;
}
开发者ID:ndilday,项目名称:virtualu,代码行数:30,代码来源:Osprite.cpp

示例14: if

//---------- 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();
    }
}
开发者ID:ndilday,项目名称:virtualu,代码行数:31,代码来源:Opsch_pi.cpp

示例15: to_nation_name

//----- 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 = "";
	}
}
开发者ID:112212,项目名称:7k2,代码行数:62,代码来源:otalkeng.cpp


注:本文中的err_here函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。