comparison NPC.cpp @ 2376:bcd7fadbf7d2

Слияние
author Ritor1
date Mon, 12 May 2014 12:28:06 +0600
parents bddcaf5d5db2
children 802460e60eee
comparison
equal deleted inserted replaced
2375:14c05b876218 2376:bcd7fadbf7d2
199 return &pNPCStats->pAdditionalNPC[npcid - 5000]; 199 return &pNPCStats->pAdditionalNPC[npcid - 5000];
200 } 200 }
201 if ( sDialogue_SpeakingActorNPC_ID >= 0 ) 201 if ( sDialogue_SpeakingActorNPC_ID >= 0 )
202 { 202 {
203 *npc_indx = 0; 203 *npc_indx = 0;
204 result = NULL; 204 result = nullptr;
205 } 205 }
206 else 206 else
207 { 207 {
208 v5 = abs(sDialogue_SpeakingActorNPC_ID) - 1; 208 v5 = abs(sDialogue_SpeakingActorNPC_ID) - 1;
209 v6 = 0; 209 v6 = 0;
247 bool break_loop; 247 bool break_loop;
248 unsigned int temp_str_len; 248 unsigned int temp_str_len;
249 char* tmp_pos; 249 char* tmp_pos;
250 int decode_step; 250 int decode_step;
251 251
252 if (pNPCTextTXT_Raw) 252 free(pNPCTextTXT_Raw);
253 free(pNPCTextTXT_Raw);
254 pNPCTextTXT_Raw =NULL;
255 pNPCTextTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0); 253 pNPCTextTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0);
256 strtok(pNPCTextTXT_Raw, "\r"); 254 strtok(pNPCTextTXT_Raw, "\r");
257 255
258 for (i=0; i<789; ++i) 256 for (i=0; i<789; ++i)
259 { 257 {
285 ++decode_step; 283 ++decode_step;
286 test_string=tmp_pos+1; 284 test_string=tmp_pos+1;
287 } while ((decode_step<2)&&!break_loop); 285 } while ((decode_step<2)&&!break_loop);
288 } 286 }
289 287
290 if (pNPCTopicTXT_Raw) 288 free(pNPCTopicTXT_Raw);
291 free(pNPCTopicTXT_Raw);
292 pNPCTopicTXT_Raw =NULL;
293 pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0); 289 pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0);
294 strtok(pNPCTopicTXT_Raw, "\r"); 290 strtok(pNPCTopicTXT_Raw, "\r");
295 291
296 for ( i = 1; i <= 579; ++i )//NPC topics count limit 292 for ( i = 1; i <= 579; ++i )//NPC topics count limit
297 { 293 {
323 ++decode_step; 319 ++decode_step;
324 test_string=tmp_pos+1; 320 test_string=tmp_pos+1;
325 } while ((decode_step<2)&&!break_loop); 321 } while ((decode_step<2)&&!break_loop);
326 } 322 }
327 323
328 if (pNPCDistTXT_Raw) 324 free(pNPCDistTXT_Raw);
329 free(pNPCDistTXT_Raw);
330 pNPCDistTXT_Raw = NULL;
331 pNPCDistTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdist.txt", 0); 325 pNPCDistTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdist.txt", 0);
332 strtok(pNPCDistTXT_Raw, "\r"); 326 strtok(pNPCDistTXT_Raw, "\r");
333 strtok(NULL, "\r"); 327 strtok(NULL, "\r");
334 328
335 for (i=1; i<59; ++i) 329 for (i=1; i<59; ++i)
379 } 373 }
380 pProfessionChance[i].professionChancePerArea[0]=0; 374 pProfessionChance[i].professionChancePerArea[0]=0;
381 pProfessionChance[i].professionChancePerArea[59]=0; 375 pProfessionChance[i].professionChancePerArea[59]=0;
382 } 376 }
383 377
384 if (pNPCDistTXT_Raw) 378 free(pNPCDistTXT_Raw);
385 { 379 pNPCDistTXT_Raw = nullptr;
386 free(pNPCDistTXT_Raw);
387 pNPCDistTXT_Raw = NULL;
388 }
389 } 380 }
390 381
391 //----- (00476C60) -------------------------------------------------------- 382 //----- (00476C60) --------------------------------------------------------
392 void NPCStats::_476C60() 383 void NPCStats::_476C60()
393 { 384 {
602 InitializeAwards(); 593 InitializeAwards();
603 InitializeTransitions(); 594 InitializeTransitions();
604 InitializeMerchants(); 595 InitializeMerchants();
605 InitializeScrolls(); 596 InitializeScrolls();
606 597
607 pNPCNamesTXT_Raw = NULL;
608 pNPCNamesTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcnames.txt", 0); 598 pNPCNamesTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcnames.txt", 0);
609 strtok(pNPCNamesTXT_Raw, "\r"); 599 strtok(pNPCNamesTXT_Raw, "\r");
610 600
611 uNewlNPCBufPos = 0; 601 uNewlNPCBufPos = 0;
612 602
653 test_string=tmp_pos+1; 643 test_string=tmp_pos+1;
654 } while ((decode_step<2)&&!break_loop); 644 } while ((decode_step<2)&&!break_loop);
655 } 645 }
656 uNumNPCNames[0] = i; 646 uNumNPCNames[0] = i;
657 647
658 pNPCProfTXT_Raw = NULL;
659 pNPCProfTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcprof.txt", 0); 648 pNPCProfTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcprof.txt", 0);
660 strtok(pNPCProfTXT_Raw, "\r"); 649 strtok(pNPCProfTXT_Raw, "\r");
661 strtok(NULL, "\r"); 650 strtok(NULL, "\r");
662 strtok(NULL, "\r"); 651 strtok(NULL, "\r");
663 strtok(NULL, "\r"); 652 strtok(NULL, "\r");
717 706
718 //----- (00477266) -------------------------------------------------------- 707 //----- (00477266) --------------------------------------------------------
719 void NPCStats::Release() 708 void NPCStats::Release()
720 { 709 {
721 free(pNPCTopicTXT_Raw); 710 free(pNPCTopicTXT_Raw);
722 pNPCTopicTXT_Raw = NULL; 711 pNPCTopicTXT_Raw = nullptr;
723 free(pNPCTextTXT_Raw); 712 free(pNPCTextTXT_Raw);
724 pNPCTextTXT_Raw = NULL; 713 pNPCTextTXT_Raw = nullptr;
725 free(pNPCNewsTXT_Raw); 714 free(pNPCNewsTXT_Raw);
726 pNPCNewsTXT_Raw = NULL; 715 pNPCNewsTXT_Raw = nullptr;
727 free(pNPCProfTXT_Raw); 716 free(pNPCProfTXT_Raw);
728 pNPCProfTXT_Raw = NULL; 717 pNPCProfTXT_Raw = nullptr;
729 free(pNPCNamesTXT_Raw); 718 free(pNPCNamesTXT_Raw);
730 pNPCNamesTXT_Raw = NULL; 719 pNPCNamesTXT_Raw = nullptr;
731 free(pNPCDataTXT_Raw); 720 free(pNPCDataTXT_Raw);
732 pNPCDataTXT_Raw = NULL; 721 pNPCDataTXT_Raw = nullptr;
733 free(pNPCDistTXT_Raw); 722 free(pNPCDistTXT_Raw);
734 pNPCDistTXT_Raw = NULL; 723 pNPCDistTXT_Raw = nullptr;
735 free(pNPCGreetTXT_Raw); 724 free(pNPCGreetTXT_Raw);
736 pNPCGreetTXT_Raw = NULL; 725 pNPCGreetTXT_Raw = nullptr;
737 free(pNCPGroupTXT_Raw); 726 free(pNCPGroupTXT_Raw);
738 pNCPGroupTXT_Raw = NULL; 727 pNCPGroupTXT_Raw = nullptr;
739 } 728 }
740 729
741 //----- (0047730C) -------------------------------------------------------- 730 //----- (0047730C) --------------------------------------------------------
742 bool CheckPortretAgainstSex(int a1, int) 731 bool CheckPortretAgainstSex(int a1, int)
743 { 732 {
971 bool break_loop; 960 bool break_loop;
972 unsigned int temp_str_len; 961 unsigned int temp_str_len;
973 char* tmp_pos; 962 char* tmp_pos;
974 int decode_step; 963 int decode_step;
975 964
976 if ( pAwardsTXT_Raw ) 965 free(pAwardsTXT_Raw);
977 free(pAwardsTXT_Raw);
978 pAwardsTXT_Raw = NULL;
979 pAwardsTXT_Raw = (char *)pEvents_LOD->LoadRaw("awards.txt", 0); 966 pAwardsTXT_Raw = (char *)pEvents_LOD->LoadRaw("awards.txt", 0);
980 strtok(pAwardsTXT_Raw, "\r"); 967 strtok(pAwardsTXT_Raw, "\r");
981 968
982 for (i=1; i<105; ++i) 969 for (i=1; i<105; ++i)
983 { 970 {
1025 bool break_loop; 1012 bool break_loop;
1026 unsigned int temp_str_len; 1013 unsigned int temp_str_len;
1027 char* tmp_pos; 1014 char* tmp_pos;
1028 int decode_step; 1015 int decode_step;
1029 1016
1030 if ( pScrollsTXT_Raw ) 1017 free(pScrollsTXT_Raw);
1031 free(pScrollsTXT_Raw);
1032 pScrollsTXT_Raw = NULL;
1033 pScrollsTXT_Raw = (char *)pEvents_LOD->LoadRaw("scroll.txt", 0); 1018 pScrollsTXT_Raw = (char *)pEvents_LOD->LoadRaw("scroll.txt", 0);
1034 strtok(pScrollsTXT_Raw, "\r"); 1019 strtok(pScrollsTXT_Raw, "\r");
1035 for (i=0; i<82; ++i) 1020 for (i=0; i<82; ++i)
1036 { 1021 {
1037 test_string = strtok(NULL, "\r") + 1; 1022 test_string = strtok(NULL, "\r") + 1;
1074 bool break_loop; 1059 bool break_loop;
1075 unsigned int temp_str_len; 1060 unsigned int temp_str_len;
1076 char* tmp_pos; 1061 char* tmp_pos;
1077 int decode_step; 1062 int decode_step;
1078 1063
1079 if ( pMerchantsTXT_Raw ) 1064 free(pMerchantsTXT_Raw);
1080 free(pMerchantsTXT_Raw);
1081 pMerchantsTXT_Raw = NULL;
1082 pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadRaw("merchant.txt", 0); 1065 pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadRaw("merchant.txt", 0);
1083 strtok(pMerchantsTXT_Raw, "\r"); 1066 strtok(pMerchantsTXT_Raw, "\r");
1084 1067
1085 for (i=0; i<7; ++i) 1068 for (i=0; i<7; ++i)
1086 { 1069 {
1138 bool break_loop; 1121 bool break_loop;
1139 unsigned int temp_str_len; 1122 unsigned int temp_str_len;
1140 char* tmp_pos; 1123 char* tmp_pos;
1141 int decode_step; 1124 int decode_step;
1142 1125
1143 if ( pTransitionsTXT_Raw ) 1126 free(pTransitionsTXT_Raw);
1144 free(pTransitionsTXT_Raw);
1145 pTransitionsTXT_Raw = NULL;
1146 pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("trans.txt", 0); 1127 pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("trans.txt", 0);
1147 strtok(pTransitionsTXT_Raw, "\r"); 1128 strtok(pTransitionsTXT_Raw, "\r");
1148 1129
1149 for (i=0; i<464; ++i) 1130 for (i=0; i<464; ++i)
1150 { 1131 {
1188 bool break_loop; 1169 bool break_loop;
1189 unsigned int temp_str_len; 1170 unsigned int temp_str_len;
1190 char* tmp_pos; 1171 char* tmp_pos;
1191 int decode_step; 1172 int decode_step;
1192 1173
1193 if ( pAutonoteTXT_Raw ) 1174 free(pAutonoteTXT_Raw);
1194 free(pAutonoteTXT_Raw);
1195 pAutonoteTXT_Raw = 0;
1196 pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0); 1175 pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0);
1197 strtok(pAutonoteTXT_Raw, "\r"); 1176 strtok(pAutonoteTXT_Raw, "\r");
1198 1177
1199 for (i=0; i<195; ++i) 1178 for (i=0; i<195; ++i)
1200 { 1179 {
1273 bool break_loop; 1252 bool break_loop;
1274 unsigned int temp_str_len; 1253 unsigned int temp_str_len;
1275 char* tmp_pos; 1254 char* tmp_pos;
1276 int decode_step; 1255 int decode_step;
1277 1256
1278 if ( pQuestsTXT_Raw ) 1257 free(pQuestsTXT_Raw);
1279 free(pQuestsTXT_Raw);
1280 pQuestsTXT_Raw = NULL;
1281 pQuestsTXT_Raw = (char *)pEvents_LOD->LoadRaw("quests.txt", 0); 1258 pQuestsTXT_Raw = (char *)pEvents_LOD->LoadRaw("quests.txt", 0);
1282 strtok(pQuestsTXT_Raw, "\r"); 1259 strtok(pQuestsTXT_Raw, "\r");
1283 memset(pQuestTable.data(),0, sizeof(pQuestTable)); 1260 memset(pQuestTable.data(),0, sizeof(pQuestTable));
1284 for (i=0; i<512; ++i) 1261 for (i=0; i<512; ++i)
1285 { 1262 {
1401 else 1378 else
1402 { 1379 {
1403 current_npc_text = 0; 1380 current_npc_text = 0;
1404 activeLevelDecoration = (LevelDecoration*)1; 1381 activeLevelDecoration = (LevelDecoration*)1;
1405 EventProcessor(pEventNumber, 0, 1); 1382 EventProcessor(pEventNumber, 0, 1);
1406 activeLevelDecoration = NULL; 1383 activeLevelDecoration = nullptr;
1407 } 1384 }
1408 } 1385 }
1409 } 1386 }
1410 else 1387 else
1411 { 1388 {