C++ ne +1 hanem annyi amennyit megadok

Started by AngelOfGod, 2017-01-17, 23:38:37

2017-01-17, 23:38:37 Last Edit: 2017-01-18, 00:08:39 by AngelOfGod
Quotech->SetRealPoint(idx, ch->GetRealPoint(idx) + 1);
   ch->SetPoint(idx, ch->GetPoint(idx) + 1);

ezt hogy tudnám úgy átírni hogy ne + 1-et adjon hanem annyit adjon amennyit én beírok a játékban, mert ha így beírom: /stat st akkor csak 1-et ad tök mind1 hogy beírom /stat st 50

itt van az egész parancs
[spoiler]
QuoteACMD(do_stat)
{
   char arg1[256];
   one_argument(argument, arg1, sizeof(arg1));

   if (!*arg1)
      return;

   if (ch->IsPolymorphed())
   {
      ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("둔갑 중에는 능력을 올릴 수 없습니다."));
      return;
   }

   if (ch->GetPoint(POINT_STAT) <= 0)
      return;

   BYTE idx = 0;
   
   if (!strcmp(arg1, "st"))
      idx = POINT_ST;
   else if (!strcmp(arg1, "dx"))
      idx = POINT_DX;
   else if (!strcmp(arg1, "ht"))
      idx = POINT_HT;
   else if (!strcmp(arg1, "iq"))
      idx = POINT_IQ;
   else
      return;

   if (ch->GetRealPoint(idx) >= MAX_STAT)
      return;

   ch->SetRealPoint(idx, ch->GetRealPoint(idx) + 1);
   ch->SetPoint(idx, ch->GetPoint(idx) + 1);
   ch->ComputePoints();
   ch->PointChange(idx, 0);

   if (idx == POINT_IQ)
   {
      ch->PointChange(POINT_MAX_HP, 0);
   }
   else if (idx == POINT_HT)
   {
      ch->PointChange(POINT_MAX_SP, 0);
   }

   ch->PointChange(POINT_STAT, -1);
   ch->ComputePoints();
}
[/spoiler]


Megoldva