changeset 2265:f38f53397bc0

Слияние
author Ritor1
date Sat, 08 Mar 2014 22:23:27 +0600
parents 47b87aea14ba (current diff) 236d8d7c7295 (diff)
children 01489aec3cb0
files
diffstat 2 files changed, 6 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/Items.cpp	Sat Mar 08 22:23:20 2014 +0600
+++ b/Items.cpp	Sat Mar 08 22:23:27 2014 +0600
@@ -452,7 +452,7 @@
 	{
     test_string = strtok(NULL, "\r") + 1;
     auto tokens = Tokenize(test_string, '\t');
-    Assert(tokens.size() == 17, "Invalid number of tokens");
+    Assert(tokens.size() >= 17, "Invalid number of tokens");
     pSpecialEnchantments[i].pBonusStatement=RemoveQuotes(tokens[0]);
     pSpecialEnchantments[i].pNameAdd= RemoveQuotes(tokens[1]);
     for (int i = 0; i < 12; i++)
@@ -507,9 +507,9 @@
       pItems[item_counter].uDamageDice=atoi(tokens2[0]);
       pItems[item_counter].uDamageRoll=atoi(tokens2[1]);
     }
-    else if (tolower(test_string[0]) != 's')
+    else if (tolower(tokens2[0][0]) != 's')
     {
-      pItems[item_counter].uDamageDice=atoi(test_string);
+      pItems[item_counter].uDamageDice=atoi(tokens2[0]);
       pItems[item_counter].uDamageRoll=1;
     }
     else
@@ -564,7 +564,6 @@
     item_counter++;
 	}
 
-
 	pRndItemsTXT_Raw = NULL;
 	uAllItemsCount = item_counter;
 	pRndItemsTXT_Raw = (char *)pEvents_LOD->LoadRaw("rnditems.txt", 0);
@@ -646,7 +645,7 @@
 		{
 		test_string = strtok(NULL, "\r") + 1;
     auto tokens = Tokenize(test_string, '\t');
-    Assert(tokens.size() == 6, "Invalid number of tokens");
+    Assert(tokens.size() >= 6, "Invalid number of tokens");
     pSkillDesc[i] = RemoveQuotes(tokens[1]);
     pNormalSkillDesc[i] = RemoveQuotes(tokens[2]);
     pExpertSkillDesc[i] = RemoveQuotes(tokens[3]);
--- a/texts.cpp	Sat Mar 08 22:23:20 2014 +0600
+++ b/texts.cpp	Sat Mar 08 22:23:27 2014 +0600
@@ -9,31 +9,16 @@
 std::vector<char*> Tokenize( char* input, const char separator )
 {
   std::vector<char*> retVect;
-  char* lastInput = input;
+  retVect.push_back(input);
   while (*input)
   {
     if (*input == separator)
     {
-      if (lastInput != nullptr)
-      {
         *input = '\0';
-        retVect.push_back(lastInput);
-        lastInput = nullptr;
-      }
-    }
-    else
-    {
-      if (lastInput == nullptr)
-      {
-        lastInput = input;
-      }
+        retVect.push_back(input + 1);
     }
     ++input;
   }
-  if (lastInput != nullptr)
-  {
-    retVect.push_back(lastInput);
-  }
   return retVect;
 }