While it's compiling, I'll post something I dug up last night. Apparently there was a more complete patch than what I posted, and most the files it affects had not changed between revisions 216 and 239. It may be useful. Then again, maybe not.
I think the only thing that changed between 216 and 239 was saveload.cpp.
Index: 31104branch/src/title/saveload.cpp
===================================================================
--- 31104branch/src/title/saveload.cpp (revision 216)
+++ 31104branch/src/title/saveload.cpp (working copy)
@@ -51,7 +51,8 @@
fstream filestr;
- filestr.open (str, fstream::in | fstream::out | fstream::binary | fstream::trunc);
+ filestr.open ((LCSGetTargetDirectory (LCSIO_PRE_HOME) + str).c_str(),
+ fstream::in | fstream::out | fstream::binary | fstream::trunc);
//Puzz: NEW SAVE SYSTEM! YAAAY!
if(filestr.is_open())
{
@@ -330,9 +331,11 @@
char load(void)
{
- fstream filestr;
+ fstream filestr;
- filestr.open ("save.dat", fstream::in | fstream::out | fstream::binary);
+ filestr.open ((LCSGetTargetDirectory (LCSIO_PRE_HOME) + "save.dat").c_str(),
+ fstream::in | fstream::out | fstream::binary);
+
//Puzz: NEW SAVE SYSTEM! YAAAY!
if(filestr.is_open())
{
Index: 31104branch/src/lcsio.cpp
===================================================================
--- 31104branch/src/lcsio.cpp (revision 216)
+++ 31104branch/src/lcsio.cpp (working copy)
@@ -129,60 +129,37 @@
strncpy(artdir,artprefix,MAX_PATH_SIZE);
}
-
-
-FILE* LCSOpenFile(char* filename,char* mode,int flags)
-{
+// ensure our home and art directories have been created
+void LCSInitIO ()
+{
if(!initialized)
{
LCSInitHomeDir();
LCSInitArtDir();
initialized=true;
}
+}
+
+
+FILE* LCSOpenFile(char* filename,char* mode,int flags)
+{
+ LCSInitIO();
std::string filepath;
- if(flags & LCSIO_PRE_ART)
- {
- filepath=artdir;
- }
- else if(flags & LCSIO_PRE_HOME)
- {
- filepath=homedir;
- }
- filepath.append(filename);
+ filepath = LCSGetTargetDirectory (flags) + filename;
return fopen(filepath.c_str(),mode);
}
void LCSDeleteFile(char* filename,int flags)
{
+ LCSInitIO();
- if(!initialized)
- {
- LCSInitHomeDir();
- LCSInitArtDir();
- initialized=true;
- }
-
std::string str;
- if(flags & LCSIO_PRE_ART)
- {
- str.append(artdir);
- }
- else if(flags & LCSIO_PRE_HOME)
- {
- str.append(homedir);
- }
+ str = LCSGetTargetDirectory (flags) + filename;
- str.append(filename);
-
unlink(str.c_str());
-
-
-
-
-
}
void LCSCloseFile(FILE* handle)
@@ -190,3 +167,14 @@
fclose(handle);
}
+
+std::string LCSGetTargetDirectory (int flags)
+{
+ LCSInitIO();
+
+ if (flags & LCSIO_PRE_ART)
+ return artdir;
+ else if (flags & LCSIO_PRE_HOME)
+ return homedir;
+}
+
Index: 31104branch/src/organizationdef.cpp
===================================================================
--- 31104branch/src/organizationdef.cpp (revision 216)
+++ 31104branch/src/organizationdef.cpp (working copy)
@@ -15,15 +15,15 @@
initVariable<std::string>("NAME", &name);
initVariable<short>("ATTACKPOWER", &attackPower);
- initVariable<std::vector<int>>("SOLDIERS", &soldiers);
+ initVariable<std::vector<int> >("SOLDIERS", &soldiers);
initVariable<short>("LOBBYPOWER", &lobbyPower);
- initVariable<std::vector<int>>("LOBBYISTS", &lobbyists);
+ initVariable<std::vector<int> >("LOBBYISTS", &lobbyists);
initVariable<short>("PUBLICITYPOWER", &publicityPower);
- initVariable<std::vector<int>>("PUBLICISTS", &publicists);
+ initVariable<std::vector<int> >("PUBLICISTS", &publicists);
- initVariable<std::vector<int>>("INTERESTS", &specialInterests);
+ initVariable<std::vector<int> >("INTERESTS", &specialInterests);
}
void organizationDef::initializeInstance(organization &instance)
@@ -39,4 +39,4 @@
instance.lobbyPower = lobbyPower;
instance.lobbyists = lobbyists;
instance.specialInterests = specialInterests;
-}
\ No newline at end of file
+}
Index: 31104branch/src/configfile.h
===================================================================
--- 31104branch/src/configfile.h (revision 216)
+++ 31104branch/src/configfile.h (working copy)
@@ -59,7 +59,7 @@
float *variable;
};
-template <> class configContainer<std::vector<int>> : public configContainerBase
+template <> class configContainer<std::vector<int> > : public configContainerBase
{
public:
configContainer(std::string inName, std::vector<int> *inVariable)
Index: 31104branch/src/lcsio.h
===================================================================
--- 31104branch/src/lcsio.h (revision 216)
+++ 31104branch/src/lcsio.h (working copy)
@@ -155,5 +155,16 @@
*/
void LCSDeleteFile(char* filename,int flags);
+/**
+ \brief Gets a directory name
+
+ This function returns the path (unspecified whether absolute or relative)
+ of the directory corresponding to the given LCSIO flag.
+
+ \param flags See enum LCSIO_FLAGS.
+*/
+
+std::string LCSGetTargetDirectory (int flags);
+
#endif // LCSIO_H_INCLUDED
Index: 31104branch/src/organization/orghandler.cpp
===================================================================
--- 31104branch/src/organization/orghandler.cpp (revision 216)
+++ 31104branch/src/organization/orghandler.cpp (working copy)
@@ -23,6 +23,8 @@
#include <includes.h>
#include <externs.h>
+#include <list>
+#include "orghandler.h"
orgHandler::orgHandler() : nextID(0)
{
Index: 31104branch/src/Makefile.am
===================================================================
--- 31104branch/src/Makefile.am (revision 216)
+++ 31104branch/src/Makefile.am (working copy)
@@ -1,20 +1,18 @@
bin_PROGRAMS = crimesquad
-crimesquad_SOURCES = game.cpp lcsio.cpp cursesmovie.cpp compat.cpp cursesgraphics.cpp\
- lcsio.h cursesmovie.h compat.h cursesgraphics.h includes.h externs.h\
- common/commondisplay.cpp common/commonactions.cpp common/consolesupport.cpp\
- common/getnames.cpp common/translateid.cpp common/equipment.cpp common/creature.cpp\
- title/titlescreen.cpp title/highscore.cpp title/newgame.cpp title/saveload.cpp\
- basemode/basemode.cpp basemode/baseactions.cpp basemode/activate.cpp \
- basemode/reviewmode.cpp sitemode/advance.cpp sitemode/mapspecials.cpp \
- sitemode/newencounter.cpp sitemode/sitemode.cpp sitemode/talk.cpp sitemode/map.cpp\
- sitemode/miscactions.cpp sitemode/sitedisplay.cpp sitemode/stealth.cpp combat/chase.cpp\
- combat/fight.cpp combat/haulkidnap.cpp daily/activities.cpp daily/daily.cpp\
- daily/date.cpp daily/news.cpp daily/shopsnstuff.cpp daily/siege.cpp monthly/endgame.cpp\
- monthly/justice.cpp monthly/lcsmonthly.cpp monthly/monthly.cpp politics/politics.cpp\
- daily/interrogation.cpp daily/recruit.cpp organization/organization.cpp\
- organization/orghandler.cpp organization/testdriver.cpp politics/law.cpp\
- politics/alignment.h politics/law.h configfile.cpp configfile.h organization/orghandler.h\
- organization/organization.h organization/testdriver.h
+crimesquad_SOURCES = compat.cpp common/commondisplay.cpp common/equipment.cpp common/getnames.cpp\
+ common/commonactions.cpp common/consolesupport.cpp common/creature.cpp common/translateid.cpp\
+ monthly/monthly.cpp monthly/justice.cpp monthly/lcsmonthly.cpp monthly/endgame.cpp cursesmovie.cpp\
+ organizationdef.cpp game.cpp manager/manager.cpp\
+ cursesgraphics.cpp title/titlescreen.cpp title/saveload.cpp title/newgame.cpp title/highscore.cpp\
+ locationdef.cpp serializer.cpp basemode/activate.cpp basemode/basemode.cpp\
+ basemode/baseactions.cpp basemode/reviewmode.cpp news/squadstory_text.cpp news/headline.cpp\
+ news/majorevent.cpp news/layout.cpp news/ads.cpp combat/chase.cpp combat/fight.cpp combat/haulkidnap.cpp\
+ lcsio.cpp organization/organization.cpp organization/orghandler.cpp organization/orgmanager.cpp\
+ organization/testdriver.cpp daily/date.cpp daily/activities.cpp daily/daily.cpp daily/news.cpp\
+ daily/recruit.cpp daily/siege.cpp daily/interrogation.cpp daily/shopsnstuff.cpp configfile.cpp\
+ sitemode/sitemode.cpp sitemode/mapspecials.cpp sitemode/sitedisplay.cpp sitemode/stealth.cpp\
+ sitemode/miscactions.cpp sitemode/map.cpp sitemode/advance.cpp sitemode/talk.cpp sitemode/newencounter.cpp\
+ location.cpp politics/law.cpp politics/politics.cpp
crimesquad_CPPFLAGS = -DINSTALL_DATA_DIR=\"$(datadir)\"
crimesquad_CXXFLAGS = -I$(top_srcdir)/src
Index: 31104branch/src/manager/manager.h
===================================================================
--- 31104branch/src/manager/manager.h (revision 216)
+++ 31104branch/src/manager/manager.h (working copy)
@@ -25,6 +25,7 @@
//#include "configfile.h"
#include <string>
+#include <stdexcept>
#include "serializer.h"
class managedObject : public serializer
@@ -84,7 +85,7 @@
// Return reference to the object with the given ID
template <class T> T &manager<T>::getObj(int ID)
{
- vector<T>::iterator iter; // Iterator to step through my object list
+ typename vector<T>::iterator iter; // Iterator to step through my object list
// Step through my list of objects
for(iter=objects.begin(); iter!=objects.end(); iter++)
@@ -100,13 +101,13 @@
// This should never have to happen
char error[80];
sprintf(error,"manager recieved invalid ID %d in getObj; no such object.",ID);
- throw invalid_argument(error);
+ throw std::invalid_argument(error);
}
// Return reference to the object with the given ID
template <class T> std::vector<int> manager<T>::getIDByType(std::string type)
{
- vector<T>::iterator iter; // Iterator to step through my object list
+ typename vector<T>::iterator iter; // Iterator to step through my object list
vector<int> matchingObjects;
// Step through my list of objects
@@ -133,7 +134,7 @@
// Delete an object
template <class T> void manager<T>::deleteObj(T obj)
{
- vector<object>::iterator iter; // Iterator to step through the object list
+ typename vector<T>::iterator iter; // Iterator to step through the object list
// Step through all objects
for(iter = objects.begin(); iter != objects.end(); iter++)
@@ -142,12 +143,12 @@
if(iter->ID == obj.ID)
{
// Remove it
- objects.erase(iter1);
+ objects.erase(iter);
// Then go back one, so we don't skip the next one.
iter--;
}
// Else delete this org's internal record of the org we're deleting
- else iter1->deleteOrgRecord(obj.ID);
+ else iter->deleteOrgRecord(obj.ID);
}
}
@@ -161,7 +162,7 @@
public:
defManager(std::string inType)
{
- nextID = 0;
+ this->nextID = 0;
type = inType;
}
@@ -175,7 +176,7 @@
void initialize(copyClass &instance, int ID)
{
/* find the correct object */
- getObj(ID).initializeInstance(instance);
+ this->getObj(ID).initializeInstance(instance);
}
std::string type;
};
@@ -184,4 +185,4 @@
-#endif
\ No newline at end of file
+#endif
Index: 31104branch/INSTALL
===================================================================
--- 31104branch/INSTALL (revision 216)
+++ 31104branch/INSTALL (working copy)
@@ -2,7 +2,7 @@
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006 Free Software Foundation, Inc.
+2006, 2007 Free Software Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
@@ -67,6 +67,9 @@
all sorts of other programs in order to regenerate files that came
with the distribution.
+ 6. Often, you can also type `make uninstall' to remove the installed
+ files again.
+
Compilers and Options
=====================
I'll update this shortly...
UPDATE: 240 compiles with nary a glitch (unless you count all those harmless, ancient "no newline at end of file" warnings). You win a cookie (
).