Chaosforge Forum
Coding => FPC Valkyrie => Topic started by: Igor Savin on December 27, 2007, 04:35
-
///
destructor Destroy; override;
///
...even though it consecutively inherits from TVClass and TVObject, neither of which has defined destructor.
Why?
-
TObject, the base class of all objects in FreePascal has a Destroy method (note that you can call X.Destroy on ANY object in FreePascal, even if it doesn;t define it's own destructor). The usage of it is for data structures -- so they can hold any sets of objects, and be sure that if they call Object.Destroy, then all data will be properly disposed of.
P.S. What's up lately? :)
-
Aha, I see it now. God damn the FreePascal documentation for omitting heaps of useful information and being an overall mess.
A second question: I somehow managed to get program crashing with calling the TNode.Free procedure, for which I cannot find any description and which doesn't look like a simple Destructor. What is is, where it comes from and what it really does? Is it safe to replace it with merely a TNode.Destroy (which doesn't produce any crashes) or there's a catch?
Awww... lots of stuff. I'm almost ready taking on the Universe with limited public release of "HoaH", which now mostly requires some polish (functionality-wise it only lacks some easier-to-implement stuff which isn't really necessary to prove geniality of the concept).
In regards to Life (TM): I've got my first serious work (software tester at one of the largest Lithuanian IT companies), I have an uncoming session on me, and this Spring I'm getting engaged (-:. Life's bright, life's taxing. Life is good.
p. s. My avatar seems outdated in regards to yours :).
-
A good programming practice is to never use Free or Destroy at all, but to always use FreeAndNil(Object) -- from SysUtils. It's the safest way (if the object is already nil, then nothing happens).
As to real life -- OMG! O.o
-
Kornel, shouldn't TNode.Detach include Parent:=nil?..
-
Sometimes after detaching we might still like to know the parent. And leaving it uncleared doesn't open too any mistakes anyway.
-
After the major exam (World Literature on Jan. 7) is over, I'm planning on attempting a new iteration of functionality adaptation from Valkyrie to Colossus (Valkyrion Stage 2). I wonder if you have any interest in whatever expansions to Valkyrie functionality might be made from Colossus, and what would be the best way of describing and proposing them to V. - most probably SVN commits would be an inappropriate way.
-
Depends on what you want to expand -- it may be already planned. Just hint me hwat you are thinking about :)
-
I've been primarily thinking about revamping menus - I recall those used in Berserk! being a hardcoded non-reusable nightmare.
AFAIR, you are using LGPL for Valkyrie? If I'm going to distribute software which uses modified parts of it, what should I include in my sources (besides the typical kudos) - complete LGPL license in addition to the one I use (GPL3)?
-
Umm, have you seen, vtextut.pas, and TTextMenu in it? Berserk! uses those too now. And as for general GUI stuff, I'm planning to do a proper and compete GUI system in Valkyrie for the use of especialy Sa^D^D... another project of mine :P
As for license, my friend, I give you the right to relicense it under what you want :P.
-
Yep, my Berserk! sources are rather outdated. I'll check the latest ones.
You mean ASCII-based GUI? When is the expected date of release (with half a year precision :-P)?
As for license, my friend, I give you the right to relicense it under what you want :P.
Wow, thanks. Does this include relicensing rights to whatever moment I finally start using complete Valkyrie, or only to current transitional stage?
-
with a half year precision? In half a year :P.
Seriously though -- I need a simple GUI to start working on S anyway. :P
Whenever you like. The FP version of Valkyrie I may release under a BSD license anyway.
-
Latest Berserk sources are beautiful :).
What does the "class function\procedure" mean?
Like
"class procedure Skill;"
in TBerserkCharGen (bruichar)
description?
-
a class procedure/function is not tied to the instance. That is -- you don't have to create such a object, you can call that function/procedure directly.
-
Looks like this time I'll migrate completely :).
You are using AnsiStrings everywhere (e. g. default Output.DrawString). Aren't those time\resource-wasting overkill?
-
Yeah. Insted of 1 microsecond, you'll use 10 microseconds. So your roguelike will not quickly on a PC 386 DX2 -- on the others there will be no difference :P. Come on, we're writing text games here! DiabloRL used to LINEARY check it's WHOLE database each time it wanted any SINGLE attribute. And it was as fast as the others. TBH, you'd need to do some pretty fucked up shit to make a roguelike as slow as Dwarf Fortress :). Anyway, all those Java roguelikes have a massively bigger overhead on *each* operation, and still they work fast, so AnsiStrings are a yes, yes :P.
P.S. BTW, I started work on the GUI classes ^^
-
\Yeah. Insted of 1 microsecond, you'll use 10 microseconds. So your roguelike will not quickly on a PC 386 DX2 -- on the others there will be no difference :P.\
LOL.
\TBH, you'd need to do some pretty fucked up shit to make a roguelike as slow as Dwarf Fortress :).\
I still have to scale BaL's 1 lair, 1 village, 1 army x100 and see what happens (-: Though lags produced will have nothing to do with AnsiStrings...
\Anyway, all those Java roguelikes have a massively bigger overhead on *each* operation, and still they work fast\
We haven't seen JADE yet. It might compete with DF in category "Angel of Sluggishness".
\so AnsiStrings are a yes, yes :P\
*Persuasion roll successful*
\BTW, I started work on the GUI classes\
Ah, now I know their EXACT release date. It's when I finish my own berserk-based implementation :). And they'll be up the same moment I'll check up the forums to brag about it...
\BTW, I started work on the GUI classes ^^\
Like vtextui in the latest SVN?
-
\Anyway, all those Java roguelikes have a massively bigger overhead on *each* operation, and still they work fast\
We haven't seen JADE yet. It might compete with DF in category "Angel of Sluggishness".
GenRogue might ^^
Ah, now I know their EXACT release date. It's when I finish my own berserk-based implementation :). And they'll be up the same moment I'll check up the forums to brag about it...
Like vtextui in the latest SVN?
Yep.
Try this:
program s;
{$mode objfpc}{$H+}
uses
Classes, SysUtils,
vsystems, vinput, voutput, vtinput, vtoutput,
vtextut, vnode, vtextui, vutil;
var UI : TTextUIArea;
W : TTextWindow;
TM : TTextMenu;
TS : TTextUISeparator;
begin
Systems.Add(Output,TTextModeOutput.Create);
Systems.Add(Input,TTextModeInput.Create);
UI := TTextUIArea.Create(nil);
TTextModeOutput(Output).UI := UI;
TTextWindow.Create( UI, NewRectXY(10,2,50,15) );
W := TTextWindow.Create( UI, NewRectXY(15,4,65,20));
W.Title := 'S*** UI';
TS := TTextUISeparator.Create( W, False{Vertical}, 30 );
TTextContent.Create( TS.Left, 'Welcome to the new not abstract '+
'and fully working Valkyrie text user interface that was specificaly '+
'designed and written for @RS*****@> but will also be used in '+
'other Chaosforge roguelikes.' );
TM := TTextMenu.Create( TS.Right );
TM.Add( 'Option 1' );
TM.Add( 'Option 2' );
TM.Add( 'Option 3' );
TM.Add( 'Option 4', false );
// false means inactive - can't be chosen
TM.Add( 'Option 5' );
TM.Run;
end.
Works for revision 97
Note that memory management is completely automatic -- we even create anonymous (unnamed) classes! :P Another funny thing is that the interface will be drawn everytime you call Output.Update. The third cool thing is, that to get rid of the window, you just need to call FreeAndNil(W), and that's it xP.
HOWEVER, this is very volatile -- it may change any minute :P
-
OK, I'll try it tomorrow (actually, today) after the exam - H-Hour is rapidly approaching :).
-
E:\Elwin\Yhacking\Pascal\Valk\vtoutput.pas(68,18) Error: There is no method in an ancestor class to be overridden: "TTextModeOutput.ScreenShot(const AnsiString, Byte="0")"
E:\Elwin\Yhacking\Pascal\Valk\vtoutput.pas(70,17) Error: There is no method in an ancestor class to be overridden: "TTextModeOutput.ScreenShotExt(Byte="0"):AnsiString"
\\\
If I comment override out:
E:\Elwin\Yhacking\Pascal\Valk\vrltools.pas(383,47) Error: Incompatible type for arg no. 1: Got "<address of procedure(const ShortString,const ShortString);Register>", expected "<procedure variable type of procedure(const AnsiString,const AnsiString);Register>"
E:\Elwin\Yhacking\Pascal\Valk\vini.pas(346,16) Hint: Found declaration: TINI.QuerySection(TINIFileCallbackProcedure)
-
Do you use FPC 2.2.0?
-
Lazarus 0.9.24 (11-14-2007) - fpc 2.2.0
-
Check you Compiler options.../Parsing/Syntax Options -- the only ones I have checked are Delphi 2 extensions, C Sty;e operators, Allow Label, and C++ style inline. If that helps, I'll put all the options into the valkyrie files so next time you will be able to set the options as you wish.
-
You have no "Use AnsiStrings" turned on?..
Hmmm, anyway, those are the same settings as I have. I'll try it with the latest Lazarus snapshot, maybe it'll help...
\If that helps, I'll put all the options into the valkyrie files so next time you will be able to set the options as you wish\
That'd come handy.