#include "pgpanel_seltile.h" // STATICS int PG_Panel_SelTile::last_x = 0; int PG_Panel_SelTile::last_y = 0; // CONSTANTS static const int LABEL_SPACE = 6; // spacing between mission labels static const int LABEL_WIDTH = 12; // spacing between mission labels PG_Panel_SelTile::PG_Panel_SelTile(PG_Widget* parent, const PG_Rect &r) :PG_Widget(parent, r) { // selected tile box - NOTE: remember that if you change tile sets, this will change too! const int STOFFSET = (rm->GetTileSize()==64) ? 0 : 16; // we want a centered tile if it's 32, since we keep the space for 64 regardless of tile size tile = new PG_MapTile(this, PG_Rect(STOFFSET, STOFFSET, rm->GetTileSize(), rm->GetTileSize())); tile->EnableReceiver(false); // this is just a demo tile! coords_lab = new PG_Label(this, PG_Rect(64+LABEL_SPACE, (LABEL_WIDTH+LABEL_SPACE)*0, 200-64-LABEL_SPACE, LABEL_WIDTH), ""); roadq_lab = new PG_Label(this, PG_Rect(64+LABEL_SPACE, (LABEL_WIDTH+LABEL_SPACE)*1, 80, LABEL_WIDTH), "Road Quality:"); roadq_out = new PG_Label(this, PG_Rect(80+64+LABEL_SPACE, (LABEL_WIDTH+LABEL_SPACE)*1, r.w-64-80-LABEL_SPACE, LABEL_WIDTH), ""); roadq_out->LoadThemeStyle("Label", "MedLabel"); pod_lab = new PG_Label(this, PG_Rect(64+LABEL_SPACE, (LABEL_WIDTH+LABEL_SPACE)*2, r.w-64-LABEL_SPACE, LABEL_WIDTH), ""); cur_misn_lab = new PG_Label(this, PG_Rect(64+LABEL_SPACE, (LABEL_WIDTH+LABEL_SPACE)*3, r.w-64-LABEL_SPACE, LABEL_WIDTH), ""); Refresh(last_x,last_y); } PG_Panel_SelTile::~PG_Panel_SelTile() { ;; } void PG_Panel_SelTile::Refresh(int x, int y) { last_x = x; last_y = y; char b[4]; // char buffer for converting int to char char coordstr[16] = ""; strcat( coordstr,"Tile x"); strcat( coordstr, gcvt(x, 3, b) ); strcat( coordstr,", y"); strcat( coordstr, gcvt(y, 3, b) ); // draw tile & coords text if (tile != NULL) { coords_lab->SetText(coordstr); tile->SetCoordsAndDraw(x,y); } // set road quality roadq_out->SetText( gcvt(themap->GetRoadQ(x,y), 3, b) ); // get pod if any Pod* temp = themap->GetOccu(x,y); if (temp != NULL) { // set name pod_lab->SetText( temp->GetName().c_str() ); // set mission data cur_misn_lab->SetText( Mission::TranslateMission( temp->Misn(0)->GetType(), 1 ).c_str() ); } else { pod_lab->SetText(""); cur_misn_lab->SetText(""); } }