Closed Arhowk closed 10 years ago
k
I'll check it out.
It'll be fixed tomorrow.
Thank you for notifying me.
Sry, I ended up being busy.
I will get to this very soon, I promise. This is high priority for me.
k
I'm planning this for Thursday. I have 1 exam, 1 quiz, and 2 major assignments. After that, I only have a project and possibly and an exam with 1 full open week in between =).
Sorry for the wait.
I solved it. Your code is bad. The reason the 3rd one outputs 0 is because there is no version 2, you never added anything. You have to add something to the catalog in order for it to go to that version :).
More specifically, that version does not exist. Rather than doing an explicit search for a version, I should return the thing <= to that version ;), that'll fix it.
k
Give me a moment, I'm updating the catalog so that it works with versions that don't exist ;). I'll update all catalogs to do this.
Ok... this is going to take a bit of effort, give me a few hours ;).
I have to build in protection for reading from catalogs with space in between versions. Currently, everything assumes that there are 0 holes. However, there may be holes :o. I have to account for all of this. This also means that versions may have null catalogs, which I also didn't account for. Yup, gotta fix a lot.
I'm refactoring all the code :|
Ok, the update is applied!
Honestly, the entire design was broken for groups, so I had to redo a bit of it.
The output looks like the original for the most part (the filters you are using look the same), so your codes should not break. If they do, I'm sorry :(. I had to fix the broken version filter and group filter.
If you run into any issues, let me know =).
I don't know if you can close this issue or not. If you can't, let me know and I'll close it. I'm keeping it open in case you have anything else related to this issue ^)^.
k
damnit nes -_-
return GetFirstAddedCatalog(thistype.catalog, thistype.catalog)
E/ after a single catalog read, the rest of them threadcrash on creation
GetFirstAddedCatalog just returns data that is already there. I didn't add anything new there, I just wanted a way to iterate over added catalogs ;p.
I'll check out your code.
New AVL Tree, if you are using that, broke the behavior of the LevelFilter anyways, so I gotta fix it either way.
no you passed the same argument twice, it only asks for one argument
Ah, my bad. I didn't implement the module, so didn't see it ; p. I had changed the code around, so that's why it's passing in two arguments.
Is that the only problem?
k
Interesting. I'll check it out. This is actually making me laugh.
I never know what your function is going to return :(
public static method get takes unit u, integer vers returns Catalog
its posted up top lol
Couldn't reproduce your bug, but fixed another unrelated bug + AVL. See if it also fixed your bug ;).
New version is pushed.
k
Oh, but it is. You need to update AVL.
k
I can't reproduce your error. You haven't given me any test code. I tried to put together test code and I got nothing. For me, I get 0 errors.
That code there gives me no errors. The catalog counts are correct, the ids are correct... >.>
I have no idea how you are getting these errors. I couldn't even get your original errors.
edit oh, if you're talking about ItemRoots.get returning newly created catalogs, that is correct. It returns temporary catalogs that are destroyed on a timer.
I see absolutely 0 errors. I have no idea what you are talking about. I am not experiencing any thread crashes.
so, test map? Or was it the TempCatalog thing?
sorry, comp season.
anyway, test this? o.O
saves in Main SaveLoad, assets are inbottom folder
let me know when you have it as I'd like to take it down
got it
I reproduced your error with the following code
Test later went to true, true, true, true as well O_O
In the future, you need to give me code I can just cnp into the save/load with snippets map and watch the error play out.
Even with your map, I got 0 errors. It wasn't until I did the following that I got an error.
_edit_ nvm, the problem was your test function was spamming catalogs
However, that doesn't explain the true, true, true, true bit
_edit_ ok, I solved it
it's because you are retrieving the id of a version lower than the lowest version possible in your test method for the 2nd case.
the lowest version possible is the first version ever accessed
you will never ever access a version lower than the lowest version possible in any map because those catalogs _will not exist_ for prior versions, meaning that the _loader_ will not even have them in the code for prior versions because _they didn't exist_ lol. This has to do with the VersionFilter. The second case ends up writing to instance 0. Eventually, this bugs up and returns true, true, true, true.
As for your other case of ids continuing to go up, this is because of your test method. You're spamming catalogs. I don't know about the thread crash, I haven't encountered that.
So this was you running code with an undefined behavior ;). Ofc, this wasn't documented and it took me around 1.5 hours to figure this out.
Not fixing this bug as it would add incredible overhead and the bug will never ever be encountered in a real scenario.
Here is correct test code
function print takes string msg returns nothing
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 60000, msg)
endfunction
/********************************************************************************************
Hero Catalog
********************************************************************************************/
struct ItemRoots extends array
private static LevelGroupVersionCatalog catalog
//Versions
static constant integer v03G = 1
static constant integer v03H = 2
//Group Id
static constant integer gA = 1 //all
static constant integer gZA = 2
static constant integer gWR = 3
static constant integer gAm = 4
static constant integer gZ = 5
static constant integer gW = 6
static constant integer gAn = 7
static constant integer gR = 8
static constant integer amazon = 'H006'
static constant integer zealot = 'H003'
static constant integer witch = 'H013'
static constant integer anarchist = 'H010'
static constant integer runemaster = 'H005'
static integer curGroup
public static method test takes nothing returns nothing
local LevelGroupVersionCatalog catalog = LevelGroupVersionCatalog.create()
local Catalog t
call catalog.add(1010,1,gA, 1)
set t = catalog.get(1, gA,1, 1)
if t.id(1010) != 1 then
call print("return false")
else
call print("return true") //desired
endif
set catalog = LevelGroupVersionCatalog.create()
call catalog.add(15,1,gA, 1)
call catalog.add(1010,2,gA, 1)
set t = catalog.get(1, gA,1, 1)
if t.id(1010) != 1 then
call print("return false") //desired
else
call print("return true")
endif
set catalog = LevelGroupVersionCatalog.create()
call catalog.add(1010,1,gA, 1)
call catalog.add(1011,2,gA, 1)
set t = catalog.get(2, gA,1, 1)
if t.id(1010) != 1 then
call print("return false")
else
call print("return true") //desired
endif
set catalog = LevelGroupVersionCatalog.create()
call catalog.add(1010,2,gA, 1)
set t = catalog.get(2, gA,1, 1)
if t.id(1010) != 1 then
call print("return false")
else
call print("return true") //desired
endif
call print("---------------------------------------------------------------------")
endmethod
public static method get takes integer id, integer vers returns Catalog
//call test()
//call print("version : " + I2S(vers) + " : " + I2S(v03H))
//call test()
//call print("testing get")
if id == amazon then
return catalog.get(vers,gAm,0,1)
elseif id == zealot then
return catalog.get(vers,gZ,0,1)
elseif id == witch then
return catalog.get(vers,gW,0,1)
elseif id == anarchist then
return catalog.get(vers,gAn,0,1)
elseif id == runemaster then
return catalog.get(vers,gR,0,1)
else
call print("illegal ID : " + GetObjectName(id))
return 1/0
endif
endmethod
private static method init takes nothing returns nothing
call CreateUnit(Player(0), 'Hpal',0,0,0)
set catalog = LevelGroupVersionCatalog.create()
//All
//Rings
call catalog.add('I00S', v03G, gA, 1)
call catalog.add('I016', v03G, gA, 1)
call catalog.add('I01E', v03G, gA, 1)
call catalog.add('I00W', v03G, gA, 1)
// call catalog.add('I02A', v03H, gA, 1)
//Armors
call catalog.add('I004', v03G, gA, 1)
call catalog.add('I00X', v03G, gA, 1)
call catalog.add('I01F', v03G, gA, 1)
call catalog.add('I015', v03G, gA, 1)
//Helms
call catalog.add('I00J', v03G, gA, 1)
call catalog.add('I013', v03G, gA, 1)
call catalog.add('I01C', v03G, gA, 1)
call catalog.add('I01L', v03G, gA, 1)
//Boots
call catalog.add('I00K', v03G, gA, 1)
call catalog.add('I010', v03G, gA, 1)
call catalog.add('I019', v03G, gA, 1)
call catalog.add('I01I', v03G, gA, 1)
//Gloves
call catalog.add('I00H', v03G, gA, 1)
call catalog.add('I011', v03G, gA, 1)
call catalog.add('I018', v03G, gA, 1)
call catalog.add('I01K', v03G, gA, 1)
//Amulets
//Zealot and Anarchist
//Swords
call catalog.add('I002', v03G, gZA, 1)
call catalog.add('I00Y', v03G, gZA, 1)
call catalog.add('I017', v03G, gZA, 1)
call catalog.add('I01G', v03G, gZA, 1)
//Witch and Runemaster
//Staves
call catalog.add('I00O', v03G, gWR, 1)
call catalog.add('I00V', v03G, gWR, 1)
call catalog.add('I01D', v03G, gWR, 1)
call catalog.add('I014', v03G, gWR, 1)
//Amazon
//Bows
call catalog.add('I00G', v03G, gAm, 1)
call catalog.add('I012', v03G, gAm, 1)
call catalog.add('I01A', v03G, gAm, 1)
call catalog.add('I01J', v03G, gAm, 1)
//Quivers
call catalog.add('I00F', v03G, gAm, 1)
call catalog.add('I00Z', v03G, gAm, 1)
call catalog.add('I018', v03G, gAm, 1)
call catalog.add('I01H', v03G, gAm, 1)
//Charms
call catalog.addGroup(v03G, gAm, gA)
call catalog.addGroup(v03G, gZ, gA)
call catalog.addGroup(v03G, gR, gA)
call catalog.addGroup(v03G, gAn, gA)
call catalog.addGroup(v03G, gW, gA)
call catalog.addGroup(v03G, gZ, gZA)
call catalog.addGroup(v03G, gAn, gZA)
call catalog.addGroup(v03G, gW, gWR)
call catalog.addGroup(v03G, gR, gWR)
call CreateUnit(Player(0), 'Hpal',0,0,0)
call CreateUnit(Player(0), 'Hpal',0,0,0)
endmethod
private static method testz takes nothing returns nothing
call print(I2S(get(amazon, v03H)))
endmethod
private static method onInit takes nothing returns nothing
call TimerStart(CreateTimer(), 0, false, function thistype.init)
call TimerStart(CreateTimer(), 1, true, function thistype.test)
//call TimerStart(CreateTimer(), 1, true, function thistype.testz)
endmethod
//Saving
//Heroes['id00'].id
//Heroes[GetUnitTypeId(hero)].id
//call stack.push(Heroes[GetUnitTypeId(hero)].id,Heroes.count)
//Loading
//CreateUnit(Heroes[unitIdFromCode].raw,0,1)
//call CreateUnit(Heroes[stack.pop(Heroes.count)].raw,0,0)
endstruct
k
Once again, please put this code into a format that I can run immediately and see the errors, otherwise I can't help you. I can't reproduce any of the errors you are talking about.
I never never run into this -> prints 323?:-639
or any of the other stuff. You can keep posting bugs, but unless I have the code, I can't reproduce it.
I need it in a form I can cnp into a map like the code I put up. The code I put up also clearly shows the errors (if any occur) via print.
There isn't much I can do if I have absolutely no idea how you are getting these errors.
k
E/
you renamed my init method............
2e/ shouldnt getCatalog return a temp catalog?
3e/
struct test2
static constant integer v03G = 1
static constant integer v03H = 2
//Group Id
static constant integer gA = 1 //all
static constant integer gZA = 2
static constant integer gWR = 3
static constant integer gAm = 4
static constant integer gZ = 5
static constant integer gW = 6
static constant integer gAn = 7
static constant integer gR = 8
static constant integer amazon = 'H006'
static constant integer zealot = 'H003'
static constant integer witch = 'H013'
static constant integer anarchist = 'H010'
static constant integer runemaster = 'H005'
private static method per takes nothing returns nothing
local LevelGroupVersionCatalog catalog = LevelGroupVersionCatalog.create()
//All
//Rings
call catalog.add('I00S', v03G, gA, 1)
call catalog.add('I016', v03G, gA, 1)
call catalog.add('I01E', v03G, gA, 1)
call catalog.add('I00W', v03G, gA, 1)
// call catalog.add('I02A', v03H, gA, 1)
//Armors
call catalog.add('I004', v03G, gA, 1)
call catalog.add('I00X', v03G, gA, 1)
call catalog.add('I01F', v03G, gA, 1)
call catalog.add('I015', v03G, gA, 1)
//Helms
call catalog.add('I00J', v03G, gA, 1)
call catalog.add('I013', v03G, gA, 1)
call catalog.add('I01C', v03G, gA, 1)
call catalog.add('I01L', v03G, gA, 1)
//Boots
call catalog.add('I00K', v03G, gA, 1)
call catalog.add('I010', v03G, gA, 1)
call catalog.add('I019', v03G, gA, 1)
call catalog.add('I01I', v03G, gA, 1)
//Gloves
call catalog.add('I00H', v03G, gA, 1)
call catalog.add('I011', v03G, gA, 1)
call catalog.add('I018', v03G, gA, 1)
call catalog.add('I01K', v03G, gA, 1)
//Amulets
//Zealot and Anarchist
//Swords
call catalog.add('I002', v03G, gZA, 1)
call catalog.add('I00Y', v03G, gZA, 1)
call catalog.add('I017', v03G, gZA, 1)
call catalog.add('I01G', v03G, gZA, 1)
//Witch and Runemaster
//Staves
call catalog.add('I00O', v03G, gWR, 1)
call catalog.add('I00V', v03G, gWR, 1)
call catalog.add('I01D', v03G, gWR, 1)
call catalog.add('I014', v03G, gWR, 1)
//Amazon
//Bows
call catalog.add('I00G', v03G, gAm, 1)
call catalog.add('I012', v03G, gAm, 1)
call catalog.add('I01A', v03G, gAm, 1)
call catalog.add('I01J', v03G, gAm, 1)
//Quivers
call catalog.add('I00F', v03G, gAm, 1)
call catalog.add('I00Z', v03G, gAm, 1)
call catalog.add('I018', v03G, gAm, 1)
call catalog.add('I01H', v03G, gAm, 1)
//Charms
call catalog.addGroup(v03G, gAm, gA)
call catalog.addGroup(v03G, gZ, gA)
call catalog.addGroup(v03G, gR, gA)
call catalog.addGroup(v03G, gAn, gA)
call catalog.addGroup(v03G, gW, gA)
call catalog.addGroup(v03G, gZ, gZA)
call catalog.addGroup(v03G, gAn, gZA)
call catalog.addGroup(v03G, gW, gWR)
call catalog.addGroup(v03G, gR, gWR)
call BJDebugMsg("1")
call BJDebugMsg(I2S(catalog.get(v03H,gAm,0,1).count))
endmethod
private static method onInit takes nothing returns nothing
call TimerStart(CreateTimer(), 2, true, function thistype.per)
endmethod
endstruct
prints:
1
3e/ in Catalog::CatalogCount
loop
if (not cs.boolean.has(b)) then
set e=en[b][b]
if (e!=b) then
set cntt[cntd]=b
set cntb[cntd]=e
set cntd=cntd+1
endif
set cs.boolean[b]=true
set v=v+c[b]
endif
set b=en[t][b]
if (b==t) then
exitwhen 0==cntd
set cntd=cntd-1
set t=cntt[cntd]
set b=cntb[cntd]
endif
endloop
thats looping forever
Updated above post
Ok, now you are making sense ;). I'll check it out. I have my hands full with UnitIndexer and stuff at the moment ;o.
eta?
right now I'm updating IsPathBlocked.
It was super broken >.<. I'm trying to get a map running so that I have something to play while I work on stuff : D
I'm doing the tracing algorithm atm.
next is UnitEvent and then DDS
I'll be mixing Catalog into UnitEvent and DDS, but for now I wanna focus on IsPathBlocked so that I can play wmw :(
okay :( its only been two months. I suppose I can be patient.
You're map isn't anywhere near ready anyways : |
_edit_
fixed the map, I can start working on UnitEvent, DDS, and Catalog again. I can also play the map, /woo!
yes, but its depressing without a saveload.
I do apologize, I'm completely swamped with university work right now. I've been going 18+ hours every day. I won't be able to get to anything for at least 3 weeks : (.
I'm apparently coding an entire game from scratch by myself, and I need to have 90% of it done by Monday : |, so I'm working non-stop around the clock.
jeez how many credits do you need in a spring semester? O.O
I did code this beauty for python though. It's for the project ^)^, one of many required resource >.<.
#
# bind(obj, name = None, prop = None)
# - binds a field, method, function, or property to a given class instance
# this enables the class to use the field
#
# Example: bind(instance, "hello", myFunction)
#
# instance.myFunction()
#
# - this keeps a history of all binding. When something is unbound, it loads
# up the previous binding.
#
# - may not bind None
#
# bindProperty(obj, name, fget = None, fset = None)
# - this converts the getter and setter to a property
# and then binds it. The getter and setter may be a function
# or a method.
#
# - this is essentially a wrapper for bind
#
# Example: def getter(self):
# return self._some_field_in_object
#
# def setter(self, value):
# self._some_field_in_object = value
#
# bind(object, "_some_field_in_object", 9)
# bindProperty(object, "myField", getter, setter)
#
# print object.myField -> 9
# object.myField = 11
# print object.myField -> 11
#
# unbind(obj, name, prop)
# - this will unbind the thing that was bound and revert the binding
# back to what it previously was if the thing that was bound is the active
# binding
#
# - for fields, if the field was a scalar, then that specific value must
# be unbound
#
# Example: bind(instance, "field", 7)
#
# print str(t.field) -> 7
#
# unbind(instance, "field", 7)
#
# print str(t.field) -> previous value
#
# unbindProperty(obj, name, fget = None, fset = None)
#
It should be true->false->true
I'll look into it. Thanks for bringing this up.
Try this demo script. Last time I tested it, it worked ;).
https://github.com/nestharus/JASS/blob/master/jass/Data%20Structures/Catalog/Level%20%26%20Group%20%26%20Version%20Filter/demo.j
edit it may be that the id isn't 1, but it's in there. That would be incorrect behavior >.<.
I don't have time to fix this today, but I can likely get to it tomorrow.
edit actually, you should always be loading from the user's version, not the current version of the map. The value should be in the catalog, but I don't know if it's id 1. However, it's the only value in that catalog, so it should have an id of 1 >.<. Regardless, I'll check it out.