Not logged inOpenClonk Forum
Up Topic Development / Developer's Corner / Obsolete functions
1 2 Previous Next
- - By Newton [de] Date 2009-10-12 10:57
While dwelling in the engine code, I stumble upon imo obsolete functions. Since I don't know my way around the engine, and if they are perhaps very important after all, I'll post them here and request for comments/advice whether they can be deleted.

C4Object::BuyEnergy() - refills Clonks energy inside bases for a reasonable price
C4Object::ExecBase() - apparently removes the snow on the base

I'll post more over the time.
Parent - By Günther [de] Date 2009-10-12 13:06

> C4Object::ExecBase() - apparently removes the snow on the base


I already removed everything else that function did, because that has been reimplemented in script. Snow-removal is probably best kept in the engine for performance reasons, so there's nothing to do here anymore, except possibly renaming the function.

> C4Object::BuyEnergy()


That function is already gone, in the same commit as the above.
Reply
Parent - - By Newton [de] Date 2009-10-13 13:01
C4Object.cpp
2336  // Energy shortage
2337  if (NeedEnergy) if (::Game.iTick35>12) if (eDrawMode!=ODM_BaseOnly)
2338  {
2339  C4Facet &fctEnergy = ::GraphicsResource.fctEnergy;
2340  int32_t tx=cox+Shape.Wdt/2-fctEnergy.Wdt/2, ty=coy-fctEnergy.Hgt-5;
2341  fctEnergy.Draw(cgo.Surface,cgo.X+tx,cgo.Y+ty);
2342  }

along with NeedEnergy
Parent - - By Isilkor Date 2009-10-13 13:39
This draws the red lightning symbol above the object when it's out of energy.
Reply
Parent - - By Newton [de] Date 2009-10-13 13:47
Isn't it done by script now with Maikels system
Parent - By Isilkor Date 2009-10-13 15:08
It might, I just wanted to tell you what it does. :)
Reply
Parent - - By Newton [de] Date 2009-12-14 22:51
Actually: There is far more to remove if the energy system gets completely replaced by Maikels. Question is, of how much should be still left of it.
Parent - - By Maikel Date 2009-12-15 15:01
That depends on how the Command system will look in the future, at the moment the Energy command is completely broken. Things that can at least be removed are the OCFs and C4Ds related to power but not to lines. ObjectComDigDouble and ObjectComLineConstruction should probably be reimplemented in C4Script, and are obsolete as such. C4Player::PlaceReadyBase is broken, but do we need this in the future. And the command Build is partly broken since it depends on Energy. And probably something I missed.
Parent - - By Newton [de] Date 2009-12-15 15:25

>removed are the OCFs


Why are the OCFs not used instead of the functions "IsPowerConsumer return 1"?

>C4Ds


Are there any?

>ObjectComDigDouble and ObjectComLineConstruction
>C4Player::PlaceReadyBase


What are these used for?

----

and I am also talking about the act map entry "energyusage" and the related checks in the engine. Plus all this energy management for structures.
Parent - By Maikel Date 2009-12-15 15:41
OCFs are based on LineConnect C4Ds, and these are specified in the Defcore. If one makes a new building only including the power consumer would not be enough, one would need additional defcore changes. I don't know what is prefered, keeping the OCFs or not.

>>ObjectComDigDouble and ObjectComLineConstruction
>>C4Player::PlaceReadyBase
>What are these used for?


The first is what happens on double dig with a clonk, i.e. Activate calls in the first held object, Checking for trees, Checking for linekits to be disconnected, Activate call inside the clonk itself. Line construction handles linekit connection, i.e. power lines, drain and source pipes, although this is never called in praxis.
PlaceReadyBase is used to generate the base when you select multiple buildings in scenario.txt, it also includes powerline connection.

>and I am also talking about the act map entry "energyusage" and the related checks in the engine. Plus all this energy management for structures.


Seems to be obsolete.
Parent - By Newton [de] Date 2009-12-16 01:01
I'd say it can be removed when the new power system has been used and tested for a while.
Parent - - By Newton [de] Date 2009-10-13 13:46 Edited 2009-12-16 00:57
void C4SGame::ConvertGoals(C4SRealism &rRealism)
Parent - By Newton [de] Date 2009-12-14 22:44
Quite a bit of work. The "backward compatibility" was still quite deep inside. I hope I carved it all out.
Parent - - By Newton [de] Date 2009-11-03 02:00 Edited 2010-11-25 13:33
in PlrCtrl:

