I need to embark on some work in fixing and probably redesigning city growth code in Experimental's devel-new branch to prepare for the next major release. However, city growth is not an area of the code into which I have previously delved. Would any of the Standard developers be so kind to give me a brief overview of how the code is intended to work, and the main methods/functions (which exactly is the correct term for C++ in any event?) that handle city growth? I should be exceedingly grateful.
THe calculations all happens in void stadt_t::step(long delta_t)
There are two functions then calc_growth() and step_grow_city(). There the actual magic happens. But I am not sure if experimetnal is still using the same.
Thank you - that is helpful. Experimental has not made major changes to these yet. In general terms, how do calc_growth() and step_grow_city() work?
Quote from: jamespetts on December 15, 2013, 09:55:15 PM
methods/functions (which exactly is the correct term for C++ in any event?)
Standalone functions (like main()) are a
functions. Functions that are part of a class are
member functions.
Intriguing - I had originally thought that all object oriented languages used the term "method" for what are described here as "member functions". It is confusing that C++ is not a functional language yet has "functions"...
Even Microsoft BASIC in the early 1980s had functions (http://hwiegman.home.xs4all.nl/gw-man/DEFFN.html): 10 DEF FNFOO(X)=X^2
Quote from: jamespetts on December 16, 2013, 10:01:46 AM
It is confusing that C++ is not a functional language yet has "functions"...
Well, you can do some simple functional programming with C++.
Quote from: Ters on December 16, 2013, 06:10:56 PM
Well, you can do some simple functional programming with C++.
Yes, I suppose that that is also confusing, as is much about C++...
Not really - C++ like many languages gives you a variety of tools to write your code in. As was pointed out many BASIC variants have functions as well as procedures.