Exemple #1
0
//-------- Begin of static function put_news_rec --------//
//
static void put_news_rec(int recNo, int x, int y, int refreshFlag)
{
#if(defined(CHINESE))
	//SXM
	y+=4;
	//SXM
#endif

	News* newsPtr = news_array[ news_array.size()-recNo+1 ]; 	// display in reversed order

	font_bld.put( x+20, y, date.date_str(newsPtr->news_date, 1) );

   talk_res.msg_add_nation_color = 1; 
	font_bld.put_paragraph( x+110, y, browse_news.ix2-30, y+30, newsPtr->msg() );
	talk_res.msg_add_nation_color = 0;

	//----- display and detect the go icon -----//

	if( newsPtr->is_loc_valid() )
	{
		image_icon.put_back( x+2, y+1, "NEWS_GO" );

		if( mouse.single_click(x+2, y+1, x+17, y+16) )
		{
			vga.use_front();
			world.go_loc( newsPtr->loc_x, newsPtr->loc_y, 1 );		// 1-select object on the location if there is any
			vga.use_back();
		}
	}
}
Exemple #2
0
//------- Begin of function TaskArray::next_day -----//
void TaskArray::next_day() {

    // - will be removed from the objective/task section after the task offer expires or the task is completed
    // - checked monthly the success of the task; add bonus if task is completed

    Task* taskPtr;

    // return if not start of a month
    if ( info.game_day != 1) {                      //## chea 210899 BUGHERE the news date will not match
	return;
    }

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

    for( int i=size() ; i>0 ; i-- ) {
	taskPtr = operator[](i);

	// already completed
	if ( taskPtr->task_msg_subtype == TASK_COMPLETED )
	    continue;

	if ( (taskPtr->*(task_info_array[taskPtr->id-1].is_completed_func))() == true ) {
	    // add msg to news array
	    news_array.new_task(taskPtr, TASK_COMPLETED);

	    // 1126 don't remove if complete // remove(i);
	    taskPtr->set_completed();
	}
	//else if ( (*taskPtr->expiry_func)() == true )
	else if ( (taskPtr->*(task_info_array[taskPtr->id-1].is_expired_func))() == true ) {
	    news_array.new_task(taskPtr, TASK_EXPIRED); // add msg to news array

	    //------- set for newspaper display --------//

	    News* newsPtr = news_array[news_array.size()];
	    chance_event.news_str=newsPtr->msg();
	    chance_event.news_news_str=chance_event.news_str;
	    //			memcpy(chance_event.news_date_str,date.date_str(newsPtr->news_date),55);
	    strncpy(chance_event.news_date_str, info.date_str_julian(newsPtr->news_date), 55 );
	    chance_event.news_date_str[55-1] = '\0';
	    //		   chance_event.date_str=date.date_str( newsPtr->news_date, 1, 0 );
	    chance_event.date_str=info.date_str_julian(newsPtr->news_date, INFO_DATE_DEFAULT|INFO_DATE_SHORT_MONTH|INFO_DATE_NO_DAY);

	    remove(i);
	}

	sys.yield();
    }
}