QTfrontend/frameTeam.cpp
author unc0rr
Tue, 11 Jul 2006 21:04:05 +0000
changeset 75 d2b737858ff7
parent 63 27e2b5bb6d4b
child 80 3c3dc6a148ca
permissions -rw-r--r--
- New First Aid powerup - New power progressbar - Less powerful Desert Eagle - Bots can use Desert Eagle - Set TurnTimeLeft to 0 when hh damaged - Bots can handle situation when ammo is over - Bots can go in different directions to reach good position, not just only go left or right - Small fixes for FillLand (use all the array) - Fixes for world geometry, get rid of one variable - Added missed in previous commit files - New test map

#include "frameTeam.h"
#include "teamselhelper.h"

#include <QResizeEvent>
#include <QCoreApplication>

#include <iostream>
using namespace std;

FrameTeams::FrameTeams(QWidget* parent) :
  QWidget(parent), mainLayout(this)
{
}

void FrameTeams::addTeam(tmprop team)
{
  TeamShowWidget* pTeamShowWidget =new TeamShowWidget(team, this);
  int hght=teamToWidget.empty() ? 0 : teamToWidget.begin()->second->size().height();
  teamToWidget.insert(make_pair(team, pTeamShowWidget));
  mainLayout.addWidget(pTeamShowWidget);
  QResizeEvent* pevent=new QResizeEvent(parentWidget()->size(), parentWidget()->size());
  QCoreApplication::postEvent(parentWidget(), pevent);
}

void FrameTeams::removeTeam(tmprop team)
{
  tmapTeamToWidget::iterator it=teamToWidget.find(team);
  mainLayout.removeWidget(it->second);
  delete it->second;
  teamToWidget.erase(team);
}

QWidget* FrameTeams::getTeamWidget(tmprop team)
{
  tmapTeamToWidget::iterator it=teamToWidget.find(team);
  QWidget* ret = it!=teamToWidget.end() ? it->second : 0;
  if(!ret) throw; // FIXME: this is debug exception
  return ret;
}