~joerg-ehrichs/botrace/master

« back to all changes in this revision

Viewing changes to src/editor/boardscenarioscene.cpp

  • Committer: Jörg Ehrichs
  • Date: 2012-07-22 19:58:16 UTC
  • Revision ID: git-v1:2f4f14cc49bf6e8aed5cc0399f6fe606201784f8
inital start to add king of the flag/hill game modes

Show diffs side-by-side

added added

removed removed

Lines of Context:
101
101
        item->setData(TILE_DATA, sp.number);
102
102
    }
103
103
 
 
104
    foreach(const Core::SpecialPoint_T &sp, scenario.startingPointsCTF) {
 
105
        SpecialGraphicsItem * item = addOrMoveItem( (Core::SpecialTileType) ((int)(Core::SPECIAL_FLAG_RED) + sp.number), toScenePos( sp.position ), true );
 
106
 
 
107
        m_tmpStartDMCounter++;
 
108
        item->setData(TILE_DATA, sp.number);
 
109
    }
 
110
 
104
111
    if( !scenario.virtualStartingPoint.isNull() ) {
105
112
        addOrMoveItem( Core::SPECIAL_START_VIRTUAL_RALLY, toScenePos( scenario.virtualStartingPoint ), true );
106
113
    }
 
114
 
 
115
    if( !scenario.kingOfTheFlagPoint.isNull() ) {
 
116
        addOrMoveItem( Core::SPECIAL_FLAG_KING, toScenePos( scenario.kingOfTheFlagPoint ), true );
 
117
    }
107
118
}
108
119
 
109
120
Core::BoardScenario_T BoardScenarioScene::saveScenario()
170
181
                scenario.startingPoints.append(sp);
171
182
                break;
172
183
            }
 
184
            case Core::SPECIAL_FLAG_GOLD:
 
185
            case Core::SPECIAL_FLAG_RED:
 
186
            case Core::SPECIAL_FLAG_BLUE:
 
187
            case Core::SPECIAL_FLAG_GREEN:
 
188
            {
 
189
                Core::SpecialPoint_T sp;
 
190
                sp.number = ((int)Core::SPECIAL_FLAG_RED) - ((int)specialItem);
 
191
                sp.position = toBoardPos(gi->scenePos() - boardSceneRect.topLeft());
 
192
                sp.position.rx()++;
 
193
                sp.position.ry()++;
 
194
                scenario.startingPointsCTF.append(sp);
 
195
                break;
 
196
            }
 
197
            case Core::SPECIAL_FLAG_KING:
 
198
            {
 
199
                QPoint pos = toBoardPos(gi->scenePos() - boardSceneRect.topLeft());
 
200
                pos.rx()++;
 
201
                pos.ry()++;
 
202
                scenario.kingOfTheFlagPoint = pos;
 
203
                break;
 
204
            }
173
205
            case Core::SPECIAL_START_VIRTUAL_RALLY:
174
206
                scenario.virtualStartingPoint = toBoardPos(gi->scenePos() - boardSceneRect.topLeft());
175
207
                scenario.virtualStartingPoint.rx()++;
345
377
    case Core::SPECIAL_FLAG_6:
346
378
    case Core::SPECIAL_FLAG_7:
347
379
    case Core::SPECIAL_FLAG_8:
 
380
    case Core::SPECIAL_FLAG_RED:
 
381
    case Core::SPECIAL_FLAG_BLUE:
 
382
    case Core::SPECIAL_FLAG_GREEN:
 
383
    case Core::SPECIAL_FLAG_GOLD:
 
384
    case Core::SPECIAL_FLAG_KING:
348
385
    case Core::SPECIAL_START_VIRTUAL_RALLY:
349
386
    {
350
387
        addOrMoveItem(m_selectedTileToAdd, toGridScenePos(event->scenePos()) );