void CMsgCallBack<transMsg::QGetOrderStatus>::_Process( transMsg::QGetOrderStatus& msg, uint64_t recvID, const mori::RecvFileList& files, SUserInfo& userInfo, soci::session& sql, SSendInfoSPtr& sendInfoPtr )
{
	auto retMsg = smartPtr::make_shared<transMsg::AGetOrderStatus>();
	auto& retInfo = sendInfoPtr->Add();
	retInfo.MsgPtr_ = retMsg;
	retMsg->set_stats(transMsg::ERS_SERVER_ERROR);

	if ( 0 == msg.orderids_size() )
	{
		retMsg->set_stats(transMsg::ERS_SUCCESS);
		return;
	}

	std::vector<int64_t> orders;
	std::vector<int32_t> status;

	SociAdaptor (Statement()
		.Select(GL_OrderInfo.OrderID.Into(orders)|GL_OrderInfo.OrderStatus.Into(status))
		.From(GL_OrderInfo)
		.Where(GL_OrderInfo.FactoryID==*userInfo.UserInfo_.FactoryID_ && GL_OrderInfo.OrderID.In(msg.orderids().begin(), msg.orderids().end())), sql).Excute();

	for ( uint32_t i=0; i<orders.size(); ++i )
	{
		auto info = retMsg->add_orderstatus();
		info->set_orderid(orders[i]);
		info->set_orderstatus(static_cast<order::EOrderState>(status[i]));
	}

	retMsg->set_stats(transMsg::ERS_SUCCESS);
}
Example #2
0
void create() {
::create();
set_name("Raymond");
set_short("Raymond, the insane one");
set_long("This is the biggest human being you have ever seen. He looks"
	" almost like an ogre, but is not as ugly. He has black hair"
	" with the most puppy dog brown eyes you have ever seen. He"
	" looks at you and scoffs at your tiny size. I guess you could"
	" say he has the face of an angel and the body of a GOD!!!");
set("aggressive",50);
set_subclass("monk");
set_level(99);
set_stats("strength",300);
set_stats("constitution",250);
set_skill("attack",100);
set_skill("melee",300);
set_id(({"Raymond"}));
Example #3
0
// Main function
int main() {
    int num_day, ans, weather_value, score = 0, completed = FALSE;
    int dragon_strength, dragon_intelligence, dragon_agility;
    
    char name[20], answer[4];
    
    srand(time(0));
    
    printf("Welcome to Dragon Training!\n");
    printf("You've been assigned a new dragon! Would you like to give it a name? (yes/no)\n");
    scanf("%s", answer);
    
    if(strcmp(answer, "yes") == 0) {
        printf("Great! What would like to call your dragon?\n");
        scanf("%s", name);
    }
    else
        strcpy(name, "your dragon");
    
    printf("\nTo complete training, %s must finish the final \nobstacle course with a score of 70 or better.\n", name);
    printf("\nYou may attempt the obstacle course at any time, \nbut you must finish within 10 days.\n");
    printf("\nBetter get started!\n");
    
    set_stats(&dragon_strength, &dragon_intelligence, &dragon_agility);
    
    for (num_day = 1; num_day <= 10; num_day++) {
        printf("\nIt is Day #%d.\n", num_day);
        print_stats(dragon_strength, dragon_intelligence, dragon_agility, name);
        weather_value = weather();
        ans = menu();
        
        switch(ans) {
            case 1:
                dragon_strength += train_strength(weather_value, name);
                break;
            case 2:
                dragon_intelligence += train_intelligence(weather_value, name);
                break;
            case 3:
                dragon_agility += train_agility(weather_value, name);
                break;
            case 4:
                score = obstacle_course(weather_value, dragon_strength, dragon_intelligence, dragon_agility);
                printf("%s scored a %d on their obstacle course run!\n", name, score);
                break;
        }
        
        if(score >= SCORE) {
            completed = TRUE;
            break;
        }
    }
    
    end_message(completed, name);
    
    return 0;
}
Example #4
0
void data_socket_treatment(struct data_descriptor *ad,struct consumer_workspace *ws) {
  int nb_send;
  struct acq_workspace *gws=(struct acq_workspace *)ws->gws;
  //printf("data_socket treatment\n");
  if (ad->streamid!=-1) {
    nb_send=send2client(gws->streams[ad->streamid].socket,ad->data,ad->data_size);
    //printf("nb_send=%d\n",nb_send);
    set_stats(gws,BYTES_ON_SKT,SOP_PLUS,nb_send*ad->data_size);
  }
}
Example #5
0
int bd_stat(const char *pFilename, gstat *pStat) {
    int iNode = find_iNode(pFilename);

    if (iNode != -1) {
        set_stats(iNode, pStat);
    } else {
        return -1;
    }

    return 0;
}
Example #6
0
/*
 * Advancement stuff.
 */
void advance_level (CHAR_DATA * ch, bool hide)
{
    double cache;
    
    float m1,m2,m3,m4,m5;

    if(ch->sex == SEX_MALE)
    { 
    m1 = 3.5;
    m2 = 3.2;
    m3 = 2.5;
    m4 = 3.2;
    m5 = 2.4;
    }
    else
    {
    m1 = 3.2;
    m2 = 3.5;
    m3 = 2.6;
    m4 = 2.4;
    m5 = 3.4;
    }

    ch->level++;
    cache = (ch->HPP / ( job_table[ch->jobid].classhpmult + ch->level));
    ch->HPP += cache*m1;
    cache = (ch->MPP / ( job_table[ch->jobid].classmpmult + ch->level));
    ch->MPP += cache*m2;
    cache = (ch->SpP / ( job_table[ch->jobid].classspmult + ch->level));
    ch->SpP += cache*m3;
    cache = (ch->PAP / ( job_table[ch->jobid].classpamult + ch->level));
    ch->PAP += cache*m4;
    cache = (ch->MAP / ( job_table[ch->jobid].classmamult + ch->level));
    ch->MAP += cache*m5;

    if(!hide)
    send_to_char("{GYou gain a level!!\n\r{x",ch);
    set_stats(ch);
    return;
}
Example #7
0
void MainWindow::new_world() {
    if(changed) {
        int ret = QMessageBox::warning(this, tr("Bugs"), tr("Save changes?"), QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel, QMessageBox::Save);
        if(ret == QMessageBox::Cancel) return;
        else if(ret == QMessageBox::Save) save_world();
        else if(ret != QMessageBox::Discard) return; // in case of pressing escape
    }

    bool was_running = false;
    if(isRunning()) {
        start_stop();
        was_running = true;
    }

    WorldParams newParams = settings->getParams();

    petri_dish.cleanup();
    petri_dish.init(newParams);
    petri_dish.balance();
    petri_dish.update_all_pixels();
    if(histogramDialog) histogramDialog->newData(petri_dish.get_dna_data(), petri_dish.get_population());

    totalEnergy->setText(QString().setNum(petri_dish.get_total_energy()));
    spinDNAVal->setMaximum(newParams.max_data);
    set_stats();
    changed = false;

    last_time = 0;
    update_time.restart();
    if(was_running) {
        start_stop();
    } else
        update();

    filename = "";
    actionAutoSave->setChecked(false);
}
Example #8
0
bool player::create(game *g, character_type type, std::string tempname)
{
 weapon = item(g->itypes[0], 0);

 int iMaxX = (g->VIEWX < 12) ? 80 : (g->VIEWX*2)+56;
 int iMaxY = (g->VIEWY < 12) ? 25 : (g->VIEWY*2)+1;

 WINDOW* w = newwin(25, 80, (iMaxY > 25) ? (iMaxY-25)/2 : 0, (iMaxX > 80) ? (iMaxX-80)/2 : 0);

 int tab = 0, points = 38;
 if (type != PLTYPE_CUSTOM) {
  switch (type) {
   case PLTYPE_RANDOM: {
    str_max = rng(6, 12);
    dex_max = rng(6, 12);
    int_max = rng(6, 12);
    per_max = rng(6, 12);
    points = points - str_max - dex_max - int_max - per_max;
    if (str_max > HIGH_STAT)
     points -= (str_max - HIGH_STAT);
    if (dex_max > HIGH_STAT)
     points -= (dex_max - HIGH_STAT);
    if (int_max > HIGH_STAT)
     points -= (int_max - HIGH_STAT);
    if (per_max > HIGH_STAT)
     points -= (per_max - HIGH_STAT);

    int num_gtraits = 0, num_btraits = 0, rn, tries;
    while (points < 0 || rng(-3, 20) > points) {
     if (num_btraits < MAX_TRAIT_POINTS && one_in(3)) {
      tries = 0;
      do {
       rn = random_bad_trait();
       tries++;
      } while ((has_trait(rn) ||
              num_btraits - traits[rn].points > MAX_TRAIT_POINTS) && tries < 5);
      if (tries < 5) {
       toggle_trait(rn);
       points -= traits[rn].points;
       num_btraits -= traits[rn].points;
      }
     } else {
      switch (rng(1, 4)) {
       case 1: if (str_max > 5) { str_max--; points++; } break;
       case 2: if (dex_max > 5) { dex_max--; points++; } break;
       case 3: if (int_max > 5) { int_max--; points++; } break;
       case 4: if (per_max > 5) { per_max--; points++; } break;
      }
     }
    }
    while (points > 0) {
     switch (rng((num_gtraits < MAX_TRAIT_POINTS ? 1 : 5), 9)) {
     case 1:
     case 2:
     case 3:
     case 4:
      rn = random_good_trait();
      if (!has_trait(rn) && points >= traits[rn].points &&
          num_gtraits + traits[rn].points <= MAX_TRAIT_POINTS) {
       toggle_trait(rn);
       points -= traits[rn].points;
       num_gtraits += traits[rn].points;
      }
      break;
     case 5:
      switch (rng(1, 4)) {
       case 1: if (str_max < HIGH_STAT) { str_max++; points--; } break;
       case 2: if (dex_max < HIGH_STAT) { dex_max++; points--; } break;
       case 3: if (int_max < HIGH_STAT) { int_max++; points--; } break;
       case 4: if (per_max < HIGH_STAT) { per_max++; points--; } break;
      }
      break;
     case 6:
     case 7:
     case 8:
     case 9:
      rn = random_skill();

      Skill *aSkill = Skill::skill(rn);
      int level = skillLevel(aSkill);

      if (level < points) {
        points -= level + 1;
        skillLevel(aSkill).level(level + 2);
      }
      break;
     }
    }
   } break;
   case PLTYPE_TEMPLATE: {
    std::ifstream fin;
    std::stringstream filename;
    filename << "data/" << tempname << ".template";
    fin.open(filename.str().c_str());
    if (!fin.is_open()) {
     debugmsg("Couldn't open %s!", filename.str().c_str());
     return false;
    }
    std::string(data);
    getline(fin, data);
    load_info(g, data);
    points = 0;
   } break;
  }
  tab = 3;
 } else
  points = OPTIONS[OPT_INITIAL_POINTS];

 do {
  werase(w);
  wrefresh(w);
  switch (tab) {
   case 0: tab += set_stats      (w, this, points); break;
   case 1: tab += set_traits     (w, this, points); break;
   case 2: tab += set_skills     (w, this, points); break;
   case 3: tab += set_description(w, this, points); break;
  }
 } while (tab >= 0 && tab < 4);
 delwin(w);

 if (tab < 0)
  return false;

 // Character is finalized.  Now just set up HP, &c
 for (int i = 0; i < num_hp_parts; i++) {
  hp_max[i] = calc_HP(str_max, has_trait(PF_TOUGH));
  hp_cur[i] = hp_max[i];
 }
 if (has_trait(PF_GLASSJAW)) {
  hp_max[hp_head] = int(hp_max[hp_head] * .85);
  hp_cur[hp_head] = hp_max[hp_head];
 }
 if (has_trait(PF_SMELLY))
  scent = 800;
 if (has_trait(PF_ANDROID)) {
  add_bionic(bionic_id(rng(bio_memory, max_bio_start - 1)));// Other
  if (bionics[my_bionics[0].id].power_cost > 0) {
   add_bionic(bionic_id(rng(1, bio_ethanol)));	// Power Source
   max_power_level = 10;
   power_level = 10;
  } else {
   bionic_id tmpbio;
   do
    tmpbio = bionic_id(rng(bio_ethanol + 1, bio_armor_legs));
   while (bionics[tmpbio].power_cost > 0);
   add_bionic(tmpbio);
   max_power_level = 0;
   power_level = 0;
  }

/* CHEATER'S STUFF

  add_bionic(bionic_id(rng(0, bio_ethanol)));	// Power Source
  for (int i = 0; i < 5; i++)
   add_bionic(bionic_id(rng(bio_memory, max_bio_start - 1)));// Other
  max_power_level = 80;
  power_level = 80;

End of cheatery */
 }

 if (has_trait(PF_MARTIAL_ARTS)) {
  itype_id ma_type;
  do {
   int choice = menu("Pick your style:",
                     "Karate", "Judo", "Aikido", "Tai Chi", "Taekwando", NULL);
   if (choice == 1)
    ma_type = itm_style_karate;
   if (choice == 2)
    ma_type = itm_style_judo;
   if (choice == 3)
    ma_type = itm_style_aikido;
   if (choice == 4)
    ma_type = itm_style_tai_chi;
   if (choice == 5)
    ma_type = itm_style_taekwando;
   item tmpitem = item(g->itypes[ma_type], 0);
   full_screen_popup(tmpitem.info(true).c_str());
  } while (!query_yn("Use this style?"));
  styles.push_back(ma_type);
 }
 ret_null = item(g->itypes[0], 0);
 if (!styles.empty())
  weapon = item(g->itypes[ styles[0] ], 0, ':');
 else
  weapon   = item(g->itypes[0], 0);
// Nice to start out less than naked.
 item tmp(g->itypes[itm_jeans_fit], 0, 'a');
 worn.push_back(tmp);
 tmp = item(g->itypes[itm_tshirt_fit], 0, 'b');
 worn.push_back(tmp);
 tmp = item(g->itypes[itm_sneakers_fit], 0, 'c');
 worn.push_back(tmp);
// The near-sighted get to start with glasses.
 if (has_trait(PF_MYOPIC)) {
  tmp = item(g->itypes[itm_glasses_eye], 0, 'd');
  worn.push_back(tmp);
 }
// Likewise, the asthmatic start with their medication.
 if (has_trait(PF_ASTHMA)) {
  tmp = item(g->itypes[itm_inhaler], 0, 'a' + worn.size());
  inv.push_back(tmp);
 }
 // Basic starter gear, added independently of profession.
 tmp = item(g->itypes[itm_pockknife], 0,'a' + worn.size());
  inv.push_back(tmp);
 tmp = item(g->itypes[itm_lighter], 0,'a' + worn.size());
  inv.push_back(tmp);
// make sure we have no mutations
 for (int i = 0; i < PF_MAX2; i++)
  my_mutations[i] = false;
 return true;
}
Example #9
0
void CMsgCallBack<transMsg::QUploadRes>::_Process( transMsg::QUploadRes& msg, uint64_t recvID, const mori::RecvFileList& files, SUserInfo& userInfo, soci::session& sql, SSendInfoSPtr& sendInfoPtr )
{
	auto retMsg = smartPtr::make_shared<transMsg::AUploadRes>();
	auto& retInfo = sendInfoPtr->Add();
	retInfo.MsgPtr_ = retMsg;
	retMsg->set_stats(transMsg::ERS_SERVER_ERROR);

	typedef	std::unordered_map<AStringType,mori::FilePath>	AddList;
	AddList	toAddList;

	if ( msg.fileshash_size() != files.size() )
	{
		ProcessorCommon::RemoveFiles(files);

		retMsg->set_stats(transMsg::ERS_WRONG_FILE);
		return;
	}

	try
	{
		std::unordered_set<AStringType> neededFiles;

		//查找缺失文件
		//********************************************************************************************************************	
		{
			std::vector<AStringType> tmp;

			SociAdaptor(Statement()
				.Select(SV_LibFileInfo("TmpTb").HashCode.Into(tmp))
				.From(Statement()
					.Select(JK_ResourceInfo.HASHCode)
					.From(JK_ResourceInfo)
					.Where(JK_ResourceInfo.HASHCode!="" && JK_ResourceInfo.FactoryID==*userInfo.UserInfo_.FactoryID_)
					.Union(Statement()
					.Select(JK_ModelInfo.HASHCode)
					.From(JK_ModelInfo)
					.Where(JK_ModelInfo.HASHCode!="" && JK_ModelInfo.FactoryID==*userInfo.UserInfo_.FactoryID_)),"TmpTb")
				.Where(SV_LibFileInfo("TmpTb").HashCode.NotIn(Statement()
					.Select(SV_LibFileInfo.HashCode)
					.From(SV_LibFileInfo)
					.Where(SV_LibFileInfo.DeptID==*userInfo.UserInfo_.FactoryID_ && SV_LibFileInfo.HashCode!="").GetString())), sql).Excute();

			std::copy(tmp.begin(), tmp.end(), std::inserter(neededFiles, neededFiles.end()));
		}
		//********************************************************************************************************************

		//检验文件
		//********************************************************************************************************************
		for ( auto i=0; i<msg.fileshash_size(); ++i )
		{
			const auto& curFileHash = msg.fileshash(i);
			const auto& curFilePath = files[i];
			ErrCodeType ec;

			if ( curFilePath.ChkFaild_ )
			{
				retMsg->add_lostfiles(curFileHash);

				ProcessorCommon::RemoveFile(curFilePath.Path_);
				continue;				
			}
			
			if ( neededFiles.end() == neededFiles.find(curFileHash) )
			{
				retMsg->add_rejectedfiles(curFileHash);

				ProcessorCommon::RemoveFile(curFilePath.Path_);
				continue;
			}
			
			auto newPt = MoveResFile(*userInfo.UserInfo_.FactoryID_, curFilePath.Path_, curFileHash, ec);
			if ( !ec )
			{
				toAddList.insert(std::make_pair(curFileHash,newPt));
			}
			else
			{
				LOG_INFO << ec << L", " << curFilePath.Path_;
			}
		}
		//********************************************************************************************************************


		//添加文件
		//********************************************************************************************************************
		{
			soci::transaction trans(sql);

			SV_LibFileInfo_Data info;
			info.DeptID_ = userInfo.UserInfo_.FactoryID_;
			info.DestPath_.reset(boost::initialized_value);
			info.HashCode_.reset(boost::initialized_value);

			SociAdaptor ada(Statement().Insert(SV_LibFileInfo.Use(info)), sql);
			
			for ( auto& perFile : toAddList )
			{
				info.DestPath_ = std::move(perFile.second.string());
				info.HashCode_ = perFile.first;

				ada.Excute();
			}

			trans.commit();
		}
		//********************************************************************************************************************

		//更新状态
		//********************************************************************************************************************
		{
			std::vector<int64_t>	toUpdateCodes;
			{
				SociAdaptor(Statement()
					.Select(GL_SugarVerInfo.VerCode.Into(toUpdateCodes))
					.From(GL_SugarVerInfo)
					.Where(GL_SugarVerInfo.UploadStatus!=DBValue::UploadStatus::Done &&
							GL_SugarVerInfo.DeptID==*userInfo.UserInfo_.FactoryID_ &&
							GL_SugarVerInfo.VerCode.NotIn(Statement()
													.Select(JK_ResourceInfo.VerCode)
													.From(JK_ResourceInfo)
													.InnerJoin(GL_SugarVerInfo).On(JK_ResourceInfo.VerCode==GL_SugarVerInfo.VerCode)
													.Where(GL_SugarVerInfo.UploadStatus!=DBValue::UploadStatus::Done &&
															JK_ResourceInfo.HASHCode!="" &&
															JK_ResourceInfo.HASHCode.NotIn(Statement()
																							.Select(SV_LibFileInfo.HashCode)
																							.From(SV_LibFileInfo)
																							.Where(SV_LibFileInfo.DeptID==*userInfo.UserInfo_.FactoryID_).GetString()))
													.Union(Statement()
													.Select(JK_ModelInfo.VerCode)
													.From(JK_ModelInfo)
													.InnerJoin(GL_SugarVerInfo).On(JK_ModelInfo.VerCode==GL_SugarVerInfo.VerCode)
													.Where(GL_SugarVerInfo.UploadStatus!=DBValue::UploadStatus::Done &&
															JK_ModelInfo.HASHCode!="" &&
															JK_ModelInfo.HASHCode.NotIn(Statement()
																						.Select(SV_LibFileInfo.HashCode)
																						.From(SV_LibFileInfo)
																						.Where(SV_LibFileInfo.DeptID==*userInfo.UserInfo_.FactoryID_).GetString()))
															).GetString()
															)
							), sql).Excute();
			}

			if ( toUpdateCodes.empty() )
			{
				retMsg->set_stats(transMsg::ERS_SUCCESS);
				return;
			}

			SociAdaptor(Statement()
				.Update(GL_SugarVerInfo.UploadStatus.Use(DBValue::UploadStatus::Done))
				.Where(GL_SugarVerInfo.VerCode.In(toUpdateCodes.begin(), toUpdateCodes.end())), sql).Excute();

			retMsg->set_stats(transMsg::ERS_SUCCESS);
		}
		//********************************************************************************************************************
	}
	catch (soci::soci_error& err)
	{
		for ( auto& perFile : toAddList )
		{
			ProcessorCommon::RemoveFile(perFile.second);
		}

		retMsg->set_stats(transMsg::ERS_SERVER_ERROR);

		LOG_ERROR << DataBase::GetSociErrorString(err) << userInfo.RemoteEP_;
	}
	
}
Example #10
0
bool player::create(game *g, character_type type, std::string tempname)
{
 weapon = item(g->itypes["null"], 0);
 
 g->u.prof = profession::generic();

 WINDOW* w = newwin(25, 80, (TERMY > 25) ? (TERMY-25)/2 : 0, (TERMX > 80) ? (TERMX-80)/2 : 0);

 int tab = 0, points = 38;
 if (type != PLTYPE_CUSTOM) {
  switch (type) {
   case PLTYPE_RANDOM: {
    str_max = rng(6, 12);
    dex_max = rng(6, 12);
    int_max = rng(6, 12);
    per_max = rng(6, 12);
    points = points - str_max - dex_max - int_max - per_max;
    if (str_max > HIGH_STAT)
     points -= (str_max - HIGH_STAT);
    if (dex_max > HIGH_STAT)
     points -= (dex_max - HIGH_STAT);
    if (int_max > HIGH_STAT)
     points -= (int_max - HIGH_STAT);
    if (per_max > HIGH_STAT)
     points -= (per_max - HIGH_STAT);

    int num_gtraits = 0, num_btraits = 0, rn, tries;
    while (points < 0 || rng(-3, 20) > points) {
     if (num_btraits < MAX_TRAIT_POINTS && one_in(3)) {
      tries = 0;
      do {
       rn = random_bad_trait();
       tries++;
      } while ((has_trait(rn) ||
              num_btraits - traits[rn].points > MAX_TRAIT_POINTS) && tries < 5);
      if (tries < 5) {
       toggle_trait(rn);
       points -= traits[rn].points;
       num_btraits -= traits[rn].points;
      }
     } else {
      switch (rng(1, 4)) {
       case 1: if (str_max > 5) { str_max--; points++; } break;
       case 2: if (dex_max > 5) { dex_max--; points++; } break;
       case 3: if (int_max > 5) { int_max--; points++; } break;
       case 4: if (per_max > 5) { per_max--; points++; } break;
      }
     }
    }
    while (points > 0) {
     switch (rng((num_gtraits < MAX_TRAIT_POINTS ? 1 : 5), 9)) {
     case 1:
     case 2:
     case 3:
     case 4:
      rn = random_good_trait();
      if (!has_trait(rn) && points >= traits[rn].points &&
          num_gtraits + traits[rn].points <= MAX_TRAIT_POINTS) {
       toggle_trait(rn);
       points -= traits[rn].points;
       num_gtraits += traits[rn].points;
      }
      break;
     case 5:
      switch (rng(1, 4)) {
       case 1: if (str_max < HIGH_STAT) { str_max++; points--; } break;
       case 2: if (dex_max < HIGH_STAT) { dex_max++; points--; } break;
       case 3: if (int_max < HIGH_STAT) { int_max++; points--; } break;
       case 4: if (per_max < HIGH_STAT) { per_max++; points--; } break;
      }
      break;
     case 6:
     case 7:
     case 8:
     case 9:
      rn = random_skill();

      Skill *aSkill = Skill::skill(rn);
      int level = skillLevel(aSkill);

      if (level < points) {
        points -= level + 1;
        skillLevel(aSkill).level(level + 2);
      }
      break;
     }
    }
   } break;
   case PLTYPE_TEMPLATE: {
    std::ifstream fin;
    std::stringstream filename;
    filename << "data/" << tempname << ".template";
    fin.open(filename.str().c_str());
    if (!fin.is_open()) {
     debugmsg("Couldn't open %s!", filename.str().c_str());
     return false;
    }
    std::string(data);
    getline(fin, data);
    load_info(g, data);
    points = 0;
   } break;
  }
  tab = 3;
 } else
  points = OPTIONS[OPT_INITIAL_POINTS];

 do {
  werase(w);
  wrefresh(w);
  switch (tab) {
   case 0: tab += set_stats      (w, g, this, points); break;
   case 1: tab += set_traits     (w, g, this, points); break;
   case 2: tab += set_profession (w, g, this, points); break;
   case 3: tab += set_skills     (w, g, this, points); break;
   case 4: tab += set_description(w, g, this, points); break;
  }
 } while (tab >= 0 && tab < 5);
 delwin(w);

 if (tab < 0)
  return false;

 // Character is finalized.  Now just set up HP, &c
 for (int i = 0; i < num_hp_parts; i++) {
  hp_max[i] = calc_HP(str_max, has_trait(PF_TOUGH));
  hp_cur[i] = hp_max[i];
 }
 if (has_trait(PF_GLASSJAW)) {
  hp_max[hp_head] = int(hp_max[hp_head] * .85);
  hp_cur[hp_head] = hp_max[hp_head];
 }
 if (has_trait(PF_SMELLY))
  scent = 800;
 if (has_trait(PF_ANDROID)) {
  std::map<std::string,bionic_data*>::iterator random_bionic = bionics.begin();
  std::advance(random_bionic,rng(0,bionics.size()-1));
  add_bionic(random_bionic->first);// Other
  if (bionics[my_bionics[0].id]->power_cost > 0) {
   add_bionic(bionic_id(power_source_bionics[rng(0,power_source_bionics.size())]));	// Power Source
   max_power_level = 10;
   power_level = 10;
  } else {
   bionic_id tmpbio;
   do
   tmpbio = bionic_id(unpowered_bionics[rng(0, unpowered_bionics.size())]);
   while (bionics[tmpbio]->power_cost > 0);
   add_bionic(tmpbio);
   max_power_level = 0;
   power_level = 0;
  }

/* CHEATER'S STUFF

  add_bionic(bionic_id(rng(0, "bio_ethanol")));	// Power Source
  for (int i = 0; i < 5; i++)
   add_bionic(bionic_id(rng("bio_memory", max_"bio_start" - 1)));// Other
  max_power_level = 80;
  power_level = 80;

End of cheatery */
 }

 if (has_trait(PF_MARTIAL_ARTS)) {
  itype_id ma_type;
  do {
   int choice = menu("Pick your style:",
                     "Karate", "Judo", "Aikido", "Tai Chi", "Taekwondo", NULL);
   if (choice == 1)
    ma_type = "style_karate";
   if (choice == 2)
    ma_type = "style_judo";
   if (choice == 3)
    ma_type = "style_aikido";
   if (choice == 4)
    ma_type = "style_tai_chi";
   if (choice == 5)
    ma_type = "style_taekwondo";
   item tmpitem = item(g->itypes[ma_type], 0);
   full_screen_popup(tmpitem.info(true).c_str());
  } while (!query_yn("Use this style?"));
  styles.push_back(ma_type);
 }
 ret_null = item(g->itypes["null"], 0);
 if (!styles.empty())
  weapon = item(g->itypes[ styles[0] ], 0, ':');
 else
  weapon   = item(g->itypes["null"], 0);
 
 item tmp; //gets used several times

 std::vector<std::string> prof_items = g->u.prof->items();
 for (std::vector<std::string>::const_iterator iter = prof_items.begin(); iter != prof_items.end(); ++iter) {
  item tmp = item(g->itypes.at(*iter), 0, 'a' + worn.size());
  if (tmp.is_armor()) {
   if (tmp.has_flag(IF_VARSIZE))
    tmp.item_flags |= mfb(IF_FIT);      
   worn.push_back(tmp);
  } else {
   inv.push_back(tmp);
  }

  // if we start with drugs, need to start strongly addicted, too
  if (tmp.is_food()) {
   it_comest *comest = dynamic_cast<it_comest*>(tmp.type);
   if (comest->add != ADD_NULL) {
    addiction add(comest->add, 10);
    g->u.addictions.push_back(add);
   }
  }
 }

// The near-sighted get to start with glasses.
 if (has_trait(PF_MYOPIC)) {
  tmp = item(g->itypes["glasses_eye"], 0, 'a' + worn.size());
  worn.push_back(tmp);
 }
// And the far-sighted get to start with reading glasses.
 if (has_trait(PF_HYPEROPIC)) {
  tmp = item(g->itypes["glasses_reading"], 0, 'a' + worn.size());
  worn.push_back(tmp);
 }
// Likewise, the asthmatic start with their medication.
 if (has_trait(PF_ASTHMA)) {
  tmp = item(g->itypes["inhaler"], 0, 'a' + worn.size());
  inv.push_back(tmp);
 }
// Basic starter gear, added independently of profession.
 tmp = item(g->itypes["pockknife"], 0,'a' + worn.size());
  inv.push_back(tmp);
 tmp = item(g->itypes["matches"], 0,'a' + worn.size());
  inv.push_back(tmp);
// make sure we have no mutations
 for (int i = 0; i < PF_MAX2; i++)
  my_mutations[i] = false;
 return true;
}
Example #11
0
bool player::create(game *g, character_type type, std::string tempname)
{
 weapon = item(g->itypes["null"], 0);

 g->u.prof = profession::generic();

 WINDOW* w = newwin(FULL_SCREEN_HEIGHT, FULL_SCREEN_WIDTH,
                    (TERMY > FULL_SCREEN_HEIGHT) ? (TERMY-FULL_SCREEN_HEIGHT)/2 : 0,
                    (TERMX > FULL_SCREEN_WIDTH) ? (TERMX-FULL_SCREEN_WIDTH)/2 : 0);

 int tab = 0, points = 38, max_trait_points = 12;
 if (type != PLTYPE_CUSTOM) {
  switch (type) {
   case PLTYPE_RANDOM: {
    str_max = rng(6, 12);
    dex_max = rng(6, 12);
    int_max = rng(6, 12);
    per_max = rng(6, 12);
    points = points - str_max - dex_max - int_max - per_max;
    if (str_max > HIGH_STAT)
     points -= (str_max - HIGH_STAT);
    if (dex_max > HIGH_STAT)
     points -= (dex_max - HIGH_STAT);
    if (int_max > HIGH_STAT)
     points -= (int_max - HIGH_STAT);
    if (per_max > HIGH_STAT)
     points -= (per_max - HIGH_STAT);

    int num_gtraits = 0, num_btraits = 0, rn, tries;
    while (points < 0 || rng(-3, 20) > points) {
     if (num_btraits < max_trait_points && one_in(3)) {
      tries = 0;
      do {
       rn = random_bad_trait();
       tries++;
      } while ((has_trait(rn) ||
              num_btraits - traits[rn].points > max_trait_points) && tries < 5);
      if (tries < 5) {
       toggle_trait(rn);
       points -= traits[rn].points;
       num_btraits -= traits[rn].points;
      }
     } else {
      switch (rng(1, 4)) {
       case 1: if (str_max > 5) { str_max--; points++; } break;
       case 2: if (dex_max > 5) { dex_max--; points++; } break;
       case 3: if (int_max > 5) { int_max--; points++; } break;
       case 4: if (per_max > 5) { per_max--; points++; } break;
      }
     }
    }
    while (points > 0) {
     switch (rng((num_gtraits < max_trait_points ? 1 : 5), 9)) {
     case 1:
     case 2:
     case 3:
     case 4:
      rn = random_good_trait();
      if (!has_trait(rn) && points >= traits[rn].points &&
          num_gtraits + traits[rn].points <= max_trait_points) {
       toggle_trait(rn);
       points -= traits[rn].points;
       num_gtraits += traits[rn].points;
      }
      break;
     case 5:
      switch (rng(1, 4)) {
       case 1: if (str_max < HIGH_STAT) { str_max++; points--; } break;
       case 2: if (dex_max < HIGH_STAT) { dex_max++; points--; } break;
       case 3: if (int_max < HIGH_STAT) { int_max++; points--; } break;
       case 4: if (per_max < HIGH_STAT) { per_max++; points--; } break;
      }
      break;
     case 6:
     case 7:
     case 8:
     case 9:
      rn = random_skill();

      Skill *aSkill = Skill::skill(rn);
      int level = skillLevel(aSkill);

      if (level < points) {
        points -= level + 1;
        skillLevel(aSkill).level(level + 2);
      }
      break;
     }
    }
   } break;
   case PLTYPE_TEMPLATE: {
    std::ifstream fin;
    std::stringstream filename;
    filename << "data/" << tempname << ".template";
    fin.open(filename.str().c_str());
    if (!fin.is_open()) {
     debugmsg("Couldn't open %s!", filename.str().c_str());
     return false;
    }
    std::string(data);
    getline(fin, data);
    load_info(g, data);
    points = 0;
   } break;
  }
  tab = NEWCHAR_TAB_MAX;
 } else
  points = OPTIONS[OPT_INITIAL_POINTS];
  max_trait_points = OPTIONS[OPT_MAX_TRAIT_POINTS];

 do {
  werase(w);
  wrefresh(w);
  switch (tab) {
   case 0: tab += set_stats      (w, g, this, points); break;
   case 1: tab += set_traits     (w, g, this, points, max_trait_points); break;
   case 2: tab += set_profession (w, g, this, points); break;
   case 3: tab += set_skills     (w, g, this, points); break;
   case 4: tab += set_description(w, g, this, points); break;
  }
 } while (tab >= 0 && tab <= NEWCHAR_TAB_MAX);
 delwin(w);

 if (tab < 0)
  return false;

 // Character is finalized.  Now just set up HP, &c
 for (int i = 0; i < num_hp_parts; i++) {
  hp_max[i] = calc_HP(str_max, has_trait(PF_TOUGH));
  hp_cur[i] = hp_max[i];
 }
 if (has_trait(PF_HARDCORE)) {
  for (int i = 0; i < num_hp_parts; i++) {
   hp_max[i] = int(hp_max[i] * .25);
   hp_cur[i] = hp_max[i];
  }
 } if (has_trait(PF_GLASSJAW)) {
  hp_max[hp_head] = int(hp_max[hp_head] * .80);
  hp_cur[hp_head] = hp_max[hp_head];
 }
 if (has_trait(PF_SMELLY))
  scent = 800;
 if (has_trait(PF_ANDROID)) {
  bionic_id first_bio;
  do {
   first_bio = g->random_good_bionic();
  } while (bionics[first_bio]->power_cost > 10);
  add_bionic(first_bio);
  add_bionic(bionic_id(power_source_bionics[rng(0,power_source_bionics.size()-1)]));	// Power Source
  max_power_level = 10;
  power_level = 10;
 }

 if (has_trait(PF_MARTIAL_ARTS)) {
  itype_id ma_type;
  do {
   int choice = menu(false, _("Pick your style:"),
                     _("Karate"), _("Judo"), _("Aikido"), _("Tai Chi"),
                     _("Taekwondo"), NULL);
   if (choice == 1)
    ma_type = "style_karate";
   if (choice == 2)
    ma_type = "style_judo";
   if (choice == 3)
    ma_type = "style_aikido";
   if (choice == 4)
    ma_type = "style_tai_chi";
   if (choice == 5)
    ma_type = "style_taekwondo";
   item tmpitem = item(g->itypes[ma_type], 0);
   full_screen_popup(tmpitem.info(true).c_str());
  } while (!query_yn(_("Use this style?")));
  styles.push_back(ma_type);
  style_selected=ma_type;
 }

    if (has_trait(PF_MARTIAL_ARTS2)) {
  itype_id ma_type;
  do {
   int choice = menu(false, _("Pick your style:"),
                     _("Capoeira"), _("Krav Maga"), _("Muay Thai"),
                     _("Ninjutsu"), _("Zui Quan"), NULL);
   if (choice == 1)
    ma_type = "style_capoeira";
   if (choice == 2)
    ma_type = "style_krav_maga";
   if (choice == 3)
    ma_type = "style_muay_thai";
   if (choice == 4)
    ma_type = "style_ninjutsu";
   if (choice == 5)
    ma_type = "style_zui_quan";
   item tmpitem = item(g->itypes[ma_type], 0);
   full_screen_popup(tmpitem.info(true).c_str());
  } while (!query_yn(_("Use this style?")));
  styles.push_back(ma_type);
  style_selected=ma_type;
 }
 if (has_trait(PF_MARTIAL_ARTS3)) {
  itype_id ma_type;
  do {
   int choice = menu(false, _("Pick your style:"),
                     _("Tiger"), _("Crane"), _("Leopard"), _("Snake"),
                     _("Dragon"), NULL);
   if (choice == 1)
    ma_type = "style_tiger";
   if (choice == 2)
    ma_type = "style_crane";
   if (choice == 3)
    ma_type = "style_leopard";
   if (choice == 4)
    ma_type = "style_snake";
   if (choice == 5)
    ma_type = "style_dragon";
   item tmpitem = item(g->itypes[ma_type], 0);
   full_screen_popup(tmpitem.info(true).c_str());
  } while (!query_yn(_("Use this style?")));
  styles.push_back(ma_type);
  style_selected=ma_type;
 }
 if (has_trait(PF_MARTIAL_ARTS4)) {
  itype_id ma_type;
  do {
   int choice = menu(false, _("Pick your style:"),
                     _("Centipede"), _("Viper"), _("Scorpion"), _("Lizard"),
                     _("Toad"), NULL);
   if (choice == 1)
    ma_type = "style_centipede";
   if (choice == 2)
    ma_type = "style_venom_snake";
   if (choice == 3)
    ma_type = "style_scorpion";
   if (choice == 4)
    ma_type = "style_lizard";
   if (choice == 5)
    ma_type = "style_toad";
   item tmpitem = item(g->itypes[ma_type], 0);
   full_screen_popup(tmpitem.info(true).c_str());
  } while (!query_yn(_("Use this style?")));
  styles.push_back(ma_type);
  style_selected=ma_type;
 }
 ret_null = item(g->itypes["null"], 0);
 weapon = get_combat_style();
 
 
 item tmp; //gets used several times

 std::vector<std::string> prof_items = g->u.prof->items();
 for (std::vector<std::string>::const_iterator iter = prof_items.begin(); iter != prof_items.end(); ++iter)
 {
    tmp = item(item_controller->find_template(*iter), 0);
    inv.push_back(tmp);
 }

 std::vector<addiction> prof_addictions = g->u.prof->addictions();
 for (std::vector<addiction>::const_iterator iter = prof_addictions.begin(); iter != prof_addictions.end(); ++iter)
 {
     g->u.addictions.push_back(*iter);
 }

 // Grab the skills from the profession, if there are any
 profession::StartingSkillList prof_skills = g->u.prof->skills();
 for (profession::StartingSkillList::const_iterator iter = prof_skills.begin(); 
      iter != prof_skills.end(); ++iter)
 {
     assert(Skill::skill(iter->first));
     if (Skill::skill(iter->first))
     {
        g->u.boost_skill_level(iter->first, iter->second);
     }
 }

 // Those who are both near-sighted and far-sighted start with bifocal glasses.
 if (has_trait(PF_HYPEROPIC) && has_trait(PF_MYOPIC))
 {
    tmp = item(g->itypes["glasses_bifocal"], 0);
    inv.push_back(tmp);
 }
 // The near-sighted start with eyeglasses.
 else if (has_trait(PF_MYOPIC))
 {
    tmp = item(g->itypes["glasses_eye"], 0);
    inv.push_back(tmp);
 }
 // The far-sighted start with reading glasses.
 else if (has_trait(PF_HYPEROPIC))
 {
    tmp = item(g->itypes["glasses_reading"], 0);
    inv.push_back(tmp);
 }

// Likewise, the asthmatic start with their medication.
 if (has_trait(PF_ASTHMA)) {
  tmp = item(g->itypes["inhaler"], 0);
  inv.push_back(tmp);
 }
// Basic starter gear, added independently of profession.
 tmp = item(g->itypes["pockknife"], 0);
  inv.push_back(tmp);
 tmp = item(g->itypes["matches"], 0);
  inv.push_back(tmp);
// make sure we have no mutations
 for (int i = 0; i < PF_MAX2; i++)
  if (!has_base_trait(i))
	my_mutations[i] = false;
	
	// Equip any armor from our inventory. If we are unable to wear some of it due to encumberance, it will silently fail.
    std::vector<item*> tmp_inv;
    inv.dump(tmp_inv);
    
    for(std::vector<item*>::iterator i = tmp_inv.begin(); i != tmp_inv.end(); ++i)
    {
        if( (*i)->is_armor())
        {
            if( (*i)->has_flag("VARSIZE"))
            {
                (*i)->item_tags.insert("FIT");
            }
            // It might be more elegant to use player::wear_item, but then we have to implement our own inventory removal.
            wear(g, (*i)->invlet, false);
        }
    }

 // Ensure that persistent morale effects (e.g. Optimist) are present at the start.
 apply_persistent_morale();
 return true;
}
Example #12
0
MainWindow::MainWindow(QWidget *parent, Qt::WFlags flags): QMainWindow(parent, flags), petri_dish(),
    histogramDialog(0), changed(true), auto_save(false), update_thread(this, this)
{
    setupUi(this);

    connect(&timer, SIGNAL(timeout()), &petri_dish, SLOT(step()));
    connect(&petri_dish, SIGNAL(changed()), worldView, SLOT(queueUpdate()));
    //connect(&petri_dish, SIGNAL(changed()), worldView, SLOT(repaint()));
    connect(&petri_dish, SIGNAL(changed()), this, SLOT(set_stats()));
    connect(runButton, SIGNAL(clicked()), this, SLOT(start_stop()));
    //connect(checkIntegrity, SIGNAL(clicked()), this, SLOT(check_integrity()));
    connect(stepBtn, SIGNAL(clicked()), this, SLOT(step()));

    connect(radViewDefault, SIGNAL(clicked()), &petri_dish, SLOT(set_default_view_mode()));
    connect(radViewBugs, SIGNAL(clicked()), &petri_dish, SLOT(set_bugs_view_mode()));
    connect(radViewEnergy, SIGNAL(clicked()), &petri_dish, SLOT(set_energy_view_mode()));
    connect(radViewAge, SIGNAL(clicked()), &petri_dish, SLOT(set_age_view_mode()));
    connect(radViewSize, SIGNAL(clicked()), &petri_dish, SLOT(set_dna_size_view_mode()));
    connect(radViewDNA, SIGNAL(clicked()), &petri_dish, SLOT(set_dna_view_mode()));
    connect(radViewTerrain, SIGNAL(clicked()), &petri_dish, SLOT(set_terrain_view_mode()));

    connect(actionNew, SIGNAL(triggered()), this, SLOT(new_world()));
    connect(actionSave, SIGNAL(triggered()), this, SLOT(save_world()));
    connect(actionOpen, SIGNAL(triggered()), this, SLOT(load_world()));
    connect(actionSave_As, SIGNAL(triggered()), this, SLOT(save_as_world()));
    connect(settings, SIGNAL(settingsChanged()), this, SLOT(change_world()));
    connect(actionAutoSave, SIGNAL(triggered()), this, SLOT(autosave_world()));

    connect(actionCheck_Integrity, SIGNAL(triggered()), this, SLOT(check_integrity()));

    connect(worldView, SIGNAL(clicked(int, int)), this, SLOT(edit_bug(int, int)));

    connect(idleChk, SIGNAL(clicked(bool)), this, SLOT(enableIdleDetect(bool)));

    connect(&idleTimer, SIGNAL(timeout()), this, SLOT(checkIdle()));

    autosave_timer.setInterval(1000 * 60 * 2); // every two mins
    connect(&autosave_timer, SIGNAL(timeout()), this, SLOT(save_world()));

    petri_dish.set_widget(worldView);
    petri_dish.init(settings->getParams());
    totalEnergy->setText(QString().setNum(petri_dish.get_total_energy()));
    spinDNAVal->setMaximum(settings->getParams().max_data);
    set_stats();

    last_time = 0;
    update_time.start();
    updates_per_sec = 0;


    //update_thread.start();
    horizontalSlider->setValue(1000);
    timer.start(0);

    setAttribute(Qt::WA_QuitOnClose, true);

    repaint();

    if(!qApp->arguments().size() > 1) {
        bool running;
        load_from_file(qApp->arguments().at(1), running);

        if(running) start();
    }
}
Example #13
0
void MainWindow::updt() {
    petri_dish.update_all_pixels();
    set_stats();
    update();
}
Example #14
0
void CMsgCallBack<transMsg::QUploadOrder>::_Process( transMsg::QUploadOrder& msg, uint64_t recvID, const mori::RecvFileList& files, SUserInfo& userInfo, soci::session& sql, SSendInfoSPtr& sendInfoPtr )
{
	auto retMsg = smartPtr::make_shared<transMsg::AUploadOrder>();
	auto& retInfo = sendInfoPtr->Add();
	retInfo.MsgPtr_ = retMsg;
	retMsg->set_stats(transMsg::ERS_SERVER_ERROR);
		
	soci::transaction trans(sql);

	int64_t orderID = 0;
	int32_t orderIndex = 0;

	if ( msg.isneworder() )
	{
		auto updateInfo = retMsg->mutable_newinfo();
		updateInfo->set_oldid(msg.orderid());

		GL_OrderInfo_Data orderStatusInfo;
		orderStatusInfo.ClientOrderID_ = msg.orderid();
		orderStatusInfo.DesignerID_ = userInfo.UserInfo_.UserID_;
		orderStatusInfo.FactoryID_ = userInfo.UserInfo_.FactoryID_;
		orderStatusInfo.ShopID_ = userInfo.UserInfo_.ShopID_;
		orderStatusInfo.ShopAuditTime_ = DBTime(rawDate);
		orderStatusInfo.ShopCommitTime_ = DBTime(rawDate);
		orderStatusInfo.GraphAuditTime_ = DBTime(rawDate);
		orderStatusInfo.ListAuditTime_ = DBTime(rawDate);
		orderStatusInfo.FinanceAuditTime_ = DBTime(rawDate);

		if ( msg.has_ordertype() )
		{
			orderStatusInfo.OrderType_ = msg.ordertype();
		}
		else
		{
			orderStatusInfo.OrderType_ = 1;
		}
		
		SociAdaptor(Statement().Insert(GL_OrderInfo.Use(orderStatusInfo)), sql).Excute();

		SociAdaptor(Statement()
#ifdef USE_SQLSERVER
			.Select(isnull(max(GL_OrderInfo.OrderID), 0).Into(orderID)|isnull(max(GL_OrderInfo.OrderIndex), 0).Into(orderIndex))
#elif defined USE_MYSQL
			.Select(ifnull(max(GL_OrderInfo.OrderID), 0).Into(orderID)|ifnull(max(GL_OrderInfo.OrderIndex), 0).Into(orderIndex))
#endif
			.From(GL_OrderInfo)
			.Where(GL_OrderInfo.FactoryID==*userInfo.UserInfo_.FactoryID_), sql).Excute();

		++orderIndex;

		boost::format fmtOrderCode("%012d");
		fmtOrderCode % orderIndex;

		updateInfo->set_newcode(fmtOrderCode.str());
		
		GL_OrderInfo_Data updateOrder;
		updateOrder.OrderIndex_ = orderIndex;
		updateOrder.OrderCode_ = fmtOrderCode.str();

		if ( !msg.iszborder() )
		{
			updateOrder.OrderStatus_ = order::EOS_SAVE;
		}
		else
		{
			updateOrder.OrderStatus_ = order::EOS_ZB_SAVE;
		}

		SociAdaptor(Statement().Update(GL_OrderInfo.Use(updateOrder)).Where(GL_OrderInfo.OrderID==orderID && GL_OrderInfo.FactoryID == *userInfo.UserInfo_.FactoryID_), sql).Excute();

		updateInfo->set_newid(orderID);
		updateInfo->set_newindex(orderIndex);

		msg.set_orderid(orderID);
	}

	GL_OrderInfo_Data statusInfo;
	statusInfo.SetAll(true);

	SociAdaptor(Statement().Select(GL_OrderInfo.Into(statusInfo)).From(GL_OrderInfo).Where(GL_OrderInfo.OrderID==msg.orderid()), sql).Excute();

	PathType theFile;
	ErrCodeType ec;
	if ( !files.empty() )
	{
		if ( 1 != files.size() )
		{
			ProcessorCommon::RemoveFiles(files);
			retMsg->set_stats(transMsg::ERS_WRONG_FILE);
			return;
		}
		else
		{
			theFile = MoveResFile(*userInfo.UserInfo_.FactoryID_, *statusInfo.OrderID_, files.front().Path_, ec);
			if ( ec )
			{
				LOG_INFO << ec;
				return;
			}
		}
	}

	auto curState = IOrderState::Factory(static_cast<order::EOrderState>(*statusInfo.OrderStatus_));
	if ( !curState )
	{
		retMsg->set_stats(transMsg::ERS_ORDER_DENY);
		return;
	}
	
	auto ret = curState->Upload(userInfo, statusInfo, *msg.mutable_ordertable(), theFile, sql);
	retMsg->set_stats(ret);

	if ( transMsg::ERS_SUCCESS == ret )
	{
		trans.commit();
	}
}