From: Keith F. <ven...@us...> - 2003-02-05 06:18:11
|
Update of /cvsroot/planeshift/planeshift/src/client/gui In directory sc8-pr-cvs1:/tmp/cvs-serv11749 Modified Files: psdcjob.h psdcjob.cpp Log Message: Committing a patch by Matt Holmes (Kerion) to make skills required for a job display in the lower part of the Jobs window. Index: psdcjob.h =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/gui/psdcjob.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** psdcjob.h 21 Apr 2002 19:59:55 -0000 1.4 --- psdcjob.h 5 Feb 2003 06:18:08 -0000 1.5 *************** *** 48,51 **** --- 48,56 ---- int titleColour; + + csHashMap jobHash; + psText *infoText; + psText *skillsText; + psText *lastSelected; }; Index: psdcjob.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/client/gui/psdcjob.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** psdcjob.cpp 1 Feb 2003 15:10:25 -0000 1.12 --- psdcjob.cpp 5 Feb 2003 06:18:09 -0000 1.13 *************** *** 72,75 **** --- 72,77 ---- SetBackground(bg); + lastSelected = NULL; + float ratiox = (float)width / 640.0f; float ratioy = (float)height / 480.0f; *************** *** 96,100 **** titleColour = dmanager->GetG2D()->FindRGB(255,0,0); ! // Write Jobs psJobSet* set = dmanager->GetRPGInfo()->GetJobSet(); --- 98,113 ---- titleColour = dmanager->GetG2D()->FindRGB(255,0,0); ! // create the info text widget ! infoText = new psText(this, 1); ! infoText->Initialize(RX(48), RY(415), RX(540), RY(15)); ! infoText->SetText(""); ! AddComp(infoText); ! ! skillsText = new psText(this, 2); ! skillsText->Initialize(RX(48), RY(430), RX(540), RY(15)); ! skillsText->SetText(""); ! AddComp(skillsText); ! ! // Write Jobs psJobSet* set = dmanager->GetRPGInfo()->GetJobSet(); *************** *** 123,126 **** --- 136,141 ---- AddJob("Riders of Darkness", 430, 340, set->jobs ); + // create the info text + return true; } *************** *** 177,180 **** --- 192,198 ---- count++; drawY+=RY(10); + + // hash the text/button id against the job info + jobHash.Put(i + 10, jobs[i]); } } *************** *** 183,192 **** void psdcJob::Select(psDialog* dialog, int iID,void *) { ! int colourOn = dialog->GetDialogManager()->GetG2D()->FindRGB(0,0,255); ! int colourOff = dialog->GetDialogManager()->GetG2D()->FindRGB(255,255,255); - psText* text = (psText*)dialog->GetComp(iID); int color = text->GetFGColor(); --- 201,220 ---- void psdcJob::Select(psDialog* dialog, int iID,void *) { ! psdcJob *dlg = (psdcJob *)dialog; ! int colourOn = dialog->GetDialogManager()->GetG2D()->FindRGB(0,0,255); int colourOff = dialog->GetDialogManager()->GetG2D()->FindRGB(255,255,255); psText* text = (psText*)dialog->GetComp(iID); + + // Make sure they can only select one + if(!dlg->lastSelected) + dlg->lastSelected = text; + else + { + if(dlg->lastSelected->GetFGColor() == colourOn) + dlg->lastSelected->SetFGColor(colourOff); + + dlg->lastSelected = text; + } int color = text->GetFGColor(); *************** *** 195,198 **** --- 223,268 ---- else text->SetFGColor( colourOn ); + + int i = 0; + + dlg->infoText->SetText(""); + dlg->skillsText->SetText(""); + if(text->GetFGColor() == colourOn) + { + psJob *job = (psJob *)dlg->jobHash.Get(iID); + if(job) + { + dlg->infoText->SetText(job->info); + + printf("Skills: %d\n", job->skills.Length()); + csString skills = "Skills: "; + for(i = 0; i < job->skills.Length(); i++) + { + psJobSkill *skill = (psJobSkill *)job->skills[i]; + + csString value = " ("; + value += skill->value; + value += ")"; + + printf("Value: %s\n", value.GetData()); + printf("Skills: %s\n", skills.GetData()); + + if(skills == "Skills: ") + { + skills += skill->name; + skills += value; + } + else + { + skills += ", "; + skills += skill->name; + skills += value; + } + + printf("Skills: %s\n", skills.GetData()); + } + dlg->skillsText->SetText(skills); + } + } } |