Jump to content
  • Advertisement

reptor

Member
  • Content Count

    147
  • Joined

  • Last visited

Community Reputation

101 Neutral

About reptor

  • Rank
    Member
  1. Thank you very much. At least the build process of the library completed without errors now after changes to the template code and after some other fixes elsewhere.
  2. Hey guys, the following code: http://code.google.c...SBPropertySet.h /* The zlib/libpng License Copyright (c) 2009-2010 Martin Preisler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #ifndef __OISB_PROPERTY_SET_H__ #define __OISB_PROPERTY_SET_H__ #include "OISBGlobal.h" #include "OISBString.h" #include namespace OISB { /** * @brief base abstract class for all classes allowing property set/get */ class _OISBExport PropertySet { public: /** * @brief destructor */ virtual ~PropertySet(); typedef std::vector PropertyList; virtual void listProperties(PropertyList& list); /** * @brief sets property of given name to given value */ template inline void setProperty(const String& name, const T& value) { impl_setProperty(name, toString(value)); } /// @copydoc PropertySet::setProperty template<> inline void setProperty(const String& name, const String& value) { impl_setProperty(name, value); } /** * @brief gets property of given name and the result is returned as given type */ template inline typename T getProperty(const String& name) const { return fromString(impl_getProperty(name)); } /// @copydoc PropertySet::getProperty template<> inline String getProperty(const String& name) const { return impl_getProperty(name); } /// coverts given type to string, idea from boost::lexical_cast template inline static String toString(const T& value) { std::ostringstream sstr; sstr << value; return sstr.str(); } /// converts given string to type, idea from boost::lexical_cast template inline static T fromString(const String& value) { T ret; std::istringstream sstr(value); sstr >> ret; return ret; } protected: /** * @brief implementation of property set */ virtual void impl_setProperty(const String& name, const String& value); /** * @brief implementation of property get */ virtual String impl_getProperty(const String& name) const; }; } #endif (You can see the line numbers if you follow the link) gives the following errors when compiled with g++ (Debian 4.3.2-1.1) 4.3.2: oisb/include/OISBPropertySet.h:57: error: explicit specialization in non-namespace scope ‘class OISB::PropertySet’ oisb/include/OISBPropertySet.h:67: error: expected nested-name-specifier before ‘T’ oisb/include/OISBPropertySet.h:67: error: too many template-parameter-lists oisb/include/OISBPropertySet.h:73: error: explicit specialization in non-namespace scope ‘class OISB::PropertySet’ oisb/include/OISBPropertySet.h:81: error: too many template-parameter-lists oisb/include/OISBPropertySet.h:91: error: too many template-parameter-lists[/quote] It appears that Visual C++ thinks that code is OK. It would be great if someone could explain why these errors happen and how the code should be changed to make it work. I'm not the author of the code - I'm a user of the library and just trying to help the author to get it fixed so that it can be used on Linux too.
  3. About floats vs. doubles. The accuracy of intermediate results of calculations can matter to the user as any error on one step of the calculation will pass on to the next step of the calculation and the more steps the calculation has the more likely it is that the final result has significant error. So to improve accuracy of the intermediate steps you can use doubles when you calculate something even when the final result must be passed on as a float and this can give you a better end result. So rejecting doubles simply on the basis that the final result of a calculation must be passed on as a float to an API is not necessarily a good thing to do.
  4. reptor

    Need C++ Audio Library

    Quote:Original post by sepul you can also check out OpenAL (better alternative OpenAL Soft - http://kcat.strangesoft.net/openal.html) it's also open source Based on what is OpenAL Soft "better"? I assume you compare it to proprietary OpenAL implementations.
  5. Secunia published a Half-Year Report 2010 (under "Resources - Reports") which talks about a switch from Microsoft to 3rd-party programs regarding security problems / threats. To put it simply, as the operating system has improved, attackers are targeting 3rd-party programs more. So they just go after the weak link which is natural. Games belong to this group as well. Put a reasonably successful game on-line and it will be attacked. Would you like your game to be used as a security hole into a user's system? It's about time for people to wake up to this problem.
  6. People should be careful when talking about Europe. Some people may not realise it but this is not at all a very balanced area. There are these certain highly-developed countries in Europe like the UK, Germany, Sweden and Finland (my country). And then there are countries like Romania, Bulgaria, Poland, even Hungary. Where you don't get paid nowhere near as much as you get paid in the more developed countries. The gap between these kind of countries is huge. Don't underestimate this please. The gap between for example Finland and Estonia, which are "brother" countries, has certainly reduced to our great delight, but it still exists. This is why many of the Estonians come to Finland to find better-paying work and most Finns don't bother to go to Estonia except for the cheaper booze and tobacco and to have a night out partying... I am delighted for the improvement of this brother country but there is still an obvious gap, they are still lagging behind. The time has not been enough for them to make a full recovery from the disaster that was the USSR. The fact that many of these poorer countries have joined the European Union may fool you into thinking that the countries are somewhat on-par with each other, but they are not, and with countries like Romania and Bulgaria I reckon it's going to take about a hundred years for them to even halve the gap so huge is the gap now. I hope they will make it because I hate the beggars harass me 5 times coming and going during a short walk in the main street of my town. I would like them to improve their own country so they don't have to come here begging and stealing and abusing our welfare systems. But yeah, the point is, some arguments made here are very questionable. Like the salary level mentioned by Antheus. I think it's clearly too low, what were you thinking dude? Were you talking about programmers in Romania? :) Qualified engineers (programmers are most often qualified engineers at the minimum here, I mean a 4-year Bachelor's degree or better) get much better in these well-developed European countries. What you mentioned is like what someone who hasn't even graduated can get already easily. I can get more than that working as a mechanic, easily. And perhaps people confuse the value of currencies? Notice that the Pound Sterling is more valuable than the Euro. It seems to have come closer but there used to be a bigger gap I recall. And about working hours. Yeah my country too has rules that say you must get permission from your employer to work overtime. I personally have broken this rule many times and never has there been any problem. But the rule is there - technically the employer can refuse to pay you a compensation for the time you spent working overtime if you did not have their prior permission to do it. I think most employers are not crazy about this so they let you work if you want to and they will pay you - this is my experience in more than one company. Yeah I guess my main point in this post is that pay attention to the fact that there are many very poor countries in Europe and I think using those countries as examples of what is normal in Europe is not right. Those countries are severely lagging behind the rest of us and they are... I don't know the statistically correct terms for this, but those countries should not be influencing so much where you draw the curve in the graph - they certainly have less value in this comparison so they must be "weighed" down.
  7. The benefit of having to open only one file versus having to open many files would make such name searching issues very insignificant. The overhead of opening a (file system level) file is significant.
  8. Yes, of course it has. The big file has a "header" table which is basically a list of all the files contained in the file. The actual data of the files come sequentially after this header table. Together with each file name, you can have other information listed. Such as the offset from the beginning of the file to the start of the data block, and the size of the data block. You can list two sizes for each data block: 1) uncompressed size 2) compressed size. And you can have a variable indicating whether the data block is compressed or not (or use the compressedSize variable to figure that out). Then you can read the header table and jump to whichever file data block you want to read and decompress if necessary. Some people may prefer to store more information, such as the last write time. I suggest writing the number of files stored in the package file before the header table. So you can read the header table in one go as you will then know how many entries it has. Watch out for padding issues if you try to write and read structures.
  9. reptor

    reading binary file header

    Don't use a character array (string) for the signature ("magic"). Use an "unsigned int". Store it in your code as an unsigned int and then when you read it from the file you read an unsigned int. Then you compare the two unsigned ints. Of course the same applies to the version as well.
  10. One good reason for me to go to engineering school was to open up more possibilities for myself. I figured out I could have a reasonable salary as a factory worker where I used to work as a mechanic assembling new mobile machines. I was pretty damn good at it after only a few years in the job. But that was actually part of the problem - I noticed I was running out of challenge in my job. And I looked at the older guys doing the same job and asked myself "do I want to end up like them, bitter and whining about the job pretty much every day and being jealous towards anyone who worked to get into a better position?" No, I didn't want to be one of those guys... so I left the job I enjoyed doing a lot and went studying. It was actually hard to walk away from that job as I had become pretty damn good in it and I enjoyed it a lot! But I saw I would quickly run out of challenges in that position and that's the main reason I felt I need to get out - the main reason was not money! Many people who have continued in that job surely have made more money than I have as I've lost of lot because of the studies. But I have more options open for me as I go hunt for a job - the guys without any education are pretty much stuck at the factory and are whining about it and being very jealous and bitter towards anyone who tries to improve his or her position - that's dumb but that's what they do.
  11. I am going with option number 3 with 2 slightly modified as in allowing compression. I just write the files sequentially into one big file and have header information on them about are they compressed or not. This is a very simple file format to create. I test the compression ratio - if it is not good-enough then I will leave the file uncompressed. You can easily create a compression tool with this feature. Also I suggest your tool should detect duplicate files and either stop the process or store one copy and create two entries into your list of files stored in that package file if more than one copies of the same data is detected. I think it is really best to have the files stored in one big file - this is to make the performance better. You only need one file handle from the operating system - it is one 'open' operation and one 'close' operation. And also consider that anti-virus programs may monitor file usage so the more files you touch the more work may be done by an anti-virus program and if they do this then it won't help with performance that is for sure. Touching the minimal amount of file system level files is the best way to go.
  12. reptor

    Recomended C++ books

    Yes, the books by Scott Meyers are a very good read. At least they will give you a better idea of how difficult a language C++ actually is.
  13. I agree. You can just call reserve with some guessed value in the case that you can't know what it should be exactly without going through the file. It will likely work fine most of the time.
  14. Doing programming as a hobby it really doesn't matter much if projects get abandoned completely or for a few months or even years. Usually when I go back to an old project I have learned a lot more about programming in the mean time and the old code looks ugly and the next version I write is much better. This means a lot of re-writing but as it's a hobby there is no real loss. If it were a commercial project it could not be done like this.
  15. Yes, use reserve(). It can dramatically improve performance. I have seen this with my own projects - the difference can be huge.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!