Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 0 additions & 77 deletions src/allocarray.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ int makeint(U8 low, S8 high)
return combined;
}

void read_file(std::istream&in,int infover,int grfcontversion,AllocArray<Sprite>&sprites);
void read_file(std::istream&in,int infover,int grfcontversion,std::vector<std::unique_ptr<Sprite>>&sprites);

nfe_map nfo_escapes;

Expand Down
4 changes: 2 additions & 2 deletions src/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

#include <stdio.h>
#include <string>
#include <memory>

#include "pcxsprit.h"
#include "pngsprit.h"
#include "sprites.h"
#include "nfosprite.h"
#include "allocarray.h"

class inforeader {
public:
Expand All @@ -32,7 +32,7 @@ class inforeader {

std::string imgname;
int *colourmap;
AllocArray<Sprite> nfofile;
std::vector<std::unique_ptr<Sprite>> nfofile;
private:
pcxread* MakeReader()const;
};
Expand Down
14 changes: 8 additions & 6 deletions src/readinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Version 7: Add backslash escapes
#include<sstream>
#include<iomanip>
#include<cstdio>
#include<memory>


// grfcodec requires boost::date_time for its processing of the \wYMD and
Expand All @@ -48,7 +49,6 @@ Version 7: Add backslash escapes
using namespace boost::gregorian;

#include"nfosprite.h"
#include"allocarray.h"
#include"inlines.h"

extern int _quiet;
Expand All @@ -65,14 +65,14 @@ const char *depths[DEPTHS] = { "8bpp", "32bpp", "mask" };
if(true){\
if(buffer!=""){\
checkspriteno();\
sprites.push_back(Pseudo(sprites.size(),infover,grfcontversion,buffer,claimed_size));\
sprites.push_back(std::make_unique<Pseudo>(sprites.size(),infover,grfcontversion,buffer,claimed_size));\
buffer="";\
}\
spriteno=temp;\
}else\
(void(0))

void read_file(std::istream&in,int infover,int grfcontversion,AllocArray<Sprite>&sprites){
void read_file(std::istream&in,int infover,int grfcontversion,std::vector<std::unique_ptr<Sprite>>&sprites){
std::string sprite,datapart,buffer;

int temp=-1,spriteno=-1,claimed_size=1;
Expand All @@ -95,7 +95,7 @@ void read_file(std::istream&in,int infover,int grfcontversion,AllocArray<Sprite>
getline(eat_white(spritestream.ignore()),datapart);
strip_trailing_white(datapart);
checkspriteno();
sprites.push_back(Include(datapart));
sprites.push_back(std::make_unique<Include>(datapart));
}else{
flush_buffer();
eat_white(spritestream>>claimed_size);
Expand All @@ -115,13 +115,15 @@ void read_file(std::istream&in,int infover,int grfcontversion,AllocArray<Sprite>
flush_buffer();
checkspriteno();
if (peeked!='|') {
sprites.push_back(Real());
sprites.push_back(std::make_unique<Real>());
} else {
do {
datapart.erase(0, 1);
} while (isspace(datapart[0]));
}
((Real*)sprites.last())->AddSprite(sprites.size()-1,infover,datapart);
Real *r = dynamic_cast<Real *>(sprites.back().get());
if (r == nullptr) throw Sprite::unparseable("internal error, expected Real sprite", sprites.size() - 1);
r->AddSprite(sprites.size()-1,infover,datapart);
}
}
}
Expand Down