Skip to content

Commit

Permalink
editor: fixed compilation, but crashes on start up
Browse files Browse the repository at this point in the history
boost::scoped_ptr<ParserData> data; in EditorParser would halt compilation because it is non-copyable
  • Loading branch information
JanSimek committed Feb 5, 2014
1 parent f7f01de commit dac4bd2
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 27 deletions.
12 changes: 6 additions & 6 deletions editor/explosion_scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ namespace frozenbyte {

void reload()
{
Parser sParser(true, false);
Parser pParser(true, false);
Parser eParser(true, false);
Parser soParser(true, false);
Parser mParser(true, false);
Parser aParser(true, false);
EditorParser sParser(true, false);
EditorParser pParser(true, false);
EditorParser eParser(true, false);
EditorParser soParser(true, false);
EditorParser mParser(true, false);
EditorParser aParser(true, false);
//ifstream("Editor/ExplosionScripts.fbt") >> sParser;
//ifstream("Editor/ExplosionProjectiles.fbt") >> pParser;
//ifstream("Editor/ExplosionEffects.fbt") >> eParser;
Expand Down
6 changes: 3 additions & 3 deletions editor/exporter_scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include "../filesystem/output_file_stream.h"
#include <map>

#ifdef _MSC_EXTENSIONS
# define for if (false) { } else { for
#endif
//#ifdef _MSC_EXTENSIONS

This comment has been minimized.

Copy link
@vayerx

vayerx Feb 5, 2014

OMG! Lets delete this 'code' forever!

//# define for if (false) { } else { for
//#endif

namespace frozenbyte {
namespace editor {
Expand Down
4 changes: 2 additions & 2 deletions editor/group_list.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace frozenbyte {

void load(const string &name)
{
Parser parser(true, false);
EditorParser parser(true, false);
//ifstream(name.c_str()) >> parser;
filesystem::FilePackageManager::getInstance().getFile(name) >> parser;

Expand Down Expand Up @@ -276,7 +276,7 @@ namespace frozenbyte {

void GroupList::addObjectGroup(const string &group, const string &subgroup, const ObjectGroup &objectGroup)
{
Parser parser(true, false);
EditorParser parser(true, false);
ParserGroup &root = parser.getGlobals();
root.setValue("group", group);
root.setValue("subgroup", subgroup);
Expand Down
6 changes: 4 additions & 2 deletions editor/object_mode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
#include "icommand.h"
#include "command_list.h"
#include "common_dialog.h"
#include "istream.h"
#include "ostream.h"

//#include "istream.h"
//#include "ostream.h"

#include "object_settings.h"
#include "ieditor_state.h"
#include "color_picker.h"
Expand Down
2 changes: 1 addition & 1 deletion editor/object_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace frozenbyte {
typedef std::map<std::string, std::string> ValueMap;
ValueMap defaultValues;

Parser parser;
EditorParser parser;
Storm &storm;

ObjectSettingsData(Storm &storm_)
Expand Down
6 changes: 3 additions & 3 deletions editor/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,13 +316,13 @@ namespace frozenbyte {

ParserGroup::ParserGroup()
{
boost::scoped_ptr<ParserGroupData> tempData( new ParserGroupData() );
/*boost::scoped_ptr*/ boost::shared_ptr<ParserGroupData> tempData( new ParserGroupData() );
data.swap(tempData);
}

ParserGroup::ParserGroup(const ParserGroup &rhs)
{
boost::scoped_ptr<ParserGroupData> tempData( new ParserGroupData() );
/*boost::scoped_ptr*/ boost::shared_ptr<ParserGroupData> tempData( new ParserGroupData() );
tempData->copy( *rhs.data.get() );

data.swap(tempData);
Expand Down Expand Up @@ -541,7 +541,7 @@ namespace frozenbyte {

EditorParser::EditorParser(bool logUnreferenced, bool logNonExisting)
{
boost::scoped_ptr<ParserData> tempData( new ParserData() );
/*boost::scoped_ptr*/ boost::shared_ptr<ParserData> tempData( new ParserData() );
data.swap(tempData);
data->logUnreferenced = logUnreferenced;
data->logNonExisting = logNonExisting;
Expand Down
8 changes: 6 additions & 2 deletions editor/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
#ifndef INCLUDED_EDITOR_EDITOR_PARSER
#define INCLUDED_EDITOR_EDITOR_PARSER

#ifndef INCLUDED_BOOST_SHARED_PTR_HPP

This comment has been minimized.

Copy link
@vayerx

vayerx Feb 5, 2014

Looks a little bit excessive

This comment has been minimized.

Copy link
@JanSimek

JanSimek Feb 5, 2014

Author Owner

I thought so too

This comment has been minimized.

Copy link
@JanSimek

JanSimek Feb 5, 2014

Author Owner

Removed in a4a8866

(tested OS X compilation, still have to test on Windows)

# define INCLUDED_BOOST_SHARED_PTR_HPP
# include <boost/shared_ptr.hpp>
#endif
#ifndef INCLUDED_BOOST_SCOPED_PTR_HPP
# define INCLUDED_BOOST_SCOPED_PTR_HPP
# include <boost/scoped_ptr.hpp>
Expand All @@ -27,7 +31,7 @@ namespace frozenbyte {
struct ParserData;

class ParserGroup {
boost::scoped_ptr<ParserGroupData> data;
/*boost::scoped_ptr*/ boost::shared_ptr<ParserGroupData> data;

public:
ParserGroup();
Expand Down Expand Up @@ -74,7 +78,7 @@ namespace frozenbyte {
}

class EditorParser {
boost::scoped_ptr<ParserData> data;
/*boost::scoped_ptr*/ boost::shared_ptr<ParserData> data;

public:
// the new error whine to get rid of the f*ed up "silently ignore errors" feature. --jpk
Expand Down
2 changes: 1 addition & 1 deletion editor/physics_mass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace frozenbyte {

void parseData()
{
Parser parser;
EditorParser parser;
filesystem::FilePackageManager::getInstance().getFile(fileName) >> parser;

const ParserGroup &globals = parser.getGlobals();
Expand Down
2 changes: 1 addition & 1 deletion editor/storm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace frozenbyte {
float ts = .7f;
storm->addAdditionalRenderTargets(VC2(ts, ts), 1);
*/
if ( !storm->SetWindowedMode(hwnd, disableBuffers) ) {
if ( !storm->SetWindowedMode(hwnd) { //, disableBuffers) ) {

This comment has been minimized.

Copy link
@vayerx

vayerx Feb 5, 2014

closing parenthesis seems to be missing

This comment has been minimized.

Copy link
@JanSimek

JanSimek Feb 5, 2014

Author Owner

Yes, copy & paste error 👎

std::string error = storm->GetErrorString();
MessageBox(hwnd, error.c_str(), "Failed to initialize storm.", MB_OK);

Expand Down
12 changes: 6 additions & 6 deletions editor/unit_scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,17 @@ namespace frozenbyte {
std::vector<ScriptConfig> scriptConfigs;
std::map<std::string, std::vector<Script> > scripts;

void parseUnits(const Parser &parser)
void parseUnits(const EditorParser &parser)
{
parseBlocks(parser.getGlobals(), units, "Unit");
}

void parseConfigs(const Parser &parser)
void parseConfigs(const EditorParser &parser)
{
parseBlocks(parser.getGlobals(), scriptConfigs, "Config");
}

void parseScripts(const Parser &parser)
void parseScripts(const EditorParser &parser)
{
const ParserGroup &parserGroup = parser.getGlobals();

Expand All @@ -277,9 +277,9 @@ namespace frozenbyte {
scripts.clear();
scriptConfigs.clear();

Parser unitParser(true, false);
Parser configParser(true, false);
Parser scriptParser(true, false);
EditorParser unitParser(true, false);
EditorParser configParser(true, false);
EditorParser scriptParser(true, false);

//std::ifstream(unitName) >> unitParser;
//std::ifstream(configName) >> configParser;
Expand Down

0 comments on commit dac4bd2

Please sign in to comment.