C4Object::ViewDelay
Parent - By Newton [de] Date 2010-11-25 13:35
Done, along with ScoreDelay and WealthDelay, those seemed to be used for the engine-side HUD once. (Didn't bother to find out - they have been assigned only and counted down but never read.
Parent - - By Maikel Date 2009-11-05 17:32 Edited 2009-11-06 00:20
No need for a new thread. I removed GetTaggedPlayerName from the engine, and reimplemented it in C4Script. Also extended it and the already available GetPlayerByName to Teams. I hope I exported it right. Would be useful if someone could test/commit it.

ISC licence is understood.
Attachment: TaggedPlayer.patch (8k)
Parent - By Newton [de] Date 2009-11-05 19:44
I don't think this is a change that might cause problems on different systems. If it works for you, we don't need to review it again. If you extended the functions it'd be good to update the docs as well.
Parent - - By Isilkor Date 2009-11-05 19:44 Edited 2009-11-05 19:50

> I hereby license the following file(s) under the CC-by license


Since this is the blanket statement the forum adds, I'd like to have this clarified: Is this patch CC-by or ISC (furthermore, what's our preferred license for scripts)?
Reply
Parent - - By Newton [de] Date 2009-11-05 20:26
We could change the statement to
I hereby license the following file(s) under the CC-by license for artwork or the ISC license for scripts
Parent - By Isilkor Date 2009-11-05 21:11
Use a combo box ;P
Reply
Parent - By Maikel Date 2009-11-06 00:20
ISC, automation is a cause of errors.
Parent - - By Newton [de] Date 2009-12-14 16:49 Edited 2010-11-25 13:49
Script function MakeCrewMember
Parent - By Newton [de] Date 2010-11-25 13:49
Replaced by SetCrewStatus
Parent - By Newton [de] Date 2009-12-16 00:57
HomebaseMaterial-stuff after script base functionality has been tested.
Parent - By Newton [de] Date 2010-03-02 13:23
The whole FIGHT-procedure and all the stuff that belongs to it (probably commands, FIGHT logic, actions etc.)
Parent - By Newton [de] Date 2010-03-02 16:51
BubbleOut
Parent - - By Günther [de] Date 2010-04-15 21:32
Message without an object parameter - For important things dialog boxes are the prettier option, and anything that's not important does not need to be a global message.
Reply
Parent - By Günther [de] Date 2010-04-16 00:12
I've implemented this. We're getting close to a critical mass of game content where incompatible script changes aren't easy to deploy anymore. Well, I guess that's good for the game...

http://bitbucket.org/guenther/openclonk/changeset/ad89db429c5d

I'd appreciate reviews and/or tests.
Reply
Parent - - By Sven2 [de] Date 2010-04-16 10:55
Actually, I'd rather see CustomMessage renamed to Message and all other Message functions removed. Having so many message functions with different parameter sets just sucks.
Parent - - By Günther [de] Date 2010-04-16 12:33
Well, that's more work than I want to do at the moment. Also, CustomMessage would need to be fixed so that the default behaviour would be to display the message to either all players or the owner of the object, instead of player one.
Reply
Parent - - By Sven2 [de] Date 2010-04-16 12:46
Actually, that's a common problem. And it's something I'd rather fix by changing NO_OWNER to 0 and let player numbers start at 1.
Parent - By Ringwaul [ca] Date 2010-04-16 19:08
I would appreciate such a change. :D
Reply
Parent - By Günther [de] Date 2010-04-17 00:20
The alternative would be to distinguish nil and 0.
Reply
Parent - - By Caesar [de] Date 2010-04-17 18:38
If you're about it: Make GetID() obsolete and disallow reuse of player numbers.
Parent - By Newton [de] Date 2010-04-17 18:45
why is GetID obsolete?
Parent - - By Sven2 [de] Date 2010-04-17 18:45
You mean GetPlayerID?

Setting player IDs equal to player numbers would be a possibility.
Parent - By Caesar [de] Date 2010-04-17 18:47
Yes, I do...
Parent - - By Newton [de] Date 2010-04-16 19:26
What about the Messages in the "Guardians of the Windmill" scenario?
Parent - By Günther [de] Date 2010-04-17 00:19
I've changed them to CustomMessage.
Reply
Parent - By Günther [de] Date 2010-04-21 21:43
Done.
Reply
Parent - - By Maikel Date 2010-04-20 17:10
Anything to do with settlement scores can be removed from the engine, since it is not displayed in the hud anymore. It is also easy to reimplement with C4Script. It still appears in the evaluation after the game.
Parent - - By Sven2 [de] Date 2010-04-20 17:37
I think we could keep the score fields, but remove automatic engine counting of objects, etc.

Then objects/scenarios can still use the score, but do it on a more meaningful basis. For example, goal objects could give you score based on the difficulty of the goal.
Parent - By Isilkor Date 2010-04-20 17:42
And then we can finally implement GameOver(2000)!
Reply
Parent - - By Newton [de] Date 2010-04-20 21:41
Sounds reasonable. Maikel, will you do this then?
Parent - By Maikel Date 2010-04-21 18:08
No, too complicated for me.
Parent - By Sven2 [de] Date 2010-04-21 20:14
Done. I also renamed all functions and fields to refer to score (was Score, Value, Points before):

DoPlayerScore
GetPlayerScore
GetPlayerScoreGain
Parent - By Günther [de] Date 2010-04-21 21:44
All those backwards-compatibility options for landscapes in the Scenario.txt. We might need them again, but at the moment, we only need one format for the landscape.bmp.
Reply
Parent - By Günther [de] Date 2010-04-27 01:10
Bitmap fonts. Did any scenario actually use them? The font stuff could be nicely simplified if it only had to worry about vector fonts. And bitmap fonts probably got broken in the Unicode transition anyway.
Reply
Parent - - By Maikel Date 2010-09-18 10:25
What about DefinitionCall()? Seems fairly obsolete to me.
Parent - By B_E [de] Date 2010-09-18 11:34 Edited 2010-09-18 11:36
Well, in general then Call() and DefinitionCall(). Also global() seems fairly obsolete.

Edit: Blah, see Zapper, he's right about this.
Up Topic Development / Developer's Corner / Obsolete functions
1 2 Previous Next

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill