Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kumir2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kumir
kumir2
Commits
97e60ebb
Commit
97e60ebb
authored
Aug 25, 2016
by
Victor Yacovlev
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://git.lpm.org.ru:7999/niisi/kumir2
parents
1f190d1b
33a5dff0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
5 deletions
+76
-5
src/actors/robot/robotmodule.cpp
src/actors/robot/robotmodule.cpp
+45
-4
src/actors/robot/robotmodule.h
src/actors/robot/robotmodule.h
+31
-1
No files found.
src/actors/robot/robotmodule.cpp
View file @
97e60ebb
...
...
@@ -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
;
}
...
...
src/actors/robot/robotmodule.h
View file @
97e60ebb
...
...
@@ -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
&
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment