author | ecalot
<ecalot> 2006-05-27 11:37:51 UTC |
committer | ecalot
<ecalot> 2006-05-27 11:37:51 UTC |
parent | 706eb61c5e423b9f1ae6440be55ea3c62a218454 |
PV4/Makefile | +141 | -0 |
PV4/include/level.h | +2 | -2 |
PV4/include/levelformat.h | +1 | -2 |
PV4/include/tile.h | +1 | -0 |
PV4/src/level.cpp | +22 | -21 |
PV4/src/tile.cpp | +6 | -0 |
diff --git a/PV4/Makefile b/PV4/Makefile new file mode 100644 index 0000000..8c166e0 --- /dev/null +++ b/PV4/Makefile @@ -0,0 +1,141 @@ +############ +# Programs # +############ + +CC = @g++ +LINKER = @ld +INFO = @echo +MAKEDIR = @mkdir -p +REMOVER = @rm -f +GZIP = @gzip +COPY = @ln -f + +##################### +# Operating Systems # +##################### + +OS := $(shell uname) +ifeq ($(OS),Linux) + LINUX = -DLINUX + OS = GNU/Linux + PORTS = +else + LINUX = -DNOLINUX + PORTS = + ifeq ($(OS),Darwin) + LINUX = -DNOLINUX -DMACOS + endif +endif + +#################### +# Compiler options # +#################### + +#Libraries: include path and linked libs +INCLUDE = -Iinclude/ +LIBS = +DEFINES = -DOS=\"$(OS)\" $(LINUX) + +#Release type +TYPE = Debug +# RELEASE may be: +# -g -Wall -ansi -pedantic for debug +# -O2 for release +# LINKERRELEASE may be: +# -s for release +ifeq ($(TYPE),Debug) + #RELEASE = -g -Wall -pedantic -fPIC for .so files + RELEASE = -g -Wall +#-pedantic + LINKERRELEASE = +else + RELEASE = -O2 + LINKERRELEASE = -s +endif + +OBJECTS = .guard.o .level.o .levelformat.o .outertile.o .pop1levelformat.o .pop1tile.o .pop2tile.o .tile.o +LAYERS = .endiansafestream.o +SUPPORT = .main.o + +EXEOBJ = $(SUPPORT) $(LAYERS) $(OBJECTS) +#LIBOBJ = $(MAIN) $(XML) $(COMPRESS) $(ACTIONS) $(LAYERS) $(OBJECT) $(FORMAT) $(PORTS) + +EXEFILE = bin/pv4 + +#Use this to temporary remove an option +OPTIONS = $(INCLUDE) $(DEFINES) $(RELEASE) +LINKEROPTIONS = $(LINKERRELEASE) $(LIBS) + +#main file + +$(EXEFILE): $(EXEOBJ) + $(INFO) Linking files... + $(MAKEDIR) bin + $(CC) $(OPTIONS) -o $(EXEFILE) $(EXEOBJ) + $(INFO) Program successfully compiled + $(INFO) + $(INFO) Please read readme.txt for syntax information + $(INFO) + +#command options +.PHONY: clean build all libs + +clean: + $(INFO) Erasing temporary object files... + $(REMOVER) $(EXEOBJ) $(EXEFILE) + +build: clean bin/pv4 + +all: $(EXEFILE) + +libs: $(LIBOBJ) + $(MAKEDIR) bin + $(INFO) Making dynamic library... + $(CC) $(OPTIONS) -o bin/pr.so $(LIBOBJ) -Llibc -shared -dynamic + $(INFO) Library successfully compiled + $(INFO) + $(INFO) Please read readme.coders.txt and pr.h for interfaces + $(INFO) + +#files + +.endiansafestream.o: src/endiansafestream.cpp include/endiansafestream.h + $(INFO) Compiling endian abstraction layer... + $(CC) $(OPTIONS) -c src/endiansafestream.cpp -o $@ + +.guard.o: src/guard.cpp include/guard.h + $(INFO) Compiling main guard class... + $(CC) $(OPTIONS) -c src/guard.cpp -o $@ + +.level.o: src/level.cpp include/level.h + $(INFO) Compiling main level bridge class... + $(CC) $(OPTIONS) -c src/level.cpp -o $@ + +.levelformat.o: src/levelformat.cpp include/levelformat.h + $(INFO) Compiling main level format class... + $(CC) $(OPTIONS) -c src/levelformat.cpp -o $@ + +.main.o: src/main.cpp + $(INFO) Compiling main dummy class... + $(CC) $(OPTIONS) -c src/main.cpp -o $@ + +.outertile.o: src/outertile.cpp include/outertile.h + $(INFO) Compiling outer tile class... + $(CC) $(OPTIONS) -c src/outertile.cpp -o $@ + +.pop1levelformat.o: src/pop1levelformat.cpp include/pop1levelformat.h + $(INFO) Compiling pop1 level support class... + $(CC) $(OPTIONS) -c src/pop1levelformat.cpp -o $@ + +.pop1tile.o: src/pop1tile.cpp include/pop1tile.h + $(INFO) Compiling pop1 tile support class... + $(CC) $(OPTIONS) -c src/pop1tile.cpp -o $@ + +.pop2tile.o: src/pop2tile.cpp include/pop2tile.h + $(INFO) Compiling pop2 tile support class... + $(CC) $(OPTIONS) -c src/pop2tile.cpp -o $@ + +.tile.o: src/tile.cpp include/tile.h + $(INFO) Compiling main tile class... + $(CC) $(OPTIONS) -c src/tile.cpp -o $@ + diff --git a/PV4/include/level.h b/PV4/include/level.h index 94cbf8e..044574b 100644 --- a/PV4/include/level.h +++ b/PV4/include/level.h @@ -2,7 +2,7 @@ #define _LEVEL_H_ #include <string> -#include "levelFormat.h" +#include "levelformat.h" #include "guard.h" #include "tile.h" @@ -33,7 +33,7 @@ public: void setTile(int floor,int col,Tile* tile); Tile* getTile(int floor,int col); - void copyTiles(int sfloor,int scol,int efloor,int ecol); + void copyTiles(int sfloor,int scol,int efloor,int ecol,int tfloor, int tcol); bool addTrigger(int triggerfloor,int triggercol,int targetfloor,int targetcol); diff --git a/PV4/include/levelformat.h b/PV4/include/levelformat.h index 65b3503..9aed179 100644 --- a/PV4/include/levelformat.h +++ b/PV4/include/levelformat.h @@ -16,8 +16,7 @@ public: LevelFormat(int levelNumber); // new LevelFormat(); // dummy constructor (?) - ~LevelFormat(); - + virtual ~LevelFormat()=0; virtual void save(ostream* level)=0; virtual void setTile(int screen, int location, Tile* t)=0; diff --git a/PV4/include/tile.h b/PV4/include/tile.h index d2dfbc4..691b246 100644 --- a/PV4/include/tile.h +++ b/PV4/include/tile.h @@ -10,6 +10,7 @@ public: virtual int getDoorEvent()=0; virtual int getAttr()=0; virtual int getImg()=0; + virtual ~Tile()=0; protected: int level; /* this is very important to know what tiles are allowed */ diff --git a/PV4/src/level.cpp b/PV4/src/level.cpp index 9433f77..947ed4c 100644 --- a/PV4/src/level.cpp +++ b/PV4/src/level.cpp @@ -1,8 +1,8 @@ #include <iostream> #include "endiansafestream.h" -#include "levelFormat.h" -#include "pop1levelFormat.h" +#include "levelformat.h" +#include "pop1levelformat.h" #include "level.h" #include "guard.h" #include "tile.h" @@ -83,14 +83,14 @@ cout<<"nf "<<nf<<endl; //process user data fieldPointer* fields=new fieldPointer[nf*2]; - int currentField=1; + unsigned int currentField=1; fields[0]=ud; - for (int i=0;i<b2&¤tField<nf*2;i++) { + for (unsigned int i=0;i<b2&¤tField<nf*2;i++) { if (!ud[i]) fields[currentField++]=ud+i+1; } - for (int i=0;i<nf;i++) { + for (unsigned int i=0;i<nf;i++) { cout<<"f['"<<fields[i*2]<<"']='"<<fields[i*2+1]<<"'"<<endl; } @@ -312,22 +312,23 @@ Tile* Level::getTile(int floor,int col) { } } -void copyTiles(int sfloor,int scol,int efloor,int ecol,int tfloor, int tcol) { - -//equal col and floor are done -if (sfloor==efloor) return; -if (scol==ecol) return; - -//order col and floor in case the selection is in other order -if (sfloor<efloor) {int aux=efloor;efloor=sfloor;sfloor=aux;} -if (scol<ecol) {int aux=ecol;ecol=scol;scol=aux;} - -tTile* t; - -for (int i=0;i<efloor-sfloor;i++) { - for (int j=0;j<ecol-scol;j++) { - t=this->getTile(sfloor+i,scol+j); - this->setTile(tfloor+i,tcol+j,t); //TODO: handle sollapations +void Level::copyTiles(int sfloor,int scol,int efloor,int ecol,int tfloor, int tcol) { + + //equal col and floor are done + if (sfloor==efloor) return; + if (scol==ecol) return; + + //order col and floor in case the selection is in other order + if (sfloor<efloor) {int aux=efloor;efloor=sfloor;sfloor=aux;} + if (scol<ecol) {int aux=ecol;ecol=scol;scol=aux;} + + Tile* t; + + for (int i=0;i<efloor-sfloor;i++) { + for (int j=0;j<ecol-scol;j++) { + t=this->getTile(sfloor+i,scol+j); + this->setTile(tfloor+i,tcol+j,t); //TODO: handle sollapations + } } } diff --git a/PV4/src/tile.cpp b/PV4/src/tile.cpp index d8e7c04..02dfb62 100644 --- a/PV4/src/tile.cpp +++ b/PV4/src/tile.cpp @@ -1 +1,7 @@ #include "tile.h" + + + +Tile::~Tile() { + +}