Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: LCS code question  (Read 1495 times)

Janus

  • Bay Watcher
  • huffi muffi guffi
    • View Profile
    • Dwarf Fortress File Depot
LCS code question
« on: November 16, 2010, 07:26:43 am »

My capabilities with C++ are definitely not that great, but... how does this code in /trunk/src/creature/pool.cpp work?

Code: [Select]
private:
   std::map<int,Creature*> map;
   void dispersal_ok(Creature* cr)
   {
      for(int i=0; i<
      cr.subordinates
   }
Specifically, that FOR loop and the line after it (or is that line actually supposed to be part of it, and it's supposed to do nothing?).

I was trying to get the current trunk to compile on Windows, and compile failed at that line. Looking at the file history on SVN, it appears that section has been untouched for a long time, so it seems to have been working fine for a lot of people. I'm a bit baffled.
Logged
Tomas asked Dolgan, "What place is this?"
The dwarf puffed on his pipe. "It is a glory hole, laddie. When my people mined this area, we fashioned many such areas."
     - Raymond E. Feist, Magician: Apprentice  (Riftwar Saga)

Oscuro1987

  • Bay Watcher
    • View Profile
Re: LCS code question
« Reply #1 on: November 16, 2010, 08:10:28 am »

This for loop looks unfinished to me.
I mean, it misses the "i++){ ... code ... }"
It should be something like this :
Code: [Select]
private:
   std::map<int,Creature*> map;
   void dispersal_ok(Creature* cr)
   {
      for(int i=0; i< cr.subordinates; i++){
           [Some code bit]
      }
   }
« Last Edit: November 16, 2010, 08:13:05 am by Oscuro1987 »
Logged

Ari Rahikkala

  • Bay Watcher
    • View Profile
Re: LCS code question
« Reply #2 on: November 16, 2010, 08:55:14 am »

Seems this file was stillborn in the first place. It's not mentioned in src/Makefile.am so autotools (what you use when you do a ./configure && make) never even tried to compile it, and I guess the same applies to whatever other build systems the source is set up for. Being that dispersalcheck() lives in daily/daily.cpp these days and the only possibly useful code in this file besides that is getFounder() (which is three lines long), I just deleted that file from the repository. In case someone really needs it you can find it at http://lcsgame.svn.sourceforge.net/viewvc/lcsgame/trunk/src/creature/pool.cpp?revision=417&view=markup
Logged

Janus

  • Bay Watcher
  • huffi muffi guffi
    • View Profile
    • Dwarf Fortress File Depot
Re: LCS code question
« Reply #3 on: November 16, 2010, 10:01:25 am »

That explains it. I converted the included VC++ project to a VS2010 project, and (after scanning through the file in Notepad++) apparently that file is in the project but set to "excluded from compile". For some reason, when I converted the project it removed the exclusion and tried to compile with it included. C'est la vie.

Now I can try and figure out the errors which come up now that it's past that point.  :P
Logged
Tomas asked Dolgan, "What place is this?"
The dwarf puffed on his pipe. "It is a glory hole, laddie. When my people mined this area, we fashioned many such areas."
     - Raymond E. Feist, Magician: Apprentice  (Riftwar Saga)

Carlos Gustavos

  • Bay Watcher
    • View Profile
Re: LCS code question
« Reply #4 on: November 16, 2010, 12:08:12 pm »

You are going to have to add some files to the project. It should be all in the items folder except armor.cpp as it should already be in the project, all in the vehicle folder, shop.h and shop.cpp in the sitemode folder and Markup.h and Markup.cpp in the cmarkup folder.
Logged

olemars

  • Bay Watcher
    • View Profile
Re: LCS code question
« Reply #5 on: November 16, 2010, 03:08:18 pm »

I wrote up how to get it to build in MSVS over here, patches and all.
Logged

Janus

  • Bay Watcher
  • huffi muffi guffi
    • View Profile
    • Dwarf Fortress File Depot
Re: LCS code question
« Reply #6 on: November 16, 2010, 04:35:04 pm »

I wrote up how to get it to build in MSVS over here, patches and all.

Ah, thanks. I'll check that out.

EDIT: the patches on Google Docs are no longer there. Thanks for the thought, anyway.
You are going to have to add some files to the project.
Thanks, I'll give that a shot.
EDIT 2: that worked, much appreciated.
« Last Edit: November 16, 2010, 05:22:36 pm by Janus »
Logged
Tomas asked Dolgan, "What place is this?"
The dwarf puffed on his pipe. "It is a glory hole, laddie. When my people mined this area, we fashioned many such areas."
     - Raymond E. Feist, Magician: Apprentice  (Riftwar Saga)