From: <ave...@us...> - 2003-11-29 22:08:14
|
Update of /cvsroot/gemrb/gemrb/gemrb/plugins/GUIScript In directory sc8-pr-cvs1:/tmp/cvs-serv11002 Modified Files: GUIScript.cpp Log Message: Fix: check whether we can load an area before trying to use it Index: GUIScript.cpp =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/plugins/GUIScript/GUIScript.cpp,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** GUIScript.cpp 28 Nov 2003 17:28:47 -0000 1.74 --- GUIScript.cpp 29 Nov 2003 22:08:11 -0000 1.75 *************** *** 82,86 **** DataStream * str = core->GetResourceMgr()->GetResource(StartArea, IE_ARE_CLASS_ID); MapMgr * am = (MapMgr*)core->GetInterface(IE_ARE_CLASS_ID); ! am->Open(str, true); Map * map = am->GetMap(); int areaindex = core->GetGame()->AddMap(map); --- 82,92 ---- DataStream * str = core->GetResourceMgr()->GetResource(StartArea, IE_ARE_CLASS_ID); MapMgr * am = (MapMgr*)core->GetInterface(IE_ARE_CLASS_ID); ! if(!am) { ! return NULL; ! } ! if(am->Open(str, true)) { ! printMessage("GUIScript", "Can't load area.\n", LIGHT_RED); ! return NULL; ! } Map * map = am->GetMap(); int areaindex = core->GetGame()->AddMap(map); *************** *** 1630,1635 **** MyActor->SetPortrait(poi); } - char resref[9]; - memset(resref,0,sizeof(resref)); int mastertable=core->LoadTable("avprefix"); TableMgr * mtm = core->GetTable(mastertable); --- 1636,1639 ---- *************** *** 1639,1650 **** return NULL; } ! for(int i=0;i<count;i++) { - poi=mtm->QueryField(i,1); - if(poi[0]!='*') - { - strncat(resref,poi,8); - continue; - } poi = mtm->QueryField(i); printf("Part table: %s\n",poi); --- 1643,1651 ---- return NULL; } ! poi=mtm->QueryField(0); ! int AnimID=strtoul(poi,NULL,0); ! printf("Avatar animation base: 0x%0x",AnimID); ! for(int i=1;i<count;i++) { poi = mtm->QueryField(i); printf("Part table: %s\n",poi); *************** *** 1659,1685 **** poi = tm->QueryField(StatID); printf("Part: %s\n",poi); ! strncat(resref,poi,8); core->DelTable(table); } - printf("Resref: %s\n",resref); - core->DelTable(mastertable); - mastertable = core->LoadTable("avatars"); - printf("Got avatars\n"); - mtm = core->GetTable(mastertable); - count = mtm->GetRowCount(); - for(int i = 0; i < count; i++) { - char * ret = mtm->QueryField(i); - if(strnicmp(ret,resref,8) ) continue; - printf("Found avatar\n"); - poi = mtm->GetRowName(i); - printf("Rowname: %s\n",poi); - //MyActor->BaseStats[IE_LEATHER_COLOR] = 0x1D; - //MyActor->BaseStats[IE_ARMOR_COLOR] = 0x4D; - //MyActor->BaseStats[IE_METAL_COLOR] = 0x4E; - MyActor->SetAnimationID(strtoul(poi,NULL,0) ); - printf("Set animation complete\n"); - break; - } core->DelTable(mastertable); MyActor->Init(); int saindex = core->LoadTable("STARTARE"); --- 1660,1669 ---- poi = tm->QueryField(StatID); printf("Part: %s\n",poi); ! AnimID+=strtoul(poi,NULL,0); core->DelTable(table); } core->DelTable(mastertable); + printf("Set animation complete: 0x%0x\n",AnimID); + MyActor->SetAnimationID(AnimID); MyActor->Init(); int saindex = core->LoadTable("STARTARE"); |