Commit 97e60ebb authored by Victor Yacovlev's avatar Victor Yacovlev

Merge branch 'master' of ssh://git.lpm.org.ru:7999/niisi/kumir2

parents 1f190d1b 33a5dff0
......@@ -31,7 +31,7 @@ namespace ActorRobot {
QWidget * pult_;
};
ExtensionSystem::SettingsPtr RobotModule::robotSettings()
{
......@@ -3440,6 +3440,42 @@ namespace ActorRobot {
// qreal adjust = 0.5;
return QRectF(0,0,FIELD_SIZE_SMALL/4,FIELD_SIZE_SMALL/4);
};
//++++++++++Console Field
CFieldItem::CFieldItem()
{
IsColored=false;
radiation=0;
temperature=0;
upChar=QChar(' ');
downChar=QChar(' ');
mark=false;
upWall=false;
downWall=false;
rightWall=false;
leftWall=false;
}
ConsoleField::ConsoleField(int r,int c)
{
for(int row=0;row<r;row++)
{
QList<CFieldItem*> curRow;
for(int col=0;col<c;col++)
{
CFieldItem* cItem;
if(row==0)cItem->upWall==true;
if(row==r-1)cItem->downWall==true;
if(col==0)cItem->leftWall==true;
if(col==c-1)cItem->rightWall==true;
curRow.append(cItem);
}
rows.append(curRow);
}
roboRow=0;
roboCol=0;
};
//+++++++Simple Robot
SimpleRobot::SimpleRobot(QGraphicsItem *parent )
{
......@@ -3669,7 +3705,11 @@ void RobotModule::reset()
*/
//delete field;
qDebug()<<"Reset!!";
if(!DISPLAY)//console mode
{
qDebug()<<"Reset::console mode";
return;
}
field->destroyRobot();
field->deleteLater();
......@@ -3778,6 +3818,7 @@ QString RobotModule::initialize(const QStringList &configurationParameters, cons
if(!pe.keys().indexOf("DISPLAY")>0 ||pe.value("DISPLAY").isEmpty() ) //NO DISPLAY
{
qDebug()<<"Robot:Console mode";
curConsoleField=new ConsoleField(10,15);
DISPLAY=false;
return "";
}
......@@ -3857,11 +3898,11 @@ void RobotModule::runGoDown()
void RobotModule::runGoLeft()
{
/* TODO implement me */
qDebug() << "Robot left";
if(!DISPLAY)
{
{qDebug() << "Robot left:impement me!";
return;
}
......
......@@ -70,7 +70,36 @@ namespace ActorRobot {
class EditLine;
class RobotModule;
class CFieldItem
{
public:
CFieldItem();
void setWalls(int wallByte);
bool IsColored;
float radiation;
float temperature;
QChar upChar;
QChar downChar;
bool mark;
bool upWall;
bool downWall;
bool rightWall;
bool leftWall;
};
class ConsoleField
{
public:
ConsoleField(int w,int h);
private:
QList<QList<CFieldItem*>> rows;
int roboRow;
int roboCol;
};
class SimpleRobot:
public QGraphicsObject
......@@ -563,6 +592,7 @@ namespace ActorRobot {
int CurCellSize;
bool DISPLAY;
ExtensionSystem::SettingsPtr curSettings;
ConsoleField* curConsoleField;
signals:
void sendToPultLog(const QVariant &);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment