1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-09-15 15:02:34 +02:00

initialize some variables in constructor

This commit is contained in:
Aldoxtor 2017-04-16 07:57:08 +02:00 committed by Daniel Evans
parent 4fdf3a2280
commit 81734ae2fe
3 changed files with 10 additions and 3 deletions

View File

@ -31,7 +31,8 @@ std::map<GameRenderer::SpecialModel, std::string> kSpecialModels = {
RWGame::RWGame(Logger& log, int argc, char* argv[])
: GameBase(log, argc, argv)
, data(&log, config.getGameDataPath())
, renderer(&log, &data) {
, renderer(&log, &data)
, lastDraws(0) {
bool newgame = options.count("newgame");
bool test = options.count("test");
std::string startSave(

View File

@ -4,7 +4,7 @@
#include "RWGame.hpp"
BenchmarkState::BenchmarkState(RWGame* game, const std::string& benchfile)
: State(game), benchfile(benchfile), benchmarkTime(0.f), frameCounter(0) {
: State(game), benchfile(benchfile), benchmarkTime(0.f), duration(0.f), frameCounter(0) {
}
void BenchmarkState::enter() {

View File

@ -16,6 +16,7 @@
ViewerWidget::ViewerWidget(QGLFormat g, QWidget* parent,
const QGLWidget* shareWidget, Qt::WindowFlags f)
: QGLWidget(g, parent, shareWidget, f)
, renderer(nullptr)
, gworld(nullptr)
, activeModel(nullptr)
, selectedFrame(nullptr)
@ -76,6 +77,7 @@ void ViewerWidget::paintGL() {
if (world() == nullptr) return;
RW_CHECK(renderer != nullptr, "GameRenderer is null");
auto& r = *renderer;
r.setViewport(width(), height());
@ -163,7 +165,11 @@ void ViewerWidget::drawFrameWidget(ModelFrame* f, const glm::mat4& m) {
glLineWidth(1.f);
}
dp.textures = {whiteTex};
renderer->getRenderer()->drawArrays(thisM, _frameWidgetDraw, dp);
RW_CHECK(renderer != nullptr, "GameRenderer is null");
if(renderer != nullptr) {
renderer->getRenderer()->drawArrays(thisM, _frameWidgetDraw, dp);
}
for (auto c : f->getChildren()) {
drawFrameWidget(c.get(), thisM);